40 #include <visp3/core/vpConfig.h>
41 #include <visp3/core/vpTime.h>
42 #include <visp3/robot/vpRobotPioneer.h>
44 #ifndef VISP_HAVE_PIONEER
47 std::cout <<
"\nThis example requires Aria 3rd party library. You should install it.\n"
66 int main(
int argc,
char **argv)
69 std::cout <<
"\nWARNING: this program does no sensing or avoiding of obstacles, \n"
70 "the robot WILL collide with any objects in the way! Make sure the \n"
71 "robot has approximately 3 meters of free space on all sides.\n"
76 ArArgumentParser parser(&argc, argv);
77 parser.loadDefaultArguments();
81 ArRobotConnector robotConnector(&parser, &robot);
82 if(!robotConnector.connectRobot())
84 ArLog::log(ArLog::Terse,
"Could not connect to the robot.");
85 if(parser.checkHelpAndWarnUnparsed())
91 if (!Aria::parseArgs())
98 std::cout <<
"Robot connected" << std::endl;
104 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,
"simpleMotionCommands: Pose=(%.2f,%.2f,%.2f), Trans. Vel=%.2f, Rot. Vel=%.2f, Battery=%.2fV",
130 robot.getX(), robot.getY(), robot.getTh(), robot.getVel(), robot.getRotVel(), robot.getBatteryVoltage());
133 std::cout <<
"Ending robot thread..." << std::endl;
137 robot.waitForRunExit();
140 ArLog::log(ArLog::Normal,
"simpleMotionCommands: Exiting.");
144 std::cout <<
"Catch an exception: " << e << std::endl;
VISP_EXPORT int wait(double t0, double t)
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.
VISP_EXPORT double measureTimeMs()
static double deg(double rad)
Implementation of column vector and the associated operations.
void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &velocity)