Home | Tutorials | Wiki | Issues
Ask Your Question
0

How can I dynamically get the coordinate of a model in gazebo?

asked 2017-03-27 06:33:49 -0600

Turtle gravatar image

I'm using Gazebo/ROS with TurtleBot. My robot needs to find the distance from itself to all the obstacles that exist in the environment while it is moving. I believe Laserscan has this information, but I am not sure how can I get the position of the models from Gazebo and reuse them in ROS with rospy. Can someone help me with some examples/tutorials?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-04-03 09:20:11 -0600

jetdillo gravatar image

If you are running the gazebo_ros_laser plugin(or similar), it publishes a sensor_msgs/LaserScan.msg to /scan just like a real laser in ROS. Check out the LaserScan Message page for details on the format of the messages published by the /scan topic. One of the data elements in a LaserScan.msg is an array of range values:

float32[] ranges

This has the range data you're probably looking for. It's up to you/your code to determine how to use it, what makes up an object, filter out noise, etc.

You can find the position of the TurtleBot by subscribing to the /tf topic: (About which see here and here, and of course, The ROS Wiki tf Tutorial)

If you don't know how to work with the rospy publish/subscribe framework, there are tutorials on ros.org: Writing Publishers and Subscribers in Python

HTH and please mark this as an answer if it helped you!

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-03-27 06:26:31 -0600

Seen: 1,628 times

Last updated: Apr 03 '17