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 {
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 {

View File

@@ -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
}

View File

@@ -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;

View File

@@ -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 "

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -62,11 +62,11 @@ class HunterBase : public AgilexBase<ParserType>, public HunterInterface {
}
void ActivateBrake() override {
AgilexBase<ParserType>::SetBrakeMode(BrakeMode::BRAKE_MODE_LOCK);
AgilexBase<ParserType>::SetBrakeMode(AgxBrakeMode::BRAKE_MODE_LOCK);
}
void ReleaseBrake() override {
AgilexBase<ParserType>::SetBrakeMode(BrakeMode::BRAKE_MODE_UNLOCK);
AgilexBase<ParserType>::SetBrakeMode(AgxBrakeMode::BRAKE_MODE_UNLOCK);
}
};
} // 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);
}
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<ProtocolV2Parser>::SendLightCommand(f_mode, f_value, r_mode,
r_value);

View File

@@ -40,8 +40,8 @@ class ScoutBase : public AgilexBase<ParserType>, 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<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);
}
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,
0);
}

View File

@@ -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;

View File

@@ -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<ScoutInterface*>(robot_);
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/stopwatch.hpp"
#include "utilities/stopwatch.hpp"
namespace westonrobot {
bool ProtocolDectctor::Connect(std::string can_name) {