本文整理汇总了C++中ArSick::getDegreesChoicesString方法的典型用法代码示例。如果您正苦于以下问题:C++ ArSick::getDegreesChoicesString方法的具体用法?C++ ArSick::getDegreesChoicesString怎么用?C++ ArSick::getDegreesChoicesString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArSick
的用法示例。
在下文中一共展示了ArSick::getDegreesChoicesString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
Aria::init();
ArArgumentParser argParser(&argc, argv);
argParser.loadDefaultArguments();
ArRobot robot;
ArSick laser;
std::ofstream stream; // for loggin
time_t timer;
char buffer[120];
//for loggin
ArRobotConnector robotConnector(&argParser, &robot);
ArLaserConnector laserConnector(&argParser, &robot, &robotConnector);
int32_t count = 0;
readyLog(stream);
if (!robotConnector.connectRobot())
{
ArLog::log(ArLog::Terse, "Could not connect to the robot.");
if (argParser.checkHelpAndWarnUnparsed())
{
// -help not given, just exit.
Aria::logOptions();
Aria::exit(1);
return 1;
}
}
// Trigger argument parsing
if (!Aria::parseArgs() || !argParser.checkHelpAndWarnUnparsed())
{
Aria::logOptions();
Aria::exit(1);
return 1;
}
ArKeyHandler keyHandler;
Aria::setKeyHandler(&keyHandler);
robot.attachKeyHandler(&keyHandler);
puts("This program will make the robot wander around. It uses some avoidance\n"
"actions if obstacles are detected, otherwise it just has a\n"
"constant forward velocity.\n\nPress CTRL-C or Escape to exit.");
//ArSonarDevice sonar;
//robot.addRangeDevice(&sonar);
robot.addRangeDevice(&laser);
robot.runAsync(true);
// try to connect to laser. if fail, warn but continue, using sonar only
if (!laserConnector.connectLasers())
{
ArLog::log(ArLog::Normal, "Warning: unable to connect to requested lasers, will wander using robot sonar only.");
}
double sampleAngle, dist;
auto sampleRange = laser.currentReadingPolar(-20, 20, &sampleAngle);
auto degreeStr = laser.getDegreesChoicesString();
std::cout << "auto sampleRange = laser.currentReadingPolar(-20, 20, &sampleAngle);" << sampleRange << std::endl;
std::cout << "auto degreeStr = laser.getDegreesChoicesString(); : " << degreeStr << std::endl;
// turn on the motors, turn off amigobot sounds
robot.enableMotors();
//robot.getLaserMap()
robot.comInt(ArCommands::SOUNDTOG, 0);
// add a set of actions that combine together to effect the wander behavior
ArActionStallRecover recover;
ArActionBumpers bumpers;
ArActionAvoidFront avoidFrontNear("Avoid Front Near", 100, 0);
ArActionAvoidFront avoidFrontFar;
ArActionConstantVelocity constantVelocity("Constant Velocity", 400);
robot.addAction(&recover, 100);
robot.addAction(&bumpers, 75);
robot.addAction(&avoidFrontNear, 50);
robot.addAction(&avoidFrontFar, 49);
robot.addAction(&constantVelocity, 25);
stream << "IMPORTANT !! == robot.getRobotRadius() : " << robot.getRobotRadius << std::endl;
std::string timestamp;
while (1)
{
//
//
time(&timer);
strftime(buffer, 80, " - timestamp : %I:%M:%S", localtime(&timer));
timestamp = buffer;
dist = robot.checkRangeDevicesCurrentPolar(-70, 70, &sampleAngle) - robot.getRobotRadius();
stream << count << timestamp << "checkRangeDevicesCurrentPolar(-70, 70, &angle) : " << dist << std::endl;
Sleep(500);
count++;
}
//.........这里部分代码省略.........