# Time interval of 2 independent set_pos_setpoints commends

I am quite a beginner of using the drive.

Question:

What is the minimum time interval between 2 set_pos_setpoints command. The reason to ask this is because I want to generate a series of paths of leg configurations attached onto these motors, which means the motors have to make tiny little movements continuously to achieve that trajectory.

Can I do this by using just set_pos_setpoints? What is the function I should use?

Thank you for answering my question?

1 Like

Nice setup! Please share a video when you get it working ;D

You can send commands to set_pos_setpoints as fast as you want, the command is blocking while transferring, so you don’t need a delay. Yes my recommended method is to simply write to the set_pos_setpoints() as fast as possible to plot the trajectory. You can even use the velocity feedforward term if you have known velocity terms in your trajectory.

1 Like

However, as I tried
m0.set_pos_setpoints(100,0,0)
m1.set_pos_setpoints(-100,0,0)
m0.set_pos_setpoints(2000,0,0)
m1.set_pos_setpoints(-2000,0,0)
m0.set_pos_setpoints(1000,0,0)
m1.set_pos_setpoints(-1000,0,0)
it would only go to (1000,0,0) (-1000,0,0), instead of first going to the (2000,0,0) (-2000,0,0) and then going to the (1000,0,0) (-1000,0,0).

And also if in the python code I do:

for i in range (5):
m0.set_pos_setpoints(100,0,0)
m1.set_pos_setpoints(-100,0,0)
m0.set_pos_setpoints(2000,0,0)
m1.set_pos_setpoints(-2000,0,0)

it would just stay in one place.

So am I doing anything wrong?

The position setpoint specifies where the ODrive should try to be now. They are not go-to commands. That means you need to do something like the following psudocode:

``````for each waypoint
for x = every millimeter between this waypoint and next waypoint
motor.set_pos_setpoint(x, vel * sign(next_waypoint - this_waypoint)
delay(1/(1000*vel))
``````

That is, you need to sample your trajectory and send the setpoints in realtime to the ODrive. We may add a trajectory planner and tracker in the future, but for now you have to do this externally.

3 Likes