ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Move my robot-Tutorial (General Question)

asked 2016-07-21 10:35:55 -0500

patrchri gravatar image

updated 2016-07-21 12:03:57 -0500


I am new to ROS (I am using ROS Kinetic) and Gazebo and so far what I have managed to do are the following:

  • Create a URDF model of a 4 wheel robot with a camera on top, a base_link and 4 continuous joints (connecting the wheels with the base_link) with controllers,transmissions and actuators on each one. I also created the appropriate configuration yaml file for the control of my robot.
  • Create launch files for rviz and gazebo and successfully display my robot in these environments.
  • Get image from the camera plugin I added, in gazebo.

My next step is to move my robot. I searched this tutorial, but it is not what I am looking and I am kind of lost right now. I also checked the MoveIt C++ beginner tutorial, but it is referring to the PR2 robot and it doesn't help me to start something on my own and build from it.

To be more specific, what I am thinking of doing next is to create nodes (the motors of the robot and the camera) and according to what image I get from the camera, I would send an appropriate command to the motors to either stop or move on, but I cannot find a tutorial that could help me with that. Even a tutorial with simple movement of a robot could help me, i.e. sending to a motor-node to move forward and simulate this movement in gazebo. If you know a tutorial that could be useful for me to start from, I would appreciate your help.

Thanks for your answers and for your time in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2016-07-21 15:47:04 -0500

Mark Rose gravatar image

updated 2016-07-21 16:07:59 -0500

The RobotSetup navigation tutorial ( ) is a good place to start. In particular, the diagram in section 1 of that page shows the relationship between the navigation planners (the box in the middle) and the controller that will set the speeds of the four wheels.

The output of the local planner is a geometry_msgs/Twist message on the /cmd_vel topic (by default). The controller – which you need to supply – has to convert from the linear x velocity and the angular z velocity to wheel speeds for the four motors. You don't specify much about the hardware, so I don't know which direction to point you. There are packages in ROS such as ros_control that are configurable to talk to different hardware. On my robot there is an Arduino-compatible board that controls the motors for a differential-drive robot, so I'm using instead the ros_arduino_bridge package as the controller. (Other options for my case include rosserial_arduino.)

Once you have a controller in place that listens on the /cmd_vel topic, you can send those messages either using rostopic pub or using a panel in rviz. After you get the controller working you will then need to set up the planners, probably using move_base.

edit flag offensive delete link more


I have added controller_manager and hardware_interface from the ros_control metapackage, taken from this tutorial. But the commands from the tutorial haven't worked for me, so probably in the future I will change them.

patrchri gravatar image patrchri  ( 2016-07-22 08:49:30 -0500 )edit

I wanted to ask you about the link you sent me. In the section 2.1 Creating a Package it says: catkin_create_pkg my_robot_name_2dnav move_base my_tf_configuration_dep my_odom_configuration_dep my_sensor_configuration_dep

patrchri gravatar image patrchri  ( 2016-07-22 09:53:17 -0500 )edit

Could you please explain me what kind of dependencies it requires. I am referring to my_tf_configuration_dep my_odom_configuration_dep my_sensor_configuration_dep . What packages should I search for? Thanks for answering and for your time again.

patrchri gravatar image patrchri  ( 2016-07-22 09:54:33 -0500 )edit

All but move_base are example dependencies that you might have. The three envisioned packages are: URDF for frame defs (my_tf_configuration_dep), robot controller (my_odom_configuration_dep), and sensor publisher (my_sensor_configuration_dep). You could put all in the new package instead.

Mark Rose gravatar image Mark Rose  ( 2016-07-22 13:11:58 -0500 )edit

In that case, your package creation would be just: catkin_create_pkg my_robot_name_2dnav move_base

Mark Rose gravatar image Mark Rose  ( 2016-07-22 13:12:40 -0500 )edit

Now, what packages should you search for: you need something that provides a robot controller (listening on /cmd_vel, publishing on /odom) and something that publishes either PointCloud or LaserScan. What you need depends on your hardware.

Mark Rose gravatar image Mark Rose  ( 2016-07-22 13:14:16 -0500 )edit

So to sum up what I need to is:

  • catkin_create_pkg my_robot_name_2dnav move_base roscpp
  • Create a publisher on the /cmd_vel topic (at my_robot_name_2dnav/src/publisher.cpp)
  • Put the controllers I have on my motors to listen to it (create a listener.cpp)
  • Simulate it in gazebo


patrchri gravatar image patrchri  ( 2016-07-22 15:06:41 -0500 )edit

My comment refers to just move my robot...I will forget about the sensor for now.

patrchri gravatar image patrchri  ( 2016-07-22 15:52:47 -0500 )edit

Question Tools

1 follower


Asked: 2016-07-21 10:35:55 -0500

Seen: 6,020 times

Last updated: Jul 21 '16