mirror of
https://github.com/westonrobot/ugv_sdk
synced 2023-04-08 06:32:14 +08:00
demo_scout_robot runs
This commit is contained in:
53
src/mobile_robot/scout_robot.cpp
Normal file
53
src/mobile_robot/scout_robot.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* scout_robot.cpp
|
||||
*
|
||||
* Created on: Jul 08, 2021 11:13
|
||||
* Description:
|
||||
*
|
||||
* Copyright (c) 2021 Weston Robot Pte. Ltd.
|
||||
*/
|
||||
|
||||
#include "ugv_sdk/mobile_robot/scout_robot.hpp"
|
||||
#include "ugv_sdk/details/robot_base/scout_base.hpp"
|
||||
|
||||
namespace westonrobot {
|
||||
ScoutRobot::ScoutRobot(ProtocolType protocol) {
|
||||
if (protocol == ProtocolType::AGX_V1) {
|
||||
robot_ = new ScoutBaseV1();
|
||||
} else if (protocol == ProtocolType::AGX_V2) {
|
||||
robot_ = new ScoutBaseV2();
|
||||
}
|
||||
}
|
||||
|
||||
ScoutRobot::~ScoutRobot() {
|
||||
if (robot_) delete robot_;
|
||||
}
|
||||
|
||||
void ScoutRobot::EnableCommandedMode() { robot_->EnableCommandedMode(); }
|
||||
|
||||
void ScoutRobot::Connect(std::string can_name) { robot_->Connect(can_name); }
|
||||
|
||||
void ScoutRobot::Connect(std::string uart_name, uint32_t baudrate) {
|
||||
robot_->Connect(uart_name, baudrate);
|
||||
}
|
||||
|
||||
void ScoutRobot::ResetRobotState() { robot_->ResetRobotState(); }
|
||||
|
||||
void ScoutRobot::SetMotionCommand(double linear_vel, double angular_vel) {
|
||||
auto scout = dynamic_cast<ScoutInterface*>(robot_);
|
||||
scout->SetMotionCommand(linear_vel, angular_vel);
|
||||
}
|
||||
|
||||
void ScoutRobot::DisableLightControl() { robot_->DisableLightControl(); }
|
||||
|
||||
void ScoutRobot::SetLightCommand(LightMode f_mode, uint8_t f_value,
|
||||
LightMode r_mode, uint8_t r_value) {
|
||||
auto scout = dynamic_cast<ScoutInterface*>(robot_);
|
||||
scout->SetLightCommand(f_mode, f_value, r_mode, r_value);
|
||||
}
|
||||
|
||||
ScoutState ScoutRobot::GetRobotState() {
|
||||
auto scout = dynamic_cast<ScoutInterface*>(robot_);
|
||||
return scout->GetRobotState();
|
||||
}
|
||||
} // namespace westonrobot
|
||||
Reference in New Issue
Block a user