Thanks for your persistence with your ODrive, and I’m glad you are looking to take the functionality to the next level.
Let me take some time to explain how the ODrive is working right now.
This is not quite correct. When you send that command, you are simply telling the ODrive: Try to be at position
1000 NOW. This is an absolute position coordinate, so it will not make 1000 “steps” if it is already at position 1000. Also, since it tries to be there NOW, it will try as hard as it can to get there, it won’t go there linearly (constant speed). Like @Wetmelon demonstrated, the trajectory it takes depends on your tuning, but is generally more aggressive acceleration at the start and then a smooth slowdown.
A planned motion, with acceleration/deceleration, is called a planned trajectory. We intend to make a sinusoidal velocity profile planner/tracker, see here. If you simply wish to wait for us to finish this, you can subscribe to that issue. It is not the highest on our priority right now, though if you would like to sponsor this feature, we can bump it up in priority .
Diagram of some different velocity profiles.
If you would like to implement our planned trajectory feature, or your own, let me know and I can guide you to where it makes sense to put it in the code. Otherwise, either of your other suggestions should work:
- Use an external trajectory planner on an arduino-like platform, and send step/dir signals. @Richard_Parsons has some experience with this, and should be able to give more detailed advice.
- Use your PC or a raspberry pi to send
p commands at a fast rate. Though it wouldn’t be with increasing speed, it can be constant speed: since the
p command is absolute. To move in a linear velocity profile with motor 0, you should send something like this (in this example every 100ms):
p 0 0 0 0 (no movement)
p 0 0 1000 0 (start of move here)
p 0 100 1000 0
p 0 200 1000 0
p 0 300 1000 0
p 0 400 0 0 (end of move here)
p 0 400 0 0 (no movement)
- As you can see the second parameter is the absolute position, and the third parameter is the velocity. You can ignore the 4rd parameter for now