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