odriverobotics / ODrive

High performance motor control
https://odriverobotics.com
MIT License
2.89k stars 1.5k forks source link

Position control keeps running when the mechanical brake is engaged #704

Closed Duck-Pilot closed 1 year ago

Duck-Pilot commented 2 years ago

Describe the bug When engaging the mechanical brake while in closed loop position control mode, the controller keeps trying to correct motor position, but the mechanical brake makes this impossible. If the axis is moved by a large force while the brake is engaged, the controller will push a large current through the motor, but the motor can not move, so it will start heating up.

To Reproduce Set the controller to closed loop position control mode and engage the mechanical brake connected to the controlled motor, then move the motor by hand while the brake is still engaged. The controller will now start pushing current through the motor, trying to move it. This issue also presents itself if the position setpoint is changed while the mechanical brake is still engaged.

Expected behavior When the mechanical brake is engaged by it's command through the odrive, the controller stops controlling the motor and pushing current through it

Desktop:

Additional context The motor is connected to a large rotating table through belt reductions, the encoder is connected to the motor but the brake brakes the table directly. Due to the size of the table, it is possible to move the table by a large force while the brake is engaged.

samuelsadok commented 2 years ago

The mechanical brake engages automatically when going to IDLE state. Would it be viable for you to use a state change to IDLE instead of calling mechanical_brake.engage()?

Wetmelon commented 1 year ago

I started implementing a fix for this, but it's too sketchy. Please just drop into IDLE when you want the brake to engage.