Visual Servoing Platform
version 3.3.0
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
30
robot.
setVelocity
(
vpRobot::REFERENCE_FRAME
, v);
31
32
vpTime::wait
(1000);
33
vpColVector
v_mes = robot.getVelocity(
vpRobot::REFERENCE_FRAME
);
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
}
vpTime::wait
VISP_EXPORT int wait(double t0, double t)
Definition:
vpTime.cpp:172
vpColVector::t
vpRowVector t() const
Definition:
vpColVector.cpp:781
vpColVector
Implementation of column vector and the associated operations.
Definition:
vpColVector.h:129
vpRobot::REFERENCE_FRAME
Definition:
vpRobot.h:75
vpRobotPioneer
Interface for Pioneer mobile robots based on Aria 3rd party library.
Definition:
vpRobotPioneer.h:68
vpSimulatorCamera::setVelocity
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)
Definition:
vpSimulatorCamera.cpp:197
vpException
error that can be emited by ViSP classes.
Definition:
vpException.h:70
tutorial
robot
pioneer
tutorial-pioneer-robot.cpp
Generated by
1.8.16