diff --git a/CHANGELOG.md b/CHANGELOG.md index abea75fa..e2e5c677 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Please add a note of your changes below this heading if you make a Pull Request. * CANSimple messages which previously required the rtr bit to be set will now also respond if DLC = 0 * Ensure endstops update before being checked for errors, to prevent [#625](https://github.com/odriverobotics/ODrive/issues/625) +* Reset trajectory_done_ during homing to ensure a new trajectory is actually computed [#634](https://github.com/odriverobotics/ODrive/issues/634) # Releases ## [0.5.4] - 2021-10-12 diff --git a/Firmware/MotorControl/axis.cpp b/Firmware/MotorControl/axis.cpp index 89c56f6b..d8579c5b 100644 --- a/Firmware/MotorControl/axis.cpp +++ b/Firmware/MotorControl/axis.cpp @@ -421,6 +421,10 @@ bool Axis::run_homing() { controller_.pos_setpoint_ = pos_estimate_local.value(); controller_.vel_setpoint_ = 0.0f; controller_.input_pos_updated(); + + // Synchronization issue. Ensure trajectory_done is false prior to the while loop, so that + // the controller has time to run move_to_pos() on the next update() + controller_.trajectory_done_ = false; while ((requested_state_ == AXIS_STATE_UNDEFINED) && motor_.is_armed_ && !(done = controller_.trajectory_done_)) { osDelay(1);