Ask Your Question

Robot Global Position

asked 2015-01-02 18:37:09 -0500

newcastle gravatar image

updated 2015-01-03 14:53:46 -0500

Let's say the robot is at the origin(O) at the beginning. The goal is to move the robot to points A,B,C. If the robot is at point A at the first step and the next step I want to move it to B, then it has to go to B directly without going back to the origin.

I guess in ROS, we always have the origin at the robot. Hence, when the robot is at A. I don't know how to move it to B directly without knowing the position of the robot in the map. This comes to my question. I want to transform from robot_base coordinate to global coordinate. I tried rosrun tf tf_echo /map /base_link but it does not work.

edit retag flag offensive close merge delete


the robot global position is published as Odometry. This is the position that robot thinks to have from the initial position. I really suggest you to buy and read the book I suggested you.

Andromeda gravatar image Andromeda  ( 2015-01-03 12:21:52 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2015-01-02 23:45:23 -0500

130s gravatar image

A library called tf does exactly what you need. Going through its tutorial will get you some idea of what it is.

edit flag offensive delete link more


Yes, I have some idea what tf does, but I still do not have an idea how to transform everything to world position.

newcastle gravatar image newcastle  ( 2015-01-03 00:24:02 -0500 )edit

So, have you gone through the tutorials? Use lookupTransform as this example does.

130s gravatar image 130s  ( 2015-01-03 01:24:34 -0500 )edit

Yes, but I am not sure what frames to use. I suppose I need to transform from /base_link to /map?

newcastle gravatar image newcastle  ( 2015-01-03 01:41:43 -0500 )edit

I have no idea what frame names you use. Use rqt_tf_tree to see the base frame (in the screenshot in the link, it's /odom_combined).

130s gravatar image 130s  ( 2015-01-03 02:16:10 -0500 )edit

what frame is /odom_combined?

newcastle gravatar image newcastle  ( 2015-01-03 12:06:13 -0500 )edit

/odom_combined is nothing but an example that was used in the screenshot in the link I referred to. What I meant was that you have to find the base tf frame in your own application (by e.g. using the tool I mentioned).

130s gravatar image 130s  ( 2015-01-03 12:10:22 -0500 )edit

I know that the base_footprint is the robot frame. Is /odom_combined a global frame? In my rqt_tf_frame, I have odom_combined at the top of the tree just like in the screenshot.

newcastle gravatar image newcastle  ( 2015-01-03 14:56:03 -0500 )edit

answered 2015-01-03 04:35:56 -0500

Andromeda gravatar image

updated 2015-01-03 05:21:56 -0500

Hi newcastle,

I think I understand your question.

Basically you want to know how you can use ROS to move your robot (real or in a simulated environment). At first let me say you that, despite what many people here would say, you'll never find this answer through the ROS tutorials. because the ROS tutorial tells you how you could write a specific algorithm using ROS or how to deal with a specific ROS library, but they never tell you how to setup your robot. Basically if you want to use ROS you should already have some knowledge about robots, meant as a system of sensors, controllers, communication and automated systems...and which criteria you need for your robot to work. In this case I mean: what is a pose, an orientation, a vector speed, an odometry information referred to a know position, or how to derive it from the environment. Once you get familiar with those terms and concepts, then you can try to use ROS as a communication systems based on nodes and topics and brings the whole concept expressed above in a abstracter level, letting all those robots functionalities working together.

Now...said that... I want to give you a more real answer to your question given a specific case.

  1. Case REAL: in this case you have already an existing robots, which (since you didn't specify it I assume it is a wheeled robots like a sumovore) has encoders attached on its wheels. The values coming from the sensors must be sent through the topic structure provided by ROS to the corresponding program. The program will be able to convert the angle read from the encoders into a path and running relatively fast in your PC it will knows every time where it is. Pay attention that in this case you should be familiar with the concept of dead reckoning, which (as I said before) is it presumed to be already know if you want to develop a robot.

  2. Case SIMULATION: in this case you are interested in, for example, move your robot around in RViz or Gazebo reading, for example, the position from a gamepad or Joystick. Furthermore you can attached virtual sensors to you robot and get a map of the enviroment: the robot will moved based on this information. Assumed you already know how to calculate a position of the robot, then you can simply broadcast this information though ROS using a particular ROS broadcaster, which will send the movement of your robot (referred as a robot transformation) through the ROS system. A very bare bone example can you find here. ANYWAY... in case you are going to simulate your robot, I strongly suggest you to buy or get the following book: ROS by Example I. It has been written for people who want to build up their robot and let him moving in RViz. Even if you are many times in the book suggested to get back to the tutorials, and ...

edit flag offensive delete link more


Thank you for a very long response. I think you probably misunderstood my question due to my bad English. I just edited my original text to explain my question more clearly.

newcastle gravatar image newcastle  ( 2015-01-03 12:01:02 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-01-02 18:37:09 -0500

Seen: 1,327 times

Last updated: Jan 03 '15