# Location of the robot

**URL:** <https://forum.hello-robot.com/t/location-of-the-robot/771>\
**Category:** Knowledge Base\
**Created:** [July 17, 2023, 4:08pm UTC](https://forum.hello-robot.com/t/location-of-the-robot/771 "2023-07-17T16:08:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Humberto\_Andres\_Hida](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/humberto_andres_hida/32/524_2.png) [@Humberto\_Andres\_Hida](https://forum.hello-robot.com/u/Humberto_Andres_Hida)\
**Post date:** [July 17, 2023, 4:08pm UTC](https://forum.hello-robot.com/t/location-of-the-robot/771/1 "2023-07-17T16:08:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lamsey](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/lamsey/32/177_2.png) [@lamsey](https://forum.hello-robot.com/u/lamsey)\
**Post date:** [July 17, 2023, 10:52pm UTC](https://forum.hello-robot.com/t/location-of-the-robot/771/2 "2023-07-17T22:52:37Z")

</div>

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](http://wiki.ros.org/tf/Tutorials/Writing%20a%20tf%20listener%20%28Python%29) 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](https://github.com/hello-robot/stretch_ros/tree/noetic/stretch_navigation) repo.

---

<div class="post-metadata">

**Author:** ![chintujaguar](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/chintujaguar/32/260_2.png) [@chintujaguar](https://forum.hello-robot.com/u/chintujaguar)\
**Post date:** [July 18, 2023, 12:15am UTC](https://forum.hello-robot.com/t/location-of-the-robot/771/3 "2023-07-18T00:15:25Z")

</div>

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](https://github.com/hello-robot/stretch_ros/tree/noetic/stretch_core#transforms). 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](https://answers.ros.org/question/188882/why-can-the-odom-frame-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](https://github.com/hello-robot/stretch_ros/blob/noetic/stretch_core/launch/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](https://github.com/hello-robot/stretch_ros/tree/noetic/stretch_navigation) package to set up localization on your robot.

Please let me know if you need further help.

Best,  
Chintan Desai

---

<div class="post-metadata">

**Author:** ![Humberto\_Andres\_Hida](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/humberto_andres_hida/32/524_2.png) [@Humberto\_Andres\_Hida](https://forum.hello-robot.com/u/Humberto_Andres_Hida)\
**Post date:** [July 20, 2023, 5:25pm UTC](https://forum.hello-robot.com/t/location-of-the-robot/771/5 "2023-07-20T17:25:45Z")

</div>

thanks that help me a lot

---

<div class="post-metadata">

**Author:** ![Humberto\_Andres\_Hida](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/humberto_andres_hida/32/524_2.png) [@Humberto\_Andres\_Hida](https://forum.hello-robot.com/u/Humberto_Andres_Hida)\
**Post date:** [July 20, 2023, 5:26pm UTC](https://forum.hello-robot.com/t/location-of-the-robot/771/6 "2023-07-20T17:26:01Z")

</div>

thanks for the information
