Skip to content

Commit e87b71c

Browse files
fixed tracer bug
1 parent b0b7499 commit e87b71c

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ add_library(${PROJECT_NAME}
101101
src/mobile_robot/bunker_robot.cpp
102102
src/mobile_robot/ranger_robot.cpp
103103
src/mobile_robot/titan_robot.cpp
104+
src/mobile_robot/tracer_robot.cpp
104105
########################
105106
## protocol v2 support
106107
src/protocol_v2/agilex_msg_parser_v2.c

include/ugv_sdk/details/robot_base/tracer_base.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,32 @@ template <typename ParserType>
2525
class TracerBase : public AgilexBase<ParserType>,
2626
public TracerInterface {
2727
public:
28-
TracerBase() : AgilexBase<ProtocolV2Parser>(){};
28+
TracerBase() : AgilexBase<ParserType>(){};
2929
~TracerBase() = default;
3030

3131
// set up connection
3232
bool Connect(std::string can_name) override {
33-
return AgilexBase<ProtocolV2Parser>::Connect(can_name);
33+
return AgilexBase<ParserType>::Connect(can_name);
3434
}
3535

3636
// robot control
3737
void SetMotionCommand(double linear_vel, double angular_vel) override {
38-
AgilexBase<ProtocolV2Parser>::SendMotionCommand(linear_vel, angular_vel,
38+
AgilexBase<ParserType>::SendMotionCommand(linear_vel, angular_vel,
3939
0.0, 0.0);
4040
}
4141

4242
void SetLightCommand(AgxLightMode f_mode, uint8_t f_value) override {
43-
AgilexBase<ProtocolV2Parser>::SendLightCommand(f_mode, f_value, CONST_OFF,
43+
AgilexBase<ParserType>::SendLightCommand(f_mode, f_value, CONST_OFF,
4444
0);
4545
}
4646

4747
void DisableLightControl() override {
48-
AgilexBase<ProtocolV2Parser>::DisableLightControl();
48+
AgilexBase<ParserType>::DisableLightControl();
4949
}
5050

5151
// get robot state
5252
TracerCoreState GetRobotState() override {
53-
auto state = AgilexBase<ProtocolV2Parser>::GetRobotCoreStateMsgGroup();
53+
auto state = AgilexBase<ParserType>::GetRobotCoreStateMsgGroup();
5454

5555
TracerCoreState tracer_state;
5656
tracer_state.time_stamp = state.time_stamp;
@@ -62,7 +62,7 @@ class TracerBase : public AgilexBase<ParserType>,
6262
}
6363

6464
TracerActuatorState GetActuatorState() override {
65-
auto actuator = AgilexBase<ProtocolV2Parser>::GetActuatorStateMsgGroup();
65+
auto actuator = AgilexBase<ParserType>::GetActuatorStateMsgGroup();
6666

6767
TracerActuatorState tracer_actuator;
6868
tracer_actuator.time_stamp = actuator.time_stamp;

include/ugv_sdk/mobile_robot/tracer_robot.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace westonrobot {
1919
class TracerRobot : public RobotCommonInterface, public TracerInterface {
2020
public:
2121
TracerRobot(ProtocolVersion protocol = ProtocolVersion::AGX_V2);
22-
virtual ~TracerRobot();
22+
~TracerRobot();
2323

2424
bool Connect(std::string can_name) override;
2525

src/mobile_robot/tracer_robot.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,16 @@ void TracerRobot::SetMotionCommand(double linear_vel, double angular_vel) {
4444
Tracer->SetMotionCommand(linear_vel, angular_vel);
4545
}
4646
void TracerRobot::SetLightCommand(AgxLightMode f_mode, uint8_t f_value) {
47-
auto scout = dynamic_cast<TracerInterface*>(robot_);
48-
scout->SetLightCommand(f_mode, f_value);
47+
auto Tracer = dynamic_cast<TracerInterface*>(robot_);
48+
Tracer->SetLightCommand(f_mode, f_value);
49+
}
50+
51+
void TracerRobot::DisableLightControl() {
52+
auto Tracer = dynamic_cast<TracerInterface*>(robot_);
53+
Tracer->DisableLightControl();
4954
}
5055

56+
5157
TracerCoreState TracerRobot::GetRobotState() {
5258
auto Tracer = dynamic_cast<TracerInterface*>(robot_);
5359
return Tracer->GetRobotState();

0 commit comments

Comments
 (0)