mirror of
https://github.com/westonrobot/ugv_sdk
synced 2023-04-08 06:32:14 +08:00
renamed GetProtocolVersion() to GetParserProtocolVersion()
This commit is contained in:
@@ -49,7 +49,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
bunker->Connect(device_name);
|
||||
|
||||
if (bunker->GetProtocolVersion() == ProtocolVersion::AGX_V2) {
|
||||
if (bunker->GetParserProtocolVersion() == ProtocolVersion::AGX_V2) {
|
||||
bunker->EnableCommandedMode();
|
||||
std::cout << "Protocol version 2" << std::endl;
|
||||
} else {
|
||||
|
||||
@@ -49,7 +49,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
hunter->Connect(device_name);
|
||||
|
||||
if (hunter->GetProtocolVersion() == ProtocolVersion::AGX_V2) {
|
||||
if (hunter->GetParserProtocolVersion() == ProtocolVersion::AGX_V2) {
|
||||
hunter->EnableCommandedMode();
|
||||
std::cout << "Protocol version 2" << std::endl;
|
||||
} else {
|
||||
@@ -78,7 +78,7 @@ int main(int argc, char **argv) {
|
||||
<< state.motion_state.angular_velocity << std::endl;
|
||||
|
||||
auto actuator = hunter->GetActuatorState();
|
||||
if (hunter->GetProtocolVersion() == ProtocolVersion::AGX_V1) {
|
||||
if (hunter->GetParserProtocolVersion() == ProtocolVersion::AGX_V1) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
printf("motor %d: current %f, rpm %d, driver temp %f, motor temp %f\n",
|
||||
actuator.actuator_state[i].motor_id,
|
||||
|
||||
@@ -49,7 +49,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
scout->Connect(device_name);
|
||||
|
||||
if (scout->GetProtocolVersion() == ProtocolVersion::AGX_V2) {
|
||||
if (scout->GetParserProtocolVersion() == ProtocolVersion::AGX_V2) {
|
||||
scout->EnableCommandedMode();
|
||||
std::cout << "Protocol version 2" << std::endl;
|
||||
} else {
|
||||
@@ -95,7 +95,7 @@ int main(int argc, char **argv) {
|
||||
<< state.motion_state.angular_velocity << std::endl;
|
||||
|
||||
auto actuator = scout->GetActuatorState();
|
||||
if (scout->GetProtocolVersion() == ProtocolVersion::AGX_V1) {
|
||||
if (scout->GetParserProtocolVersion() == ProtocolVersion::AGX_V1) {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
printf("motor %d: current %f, rpm %d, driver temp %f, motor temp %f\n",
|
||||
actuator.actuator_state[i].motor_id,
|
||||
|
||||
@@ -26,7 +26,7 @@ struct can_frame {
|
||||
|
||||
#include "ugv_sdk/details/interface/agilex_message.h"
|
||||
|
||||
enum class ProtocolVersion { AGX_V1, AGX_V2 };
|
||||
enum class ProtocolVersion { UNKONWN, AGX_V1, AGX_V2 };
|
||||
|
||||
template <ProtocolVersion VersionNumber = ProtocolVersion::AGX_V2>
|
||||
class ParserInterface {
|
||||
@@ -54,7 +54,7 @@ class ParserInterface {
|
||||
return 0;
|
||||
};
|
||||
|
||||
ProtocolVersion GetProtocolVersion() { return VersionNumber; }
|
||||
ProtocolVersion GetParserProtocolVersion() { return VersionNumber; }
|
||||
};
|
||||
|
||||
#endif /* PASER_INTERFACE_HPP */
|
||||
|
||||
@@ -50,7 +50,7 @@ class RobotCommonInterface {
|
||||
// do nothing if no light on robot
|
||||
}
|
||||
|
||||
virtual ProtocolVersion GetProtocolVersion() = 0;
|
||||
virtual ProtocolVersion GetParserProtocolVersion() = 0;
|
||||
|
||||
protected:
|
||||
/****** functions not available/valid to all robots ******/
|
||||
|
||||
@@ -60,7 +60,7 @@ class AgilexBase : public RobotCommonInterface {
|
||||
if (can_connected_) {
|
||||
// motion control message
|
||||
AgxMessage msg;
|
||||
if (parser_.GetProtocolVersion() == ProtocolVersion::AGX_V1) {
|
||||
if (parser_.GetParserProtocolVersion() == ProtocolVersion::AGX_V1) {
|
||||
msg.type = AgxMsgMotionCommandV1;
|
||||
msg.body.v1_motion_command_msg.control_mode = CONTROL_MODE_CAN;
|
||||
msg.body.v1_motion_command_msg.clear_all_error = false;
|
||||
@@ -70,7 +70,8 @@ class AgilexBase : public RobotCommonInterface {
|
||||
std::abs(angular_vel) > std::abs(steering_angle) ? angular_vel
|
||||
: steering_angle;
|
||||
msg.body.v1_motion_command_msg.lateral = lateral_velocity;
|
||||
} else if (parser_.GetProtocolVersion() == ProtocolVersion::AGX_V2) {
|
||||
} else if (parser_.GetParserProtocolVersion() ==
|
||||
ProtocolVersion::AGX_V2) {
|
||||
msg.type = AgxMsgMotionCommand;
|
||||
msg.body.motion_command_msg.linear_velocity = linear_vel;
|
||||
msg.body.motion_command_msg.angular_velocity = angular_vel;
|
||||
@@ -133,8 +134,8 @@ class AgilexBase : public RobotCommonInterface {
|
||||
|
||||
void ResetRobotState() override {}
|
||||
|
||||
ProtocolVersion GetProtocolVersion() override {
|
||||
return parser_.GetProtocolVersion();
|
||||
ProtocolVersion GetParserProtocolVersion() override {
|
||||
return parser_.GetParserProtocolVersion();
|
||||
}
|
||||
|
||||
CoreStateMsgGroup GetRobotCoreStateMsgGroup() override {
|
||||
|
||||
@@ -29,7 +29,7 @@ class BunkerRobot : public RobotCommonInterface, public BunkerInterface {
|
||||
|
||||
void ResetRobotState() override;
|
||||
|
||||
ProtocolVersion GetProtocolVersion() override;
|
||||
ProtocolVersion GetParserProtocolVersion() override;
|
||||
|
||||
// get robot state
|
||||
BunkerCoreState GetRobotState() override;
|
||||
|
||||
@@ -29,7 +29,7 @@ class HunterRobot : public RobotCommonInterface, public HunterInterface {
|
||||
|
||||
void ResetRobotState() override;
|
||||
|
||||
ProtocolVersion GetProtocolVersion() override;
|
||||
ProtocolVersion GetParserProtocolVersion() override;
|
||||
|
||||
// get robot state
|
||||
HunterCoreState GetRobotState() override;
|
||||
|
||||
@@ -34,7 +34,7 @@ class ScoutRobot : public RobotCommonInterface, public ScoutInterface {
|
||||
|
||||
void ResetRobotState() override;
|
||||
|
||||
ProtocolVersion GetProtocolVersion() override;
|
||||
ProtocolVersion GetParserProtocolVersion() override;
|
||||
|
||||
// get robot state
|
||||
ScoutCoreState GetRobotState() override;
|
||||
|
||||
@@ -29,8 +29,8 @@ void BunkerRobot::Connect(std::string can_name) { robot_->Connect(can_name); }
|
||||
|
||||
void BunkerRobot::ResetRobotState() { robot_->ResetRobotState(); }
|
||||
|
||||
ProtocolVersion BunkerRobot::GetProtocolVersion() {
|
||||
return robot_->GetProtocolVersion();
|
||||
ProtocolVersion BunkerRobot::GetParserProtocolVersion() {
|
||||
return robot_->GetParserProtocolVersion();
|
||||
}
|
||||
|
||||
void BunkerRobot::SetMotionCommand(double linear_vel, double angular_vel) {
|
||||
|
||||
@@ -29,8 +29,8 @@ void HunterRobot::Connect(std::string can_name) { robot_->Connect(can_name); }
|
||||
|
||||
void HunterRobot::ResetRobotState() { robot_->ResetRobotState(); }
|
||||
|
||||
ProtocolVersion HunterRobot::GetProtocolVersion() {
|
||||
return robot_->GetProtocolVersion();
|
||||
ProtocolVersion HunterRobot::GetParserProtocolVersion() {
|
||||
return robot_->GetParserProtocolVersion();
|
||||
}
|
||||
|
||||
void HunterRobot::SetMotionCommand(double linear_vel, double angular_vel) {
|
||||
|
||||
@@ -41,8 +41,8 @@ void ScoutRobot::Connect(std::string uart_name, uint32_t baudrate) {
|
||||
|
||||
void ScoutRobot::ResetRobotState() { robot_->ResetRobotState(); }
|
||||
|
||||
ProtocolVersion ScoutRobot::GetProtocolVersion() {
|
||||
return robot_->GetProtocolVersion();
|
||||
ProtocolVersion ScoutRobot::GetParserProtocolVersion() {
|
||||
return robot_->GetParserProtocolVersion();
|
||||
}
|
||||
|
||||
void ScoutRobot::SetMotionCommand(double linear_vel, double angular_vel) {
|
||||
|
||||
Reference in New Issue
Block a user