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