Search for mechanical end of linear actuator on startup

I’m using Odrives for linear actuators. The actuators don’t have limit switches. Would it be possible to let the ODrive search for a mechanical end stop? So when the controller starts, it first searches the index pulse of the CUI encoder turning one way (positive direction, actuator extends), and then turn the other way (negative direction, actuator retracts) until it senses that the current increases to much? Then it would have to reset the setpoint to zero.

There is another user who has modified the ODrive firmware to watch for a physical stop of the motor as a limit switch. He’s “WallyWalrick” on Discord, so maybe @Wally?

Hi Robin,
I’m really busy with finishing a project but should be able to upload my code early next week. I’m not fully happy with it yet but it does work…thinking of adding a current limiter as well. Pretty much it watches the encoder every x ms and if the shadow count stops going up/down it then stops and goes the other direction to do the same thing. It will then home to either a percentage between the two stops or just an offset from the min endstop which is then the new setpoint of zero.

1 Like

Hope this works for you, any issues feel free to reply.
If you need I can merge this with the latest master or devel

1 Like