44 #include <visp/vpConfig.h>
45 #include <visp/vpTime.h>
46 #include <visp/vpRobotPioneer.h>
48 #ifndef VISP_HAVE_PIONEER
51 std::cout <<
"\nThis example requires Aria 3rd party library. You should install it.\n"
70 int main(
int argc,
char **argv)
73 std::cout <<
"\nWARNING: this program does no sensing or avoiding of obstacles, \n"
74 "the robot WILL collide with any objects in the way! Make sure the \n"
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())
88 ArLog::log(ArLog::Terse,
"Could not connect to the robot.");
89 if(parser.checkHelpAndWarnUnparsed())
95 if (!Aria::parseArgs())
102 std::cout <<
"Robot connected" << std::endl;
108 for (
int i=0; i < 100; i++)
118 std::cout <<
"Trans. vel= " << v_mes[0] <<
" m/s, Rot. vel=" <<
vpMath::deg(v_mes[1]) <<
" deg/s" << std::endl;
120 std::cout <<
"Left wheel vel= " << v_mes[0] <<
" m/s, Right wheel vel=" << v_mes[1] <<
" m/s" << std::endl;
121 std::cout <<
"Battery=" << robot.getBatteryVoltage() << std::endl;
126 ArLog::log(ArLog::Normal,
"simpleMotionCommands: Stopping.");
133 ArLog::log(ArLog::Normal,
"simpleMotionCommands: Pose=(%.2f,%.2f,%.2f), Trans. Vel=%.2f, Rot. Vel=%.2f, Battery=%.2fV",
134 robot.getX(), robot.getY(), robot.getTh(), robot.getVel(), robot.getRotVel(), robot.getBatteryVoltage());
137 std::cout <<
"Ending robot thread..." << std::endl;
141 robot.waitForRunExit();
144 ArLog::log(ArLog::Normal,
"simpleMotionCommands: Exiting.");
148 std::cout <<
"Catch an exception: " << e << std::endl;
void useSonar(bool usage)
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)
error that can be emited by ViSP classes.
Interface for Pioneer mobile robots based on Aria 3rd party library.
static double measureTimeMs()
static int wait(double t0, double t)
static double deg(double rad)
Class that provides a data structure for the column vectors as well as a set of operations on these v...
void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &velocity)