How to set startup motor position

Hello!

I’m wondering how to define the startup position of the motors. I didn’t see an odrivetool command for that. But I would really like to define a non-zero pos_setpoint that the motors will go to as soon as I power on the Odrive, even if it means doing a custom firmware update.

Let me know if this is possible!
Thanks,
Evan

1 Like

I do think it’s possible to program something like that, but what encoder are you using? In most situations this would only be possible if you have an index pin.

If I find some time I will look in to it and post some updates.

Hi LowiekVDS,

Thanks for the reply! :slight_smile:

So actually I’m using an SPI interfaced encoder (AS5048A) using a custom firmware I modified based off of this branch (https://github.com/DJGCrusader/ODrive/tree/devel).

It’s an absolute encoder using magnetic sensors to give 14 bit position resolution (CPR = 16384). My application requires that it will virtually always be shutdown at an arbitrary non-zero position, but what I want is for it to read it’s position on power up and gracefully move to another non-zero “origin” position that would always be the same for every power up. The thing is I won’t really know what that origin position will be until I finalize the way it’s mounted in the whole design.

I’m comfortable enough doing custom firmware updates and making modifications to the various source files, but I haven’t been able to decipher the whole project code well enough to know how to make a method at power up that could perform this behavior. So I guess what I’m asking is: where/how can I write a script in my custom firmware to perform a function at power up that will make this origin transition movement before any other motions in the motor’s start up sequence occur? Also I will need to set different origins for two separate motors each with their own AS5048A encoder.

Thank you so much for reading and for any help you can give!
Evan