Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
tutorial-pioneer-robot.cpp
1
2#include <iostream>
3#include <visp3/core/vpConfig.h>
4#include <visp3/robot/vpRobotPioneer.h>
5
6int 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
34 robot.setVelocity(vpRobot::REFERENCE_FRAME, v);
35
36 vpTime::wait(1000);
37 vpColVector v_mes = robot.getVelocity(vpRobot::REFERENCE_FRAME);
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.
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)
@ REFERENCE_FRAME
Definition vpRobot.h:75
VISP_EXPORT int wait(double t0, double t)