ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Can I use robot_localization package with only imu data? If I could,how to config the package?

asked 2016-04-25 03:51:22 -0500

Nico.Zhou gravatar image

I want to fuse IMU and GPS data with robot_localization package used in an autonomous car, but there will have some time that I can't obtain the GPS data and IMU is the only source I can get to calculate position. I have a high precise IMU,but the error is huge when I use robot_localization without gps, so my question is can I use robot_localization package with only imu data.If I could,how to config the package correctly? Here is my launch file:

  <node pkg="tf2_ros" type="static_transform_publisher" name="bl_imu" args="0 0 0 0 0 0 1 base_link imu_link" />
  <node pkg="tf2_ros" type="static_transform_publisher" name="bl_gps" args="0 0 0 0 0 0 1 imu_link gps_link"/>
  <node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization_global" clear_params="true">
    <param name="frequency" value="30"/>
    <param name="sensor_timeout" value="2"/>
    <!--param name="map_frame" value="map"/-->
    <param name="odom_frame" value="odom"/>
    <param name="base_link_frame" value=" base_link"/>
    <param name="world_frame" value="odom"/>
    <param name="imu0" value="/imuData"/>
    <rosparam param="imu0_config">[false, false, false,
                                   true,  true,  true,
                                   false, false, false,
                                   true, true, true,
                                   true,  true,  true]</rosparam>
    <param name="imu0_differential" value="true"/>
    <param name="imu0_remove_gravitational_acceleration" value="true"/>
    <param name="two_d_mode" value="true"/>
    <param name="odom0" value="/odometry/gps"/>
    <rosparam param="odom0_config">[true,  true,  true,
                                   false, false, false,
                                   false, false, false,
                                   false, false, false,
                                   false, false, false]</rosparam>
  <node pkg="robot_localization" type="navsat_transform_node"
      name="navsat_transform_node"  respawn="true" output="screen">
    <param name="magnetic_declination_radians" value="0.157"/>
    <param name="yaw_offset" value="1.570796327"/>
    <remap from="/imu/data" to="/imuData"/>
    <remap from="/gps/fix" to="/gpsData"/>
  <node pkg="rviz" type="rviz" name="rviz_imu_gps_fuse" output="screen" args="-d $(find robot_localization)/robot_localization.rviz"/>
edit retag flag offensive close merge delete


Thanks to your post I have a better clarity on creating the launch file. I could not find the robot_localization.rviz file in the robot_localization repository. Can you guide me as to how to create this file?

Subodh Malgonde gravatar image Subodh Malgonde  ( 2018-07-25 04:54:31 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2016-05-09 19:55:13 -0500

Tom Moore gravatar image

You can use it with just an IMU, yes, but until I add bias correction, I wouldn't expect great results. Even after bias correction has been added, I wouldn't want to have only an IMU for pose estimation. Double integration of linear acceleration is going to lead to drift.

edit flag offensive delete link more


Thanks for your answer Tom, I'm think about fuse visual odometry, hope I can get good result.

Nico.Zhou gravatar image Nico.Zhou  ( 2016-05-16 02:00:52 -0500 )edit

Hello. I just started using the robot localization package only with an IMU. I am using the the launch file Nico provided but I am getting zeros both in position and linear twist (on /odometry/filtered). Any ideas about what I am doing wrong? Is the navsat node necessary? Thank you for your time.

SprGrf gravatar image SprGrf  ( 2016-09-01 04:04:13 -0500 )edit

@SprGrf I am trying to do the same thing, IMU only navigation. Were you able to figure this out?

vik748 gravatar image vik748  ( 2018-01-29 21:42:28 -0500 )edit

I would really like to implement robot_localization with only an IMU but I have yet to get it to produce any position estimates from my IMU input. Is the launch file above usable to achieve a position estimate from just IMU data or is there a source somewhere where a working launch file of only an IMU as the sensor source can be found?

JamesS gravatar image JamesS  ( 2021-04-09 08:09:11 -0500 )edit

Hello @JamesS were you able to achieve robot_localization with only the imu data? If yes can you post a link to your launch file?

riteshgoru gravatar image riteshgoru  ( 2021-04-16 12:43:37 -0500 )edit

@riteshgoru I did manage to get it to work but as many have mentioned the drift is terrible. The way I got it to work wasn’t by altering the launch file and in fact I used the default template one. The trick was writing a script that read in the IMU linear acceleration and integrated it to achieve a rough linear velocity. I then input those values into a Nav_Msgs/Odometry message under linear twist and published that to the required Odom sensor in robot_localization and the package immediately started estimating position. Hope that helps :)

JamesS gravatar image JamesS  ( 2021-04-16 13:11:53 -0500 )edit

I have the same problem except I dont have GPS. I have IMU as only Sensor input . Can I use the raw IMU data (orientation, Angular Velocity and linear acceleration) as sensor input to achieve rough linear velocity or have to to the read the IMU raw that and do integration to achieve rough linear velocity or ?

Astronaut gravatar image Astronaut  ( 2021-09-26 10:40:58 -0500 )edit

Question Tools

1 follower


Asked: 2016-04-25 03:51:22 -0500

Seen: 2,500 times

Last updated: May 09 '16