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


visp_ros
Author(s): Francois Pasteau, Fabien Spindler, Gatien Gaumerais, Alexander Oliva
autogenerated on Wed Mar 2 2022 01:13:33