Hello ODrive Community,
I’m working with the ODrive firmware and could use some help with a specific requirement related to the homing procedure.
Background: In my setup, I don’t actually need the actuator to physically move to the home position because I know that the starting position is always “home”. The actuator is in a vertical position, and I can rely on gravity to keep it at the start of its travel. The only challenge is that the actuator is initially pushing against a bump stop.
Objective: I’d like to modify the homing code to avoid the need for the actuator to physically move to the home position and remove the requirement for pressing the homing endstop button. Essentially, I would like the actuator to move slightly away from the bump stop, roughly around a fifth of a turn, and then set that position as 0. Alternatively, I want to set an offset so that when I start the closed-loop control, it moves away from the bump stop.
Current Approach: I’ve attempted to comment out the homing code and use the
startup_homing configuration. I’ve used the following code to set the initial position:
// Set the current position to 0.
controller_.input_pos_ = 0;
controller_.input_pos_ = -0.2;
controller_.input_pos_ = 0;
When I execute this code using the
odrivetool commands, it makes the motor jump slightly away from the bump stop, which is what I want. However, I’m not entirely sure if this is the correct way to achieve this without putting the axis in the “Idle” state.
I’m reaching out to the community for insights, code suggestions, or recommendations on where to place this code in the firmware. Your help would be greatly appreciated.
Thank you for your assistance!
Can you implement this on the external motion controller (computer/Arduino/rPi/etc) instead? You should be able to accomplish this with a series of external commands.
Its what im trying to avoid hehe. I didnt want to add another board to my system, it uses three boards and it would be a bit of work to redesign the housing I have already built and a couple of things more. But I mean its a DIY project so its no big deal.
I just hoped i could use the offset part of the homing without the actual homing or something similar.
Thank you for the reply, I will keep it in mind!
Gotcha! Yeah, there’s probably a firmware modification you could do, but the ODrive firmware is pretty complex and it can be a bit difficult to add functionality - especially if it’s blocking like that. I’d say if you can sneak an Arduino Nano or something really small like that in the enclosure, that should be the easiest solution.
What’s actually controlling the ODrive then? Is it over STEP/DIR?
Yeah maybe the arduino nano is a good idea. I havent looked at how it works but maybe I could also trick the board into thinking there is an endstop switch pressed when it is turned on. The easiest would be to try and add an endstop switch and just tape it so its clicked. Dont know what other problems this could cause but its a fast mod. I just want to get this project done and give it to a friend so I can move to the next hehe
The board is controlled by a pc program, im sending it ascii comands to control trap traj movement. In this program I have made a plugin that doest what I want. When it is started it moves the simulator a bit and removes the bump stop problem. The thing is you have to manually start the program, I have been using it like this and its no problem. I just want to add another layer of safety in case my friend turns on the sim without turning the pc and the motors stay at that 0 position for long and they start warming up too much.
Another alternative would be to be able to leave the motors in AXIS_STATE_IDLE after the initial calibration and be able to set the AXIS_STATE_CLOSED_LOOP_CONTROL through an ascii command. but havent figured out how to do this either.
Thanks for the arduino Idea, will look into it as it may not be as big of a hastle as im making it out to be hehe