Asked — Edited
Resolved Resolved by Dave Schulpius!

Kangaroox2 Sendserial Commands

I have searched and searched for the proper sendserial command structure for controlling a kanagaroox2/sabertooth 2x12 setup and am not getting any answers from DE. They are clueless when it comes to their own devices at times. In any case, I have successfully tuned my kangaroo and have been able to use servo commands to control it in independent mode but I am still not able to get it to react to sendserial commands. I have seen other threads on this that are 4 years or older and am hoping someone can help me solve this mystery. The solutions from 4 years ago are no longer working with current firmware. Has anyone made any adjustments to the baud rate in DEScribe or any other adjustments in DEScribe? Thank you for any help!


ARC Pro

Upgrade to ARC Pro

Experience the transformation – subscribe to Synthiam ARC Pro and watch your robot evolve into a marvel of innovation and intelligence.

#1  

The commands should still work. Look carefully at the way you wrote your command. Here is a simple sendserial command that I use to move a motor to a position at a certian speed:

uartWrite(1, 0, "1, p113261 s10000", 0x0d) 

uartWrite(1, 0, is the command for ARC to send info to the Kangaroo. The 1, is the EZB board number you are sending to and the 0, is the Uart port you're attached to on that EZB. Your numbers may be different depending how your wired. "1, p113261 s10000" is the command for the Kangaroo to move the motor attached to motor 1 to position 113261 and a speed of 100000. Your numbers will be different depending on how your setup is built and what your autotune found. You may have to use the describe software to open the autotune stored on the kangaroo to see what it set your values at. If you send a command outside of the set values the roo wont move. , 0x0d) is the code that tells Kangaroo that the return key was hit (just like on the keyboard on your laptop). Every command you send through the serial port to the kangaroo needs this. You can change 0x0d to it's Hex equivalent but that's just showing off. LOL :P

Mind the quote marks and commas.

Strong advice: use the Describe software to save your final working autotune to a safe location you will be able to access if you ever need to reload it again. This way you wont need to do another tune if you accidentally change a setting or need a new Kangaroo for these motors. However if you ever need to redo your build or change something with the motors you will need to retune again.

Please post your code so we can look it over.

Good luck. :)

#2  

Thank you for responding Dave!

I took your suggestion and merged it with Lumpy's code for his dome since we are both essentially spinning something. In my case, it's R2D2's Periscope and lifter.

I need serial control to use the home command with my limit switch to ensure the periscope aligns properly before lowering into the dome. I don't want it to crash and ding it up. lol

Anyway, here is my code to move the periscope and my set up (which is still unresponsive)...

uartwrite(0, 1, "2, start", 0x0d, 0x0a) sleep(200) uartWrite(0, 1, "2, home", 0x0d, 0x0a) sleep(200) uartwrite(0, 1, "2, unit 1=1", 0x0d, 0x0a) sleep(200) uartWrite(0, 1, "2, p1000 s400", 0x0d, 0x0a) sleep(3000) uartWrite(0, 1, "2, home",0x0d,0x0a)

I have D5 plugged into S1 on the Roo, D6 to S2, and D5 ground to Roo ground. When I run the script nothing happens and the EZB eventually breaks the Wifi connection and I can't reconnect unless I restart the EZB. This happens everytime I try to run the above script. It's important to note that the EZB is not giving me a connection error with the uartWrite commands, so I know it is aware of the Roo. stress

Is it possible I've missed a DEScribe or a dip switch setting; perhaps even a baud issue? confused

Thank you so much for your help! BTW - I mentioned your DB9 and EZB prowess at Droid Con in my Actuators and Ewoks presentation last month. I spent the last half of the presentation showing builders how my EZB controls my droid animations with simple servo commands. :D

Actuators and Ewoks Droid Con 2018

  • Doug
#3  

Also, here is the data from the EZB when it executes the script...

Start 1: uartwrite(0, 1, "2, start", 0x0d, 0x0a) 2: sleep(200) 3: uartWrite(0, 1, "2, home", 0x0d, 0x0a) 4: sleep(200) 5: uartwrite(0, 1, "2, unit 1=1", 0x0d, 0x0a) 6: sleep(200) 7: uartWrite(0, 1, "2, p1000 s400", 0x0d, 0x0a) 8: sleep(3000) 9: uartWrite(0, 1, "2, home",0x0d,0x0a) Done (00:00:06.5051509)

Thanks again for helping me with this. I can't wait to get it working. This kids at the hospital will love the periscope!

  • Doug
#4  

Sorry for the delay getting back to you. Busy busy busy with my own life. I am at work right now and I can't really look very close or try anything but I do have a couple suggestions. First of all I don't know why you have two hex numbers in your statement. You only need one as far as I know. Try removing the 0x0a. Also nothing is going to work until your unit is successively homed. It looks like you're trying to send a movement command before the Homing has been completed. You should be doing the Homing of all your Motors at startup of the robot. There is no need to home again until the next time you restart the robot. Do the home command in its own script control. Then let that script finish before you try to move the motor. If you want the motor to move to a different position after the Homing has completed you can place that movement command in the same script but you have pause the script long enough for the Homing to complete. I actually do this when I home the waste motor of my robot. He only moves One Direction and after hits the limit switch stops because it's home. And then move him back to center with a movement command. But like I said that movement command doesn't happen until after the Homing is complete. When I get a chance I will send you a couple script examples I use to home and move my Motors. I do have a project in the cloud that you can download that has most of this already in it. I had to stop loading to the cloud because my project became too big and EZ robot won't accept it. However take a look at the one that's there and it might help you.

I also have noticed that if I try to send an improper command through the serial port that the ezb will disconnect and reboot. This will probably keep happening until you get your script right. Try just putting one command in a script at a time to test your command until you get the hang of it and figure out the proper structure. I'll keep helping you as much as I can.

Thanks so much for the honorable mention in your speech. I'm thrilled you thought what I have done was good enough to present to people that you respect and want to help.;)

#5  

David! You are fantastic!

I downloaded your B9 scripts and it turns out I was forgetting to init the roo at 9600! I removed the 0x0a from the code, added the init script, made separate home commands in script manager, and BOOM!, instant success! I can't tell you how much I appreciate your jumping in and helping me out. If you are going to be at Star Wars Celebration next April 2019 in Chicago, please let me know.

Thank you sooooo much! R2 is gonna have his lifter soon!

  • Douglas

Here's what did the trick and opened the door..

uartInit(0, 1, 9600) #Initialize Baud Rate uartWrite(0, 1, "1, start", 0x0d) #Start Lifter Motor sleep(200) uartWrite(0, 1, "1, home", 0x0d) #Home Lifter Motor sleep(200) uartwrite(0, 1, "2, start", 0x0d) #Start Rotary Motor sleep(200) uartWrite(0, 1, "2, home", 0x0d) #Home Rotary Motor sleep(200)

#6  

I'm really glad I was able to help. I remember struggling with getting my code to work with the roo. Very frustrating but so rewarding when things start to move.

I'm glad you caught the int command. I was distracted when I posted to you and missed the lack of that command. That was why you're ezb would lock up and reboot.

I'm moving from Wisconsin to Florida in a few months so the Chicago trip would be a challenge. However it would be great to attend and see all the cool stuff and people. You and your R2 would be on the top of my list.

Good luck and have fun! :D