added scout mini omni support, updated scout related demo

This commit is contained in:
Ruixiang Du
2021-07-16 14:15:12 +08:00
parent 58314696a9
commit 2a94b95f4a
10 changed files with 255 additions and 17 deletions

View File

@@ -19,17 +19,34 @@ using namespace westonrobot;
int main(int argc, char **argv) {
std::string device_name;
std::string robot_subtype;
if (argc == 2) {
device_name = {argv[1]};
std::cout << "Selected interface " << device_name << std::endl;
std::cout << "Selected interface " << device_name << ", robot type: scout"
<< std::endl;
} else if (argc == 3) {
robot_subtype = {argv[1]};
device_name = {argv[2]};
std::cout << "Selected interface " << device_name
<< ", robot type: " << robot_subtype << std::endl;
} else {
std::cout << "Usage: app_scout_demo <protocol-version> <interface>"
std::cout << "Usage: demo_scout_robot [<robot-subtype>] <interface>"
<< std::endl
<< "Example 1: ./app_scout_demo can0" << std::endl;
<< "Example 1: ./demo_scout_robot can0" << std::endl
<< "\t <robot-subtype>: mini" << std::endl;
return -1;
}
bool is_scout_mini = false;
if (robot_subtype == "mini") {
is_scout_mini = true;
} else if (!robot_subtype.empty() && robot_subtype != "scout") {
std::cout
<< "Unkonwn robot subtype. Supported subtypes: \"scout\" or \"mini\""
<< std::endl;
}
std::unique_ptr<ScoutRobot> scout;
ProtocolDectctor detector;
@@ -38,11 +55,11 @@ int main(int argc, char **argv) {
if (proto == ProtocolVersion::AGX_V1) {
std::cout << "Detected protocol: AGX_V1" << std::endl;
scout = std::unique_ptr<ScoutRobot>(
new ScoutRobot(ProtocolVersion::AGX_V1, true));
new ScoutRobot(ProtocolVersion::AGX_V1, is_scout_mini));
} else if (proto == ProtocolVersion::AGX_V2) {
std::cout << "Detected protocol: AGX_V2" << std::endl;
scout = std::unique_ptr<ScoutRobot>(
new ScoutRobot(ProtocolVersion::AGX_V2, true));
new ScoutRobot(ProtocolVersion::AGX_V2, is_scout_mini));
} else {
std::cout << "Detected protocol: UNKONWN" << std::endl;
return -1;