Location of the robot

Hi I want to ask if there is any topic, which i can subscribe to know the coordinates of the robot based on the global coordinates o a map, or other to know that.

Assuming you’re using ROS, check the /odom topic published by stretch_driver.launch. You should be able to query the transformation from the odom frame to the base_link frame. Alternatively, you could make a tf listener and lookupTransform() between the odom frame and the base_link frame.

Note that this will probably drift over time without incorporating localization, e.g. using stuff from the Stretch Navigation repo.


Hello @Humberto_Andres_Hida,

Welcome to the forum and thank you for posting your query here!

To know the robot’s co-ordinates, it is first import to define the reference frame against which the co-ordinates would be measured. Usually, the reference frame can be either a local frame such as odometry, a.k.a. odom, or a global fixed frame such as map.

The odom frame can be published by stretch_driver by setting the parameter broadcast_odom_tf. This parameter when enabled would allow you to compute the transform between odom and base_link frames like @lamsey mentioned. This transform is based on the odometry reported by wheel encoders and is prone to odometric drift.

To get more accurate results, you could use odometry reported by a different sensor than the wheel encoders such as the laser range finder or the camera. The RPlidar is able to publish odometry using the laser_scan_matcher package through the stretch_scan_matcher.launch file. This requires the broadcast_odom_tf parameter to be false.

For long-term navigation, the errors could build up to the extent that the odometry becomes unusable. To eliminate drift, you could use a pre-generated map of your environment and use a package like AMCL to localize the robot in its environment. You would then compute the transform between the map and base_link frames. As @lamsey suggested, you could use the instructions in the stretch_navigation package to set up localization on your robot.

Please let me know if you need further help.

Chintan Desai

1 Like

thanks that help me a lot

thanks for the information

1 Like