tutorial-ros-pioneer.cpp

example showing how to connect and send direct basic motion commands to a Pioneer mobile robot.

WARNING: this program does no sensing or avoiding of obstacles, the robot WILL collide with any objects in the way! Make sure the robot has about 2-3 meters of free space around it before starting the program.

#include <iostream>
#include <visp/vpTime.h>
int
main( int argc, char **argv )
{
try
{
std::cout << "\nWARNING: this program does no sensing or avoiding of obstacles, \n"
"the robot WILL collide with any objects in the way! Make sure the \n"
"robot has approximately 3 meters of free space on all sides.\n"
<< std::endl;
robot.setCmdVelTopic( "/RosAria/cmd_vel" );
robot.init();
vpColVector v( 2 ), v_mes( 2 );
for ( int i = 0; i < 100; i++ )
{
double t = vpTime::measureTimeMs();
v = 0;
v[0] = 0.01; // Translational velocity in m/s
// v[1] = vpMath::rad(2); // Rotational velocity in rad/sec
robot.setVelocity( vpRobot::REFERENCE_FRAME, v );
vpTime::wait( t, 40 );
}
return 0;
}
catch ( vpException e )
{
std::cout << "Catch an exception: " << e << std::endl;
return 1;
}
}
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:29