Maximum position value in ODrive

#1

Hi,

the position of the motor is an integer that counts encoder steps. So if I set a position setpoint of 1000, and my encoder has 10 bits (1024 counts per revolution) I can expect my motor to perform roughly 1 revolution and stop. If I set it to 5000, it will do about 5 revolutions.

What’s the maximum value we can have? Is the position variable a int16 or int32?

Thank you very much, as usual.

0 Likes

#2

Currently it’s a signed int32. We recently upgraded the back end for the protocol so it should support int64 trivially. We also want to make sure velocity and current control modes never overflow

1 Like

#3

Thanks Wetmelon,

With the int32 I have a reasonable margin for operation, but I actually have a chance of hitting overflow with my current design.

And because we are going to use CAN, I suppose it’s less trivial to expand from 32 to 64, as the message is expected to contain 32 bits there as far as I can tell. Well, probably hackable but still less trivial.

Is there a way to reset the position counter, just in case? Or I’d have to power the ODrive off and on?

Thanks!

0 Likes

#4

Unfortunately the issues is the shadow counter that you can’t reset. We did implement “Circular Position Control”, it may work for your usecase? https://docs.odriverobotics.com/#other-control-modes

0 Likes

#5

Hi,

It might be exactly what we need.
But can I still feed-forward velocity in that mode? That’s of key importance for me.

Thank you!

0 Likes

#6

Yep, should be able to

1 Like