Hi everybody,
nice to find a substitute to the old NXTasy forum (where I was named Enciladus).
I am currently working on a LEGO Mindstorms project and I am programming the robots using nxtOSEK and Eclipse. I have to use a language that supports classes. As I have noticed so far, there is no function implemented, that enables to servos to drive synchronized like the OnFwdSync method in NXC. I need this, because the variation of the motors from each other is getting to big.
Could you give me some suggestions perhaps? I have tried to read out the tacho count and adjust the speed of the slow motor manually, but therefore I have to know what distance the robot drove, which is rather difficult to know, since the robot drives on different surfaces.
I think one good way would be to read out the currently applied voltage of the servo and adjust them, but I can't see a way with the ECRobot API which nxtOSEK uses.
I would be glad for any suggestions you guys might have.
Greetings, Alex
Programmatically synchronizing two motors
Re: Programmatically synchronizing two motors
You can use a PID controller to make the difference between the two motors tacho count null.alexgd wrote:I am currently working on a LEGO Mindstorms project and I am programming the robots using nxtOSEK and Eclipse. I have to use a language that supports classes. As I have noticed so far, there is no function implemented, that enables to servos to drive synchronized like the OnFwdSync method in NXC. I need this, because the variation of the motors from each other is getting to big.
Could you give me some suggestions perhaps? I have tried to read out the tacho count and adjust the speed of the slow motor manually, but therefore I have to know what distance the robot drove, which is rather difficult to know, since the robot drives on different surfaces.
Basically:
Code: Select all
error = left_count - right_count
power_diff = kP * error # this is a P controller, it may be sufficient, or you can add I and D.
power_left = power - power_diff
power_right = power + power_diff
LEGO things http://ni.fr.eu.org/lego/ - NXT Improved Firmware (GCC) http://nxt-firmware.ni.fr.eu.org/ - Other robots http://apbteam.org
Re: Programmatically synchronizing two motors
thanks a lot!
I will give it a try.
I will give it a try.
Who is online
Users browsing this forum: No registered users and 2 guests