Closed Razbotics closed 7 years ago
I haven't run into this issue with the raspberry pi's before. We use them at work as an educational tool. I'll personally try to replicate the problem on my computer soon.
Hey, As i said it works fine on python 2 but its not working on python 3 as unicode is not supported we have convert it in bytes. Thanks for replying
Ohhh. I'm so sorry, @Shubho97 . I totally missed that.
I've added support for Python 3. Give it a try. I've haven't run into any issues updating multiple targets at once. My use of this module is to control some larger scale robots with a combination of electronic motor controllers as well as some servos for animatronics. That code updates multiple servo channels 30 times per second without a hitch. Let me know if you continue to have trouble.
Sure , will let you know soon after testing it...well i was using the library for a hexapod project. Thanks for the support and making changes.
hey, I tested your library and its a good job done by you but your code has some issues it works for only one servo at a time let me explain first it gives error saying it needs to be encoded to bytes, unicode not supported so we should simply edit it to cmd.encode() this solves the problem in python shell
but if you try to send command for 2 servos like this
maestro will always understand the second command and the servo1 will reach to position to 6000 and hold the position and servo 0 will not go anywhere also you can freely rotate servo 0 with your hands this concludes that there is some error in sending bytes to maestro which will always light up red led
i have also posted this issue on pololu forum https://forum.pololu.com/t/controlling-two-servos-at-same-time-problem/12282
Today i figured out the problem using .encode() solves the problem from python side but it also adds up an extra byte '/xc2' this creates error in maestro servo controller suppose you want to give command like this
this sends bytes like '\xc2\xaa\0xc\0x04\channelbyte 0\byte lsb0\byte msb0 \xc2 \xaa\0xc\0x04\channelbyte1\byte lsb1\byte msb1' if i am not wrong this means maestro detects wrong command \xc2\xaa\0xc\0x04\channelbyte 0\byte lsb0\byte msb0 \xc2' upto here and next command '\xaa\0xc\0x04\channelbyte1\byte lsb1\byte msb1' gets valid this ends up controlling only servo 1 also lights up red led on maestro indicating unknown command error
so i have to again modify the code like this
which will split the bytes by \xc2 and will send the exact required command this finally solves all the problem and all the servo reaches correct position also no red error led
hope You will understand this long issue and modify the library so that our python guys gets no issues maybe the issue was because i am coding on my pc using python and will not cause any problem on RPi