Two-wheel-mobile robots! Bluetooth or USB? This is the question!

42 views
Skip to first unread message

Mohsen Pashna

unread,
Dec 3, 2015, 3:47:34 AM12/3/15
to ioio-users
Hello IOIO nerds

I am using IOIO to connect my two-wheel-mobile robot to the android device (lovely NX5). I have few robots that swarming together. I tuned one of my robots which was connected via BT, and it worked fine. However, for other robots I connected (had to) them via USB, and it turns out that the previous control parameters are not suit for USB connection. Perhaps it is due to the cycle period difference, I am not sure. 

By the way, is there any way that I could understand the connection type in the code to decide which type of parameters I need to apply?

Please share with me if you have or had related experiences. 

Many Thanks

Cheers,

Mohsen

Ytai Ben-Tsvi

unread,
Dec 5, 2015, 12:10:19 AM12/5/15
to ioio-...@googlegroups.com
Depending on how you wrote the code, your control algorithm might be sensitive to latency (much higher on BT, ~20ms vs ~1ms) and/or jitter (much higher on BT). As for the cycle period, it is up to you to decide it, it shouldn't depend on the connection type.

If you want to change the behavior depending on either BT or USB, here's an example:

--
You received this message because you are subscribed to the Google Groups "ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ioio-users+...@googlegroups.com.
To post to this group, send email to ioio-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.

Mohsen Pashna

unread,
Dec 26, 2015, 5:15:47 AM12/26/15
to ioio-users
Hi Ytai

Sorry, I just saw you reply. I was working on differents approach to deal with this problem. Indeed they are working over BT very smooth, but with the cable they move ZigZagly. Perhaps the rotational PID controller acts weirdly stronger. Yesterday, I was thinking to connect them all using BT dongles, but I wonder there should be an interference between BT dongles and IOIO boards. Do you have any idea about this issue? Now, I am woking on control the robots based on their connection type separately like the ShoeBot example.

Thanks.

Ytai Ben-Tsvi

unread,
Dec 26, 2015, 11:31:41 AM12/26/15
to ioio-...@googlegroups.com

There shouldn't be any interference problems as long as your dongles use different addresses. Don't make the mistake of assuming that changing the PIN will solve this problem, it won't.
There fact that USB doesn't work well for you is likely a bug in your application, such as implicitly relying on the delay introduced by the BT comms for your controls.

Mohsen Pashna

unread,
Dec 28, 2015, 12:47:15 AM12/28/15
to ioio-users
I added a delay when it is connected with the cable, and it is much much better now, but still I wonder where is my controller bug  (It's working btw). Thanks for your tip on line #L359. It helped. :D 

Ytai Ben-Tsvi

unread,
Dec 28, 2015, 12:11:04 PM12/28/15
to ioio-...@googlegroups.com

It seems like the rate of the control loop depends on the execution time of its contents rather than on wall time. This would result in a fragile system whose gain parameters strongly depend on things such as the type of connection. To fix this, instead of making your sleep time constant, check the time and sleep until it's time for the next step.

Reply all
Reply to author
Forward
0 new messages