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

ekf_localization with gps and imu

asked 2015-03-27 04:40:05 -0600

Porti77 gravatar image

updated 2015-03-30 09:34:32 -0600

Hi everyone: I'm working with robot localization package be position estimated of a boat, my sistem consist of:

Harware: -Imu MicroStrain 3DM-GX2 (I am only interested yaw) - GPS Conceptronic Bluetooth (I am only interested position 2D (X,Y))

Nodes: -Microstrain_3dmgx2_imu (driver imu) -nmea_serial_driver (driver GPS) -ekf (kalman filter) -navsat_transform (with UTM transform odom->utm) -tf_transform (broadcast link base_link->imu)

When I launch and conect all I have: image description image description

After changed micros_strain node i got that work successful, i connected only imu and ekf and work well.

My problem is when I integrate all system such as I explain above, the topic /odometry/filtered that is publishing for the filter not work well, because without reason some time the position starting to increase until hundreds of meters, i revised the position that i get from GPS and it work well. I think that the filter not work well. Any idea?

I let in dropbox a rosbag with the system working.


EDIT 1: For now I'm using the laptop as a robot, the imu will be mounted as shown in the picture. In the laptop serial cable I have placed facing the screen, which is the direction of my movement. The fork used is . Navsat information is correct, the problem is the position in the case of filtered odometry, as sometimes hundreds of meters unexplained increases. image description

And i ploted odometry/filtered and odometry/gps and the result is this: image description

edit retag flag offensive close merge delete



Please post a picture of your IMU mounted on your robot. I want to make sure it's oriented correctly.

Tom Moore gravatar image Tom Moore  ( 2015-03-27 08:14:43 -0600 )edit

How did you plot your data? What did you use?

murdock gravatar image murdock  ( 2016-04-13 11:06:50 -0600 )edit

You can stack the position so rostopic echo -p /odometry/gps > odom_gps.csv and then plot a graphic with LibreOffice calc, other option is create a specific plugin for rviz, i did this plug-in that plot a odometry msg like a path msg. If you want this plug-in i can send you a link.

Porti77 gravatar image Porti77  ( 2016-04-18 03:31:52 -0600 )edit

Can you send me the link for the plug-in. Thanks

Nico.Zhou gravatar image Nico.Zhou  ( 2016-04-21 00:33:34 -0600 )edit
Porti77 gravatar image Porti77  ( 2016-04-21 03:26:50 -0600 )edit

Yeah,it helped me, thanks so much

Nico.Zhou gravatar image Nico.Zhou  ( 2016-04-21 09:10:06 -0600 )edit

hi, @Porti77, odometry msg path plot, as I know the rviz can do it already, just set the buffer up to 5000, it can plot the path. is this what you want? but gps path which rviz cannot plot.

asimay_y gravatar image asimay_y  ( 2016-06-14 10:04:41 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-03-27 08:30:02 -0600

Tom Moore gravatar image

updated 2015-03-30 11:49:17 -0600

I looked at the data from your other post, and this is what navsat_transform_node is outputting:

image description

You can get this plot by doing:

rostopic echo -p /odometry/gps > odom_gps.txt

...and then plotting the output with MATLAB.

This says to me that navsat_transform_node is behaving correctly, but keep reading.

Without doing a deeper analysis, my first guess is that your IMU may not be mounted correctly. If, for example, you have it turned around and facing the wrong direction, then navsat_transform_node will be outputting incorrect positions if you don't correct for the offset, and ekf_localization_node will think your robot is facing the wrong way, so when the EKF makes a prediction, it will move your robot the wrong way.

Please do this: do not remove any information from your question. Instead, at the bottom, add an "EDIT" section, and post a photo, if possible, of the IMU on your robot, and please make it clear where the front of your robot is. Also, although I believe I am aware of it, let me know if you're using this fork of the GX2 node, or the default one, as it will affect my answer.


Here's what I did:

  1. Downloaded your miercoles.bag file
  2. Ran this command (to get rid of the topics I didn't want):

    rosbag filter miercoles.bag gps_test.bag "topic != '/diagnostics' and topic != '/odometry/filtered' and topic != '/rosout' and topic != '/rosout_agg' and topic != '/tf' and topic != '/odometry/gps'"
  3. Downloaded the latest source for robot_localization, and used the indigo-devel branch
  4. Created this launch file:


<param name="/use_sim_time" value="true" />

<node pkg="tf" type="static_transform_publisher" name="bl_imu" args="0 0 0 0 0 0 1 /base_link /imu 20" />
<node pkg="rosbag" type="play" name="player" output="screen" args="--clock /home/tmoore/Desktop/gps_test.bag -d 3"/>

<node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization" clear_params="true">
  <param name="frequency" value="30"/>  
  <param name="sensor_timeout" value="0.1"/>  
  <param name="two_d_mode" value="true"/>

  <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="odom0" value="odometry/gps"/>
  <param name="imu0" value="/imu/data"/> 

  <rosparam param="odom0_config">[true,  true,  false, 
                                  false, false, false, 
                                  false, false, false, 
                                  false, false, false,
                                  false, false, false]</rosparam>

  <rosparam param="imu0_config">[false, false, false, 
                                 true,  true,  true, 
                                 false, false, false, 
                                 true,  true,  true,
                                 true, true, true]</rosparam>

  <param name="odom0_differential" value="false"/>
  <param name="imu0_differential" value="false"/>

  <param name="imu0_remove_gravitational_acceleration" value="true"/>

  <param name="print_diagnostics" value="false"/>

  <!-- ======== ADVANCED PARAMETERS ======== -->

  <param name="odom0_queue_size" value="2"/>
  <param name="imu0_queue_size" value="10"/>

  <param name="debug"           value="false"/>
  <param name="debug_out_file"  value="/home/tmoore/Desktop/debug_ekf_localization.txt"/>

  <rosparam param="process_noise_covariance">[0.05, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                                              0.0, 0.05, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0 ...
edit flag offensive delete link more


Sir, may I ask about how could I create the lauch file on my own? Any example or tutorial about it?

Envo gravatar image Envo  ( 2016-06-27 22:02:22 -0600 )edit

You can see a tutorial about launch files here , if you are using the robot localization node you can use the launch file that are above or the example attached in the package. Regards

Porti77 gravatar image Porti77  ( 2016-06-28 03:02:32 -0600 )edit

Question Tools



Asked: 2015-03-27 04:40:05 -0600

Seen: 7,838 times

Last updated: Mar 30 '15