mirror of
https://github.com/westonrobot/ugv_sdk
synced 2023-04-08 06:32:14 +08:00
scout mini works
This commit is contained in:
@@ -34,11 +34,11 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
std::unique_ptr<ScoutRobot> scout;
|
std::unique_ptr<ScoutRobot> scout;
|
||||||
if (protocol_version == "v1") {
|
if (protocol_version == "v1") {
|
||||||
scout =
|
scout = std::unique_ptr<ScoutRobot>(
|
||||||
std::unique_ptr<ScoutRobot>(new ScoutRobot(ProtocolVersion::AGX_V1));
|
new ScoutRobot(ProtocolVersion::AGX_V1, true));
|
||||||
} else if (protocol_version == "v2") {
|
} else if (protocol_version == "v2") {
|
||||||
scout =
|
scout = std::unique_ptr<ScoutRobot>(
|
||||||
std::unique_ptr<ScoutRobot>(new ScoutRobot(ProtocolVersion::AGX_V2));
|
new ScoutRobot(ProtocolVersion::AGX_V2, true));
|
||||||
} else {
|
} else {
|
||||||
std::cout << "Error: invalid protocol version string" << std::endl;
|
std::cout << "Error: invalid protocol version string" << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
@@ -66,19 +66,18 @@ int main(int argc, char **argv) {
|
|||||||
std::cout << "Light: breath" << std::endl;
|
std::cout << "Light: breath" << std::endl;
|
||||||
scout->SetLightCommand(BREATH, 0, BREATH, 0);
|
scout->SetLightCommand(BREATH, 0, BREATH, 0);
|
||||||
sleep(3);
|
sleep(3);
|
||||||
std::cout << "Light: custom 90-80" << std::endl;
|
std::cout << "Light: custom 30-80" << std::endl;
|
||||||
scout->SetLightCommand(CUSTOM, 90, CUSTOM, 80);
|
scout->SetLightCommand(CUSTOM, 30, CUSTOM, 80);
|
||||||
sleep(3);
|
sleep(3);
|
||||||
std::cout << "Light: diabled cmd control" << std::endl;
|
// std::cout << "Light: diabled cmd control" << std::endl;
|
||||||
scout->DisableLightControl();
|
// scout->DisableLightControl();
|
||||||
|
scout->SetLightCommand(CONST_OFF, 0, CONST_OFF, 0);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
// motion control
|
// motion control
|
||||||
// if (count < 100) {
|
std::cout << "Motor: 1.0, 0" << std::endl;
|
||||||
std::cout << "Motor: 0.2, 0" << std::endl;
|
scout->SetMotionCommand(1.0, 0.0);
|
||||||
scout->SetMotionCommand(0.2, 0.0);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// get robot state
|
// get robot state
|
||||||
auto state = scout->GetRobotState();
|
auto state = scout->GetRobotState();
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class ProtocolV1Parser : public ParserInterface<ProtocolVersion::AGX_V1> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
using ScoutProtocolV1Parser = ProtocolV1Parser<ScoutV2Limits>;
|
using ScoutProtocolV1Parser = ProtocolV1Parser<ScoutV2Limits>;
|
||||||
using ScoutMiniProtocolV1Parser = ProtocolV1Parser<ScoutV2Limits>;
|
using ScoutMiniProtocolV1Parser = ProtocolV1Parser<ScoutMiniLimits>;
|
||||||
|
|
||||||
using HunterProtocolV1Parser = ProtocolV1Parser<HunterV1Limits>;
|
using HunterProtocolV1Parser = ProtocolV1Parser<HunterV1Limits>;
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,10 @@ class ScoutBase : public AgilexBase<Parser>, public ScoutInterface {
|
|||||||
|
|
||||||
namespace westonrobot {
|
namespace westonrobot {
|
||||||
using ScoutBaseV1 = ScoutBase<ScoutProtocolV1Parser>;
|
using ScoutBaseV1 = ScoutBase<ScoutProtocolV1Parser>;
|
||||||
|
using ScoutMiniBaseV1 = ScoutBase<ScoutMiniProtocolV1Parser>;
|
||||||
|
|
||||||
using ScoutBaseV2 = ScoutBase<ProtocolV2Parser>;
|
using ScoutBaseV2 = ScoutBase<ProtocolV2Parser>;
|
||||||
|
using ScoutMiniBaseV2 = ScoutBase<ProtocolV2Parser>;
|
||||||
} // namespace westonrobot
|
} // namespace westonrobot
|
||||||
|
|
||||||
#endif /* SCOUT_BASE_HPP */
|
#endif /* SCOUT_BASE_HPP */
|
||||||
|
|||||||
@@ -18,7 +18,8 @@
|
|||||||
namespace westonrobot {
|
namespace westonrobot {
|
||||||
class ScoutRobot : public RobotInterface, public ScoutInterface {
|
class ScoutRobot : public RobotInterface, public ScoutInterface {
|
||||||
public:
|
public:
|
||||||
ScoutRobot(ProtocolVersion protocol = ProtocolVersion::AGX_V2);
|
ScoutRobot(ProtocolVersion protocol = ProtocolVersion::AGX_V2,
|
||||||
|
bool is_mini_model = false);
|
||||||
~ScoutRobot();
|
~ScoutRobot();
|
||||||
|
|
||||||
void Connect(std::string can_name) override;
|
void Connect(std::string can_name) override;
|
||||||
|
|||||||
@@ -11,11 +11,19 @@
|
|||||||
#include "ugv_sdk/details/robot_base/scout_base.hpp"
|
#include "ugv_sdk/details/robot_base/scout_base.hpp"
|
||||||
|
|
||||||
namespace westonrobot {
|
namespace westonrobot {
|
||||||
ScoutRobot::ScoutRobot(ProtocolVersion protocol) {
|
ScoutRobot::ScoutRobot(ProtocolVersion protocol, bool is_mini_model) {
|
||||||
if (protocol == ProtocolVersion::AGX_V1) {
|
if (!is_mini_model) {
|
||||||
robot_ = new ScoutBaseV1();
|
if (protocol == ProtocolVersion::AGX_V1) {
|
||||||
} else if (protocol == ProtocolVersion::AGX_V2) {
|
robot_ = new ScoutBaseV1();
|
||||||
robot_ = new ScoutBaseV2();
|
} else if (protocol == ProtocolVersion::AGX_V2) {
|
||||||
|
robot_ = new ScoutBaseV2();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (protocol == ProtocolVersion::AGX_V1) {
|
||||||
|
robot_ = new ScoutMiniBaseV1();
|
||||||
|
} else if (protocol == ProtocolVersion::AGX_V2) {
|
||||||
|
robot_ = new ScoutMiniBaseV2();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user