41 #include <visp3/core/vpConfig.h>
42 #include <visp3/core/vpTime.h>
43 #include <visp3/robot/vpRobotPioneer.h>
45 #ifndef VISP_HAVE_PIONEER
48 std::cout <<
"\nThis example requires Aria 3rd party library. You should "
68 int main(
int argc,
char **argv)
71 std::cout <<
"\nWARNING: this program does no sensing or avoiding of "
73 "the robot WILL collide with any objects in the way! Make sure "
75 "robot has approximately 3 meters of free space on all sides.\n"
80 ArArgumentParser parser(&argc, argv);
81 parser.loadDefaultArguments();
85 ArRobotConnector robotConnector(&parser, &robot);
86 if (!robotConnector.connectRobot()) {
87 ArLog::log(ArLog::Terse,
"Could not connect to the robot.");
88 if (parser.checkHelpAndWarnUnparsed()) {
93 if (!Aria::parseArgs()) {
99 std::cout <<
"Robot connected" << std::endl;
100 robot.useSonar(
false);
105 for (
int i = 0; i < 100; i++) {
114 std::cout <<
"Trans. vel= " << v_mes[0] <<
" m/s, Rot. vel=" <<
vpMath::deg(v_mes[1]) <<
" deg/s" << std::endl;
116 std::cout <<
"Left wheel vel= " << v_mes[0] <<
" m/s, Right wheel vel=" << v_mes[1] <<
" m/s" << std::endl;
117 std::cout <<
"Battery=" << robot.getBatteryVoltage() << std::endl;
122 ArLog::log(ArLog::Normal,
"simpleMotionCommands: Stopping.");
129 ArLog::log(ArLog::Normal,
130 "simpleMotionCommands: Pose=(%.2f,%.2f,%.2f), Trans. "
131 "Vel=%.2f, Rot. Vel=%.2f, Battery=%.2fV",
132 robot.getX(), robot.getY(), robot.getTh(), robot.getVel(), robot.getRotVel(), robot.getBatteryVoltage());
135 std::cout <<
"Ending robot thread..." << std::endl;
139 robot.waitForRunExit();
142 ArLog::log(ArLog::Normal,
"simpleMotionCommands: Exiting.");
145 std::cout <<
"Catch an exception: " << e << std::endl;