diff --git a/include/motor-control/simulation/brushed_motor_interrupt_driver.hpp b/include/motor-control/simulation/brushed_motor_interrupt_driver.hpp index 7f1621329..fa9f75ddf 100644 --- a/include/motor-control/simulation/brushed_motor_interrupt_driver.hpp +++ b/include/motor-control/simulation/brushed_motor_interrupt_driver.hpp @@ -60,8 +60,8 @@ class BrushedMotorInterruptDriver { } handler.run_interrupt(); - } while (handler.motor_state == - brushed_motor_handler::ControlState::ACTIVE); + } while (iface.get_motor_state() == + BrushedMotorState::FORCE_CONTROLLING); LOG("Move completed. Stopping interrupt simulation.."); } } diff --git a/include/motor-control/simulation/sim_motor_hardware_iface.hpp b/include/motor-control/simulation/sim_motor_hardware_iface.hpp index 2a666a95f..2a8dd67cc 100644 --- a/include/motor-control/simulation/sim_motor_hardware_iface.hpp +++ b/include/motor-control/simulation/sim_motor_hardware_iface.hpp @@ -185,6 +185,9 @@ class SimBrushedMotorHardwareIface void disable_encoder() final {} void enable_encoder() final {} + void set_motor_state(BrushedMotorState state) final { motor_state = state; } + auto get_motor_state() -> BrushedMotorState final { return motor_state; } + private: bool stay_enabled = false; bool limit_switch_status = false; @@ -199,6 +202,7 @@ class SimBrushedMotorHardwareIface MoveMessageHardware _id; bool estop_detected = false; std::atomic cancel_request = false; + BrushedMotorState motor_state = BrushedMotorState::UNHOMED; motor_hardware::UsageEEpromConfig eeprom_config{ std::array{UsageRequestSet{ .eeprom_key = 0,