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)
72 std::cout <<
"\nWARNING: this program does no sensing or avoiding of obstacles, \n"
73 "the robot WILL collide with any objects in the way! Make sure the \n"
74 "robot has approximately 3 meters of free space on all sides.\n"
79 ArArgumentParser parser(&argc, argv);
80 parser.loadDefaultArguments();
84 ArRobotConnector robotConnector(&parser, &robot);
85 if(!robotConnector.connectRobot())
87 ArLog::log(ArLog::Terse,
"Could not connect to the robot.");
88 if(parser.checkHelpAndWarnUnparsed())
94 if (!Aria::parseArgs())
101 std::cout <<
"Robot connected" << std::endl;
107 for (
int i=0; i < 100; i++)
117 std::cout <<
"Trans. vel= " << v_mes[0] <<
" m/s, Rot. vel=" <<
vpMath::deg(v_mes[1]) <<
" deg/s" << std::endl;
119 std::cout <<
"Left wheel vel= " << v_mes[0] <<
" m/s, Right wheel vel=" << v_mes[1] <<
" m/s" << std::endl;
120 std::cout <<
"Battery=" << robot.getBatteryVoltage() << std::endl;
125 ArLog::log(ArLog::Normal,
"simpleMotionCommands: Stopping.");
132 ArLog::log(ArLog::Normal,
"simpleMotionCommands: Pose=(%.2f,%.2f,%.2f), Trans. Vel=%.2f, Rot. Vel=%.2f, Battery=%.2fV",
133 robot.getX(), robot.getY(), robot.getTh(), robot.getVel(), robot.getRotVel(), robot.getBatteryVoltage());
136 std::cout <<
"Ending robot thread..." << std::endl;
140 robot.waitForRunExit();
143 ArLog::log(ArLog::Normal,
"simpleMotionCommands: Exiting.");
void useSonar(bool usage)
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)
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)