Asked — Edited

Inmoov Scrips / Inmoov Doing Math

Hello,

Hello bhouston,

slowly i am finish my inmoov (Juhu)

for some days i got my EZB4 Controllers (2x Juhu)

and now i am checking the possibilities with speech reco and so on.

I am really interested in your doing Math script.... where i can find the subscripts (Repeat Speech 3 / Do math / repeat speech 1)?

And your stuf with the speech control to the neopixel ring is also great... do you have also there a script to share?

Or other question do you share EZB InMoov File?

Greetinxx from a big fan

Boris


ARC Pro

Upgrade to ARC Pro

Unleash your robot's full potential with the cutting-edge features and intuitive programming offered by Synthiam ARC Pro.

#1  

@rentaprinta, Here's the script as it stands today, the repeat speech scripts have been removed now that we have a Talk servo Control to move a servo with text. Everyone's InMoov's are different so far as servo connection ports and calibration is concerned, so posting my subscripts won't do you any good. You will have to create them for your robot. The "Doing Math" subscript, simply brings the robots arms and hands into position. Then each finger movement has a subscript as well.


Sayezb(" I like doing math")

sleep(500)

ControlCommand("Script Manager", ScriptStart, "Do math")

sleep(5500)
ControlCommand("Script Manager", ScriptStop, "Do math")

sayezb("ready")
servospeed(D3,0)
servospeed(D4,0)
servospeed(D5,0)
servospeed(D6,0)
servospeed(D7,0)
servospeed(D13,0)
servospeed(D14,0)
servospeed(D15,0)
servospeed(D16,0)
servospeed(D18,0)

:start

$heard = "speech"

WaitForChange($heard)

if($Heard = "won")

$x = 1

elseif($heard="two")

$x = 2

elseif($heard ="three")

$x = 3

elseif($heard = "four")

$x = 4

elseif($heard = "five")

$x = 5

#else

#say("sorry, didn't hear your response correctly")

#GoTo(start)

endif



WaitForChange($heard)

if($heard = "plus one")

$y = 1

elseif($heard = "plus two")

$y = 2

elseif($heard ="plus three")

$y = 3

elseif($heard ="plus four")

$y = 4

elseif($heard = "plus five")

$y = 5

#print($x + $y)

endif





WaitForChange($heard)

if($heard = "what does that equal")

servo(d0,150)

servospeed(d0,3)

servo(d1,90)

servospeed(d1,3)

sayezb("ummm")


ControlCommand("Script Manager", ScriptStart, "Close right Hand")

ControlCommand("Script Manager", ScriptStart, "Close left hand")

Sleep(1500)

Servo(d0,116)

servospeed(d0,3)

servo(d1,118)

servospeed(d1,3)

sleep(1500)

$sum = Abs($x + $y)

Sayezb($x + " plus " + $y + " equals " + $sum)

endif



#print($x + $y)

#Endif



if($sum = 2)

ControlCommand("Script Manager", ScriptStart, "equals two")

elseif($sum = 3)

ControlCommand("Script Manager", ScriptStart, "equals three")

elseif($sum = 4)

ControlCommand("Script Manager", ScriptStart, "equals four")

elseif($sum = 5)

ControlCommand("Script Manager", ScriptStart, "equals five")

elseif($sum = 6)

ControlCommand("Script Manager", ScriptStart, "equals six")

elseif($sum = 7)

ControlCommand("Script Manager", ScriptStart, "equals seven")

elseif($sum =8)

ControlCommand("Script Manager", ScriptStart, "equals seven")

elseif($sum = 9)

ControlCommand("Script Manager", ScriptStart, "equals nine")

elseif($sum = 10)

ControlCommand("Script Manager", ScriptStart, "equals ten")

endif

sleep(4000)

ControlCommand("Script Manager", ScriptStart, "Close right Hand")

ControlCommand("Script Manager", ScriptStart, "Close left hand")

Sleep(500)

GoTo(start)

I am running the neopixel ring off of an Arduino Uno with commands sent to it from the EZB. Here's an example of a script for that.


#include <Adafruit_NeoPixel.h>


#define PIN 6

// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);

// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
// and minimize distance between Arduino and first pixel.  Avoid connecting
// on a live circuit...if you must, connect GND first.

void setup() {
  Serial.begin(9600);

  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {


  if (Serial.available())
  {


    int ib = 0;
    ib = Serial.read();


    // Stop All display
    if (ib == 33) {
      strip.show(); // Initialize all pixels to 'off'
    }



    // ColorWipes
    // Blue = "B" or 66
    if (ib == 66) {
      colorWipe(strip.Color(0, 0, 255), 3); // Blue
      
    }
    //Blue White = "P" or 80
    if (ib == 80){
      colorWipe(strip.Color(0, 0, 255), 3);
      colorWipe(strip.Color(0, 0, 0), 3);
    }
    // Red = "R" or 82
    if (ib == 82) {
      colorWipe(strip.Color(255, 0, 0), 10); // Red

    }
    // Green = "G" or 71
    if (ib == 71) {
      colorWipe(strip.Color(0, 255, 0), 50); // Green
    }
    if (ib == 87){
      colorWipe(strip.Color(0, 0, 0), 3);
    }

    // ChaseSetting
    // White = "w" or 119
    if (ib == 119) {
        theaterChase(strip.Color(127, 127, 127), 50); // White
    }
    // Red = "r" or 114
    if (ib == 114) {
      theaterChase(strip.Color(127,   0,   0), 50); // Red

    }
    
    if (ib == 98)
    {
     theaterChase(strip.Color(  0,   0, 127), 50); // Blue
    }
    
    if (ib == 88)
    {
    rainbow(20);
    }
  if (ib == 89)
  {
  rainbowCycle(20);
  }
  
  if (ib == 90)
  {
  theaterChaseRainbow(50);
  } 
    
    
  }



  


}

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for (uint16_t i = 0; i < strip.numPixels(); i++) {
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
}

void rainbow(uint8_t wait) {
  uint16_t i, j;

  for (j = 0; j < 256; j++) {
    for (i = 0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel((i + j) & 255));
    }
    strip.show();
    delay(wait);
  }
}

// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for (j = 0; j < 256 * 5; j++) { // 5 cycles of all colors on wheel
    for (i = 0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
    }
    strip.show();
    delay(wait);
  }
}

//Theatre-style crawling lights.
void theaterChase(uint32_t c, uint8_t wait) {
  for (int j = 0; j < 10; j++) { //do 10 cycles of chasing
    for (int q = 0; q < 3; q++) {
      for (int i = 0; i < strip.numPixels(); i = i + 3) {
        strip.setPixelColor(i + q, c);  //turn every third pixel on
      }
      strip.show();

      delay(wait);

      for (int i = 0; i < strip.numPixels(); i = i + 3) {
        strip.setPixelColor(i + q, 0);      //turn every third pixel off
      }
    }
  }
}

//Theatre-style crawling lights with rainbow effect
void theaterChaseRainbow(uint8_t wait) {
  for (int j = 0; j < 256; j++) {   // cycle all 256 colors in the wheel
    for (int q = 0; q < 3; q++) {
      for (int i = 0; i < strip.numPixels(); i = i + 3) {
        strip.setPixelColor(i + q, Wheel( (i + j) % 255)); //turn every third pixel on
      }
      strip.show();

      delay(wait);

      for (int i = 0; i < strip.numPixels(); i = i + 3) {
        strip.setPixelColor(i + q, 0);      //turn every third pixel off
      }
    }
  }
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  if (WheelPos < 85) {
    return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if (WheelPos < 170) {
    WheelPos -= 85;
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
    WheelPos -= 170;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}

and then to send the command from the EZB to the Arduino,


SendSerial(1. D18,9600,"R1,1")

I hope this helps you out

#2  

Hi

Bhouston,

thanx for the fast answer,

i need time to check up your scrips

Boris

#3  

Hi Bhouston,

how i can send this serial information to the ardunio?

What Shild or bridge i must buy?

Boris

#4  

I have mine connected as follows; Port 18 on the EZB connected to the Rx on the Arduino The Arduino is powered with 5V The ring power wires are connected to 5V and negative and the signal wire to pin 6 on the Arduino. Load that crazy arduino script on to the ardunio and call for what ever pixel pattern you want in an ez script. As in my example.

#5  

Hello bhouston,

today i have time to chekc the neopixel.

  1. So i upload your Arduino Script to the Arduino
  2. I connect the Neopixel with the Arduino Port 6 and + and -
  3. I connect the Arduino on RX0 with D18 on the EZB4

User-inserted image

I make a script with:

SendSerial(1. D18,9600,"R1,1")

But nothing happend.

I change the Code to:

SendSerial(1. D18,9600,"R1,66")
SendSerial(1. D18,9600,"66")

I think 66 is for BLUE, but also nothing works.

I check with the normal NeoScript uploaded on the Arduino and it works on Port 6 . So the Neopixel Ring is correct connected.

But what i did wrong?

Boris

#6  

I'm using two EZB's on my project and using the second one for the ring that is why I am using port - 1.D18. ( sorry about that) Try this code if you are only using one EZB


SendSerial(D18,9600,"66")

#7  

hi,

thanx for your help,

but still now light ;-(

I use now your new code


SendSerial(D18,9600,"66")

i connect with RX0 (also with RX1/RX2/RX3) RX0 is right?

on the EZB on D18 on the white pin! right?

and i have a 24 led ring so i change the Arduino Script :


#define PIN 6
#define STRIPSIZE 24

// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(24, PIN, NEO_GRB + NEO_KHZ800);

?

Boris

#8  

It seems, if the EZB4 not send a Serial... (How can i check if the EZB4 send something?)

or the Arduino not receive serial.

#9  

I am 1500 km away from my robot so I can't check how it's wired to see if I missed something. Try connecting a ground wire between the EZB and the Arduino.

#10  

Hi Bhouston,

also if you are 1500 km away YOU KNOW YOUR INMOOV!

Thats it! The Ground was missing!

Now everything works!

Have a nice sunday!

Your are cool!

Boris

#11  

Good deal, glad it is working for you!

#12  

Hello Bhouston,

maybe you can help me with a script.

i got this script where the blue light a changing the brightness.

 #include <Adafruit_NeoPixel.h>
    
    #define PIN 6
    
    // Parameter 1 = number of pixels in strip
    // Parameter 2 = pin number (most are valid)
    // Parameter 3 = pixel type flags, add together as needed:
    // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
    // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
    // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
    // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
    Adafruit_NeoPixel strip = Adafruit_NeoPixel(24, PIN, NEO_GRB + NEO_KHZ800);
    
    int alpha; // Current value of the pixels
    int dir = 1; // Direction of the pixels... 1 = getting brighter, 0 = getting dimmer
    int flip; // Randomly flip the direction every once in a while
    int minAlpha = 25; // Min value of brightness
    int maxAlpha = 100; // Max value of brightness
    int alphaDelta = 5; // Delta of brightness between times through the loop
    
    void setup() {

    strip.begin();
    strip.show(); // Initialize all pixels to 'off'
    }
    
    void loop() {
    flip = random(32);
    if(flip > 20) {
    dir = 1 - dir;
    }
    // Some example procedures showing how to display to the pixels:
    if (dir == 1) {
    alpha += alphaDelta;
    }
    if (dir == 0) {
    alpha -= alphaDelta;
    }
    if (alpha < minAlpha) {
    alpha = minAlpha;
    dir = 1;
    }
    if (alpha > maxAlpha) {
    alpha = maxAlpha;
    dir = 0;
    }
 
    colorWipe(strip.Color(0, 0, alpha)); // Blue
    }

    
    // Fill the dots one after the other with a color
    void colorWipe(uint32_t c) {
    for(uint16_t i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c);
    strip.show();
    }
    }

how can i create a blue ColorWipe with changing the brighness?

// ColorWipes
    // Blue = "B" or 66
    if (ib == 66) {
      colorWipe(strip.Color(0, 0, alpha), 3); // Blue
      

thanx you really much!

#13  

Hello Bhouston,

i have also a question to your math script:

I upload my math script without any servo controll. So it will be a pure speech stuff.

I understand that i must save speech commands from 1-5 and plus one - plus five.

But still i don´t get it.

My File must be called :

Boris_Math_Problem

or look to files from RentaPrinta.

what i doing wrong, or where is my mistake.

Boris

PS:

After long time to think about legs for my inmoov, i slowly come the the end, i will do also like you with the wheels.

Because the Inmoov must bring sense. It will be stupid if its only a toy. And for a longer time moving, wheels are better. And now i am building to long .... if the Inmoov will be have legs (fine) he can walk (fine) but he can fall (i do also some times ;-) ) My skin repairs herself. But the Inmoov .... it will be horrible, if for example the head will chrash! NO WAY! TO MUCH WORK!

So legs are cool, but not usefull and dangerous! If a Human can fall to the ground a Roboter will do more than a human and only one fall from my Inmoov will be get me a heardattack!

I find your concept also better then the Segwheel. And like many people say a lot of place for beer and batteries! Hahaha Batteries are enough

#14  

Hi Boris, I had a look at your project. You need to put something in the speech recognition "Command line" so when it hears a "Phrase", it knows what to do.

User-inserted image

#16  

Hello Bhouston!

Thanx that you are checking my math project!

Ok i forget (i did not know) to write there something for the varible, but now i understand this system!

It´s works like a telefone computer:

Do you want to speak to the sells dep. or the the office.

If you hear "sells dep" do this If you hear "office" do that

I think the same the paper rock and etc game works the same.

Yeah, slowly i learn how the ezb scripts are working.

With the Neopixel ring, thanx for the link, but you helped me for some weeks and the last mail since then from you help me and solved the problem. so my pixel ring works since then 3 weeks. But thanx again!

#17  

Hello Bhouston,

i was talking i my last post about your cool driving Box for your Inmoov.

In this way, i want to ask you what you use for a motor to drive your inmoov.

I check this Segwheel/Segway on the wevolver site, but i must say it really complicated. The first thing is i don´t know where i will get the board for the electronics. Must i produce myself? Thats why to complicated.

Boris