diff --git a/include/ugv_sdk/details/interface/agilex_message.h b/include/ugv_sdk/details/interface/agilex_message.h index 469db45..8701dce 100644 --- a/include/ugv_sdk/details/interface/agilex_message.h +++ b/include/ugv_sdk/details/interface/agilex_message.h @@ -32,8 +32,8 @@ typedef struct { typedef struct { bool enable_cmd_ctrl; - LightOperation front_light; - LightOperation rear_light; + AgxLightOperation front_light; + AgxLightOperation rear_light; } LightCommandMessage; typedef struct { @@ -46,7 +46,7 @@ typedef struct { // V1-only messages typedef struct { - ControlMode control_mode; + AgxControlMode control_mode; bool clear_all_error; float linear; float angular; @@ -73,8 +73,8 @@ typedef ValueSetCommandMessageV1 ValueSetStateMessageV1; #define SYSTEM_ERROR_STEER_ENCODER_MASK ((uint16_t)0x0080) typedef struct { - VehicleState vehicle_state; - ControlMode control_mode; + AgxVehicleState vehicle_state; + AgxControlMode control_mode; float battery_voltage; uint16_t error_code; } SystemStateMessage; @@ -89,10 +89,10 @@ typedef struct { typedef LightCommandMessage LightStateMessage; typedef struct { - RcSwitchState swa; - RcSwitchState swb; - RcSwitchState swc; - RcSwitchState swd; + AgxRcSwitchState swa; + AgxRcSwitchState swb; + AgxRcSwitchState swc; + AgxRcSwitchState swd; int8_t stick_right_v; int8_t stick_right_h; int8_t stick_left_v; @@ -237,11 +237,11 @@ typedef struct { } VersionResponseMessage; typedef struct { - ControlMode mode; + AgxControlMode mode; } ControlModeConfigMessage; typedef struct { - BrakeMode mode; + AgxBrakeMode mode; } BrakeModeConfigMessage; typedef struct { diff --git a/include/ugv_sdk/details/interface/agilex_types.h b/include/ugv_sdk/details/interface/agilex_types.h index dfb97c0..64fba5a 100644 --- a/include/ugv_sdk/details/interface/agilex_types.h +++ b/include/ugv_sdk/details/interface/agilex_types.h @@ -21,37 +21,37 @@ typedef enum { CONST_ON = 0x01, BREATH = 0x02, CUSTOM = 0x03 -} LightMode; +} AgxLightMode; typedef struct { - LightMode mode; + AgxLightMode mode; uint8_t custom_value; -} LightOperation; +} AgxLightOperation; typedef enum { VehicleStateNormal = 0x00, VehicleStateEStop = 0x01, VehicleStateException = 0x02 -} VehicleState; +} AgxVehicleState; typedef enum { // CONTROL_MODE_STANDBY = 0x00, CONTROL_MODE_RC = 0x00, CONTROL_MODE_CAN = 0x01, CONTROL_MODE_UART = 0x02 -} ControlMode; +} AgxControlMode; typedef enum { // CONTROL_MODE_STANDBY = 0x00, BRAKE_MODE_UNLOCK = 0x00, BRAKE_MODE_LOCK = 0x01 -} BrakeMode; +} AgxBrakeMode; typedef enum { RC_SWITCH_UP = 0, RC_SWITCH_MIDDLE, RC_SWITCH_DOWN -} RcSwitchState; +} AgxRcSwitchState; #ifdef __cplusplus } diff --git a/include/ugv_sdk/details/interface/ranger_interface.hpp b/include/ugv_sdk/details/interface/ranger_interface.hpp index 770e2c8..6153487 100644 --- a/include/ugv_sdk/details/interface/ranger_interface.hpp +++ b/include/ugv_sdk/details/interface/ranger_interface.hpp @@ -45,8 +45,8 @@ struct RangerInterface { virtual void SetMotionMode(uint8_t mode) = 0; virtual void SetMotionCommand(double linear_vel, double steer_angle, double lateral_vel, double angular_vel) = 0; - virtual void SetLightCommand(LightMode f_mode, uint8_t f_value, - LightMode r_mode, uint8_t r_value) = 0; + virtual void SetLightCommand(AgxLightMode f_mode, uint8_t f_value, + AgxLightMode r_mode, uint8_t r_value) = 0; // get robot state virtual RangerCoreState GetRobotState() = 0; diff --git a/include/ugv_sdk/details/interface/robot_common_interface.hpp b/include/ugv_sdk/details/interface/robot_common_interface.hpp index 04b28d7..05dfaab 100644 --- a/include/ugv_sdk/details/interface/robot_common_interface.hpp +++ b/include/ugv_sdk/details/interface/robot_common_interface.hpp @@ -64,7 +64,7 @@ class RobotCommonInterface { /****** functions not available/valid to all robots ******/ // functions to be implemented by class AgilexBase virtual void SetMotionMode(uint8_t mode){}; - virtual void SetBrakedMode(BrakeMode mode){}; + virtual void SetBrakedMode(AgxBrakeMode mode){}; virtual CoreStateMsgGroup GetRobotCoreStateMsgGroup() { throw std::runtime_error( @@ -88,8 +88,8 @@ class RobotCommonInterface { "is supposed to be used."); }; - virtual void SendLightCommand(LightMode front_mode, - uint8_t front_custom_value, LightMode rear_mode, + virtual void SendLightCommand(AgxLightMode front_mode, + uint8_t front_custom_value, AgxLightMode rear_mode, uint8_t rear_custom_value) { throw std::runtime_error( "Only a derived version of this function with actual implementation " diff --git a/include/ugv_sdk/details/interface/scout_interface.hpp b/include/ugv_sdk/details/interface/scout_interface.hpp index eb4974e..6e6f264 100644 --- a/include/ugv_sdk/details/interface/scout_interface.hpp +++ b/include/ugv_sdk/details/interface/scout_interface.hpp @@ -44,8 +44,8 @@ struct ScoutInterface { }; virtual void SetMotionCommand(double linear_vel, double angular_vel) = 0; - virtual void SetLightCommand(LightMode f_mode, uint8_t f_value, - LightMode r_mode, uint8_t r_value) = 0; + virtual void SetLightCommand(AgxLightMode f_mode, uint8_t f_value, + AgxLightMode r_mode, uint8_t r_value) = 0; // get robot state virtual ScoutCoreState GetRobotState() = 0; diff --git a/include/ugv_sdk/details/interface/tracer_interface.hpp b/include/ugv_sdk/details/interface/tracer_interface.hpp index 2293ebb..6432b0f 100644 --- a/include/ugv_sdk/details/interface/tracer_interface.hpp +++ b/include/ugv_sdk/details/interface/tracer_interface.hpp @@ -41,7 +41,7 @@ struct TracerInterface { }; virtual void SetMotionCommand(double linear_vel, double angular_vel) = 0; - virtual void SetLightCommand(LightMode f_mode, uint8_t f_value) = 0; + virtual void SetLightCommand(AgxLightMode f_mode, uint8_t f_value) = 0; // get robot state virtual TracerCoreState GetRobotState() = 0; diff --git a/include/ugv_sdk/details/robot_base/agilex_base.hpp b/include/ugv_sdk/details/robot_base/agilex_base.hpp index 9d5dfbb..a976f5c 100644 --- a/include/ugv_sdk/details/robot_base/agilex_base.hpp +++ b/include/ugv_sdk/details/robot_base/agilex_base.hpp @@ -97,8 +97,8 @@ class AgilexBase : public RobotCommonInterface { } // one-shot light command - void SendLightCommand(LightMode front_mode, uint8_t front_custom_value, - LightMode rear_mode, uint8_t rear_custom_value) { + void SendLightCommand(AgxLightMode front_mode, uint8_t front_custom_value, + AgxLightMode rear_mode, uint8_t rear_custom_value) { if (can_connected_) { AgxMessage msg; msg.type = AgxMsgLightCommand; @@ -190,7 +190,7 @@ class AgilexBase : public RobotCommonInterface { if (can_connected_) can_->StopService(); } - void SetBrakeMode(BrakeMode mode) { + void SetBrakeMode(AgxBrakeMode mode) { // construct message AgxMessage msg; msg.type = AgxMsgBrakeModeConfig; diff --git a/include/ugv_sdk/details/robot_base/hunter_base.hpp b/include/ugv_sdk/details/robot_base/hunter_base.hpp index 1c436d4..b33ea7c 100644 --- a/include/ugv_sdk/details/robot_base/hunter_base.hpp +++ b/include/ugv_sdk/details/robot_base/hunter_base.hpp @@ -62,11 +62,11 @@ class HunterBase : public AgilexBase, public HunterInterface { } void ActivateBrake() override { - AgilexBase::SetBrakeMode(BrakeMode::BRAKE_MODE_LOCK); + AgilexBase::SetBrakeMode(AgxBrakeMode::BRAKE_MODE_LOCK); } void ReleaseBrake() override { - AgilexBase::SetBrakeMode(BrakeMode::BRAKE_MODE_UNLOCK); + AgilexBase::SetBrakeMode(AgxBrakeMode::BRAKE_MODE_UNLOCK); } }; } // namespace westonrobot diff --git a/include/ugv_sdk/details/robot_base/ranger_base.hpp b/include/ugv_sdk/details/robot_base/ranger_base.hpp index 5bb572b..f918c91 100644 --- a/include/ugv_sdk/details/robot_base/ranger_base.hpp +++ b/include/ugv_sdk/details/robot_base/ranger_base.hpp @@ -40,7 +40,7 @@ class RangerBase : public AgilexBase, public RangerInterface { linear_vel, angular_vel, lateral_vel, steer_angle / 10.0); } - void SetLightCommand(LightMode f_mode, uint8_t f_value, LightMode r_mode, + void SetLightCommand(AgxLightMode f_mode, uint8_t f_value, AgxLightMode r_mode, uint8_t r_value) override { AgilexBase::SendLightCommand(f_mode, f_value, r_mode, r_value); diff --git a/include/ugv_sdk/details/robot_base/scout_base.hpp b/include/ugv_sdk/details/robot_base/scout_base.hpp index 604c2ce..8d4598b 100644 --- a/include/ugv_sdk/details/robot_base/scout_base.hpp +++ b/include/ugv_sdk/details/robot_base/scout_base.hpp @@ -40,8 +40,8 @@ class ScoutBase : public AgilexBase, public ScoutInterface { 0.0); } - void SetLightCommand(LightMode f_mode, uint8_t f_value, - LightMode r_mode = LightMode::CONST_ON, + void SetLightCommand(AgxLightMode f_mode, uint8_t f_value, + AgxLightMode r_mode = AgxLightMode::CONST_ON, uint8_t r_value = 0) override { AgilexBase::SendLightCommand(f_mode, f_value, r_mode, r_value); } diff --git a/include/ugv_sdk/details/robot_base/tracer_base.hpp b/include/ugv_sdk/details/robot_base/tracer_base.hpp index 86f40f5..8139268 100644 --- a/include/ugv_sdk/details/robot_base/tracer_base.hpp +++ b/include/ugv_sdk/details/robot_base/tracer_base.hpp @@ -42,7 +42,7 @@ class TracerBaseV2 : public AgilexBase, 0.0, 0.0); } - void SetLightCommand(LightMode f_mode, uint8_t f_value) override { + void SetLightCommand(AgxLightMode f_mode, uint8_t f_value) override { AgilexBase::SendLightCommand(f_mode, f_value, CONST_OFF, 0); } diff --git a/include/ugv_sdk/mobile_robot/scout_robot.hpp b/include/ugv_sdk/mobile_robot/scout_robot.hpp index 54a2046..155e710 100644 --- a/include/ugv_sdk/mobile_robot/scout_robot.hpp +++ b/include/ugv_sdk/mobile_robot/scout_robot.hpp @@ -28,7 +28,7 @@ class ScoutRobot : public RobotCommonInterface, public ScoutInterface { void EnableCommandedMode() override; void SetMotionCommand(double linear_vel, double angular_vel) override; - void SetLightCommand(LightMode f_mode, uint8_t f_value, LightMode r_mode, + void SetLightCommand(AgxLightMode f_mode, uint8_t f_value, AgxLightMode r_mode, uint8_t r_value) override; void DisableLightControl() override; diff --git a/src/mobile_robot/scout_robot.cpp b/src/mobile_robot/scout_robot.cpp index 2b85a44..c8e9710 100644 --- a/src/mobile_robot/scout_robot.cpp +++ b/src/mobile_robot/scout_robot.cpp @@ -52,8 +52,8 @@ void ScoutRobot::SetMotionCommand(double linear_vel, double angular_vel) { void ScoutRobot::DisableLightControl() { robot_->DisableLightControl(); } -void ScoutRobot::SetLightCommand(LightMode f_mode, uint8_t f_value, - LightMode r_mode, uint8_t r_value) { +void ScoutRobot::SetLightCommand(AgxLightMode f_mode, uint8_t f_value, + AgxLightMode r_mode, uint8_t r_value) { auto scout = dynamic_cast(robot_); scout->SetLightCommand(f_mode, f_value, r_mode, r_value); } diff --git a/src/utilities/protocol_detector.cpp b/src/utilities/protocol_detector.cpp index 860a190..dd9d402 100644 --- a/src/utilities/protocol_detector.cpp +++ b/src/utilities/protocol_detector.cpp @@ -8,7 +8,7 @@ */ #include "ugv_sdk/utilities/protocol_detector.hpp" -#include "ugv_sdk/utilities/stopwatch.hpp" +#include "utilities/stopwatch.hpp" namespace westonrobot { bool ProtocolDectctor::Connect(std::string can_name) { diff --git a/include/ugv_sdk/utilities/stopwatch.hpp b/src/utilities/stopwatch.hpp similarity index 100% rename from include/ugv_sdk/utilities/stopwatch.hpp rename to src/utilities/stopwatch.hpp