tutorial-ros-pioneer.cpp
Go to the documentation of this file.
00001 
00011 #include <iostream>
00012 
00013 #include <visp/vpTime.h>
00014 #include <visp_ros/vpROSRobotPioneer.h>
00015 
00016 int main(int argc, char **argv)
00017 {
00018   try {
00019     std::cout << "\nWARNING: this program does no sensing or avoiding of obstacles, \n"
00020                  "the robot WILL collide with any objects in the way! Make sure the \n"
00021                  "robot has approximately 3 meters of free space on all sides.\n"
00022               << std::endl;
00023 
00024     vpROSRobotPioneer robot;
00025 
00026     robot.setCmdVelTopic("/RosAria/cmd_vel");
00027     robot.init();
00028     vpColVector v(2), v_mes(2);
00029 
00030     for (int i=0; i < 100; i++)
00031     {
00032       double t = vpTime::measureTimeMs();
00033 
00034       v = 0;
00035       v[0] = 0.01; // Translational velocity in m/s
00036       //v[1] = vpMath::rad(2); // Rotational velocity in rad/sec
00037       robot.setVelocity(vpRobot::REFERENCE_FRAME, v);
00038 
00039       vpTime::wait(t, 40);
00040     }
00041 
00042    return 0;
00043   }
00044   catch(vpException e) {
00045     std::cout << "Catch an exception: " << e << std::endl;
00046     return 1;
00047   }
00048 }


visp_ros
Author(s): Francois Pasteau, Fabien Spindler
autogenerated on Thu Jun 6 2019 18:06:25