ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Getting a real time position feedback from rviz?

asked 2011-09-14 14:13:05 -0600

cheyanne gravatar image

We all know that if we want to get the position of your robot we are using the amcl, now my goal is to get a real time x,y position of the robot as shown in rviz interface itself and display it in a loop in the Linux terminal, how do I do it. I have create a listener.cpp file, do I change amcl file to work like a talker since whatever the talker publish, the listener will receive? Or do I implant the cl codes into my listener.cpp? I'm a bit confused.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2011-09-14 14:43:00 -0600

DimitriProsser gravatar image

updated 2011-09-15 01:35:36 -0600

You don't need to edit the amcl node at all. In the documentation here you can see that the amcl node publishes to a topic called amcl_pose that represents the robot's position with respect to the map origin. All you have to do is open a new terminal and type the following:

rostopic echo /amcl_pose

You can find a tutorial on using rostopic here.

Another option if you're going to be porting the information to a GUI application, you could run amcl while using rosbag, and then view it afterwards with rxbag to view it, export it to .csv files, etc.

EDIT: In order to then return data to the robotino_base node, first look here to see what topics that the node subscribes to. If you want to publish to cmd_vel, you can see that the type is geometry_msgs/Twist (all cmd_vel messages are of this type). So to do this, you must use:

rostopic pub /cmd_vel geometry_msgs/Twist '[1.0,0.0,0.0]' '[0.0,0.0,0.0]'

For more information on how to specify the contents of the message, you can look here. I hope this helps.

edit flag offensive delete link more

answered 2011-09-14 15:34:16 -0600

cheyanne gravatar image

OK, now that i can get position data from rviz itself, is there anyway i can send data to it? like for example, sending cmd_vel ( a suscribed topic in robotino_base package) to the robot? Do i use this?

$ rostopic pub /topic_name std_msgs/String hello

but i don't get what i should insert to replace the std_msgs/String hello

edit flag offensive delete link more


I've edited my answer to also answer this question.
DimitriProsser gravatar image DimitriProsser  ( 2011-09-15 01:35:53 -0600 )edit

answered 2011-09-14 14:56:23 -0600

cheyanne gravatar image

i guess this will help, so i do not need to use the listener and talker anymore? becasue in the later part of my project i actually need to send feedback of my robot to another computer which is going to have a GUI interface.

edit flag offensive delete link more


For this application, you don't need a listener or talker. I've edited my answer to include another solution.
DimitriProsser gravatar image DimitriProsser  ( 2011-09-14 15:05:20 -0600 )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: 2011-09-14 14:13:05 -0600

Seen: 1,981 times

Last updated: Sep 15 '11