mirror of
https://github.com/westonrobot/ugv_sdk
synced 2023-04-08 06:32:14 +08:00
added exception for invalid function calls from interface
This commit is contained in:
@@ -65,22 +65,34 @@ class RobotCommonInterface {
|
|||||||
// functions to be implemented by class AgilexBase
|
// functions to be implemented by class AgilexBase
|
||||||
virtual void SetMotionMode(uint8_t mode){};
|
virtual void SetMotionMode(uint8_t mode){};
|
||||||
virtual CoreStateMsgGroup GetRobotCoreStateMsgGroup() {
|
virtual CoreStateMsgGroup GetRobotCoreStateMsgGroup() {
|
||||||
|
throw std::runtime_error(
|
||||||
|
"Only a derived version of this function with actual implementation "
|
||||||
|
"is supposed to be used.");
|
||||||
return CoreStateMsgGroup{};
|
return CoreStateMsgGroup{};
|
||||||
};
|
};
|
||||||
virtual ActuatorStateMsgGroup GetActuatorStateMsgGroup() {
|
virtual ActuatorStateMsgGroup GetActuatorStateMsgGroup() {
|
||||||
|
throw std::runtime_error(
|
||||||
|
"Only a derived version of this function with actual implementation "
|
||||||
|
"is supposed to be used.");
|
||||||
return ActuatorStateMsgGroup{};
|
return ActuatorStateMsgGroup{};
|
||||||
};
|
};
|
||||||
|
|
||||||
// any specific robot will use a specialized version of the two functions
|
// any specific robot will use a specialized version of the two functions
|
||||||
virtual void SendMotionCommand(double linear_vel, double angular_vel,
|
virtual void SendMotionCommand(double linear_vel, double angular_vel,
|
||||||
double lateral_velocity,
|
double lateral_velocity,
|
||||||
double steering_angle){
|
double steering_angle) {
|
||||||
// use derived version
|
throw std::runtime_error(
|
||||||
|
"Only a derived version of this function with actual implementation "
|
||||||
|
"is supposed to be used.");
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void SendLightCommand(LightMode front_mode,
|
virtual void SendLightCommand(LightMode front_mode,
|
||||||
uint8_t front_custom_value, LightMode rear_mode,
|
uint8_t front_custom_value, LightMode rear_mode,
|
||||||
uint8_t rear_custom_value){};
|
uint8_t rear_custom_value) {
|
||||||
|
throw std::runtime_error(
|
||||||
|
"Only a derived version of this function with actual implementation "
|
||||||
|
"is supposed to be used.");
|
||||||
|
};
|
||||||
};
|
};
|
||||||
} // namespace westonrobot
|
} // namespace westonrobot
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ class ScoutMiniOmniRobot : public ScoutRobot, public ScoutOmniInterface {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
using ScoutRobot::SetMotionCommand;
|
using ScoutRobot::SetMotionCommand;
|
||||||
// void SetMotionCommand(double linear_vel, double angular_vel) = delete;
|
|
||||||
};
|
};
|
||||||
} // namespace westonrobot
|
} // namespace westonrobot
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user