File tree Expand file tree Collapse file tree 2 files changed +9
-13
lines changed Expand file tree Collapse file tree 2 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,15 @@ class SaboRobot : public MowerRobot {
4747 return charger_.getChargerStatus ();
4848 }
4949
50- bool TestESC (VescDriver& motor_driver);
50+ template <typename EscDriver>
51+ bool TestESC (EscDriver& motor_driver) {
52+ if (!motor_driver.IsStarted ()) return false ;
53+ if (motor_driver.GetLatestState ().status == MotorDriver::ESCState::ESCStatus::ESC_STATUS_DISCONNECTED) {
54+ motor_driver.RequestStatus ();
55+ chThdSleepMilliseconds (100 ); // give it a chance to respond
56+ }
57+ return motor_driver.GetLatestState ().status == MotorDriver::ESCState::ESCStatus::ESC_STATUS_OK;
58+ }
5159 bool TestLeftESC () {
5260 return TestESC (left_motor_driver_);
5361 }
Original file line number Diff line number Diff line change @@ -44,15 +44,3 @@ bool SaboRobot::IsHardwareSupported() {
4444
4545 return false ;
4646}
47-
48- bool SaboRobot::TestESC (VescDriver& motor_driver) {
49- if (!motor_driver.IsStarted ()) return false ;
50-
51- if (motor_driver.GetLatestState ().status == MotorDriver::ESCState::ESCStatus::ESC_STATUS_DISCONNECTED) {
52- motor_driver.RequestStatus ();
53- // Give ESC driver some time to respond so that callee don't need to go into retry loop
54- chThdSleepMilliseconds (100 );
55- }
56-
57- return motor_driver.GetLatestState ().status == MotorDriver::ESCState::ESCStatus::ESC_STATUS_OK;
58- }
You can’t perform that action at this time.
0 commit comments