mirror of
https://github.com/westonrobot/ugv_sdk
synced 2023-04-08 06:32:14 +08:00
add tracer_robot
This commit is contained in:
@@ -88,6 +88,7 @@ add_library(${PROJECT_NAME}
|
||||
########################
|
||||
## public interface to access robot
|
||||
src/mobile_robot/scout_robot.cpp
|
||||
src/mobile_robot/tracer_robot.cpp
|
||||
########################
|
||||
## protocol v2 support
|
||||
src/protocol_v2/agilex_msg_parser_v2.c
|
||||
|
||||
48
include/ugv_sdk/mobile_robot/tracer_robot.hpp
Normal file
48
include/ugv_sdk/mobile_robot/tracer_robot.hpp
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* tracer_robot.hpp
|
||||
*
|
||||
* Created on: Jul 13, 2021 21:59
|
||||
* Description:
|
||||
*
|
||||
* Copyright (c) 2021 Weston Robot Pte. Ltd.
|
||||
*/
|
||||
|
||||
#ifndef TRACER_ROBOT_HPP
|
||||
#define TRACER_ROBOT_HPP
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "ugv_sdk/details/interface/robot_interface.hpp"
|
||||
#include "ugv_sdk/details/interface/tracer_interface.hpp"
|
||||
|
||||
// #include "ugv_sdk/details/robot_base/tracer_base.hpp"
|
||||
|
||||
namespace westonrobot {
|
||||
// using TracerRobot = TracerBaseV2();
|
||||
class TracerRobot : public RobotInterface, public TracerInterface {
|
||||
public:
|
||||
TracerRobot();
|
||||
~TracerRobot();
|
||||
|
||||
void Connect(std::string can_name) override;
|
||||
void Connect(std::string uart_name, uint32_t baudrate) override;
|
||||
|
||||
void EnableCommandedMode() override;
|
||||
|
||||
void SetMotionCommand(double linear_vel, double angular_vel) override;
|
||||
void SetLightCommand(LightMode f_mode, uint8_t f_value) override;
|
||||
void DisableLightControl() override;
|
||||
|
||||
void ResetRobotState() override;
|
||||
|
||||
ProtocolVersion GetProtocolVersion() override;
|
||||
|
||||
// get robot state
|
||||
TracerState GetRobotState() override;
|
||||
|
||||
private:
|
||||
RobotInterface* robot_;
|
||||
};
|
||||
} // namespace westonrobot
|
||||
|
||||
#endif /* TRACER_ROBOT_HPP */
|
||||
52
src/mobile_robot/tracer_robot.cpp
Normal file
52
src/mobile_robot/tracer_robot.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* tracer_robot.cpp
|
||||
*
|
||||
* Created on: Jul 13, 2021 22:13
|
||||
* Description:
|
||||
*
|
||||
* Copyright (c) 2021 Weston Robot Pte. Ltd.
|
||||
*/
|
||||
|
||||
#include "ugv_sdk/mobile_robot/tracer_robot.hpp"
|
||||
#include "ugv_sdk/details/robot_base/tracer_base.hpp"
|
||||
|
||||
namespace westonrobot {
|
||||
TracerRobot::TracerRobot() {
|
||||
robot_ = new TracerBaseV2();
|
||||
}
|
||||
|
||||
TracerRobot::~TracerRobot() {
|
||||
if (robot_) delete robot_;
|
||||
}
|
||||
|
||||
void TracerRobot::EnableCommandedMode() { robot_->EnableCommandedMode(); }
|
||||
|
||||
void TracerRobot::Connect(std::string can_name) { robot_->Connect(can_name); }
|
||||
|
||||
void TracerRobot::Connect(std::string uart_name, uint32_t baudrate) {
|
||||
robot_->Connect(uart_name, baudrate);
|
||||
}
|
||||
|
||||
void TracerRobot::ResetRobotState() { robot_->ResetRobotState(); }
|
||||
|
||||
ProtocolVersion TracerRobot::GetProtocolVersion() {
|
||||
return robot_->GetProtocolVersion();
|
||||
}
|
||||
|
||||
void TracerRobot::SetMotionCommand(double linear_vel, double angular_vel) {
|
||||
auto tracer = dynamic_cast<TracerInterface*>(robot_);
|
||||
tracer->SetMotionCommand(linear_vel, angular_vel);
|
||||
}
|
||||
|
||||
void TracerRobot::DisableLightControl() { robot_->DisableLightControl(); }
|
||||
|
||||
void TracerRobot::SetLightCommand(LightMode f_mode, uint8_t f_value) {
|
||||
auto tracer = dynamic_cast<TracerInterface*>(robot_);
|
||||
tracer->SetLightCommand(f_mode, f_value);
|
||||
}
|
||||
|
||||
TracerState TracerRobot::GetRobotState() {
|
||||
auto tracer = dynamic_cast<TracerInterface*>(robot_);
|
||||
return tracer->GetRobotState();
|
||||
}
|
||||
} // namespace westonrobot
|
||||
Reference in New Issue
Block a user