agilex_types: added Agx prefix to types

This commit is contained in:
Ruixiang Du
2021-10-04 19:21:47 +08:00
parent c5faa29368
commit 636ea8fd15
15 changed files with 39 additions and 39 deletions

View File

@@ -32,8 +32,8 @@ typedef struct {
typedef struct { typedef struct {
bool enable_cmd_ctrl; bool enable_cmd_ctrl;
LightOperation front_light; AgxLightOperation front_light;
LightOperation rear_light; AgxLightOperation rear_light;
} LightCommandMessage; } LightCommandMessage;
typedef struct { typedef struct {
@@ -46,7 +46,7 @@ typedef struct {
// V1-only messages // V1-only messages
typedef struct { typedef struct {
ControlMode control_mode; AgxControlMode control_mode;
bool clear_all_error; bool clear_all_error;
float linear; float linear;
float angular; float angular;
@@ -73,8 +73,8 @@ typedef ValueSetCommandMessageV1 ValueSetStateMessageV1;
#define SYSTEM_ERROR_STEER_ENCODER_MASK ((uint16_t)0x0080) #define SYSTEM_ERROR_STEER_ENCODER_MASK ((uint16_t)0x0080)
typedef struct { typedef struct {
VehicleState vehicle_state; AgxVehicleState vehicle_state;
ControlMode control_mode; AgxControlMode control_mode;
float battery_voltage; float battery_voltage;
uint16_t error_code; uint16_t error_code;
} SystemStateMessage; } SystemStateMessage;
@@ -89,10 +89,10 @@ typedef struct {
typedef LightCommandMessage LightStateMessage; typedef LightCommandMessage LightStateMessage;
typedef struct { typedef struct {
RcSwitchState swa; AgxRcSwitchState swa;
RcSwitchState swb; AgxRcSwitchState swb;
RcSwitchState swc; AgxRcSwitchState swc;
RcSwitchState swd; AgxRcSwitchState swd;
int8_t stick_right_v; int8_t stick_right_v;
int8_t stick_right_h; int8_t stick_right_h;
int8_t stick_left_v; int8_t stick_left_v;
@@ -237,11 +237,11 @@ typedef struct {
} VersionResponseMessage; } VersionResponseMessage;
typedef struct { typedef struct {
ControlMode mode; AgxControlMode mode;
} ControlModeConfigMessage; } ControlModeConfigMessage;
typedef struct { typedef struct {
BrakeMode mode; AgxBrakeMode mode;
} BrakeModeConfigMessage; } BrakeModeConfigMessage;
typedef struct { typedef struct {

View File

@@ -21,37 +21,37 @@ typedef enum {
CONST_ON = 0x01, CONST_ON = 0x01,
BREATH = 0x02, BREATH = 0x02,
CUSTOM = 0x03 CUSTOM = 0x03
} LightMode; } AgxLightMode;
typedef struct { typedef struct {
LightMode mode; AgxLightMode mode;
uint8_t custom_value; uint8_t custom_value;
} LightOperation; } AgxLightOperation;
typedef enum { typedef enum {
VehicleStateNormal = 0x00, VehicleStateNormal = 0x00,
VehicleStateEStop = 0x01, VehicleStateEStop = 0x01,
VehicleStateException = 0x02 VehicleStateException = 0x02
} VehicleState; } AgxVehicleState;
typedef enum { typedef enum {
// CONTROL_MODE_STANDBY = 0x00, // CONTROL_MODE_STANDBY = 0x00,
CONTROL_MODE_RC = 0x00, CONTROL_MODE_RC = 0x00,
CONTROL_MODE_CAN = 0x01, CONTROL_MODE_CAN = 0x01,
CONTROL_MODE_UART = 0x02 CONTROL_MODE_UART = 0x02
} ControlMode; } AgxControlMode;
typedef enum { typedef enum {
// CONTROL_MODE_STANDBY = 0x00, // CONTROL_MODE_STANDBY = 0x00,
BRAKE_MODE_UNLOCK = 0x00, BRAKE_MODE_UNLOCK = 0x00,
BRAKE_MODE_LOCK = 0x01 BRAKE_MODE_LOCK = 0x01
} BrakeMode; } AgxBrakeMode;
typedef enum { typedef enum {
RC_SWITCH_UP = 0, RC_SWITCH_UP = 0,
RC_SWITCH_MIDDLE, RC_SWITCH_MIDDLE,
RC_SWITCH_DOWN RC_SWITCH_DOWN
} RcSwitchState; } AgxRcSwitchState;
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -45,8 +45,8 @@ struct RangerInterface {
virtual void SetMotionMode(uint8_t mode) = 0; virtual void SetMotionMode(uint8_t mode) = 0;
virtual void SetMotionCommand(double linear_vel, double steer_angle, virtual void SetMotionCommand(double linear_vel, double steer_angle,
double lateral_vel, double angular_vel) = 0; double lateral_vel, double angular_vel) = 0;
virtual void SetLightCommand(LightMode f_mode, uint8_t f_value, virtual void SetLightCommand(AgxLightMode f_mode, uint8_t f_value,
LightMode r_mode, uint8_t r_value) = 0; AgxLightMode r_mode, uint8_t r_value) = 0;
// get robot state // get robot state
virtual RangerCoreState GetRobotState() = 0; virtual RangerCoreState GetRobotState() = 0;

View File

@@ -64,7 +64,7 @@ class RobotCommonInterface {
/****** functions not available/valid to all robots ******/ /****** functions not available/valid to all robots ******/
// 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 void SetBrakedMode(BrakeMode mode){}; virtual void SetBrakedMode(AgxBrakeMode mode){};
virtual CoreStateMsgGroup GetRobotCoreStateMsgGroup() { virtual CoreStateMsgGroup GetRobotCoreStateMsgGroup() {
throw std::runtime_error( throw std::runtime_error(
@@ -88,8 +88,8 @@ class RobotCommonInterface {
"is supposed to be used."); "is supposed to be used.");
}; };
virtual void SendLightCommand(LightMode front_mode, virtual void SendLightCommand(AgxLightMode front_mode,
uint8_t front_custom_value, LightMode rear_mode, uint8_t front_custom_value, AgxLightMode rear_mode,
uint8_t rear_custom_value) { uint8_t rear_custom_value) {
throw std::runtime_error( throw std::runtime_error(
"Only a derived version of this function with actual implementation " "Only a derived version of this function with actual implementation "

View File

@@ -44,8 +44,8 @@ struct ScoutInterface {
}; };
virtual void SetMotionCommand(double linear_vel, double angular_vel) = 0; virtual void SetMotionCommand(double linear_vel, double angular_vel) = 0;
virtual void SetLightCommand(LightMode f_mode, uint8_t f_value, virtual void SetLightCommand(AgxLightMode f_mode, uint8_t f_value,
LightMode r_mode, uint8_t r_value) = 0; AgxLightMode r_mode, uint8_t r_value) = 0;
// get robot state // get robot state
virtual ScoutCoreState GetRobotState() = 0; virtual ScoutCoreState GetRobotState() = 0;

View File

@@ -41,7 +41,7 @@ struct TracerInterface {
}; };
virtual void SetMotionCommand(double linear_vel, double angular_vel) = 0; 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 // get robot state
virtual TracerCoreState GetRobotState() = 0; virtual TracerCoreState GetRobotState() = 0;

View File

@@ -97,8 +97,8 @@ class AgilexBase : public RobotCommonInterface {
} }
// one-shot light command // one-shot light command
void SendLightCommand(LightMode front_mode, uint8_t front_custom_value, void SendLightCommand(AgxLightMode front_mode, uint8_t front_custom_value,
LightMode rear_mode, uint8_t rear_custom_value) { AgxLightMode rear_mode, uint8_t rear_custom_value) {
if (can_connected_) { if (can_connected_) {
AgxMessage msg; AgxMessage msg;
msg.type = AgxMsgLightCommand; msg.type = AgxMsgLightCommand;
@@ -190,7 +190,7 @@ class AgilexBase : public RobotCommonInterface {
if (can_connected_) can_->StopService(); if (can_connected_) can_->StopService();
} }
void SetBrakeMode(BrakeMode mode) { void SetBrakeMode(AgxBrakeMode mode) {
// construct message // construct message
AgxMessage msg; AgxMessage msg;
msg.type = AgxMsgBrakeModeConfig; msg.type = AgxMsgBrakeModeConfig;

View File

@@ -62,11 +62,11 @@ class HunterBase : public AgilexBase<ParserType>, public HunterInterface {
} }
void ActivateBrake() override { void ActivateBrake() override {
AgilexBase<ParserType>::SetBrakeMode(BrakeMode::BRAKE_MODE_LOCK); AgilexBase<ParserType>::SetBrakeMode(AgxBrakeMode::BRAKE_MODE_LOCK);
} }
void ReleaseBrake() override { void ReleaseBrake() override {
AgilexBase<ParserType>::SetBrakeMode(BrakeMode::BRAKE_MODE_UNLOCK); AgilexBase<ParserType>::SetBrakeMode(AgxBrakeMode::BRAKE_MODE_UNLOCK);
} }
}; };
} // namespace westonrobot } // namespace westonrobot

View File

@@ -40,7 +40,7 @@ class RangerBase : public AgilexBase<ProtocolV2Parser>, public RangerInterface {
linear_vel, angular_vel, lateral_vel, steer_angle / 10.0); 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 { uint8_t r_value) override {
AgilexBase<ProtocolV2Parser>::SendLightCommand(f_mode, f_value, r_mode, AgilexBase<ProtocolV2Parser>::SendLightCommand(f_mode, f_value, r_mode,
r_value); r_value);

View File

@@ -40,8 +40,8 @@ class ScoutBase : public AgilexBase<ParserType>, public ScoutInterface {
0.0); 0.0);
} }
void SetLightCommand(LightMode f_mode, uint8_t f_value, void SetLightCommand(AgxLightMode f_mode, uint8_t f_value,
LightMode r_mode = LightMode::CONST_ON, AgxLightMode r_mode = AgxLightMode::CONST_ON,
uint8_t r_value = 0) override { uint8_t r_value = 0) override {
AgilexBase<ParserType>::SendLightCommand(f_mode, f_value, r_mode, r_value); AgilexBase<ParserType>::SendLightCommand(f_mode, f_value, r_mode, r_value);
} }

View File

@@ -42,7 +42,7 @@ class TracerBaseV2 : public AgilexBase<ProtocolV2Parser>,
0.0, 0.0); 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<ProtocolV2Parser>::SendLightCommand(f_mode, f_value, CONST_OFF, AgilexBase<ProtocolV2Parser>::SendLightCommand(f_mode, f_value, CONST_OFF,
0); 0);
} }

View File

@@ -28,7 +28,7 @@ class ScoutRobot : public RobotCommonInterface, public ScoutInterface {
void EnableCommandedMode() override; void EnableCommandedMode() override;
void SetMotionCommand(double linear_vel, double angular_vel) 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; uint8_t r_value) override;
void DisableLightControl() override; void DisableLightControl() override;

View File

@@ -52,8 +52,8 @@ void ScoutRobot::SetMotionCommand(double linear_vel, double angular_vel) {
void ScoutRobot::DisableLightControl() { robot_->DisableLightControl(); } void ScoutRobot::DisableLightControl() { robot_->DisableLightControl(); }
void ScoutRobot::SetLightCommand(LightMode f_mode, uint8_t f_value, void ScoutRobot::SetLightCommand(AgxLightMode f_mode, uint8_t f_value,
LightMode r_mode, uint8_t r_value) { AgxLightMode r_mode, uint8_t r_value) {
auto scout = dynamic_cast<ScoutInterface*>(robot_); auto scout = dynamic_cast<ScoutInterface*>(robot_);
scout->SetLightCommand(f_mode, f_value, r_mode, r_value); scout->SetLightCommand(f_mode, f_value, r_mode, r_value);
} }

View File

@@ -8,7 +8,7 @@
*/ */
#include "ugv_sdk/utilities/protocol_detector.hpp" #include "ugv_sdk/utilities/protocol_detector.hpp"
#include "ugv_sdk/utilities/stopwatch.hpp" #include "utilities/stopwatch.hpp"
namespace westonrobot { namespace westonrobot {
bool ProtocolDectctor::Connect(std::string can_name) { bool ProtocolDectctor::Connect(std::string can_name) {