Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You need to write your own packages as follows:

1- TF tree publisher: http://wiki.ros.org/navigation/Tutorials/RobotSetup/TF

2- Odometry publisher: http://wiki.ros.org/navigation/Tutorials/RobotSetup/Odom

3- There must be a node subscribing to the "cmd_vel" topic that is capable of taking (vx, vy, vtheta) <==> (cmd_vel.linear.x, cmd_vel.linear.y, cmd_vel.angular.z). To do this you create a subscriber with a call back like follows:

subscriber:

ros::Subscriber sub = n.subscribe("cmd_vel", 1, movecallback);

And the call back would be:

void movecallback(const geometry_msgs::Twist::ConstPtr& vel)
{
  //ROS_INFO("I heard: [%s]", msg->data.c_str());
  geometry_msgs::Twist new_vel = *vel;
  float v = sqrt (new_vel.linear.x * new_vel.linear.x + new_vel.linear.y * new_vel.linear.y);
  float vth = new_vel.angular.z;
  // here you need to send v and vth as linear and angular velocities to your robot
  }

For the rest you need to setup launch files as described here: http://wiki.ros.org/navigation/Tutorials/RobotSetup. You need to also install gmapping to be able to create a map, navigation stack do not work without a map unless you change its default to do slam.

Hope it helps Mohsen