Visual Servoing Platform  version 3.5.0 under development (2022-02-15)
tutorial-pioneer-robot.cpp
1 
2 #include <iostream>
3 #include <visp3/robot/vpRobotPioneer.h>
4 
5 int main()
6 {
7 #ifdef VISP_HAVE_PIONEER
8  try {
9  ArArgumentBuilder args;
10  args.add("-rp");
11 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX
12  args.add("/dev/ttyUSB0");
13 #else
14  args.add("COM3");
15 #endif
16 
17  ArSimpleConnector conn(&args);
18 
19  vpRobotPioneer robot;
20 
21  if (!conn.connectRobot(&robot))
22  return -1;
23 
24  robot.useSonar(false);
25  vpTime::wait(2000);
26 
27  vpColVector v(2);
28  v = 0;
29  v[0] = 0.10; // Translational velocity in m/s
31 
32  vpTime::wait(1000);
34  std::cout << "Measured vel: " << v_mes.t() << std::endl;
35  vpTime::wait(1000);
36 
37  robot.stopRunning();
38  robot.waitForRunExit();
39  } catch (const vpException &e) {
40  std::cout << "Catch an exception: " << e << std::endl;
41  }
42 #endif
43 }
VISP_EXPORT int wait(double t0, double t)
Definition: vpTime.cpp:173
void useSonar(bool usage)
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)
error that can be emited by ViSP classes.
Definition: vpException.h:71
Interface for Pioneer mobile robots based on Aria 3rd party library.
vpRowVector t() const
Implementation of column vector and the associated operations.
Definition: vpColVector.h:130
void getVelocity(const vpRobot::vpControlFrameType frame, vpColVector &velocity)