PDA

View Full Version : Simultaneously run 2 or more Dynamixel Motors via OpenCM9.04



Vighnesh
06-10-2018, 07:19 PM
Hello Everyone,

Is it possible to run 2 or more Dynamixel motors at once via an OpenCM9.04 board i.e running them in parallel with different motions?. I have been trying for so long but I couldn't find any documentation of the functions nor a tutorial about this. Can anyone point me in the right direction?

Thanks in advance.

KurtEck
06-11-2018, 08:32 AM
With questions like this you might want to ask it on the Robotis forum: http://en.robotis.com/service/forum.php

Simple answer: Yes you can control multiple servos.

Hard to give any complete answer on how best to do it, without knowing what all you are trying to do and additional information. Things like what motion, what servo, Is it Protocol 1 or Protocol 2, what library, Arduino? ...

But longer answer is, it is all up to your main program to figure out. that is your main loop function will need to do things like:


uint32_t servo1_update_time;
uint32_t servo2_update_time;

void loop() {
uint32_t loop_time = millis();
// Maybe update Servo 1 every .2 seconds
if ((loop_time - servo1_update_time) > 200) {
// compute new position for Servo 1 and output it
...
// remember
servo1_update_time = loop_time;
}
// Maybe update Servo 2 every half second second
if ((loop_time - servo2_update_time) > 500) |
// compute new position for servo 2 and output it
...
servo2_update_time = loop_time;
}
....
}
Again what exactly you do for the two servos? Depends on your needs. How to output new position depends on information like what type of servo. How much control you are giving the servos...

Vighnesh
06-11-2018, 09:02 AM
Hi KurtEck,

Thanks!. Actually, I'm using an OpenCM9.04 type C board with 6 Servos (Dynamixel XL320) in a daisy chain fashion. I have connected this OpenCM9.04 board to Raspberry pi and I'm using USB to send messages like '1', '2' etc to call a function which is like moveEars() etc.

I have a robotic pet kind of thing going on and I have to move both the ears in a certain way, but every time I try it It is moving then one after the other. I want to move them simultaneosuly. As I am programming the movement in the OpenCM board directly, I have some control over the servos.


Thanks for the code template above. I will try it out soon.

jwatte
06-11-2018, 11:31 PM
To move them all at the same time, simply call the setGoalPosition() for each of the servo IDs at once.