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

Issues using robot_localization with gps and imu

asked 2016-07-07 16:58:00 -0600

igd gravatar image

updated 2016-07-08 12:53:23 -0600

I only have two sensors, gps and and imu, that I am trying to integrate using robot_localization. I've created a launch file based on this question, pasted at the end.

There are a couple of issues. When I run the launch file I'm getting warnings about not having a base_link->map transform. The node handles the transform between odom and base link, do I need to create a transform from odom to map myself? There wasn't anything indicated in the linked answer so I assumed not, but I seem to be missing something. Warnings are pasted below

[ WARN] [1467926395.059514047]: Could not obtain base_link->map transform. Will not remove offset of navsat device from robot's origin.
[ WARN] [1467926397.126389602]: Could not obtain transform from map to base_link. Error was "map" passed to lookupTransform argument source_frame does not exist.

Second, the output of /odometry/gps is stuck at 0 for all values despite my gps data coming in fine, I would guess because of the map to base_link transform issue. Any help figuring out where I went wrong in my setup would be greatly appreciated.

EDIT- After rereading the robot_localization wiki I removed the map_frame line from the file as suggested but get the same results. Why is it still looking for a transform for the map_frame if I'm not using one?

<launch>
<node pkg="tf2_ros" type="static_transform_publisher" name="bl_imu" args="0 0 0 0 0 0 1 base_link imu_link" />

<!-- Start piksi driver, remap spp output to /gps/fix -->
<node pkg="swiftnav_piksi" type="piksi_node" name="piksi_node">
  <param name="port" value="/dev/ttyUSB0" />
  <remap from="fix" to="/gps/fix"/>
</node>

<!-- Start imu running, remap output to /imu/data -->
<node pkg="ros_erle_imu" type="imu_talker" name="imu_talker">
  <remap from="imu9250" to="/imu/data"/>
</node>

<!-- Start  -->
<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="transform_time_offset" value="0.0"/>

  <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"/>

  <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.0, 0.0, 0.0,
                                    0.0, 0.0, 0.06, 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 ...
(more)
edit retag flag offensive close merge delete

Comments

Please post sample input messages.

Tom Moore gravatar image Tom Moore  ( 2016-07-08 03:06:24 -0600 )edit

Added the rostopic echo output for /gps/fix and /imu/data, I'll figure out how to share a bag file as well

EDIT- So the warnings were from incorrectly set frame_ids. If I delete the map frame and change odom and world to gps they're silenced. Position is still drifting a ton though.

igd gravatar image igd  ( 2016-07-08 12:54:10 -0600 )edit
igd gravatar image igd  ( 2016-07-08 15:14:24 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-07-08 18:28:27 -0600

igd gravatar image

Turns out my issue was from still not setting my frames correctly. I made a static transform between gps (the frame_id of my /gps/fix messages) and base link, left the map_frame as map, and set odom_frame and world_frame to odom, now I'm getting reasonable results. My launch file is below in case it might be useful to anyone with similar issues <launch> <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 base_link gps"/>

<!-- Start piksi driver, remap spp output to /gps/fix -->
<node pkg="swiftnav_piksi" type="piksi_node" name="piksi_node">
  <param name="port" value="/dev/ttyUSB0" />
  <remap from="fix" to="/gps/fix"/>
</node>

<!-- Start imu running, remap output to /imu/data -->
<node pkg="ros_erle_imu" type="imu_talker" name="imu_talker">
  <remap from="imu9250" to="/imu/data"/>
</node>

<!-- Start  -->
<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="false"/>

  <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="transform_time_offset" value="0.0"/>

  <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,
                                 false,  false,  true,
                                 false, false, false,
                                 false,  false,  true,
                                 false,  false,  false]</rosparam>

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

  <param name="odom0_relative" value="false"/>
  <param name="imu0_relative" value="false"/>

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

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

  <param name="debug"           value="false"/>
  <param name="debug_out_file"  value="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.0, 0.0, 0.0,
                                          0.0, 0.0, 0.06, 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, 0.03, 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, 0.03, 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, 0.06, 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, 0.025, 0.0 ...
(more)
edit flag offensive delete link more

Comments

would you explain your reasoning in selectring the true/false configuration for odom0_config and imu0_config?

i.e. why is odom0 not true for velocities as well? from the documentaion of robot localization: If the odometry provides both position and linear velocity, fuse the linear velocity

JadTawil gravatar image JadTawil  ( 2017-09-25 20:39:39 -0600 )edit

i thought because when choose gps as odom, it doesn't provide the velocity as we konw.

yip gravatar image yip  ( 2023-04-16 21:05:25 -0600 )edit

I am trying to make the robot localization work with Gazebo. I keep getting the above error. But it is random. Sometimes I get it sometimes I dont. I am spawning my URDF in Gazebo and robot state publisher is publishing to the TF tree. That is where I am getting the frames.

Kaushal gravatar image Kaushal  ( 2023-08-02 14:09:39 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-07-07 16:58:00 -0600

Seen: 3,225 times

Last updated: Jul 08 '16