Rosanswers logo


Goal: Write simplest robot_localization program using Android phone sensors (GPS and IMU). To be more exact first I need navsat_transform_node to output something.

Problem: /odometry/filtered, /odometry/gps and gps/filtered topics won't publish any message.


  • Ubuntu 18.04, ROS Melodic
  • I'm quite new to ROS. Programming isn't problem for me it's just ROS concepts.
  • I don't have odometry sensors for now but it shouldn't be necessary if I understood documentation well, right?
  • Yes I have read robot_localization documentation and yes I read many answers on answers.ros.org and other places and I have spent a lot of time trying to get ir running but with no success. I might be missing some key concept and I would really appreciate the help.


  • I have "ROS Sensors Driver" app on Android which connects to the ROS master on computer via wifi. This part working fine master receives GPS and IMU messages
  • Installed ros_localization package via command: sudo apt-get install ros-melodic-robot-localization
  • Launching nav_sat.launch file for navsat_transform_node (which I assume is the first step for localization with GPS)
  • Attached bag file for GPS and IMU data also link if attachment didn't work https://drive.google.com/open?id=1uaASJ0-dRxIXZ3owNQBuTUYswiydK9GF


    <node pkg="tf2_ros" type="static_transform_publisher" name="static_tf1" args="0 0 0 0 0 0 base_link imu" />
    <node pkg="tf2_ros" type="static_transform_publisher" name="static_tf2" args="0 0 0 0 0 0 base_link gps" />

  <node pkg="robot_localization" type="navsat_transform_node" name="navsat_transform_node" output="screen">

    <param name="publish_filtered_gps" value="true"/>
    <remap from="/imu/data" to="/android/imu" />
    <remap from="/gps/fix" to="/android/fix" />
    <remap from="/odometry/filtered" to="/odometry/filtered" />

  <node pkg="rviz" type="rviz" name="rviz"/>

Output: Only output I get is in the terminal window. Also the coordinates are accurate:

[ INFO] [1568201308.195924722]: Datum (latitude, longitude, altitude) is (XX.902596, XX.960813, XX.968323)
[ INFO] [1568201308.196126403]: Datum UTM coordinate is (XXXXXX.819897, XXXXXXX.950294)

As said /odometry/filtered, /odometry/gps and gps/filtered topics won't publish any message.

Messages: /android/imu:

  seq: 581523
    secs: 1568792943
    nsecs:  82000000
  frame_id: "/imu"
  x: -0.709161221981
  y: 0.031271263957
  z: -0.681847274303
  w: 0.176625996828
orientation_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
  x: 0.757553100586
  y: -0.367462158203
  z: -0.454147338867
angular_velocity_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
  x: 8.11840820312
  y: -7.03816223145
  z: -2.65315246582
linear_acceleration_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]


  seq: 580317
    secs: 1568108152
    nsecs: 242000000
  frame_id: "/gps"
  status: 0
  service: 1
latitude: 54.9023711
longitude: 23.96061015
altitude: 108.23223877
position_covariance: [1328.4568397011753, 0.0, 0.0, 0.0, 1328.4568397011753, 0.0, 0.0, 0.0, 1328.4568397011753]
position_covariance_type: 1

/imu (same as /android/imu just with added arbitrary variances):

  seq: 34044
    secs: 1568792961
    nsecs: 936000000
  frame_id: "/imu"
  x: 0.0374677367508
  y: -0.213686034083
  z: 0.611133694649
  w: 0.761216163635
orientation_covariance: [21.0, 0.0, 0.0, 0.0, 21.0, 0.0, 0.0, 0.0, 21.0]
  x: -0.740219116211
  y: 1.10260009766
  z: -3.50825500488
angular_velocity_covariance: [21.0, 0.0, 0.0, 0.0, 21.0, 0.0, 0.0, 0.0, 21.0]
  x: -6.48143005371
  y: -10.2990722656
  z: 10.7974700928
linear_acceleration_covariance: [21.0, 0.0, 0.0, 0.0, 21.0, 0.0, 0.0, 0.0, 21.0]

Final remarks:

  • There might be problem with covariance matrix on /imu it's totally arbitrary but by adding those covariances nothing happened. Maybe it's too small?
  • Maybe I'm missing some frame or something
  • Maybe navsat_transform_node needs some kind of odometry message
  • If any information is missing I'll update it

robot_localization package documentation is poor (for beginners) and tutorials don't address this problem so after trying for quite some time I'm clueless how to implement it. Probably I am missing something really obvious. And please just don't refer to the documentation because I have read it already.

Any help or tips is appreciated, thanks.

Originally posted by Combinacijus on ROS Answers with karma: 65 on 2019-09-12

Post score: 0


1 Answer 1


Rosanswers logo

You're trying to launch a navsat_transform node without odometry data. The navsat_transofrm node requires three inputs:

  1. GPS data

  2. IMU data

  3. Odometry data

You have the first two and you're not publishing on the third one. If you look at the navsat_transform node documentation found here, you'll notice that the /odometry/filtered topic is remapped to /your/robot_localization/output/topic.

<remap from="/odometry/filtered" to="/your/robot_localization/output/topic" />

In your case, you do not have access to odometry information from your android device(I looked at your bag file). So, you need to use the gps and Imu data with one of the state estimation nodes of the robot_localization package. The output of your state estimation node will give you an odometry, which you can then pass into the navsat_transform node to get your robot localized.

Also see these answers for reference:

Originally posted by ssohin with karma: 56 on 2019-10-15

This answer was ACCEPTED on the original site

Post score: 3


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.