tutorial-ros-pioneer.cpp
Go to the documentation of this file.
1 
11 #include <iostream>
12 
13 #include <visp/vpTime.h>
15 
16 int main(int argc, char **argv)
17 {
18  try {
19  std::cout << "\nWARNING: this program does no sensing or avoiding of obstacles, \n"
20  "the robot WILL collide with any objects in the way! Make sure the \n"
21  "robot has approximately 3 meters of free space on all sides.\n"
22  << std::endl;
23 
24  vpROSRobotPioneer robot;
25 
26  robot.setCmdVelTopic("/RosAria/cmd_vel");
27  robot.init();
28  vpColVector v(2), v_mes(2);
29 
30  for (int i=0; i < 100; i++)
31  {
32  double t = vpTime::measureTimeMs();
33 
34  v = 0;
35  v[0] = 0.01; // Translational velocity in m/s
36  //v[1] = vpMath::rad(2); // Rotational velocity in rad/sec
37  robot.setVelocity(vpRobot::REFERENCE_FRAME, v);
38 
39  vpTime::wait(t, 40);
40  }
41 
42  return 0;
43  }
44  catch(vpException e) {
45  std::cout << "Catch an exception: " << e << std::endl;
46  return 1;
47  }
48 }
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)
void setCmdVelTopic(std::string topic_name)
Definition: vpROSRobot.cpp:285
void init()
basic initialization
int main(int argc, char **argv)
Interface for Pioneer mobile robots based on ROS.


visp_ros
Author(s): Francois Pasteau, Fabien Spindler, Gatien Gaumerais
autogenerated on Tue Feb 9 2021 03:40:20