Ask Your Question

Using GPS & IMU for robot positioning

asked 2021-01-19 05:40:03 -0500

kamcnally gravatar image

I'm relatively new to ROS and I'm having trouble trying to integrate all the components for the real Unmanned Surface Vehicle. I have the robot description (which I've been using within Gazebo until now), a driver node for the dual-antenna GNSS, and a LiDAR driver node.

At this time, all I want to do is integrate telemetry from the real GNSS so that I can see the robot move in the map (3D-XYZ and orientation). My understanding is that I should be using the robot_localization package to fuse the GPS & IMU but I haven't had any luck getting the robot to move. For my current base for robot_localization, I am using the answer from this question. I can see new messages being produced under the topics /odometry/gps and /odometry/filtered but I get a slew of errors and am yet to get the robot to move.

Is there something obvious that I am missing to get the robot to move? I've tried searching the subject but either I'm not finding anything that helps or just not understanding the process.

Source Repo: I've made a stripped-down test version (containing the robot description and launch file that I am using) available in this repo as well as a bag file of some GNSS output under ./cust_robot_description/misc/sample.bag. (This is from a bench test so the latitude/longitude are relatively static but the roll/pitch should change to show the robot move)

This can be run using: roslaunch cust_robot_description view.launch

When running, I get the following errors. My understanding was that the odom->cust_robot/base_link tf was meant to be published by navsat_transform_node. If I add this transform myself, the error goes away but the robot still does not move in RVIZ.

[ WARN] [1611055719.572462689]: Could not obtain transform from cust_robot/base_link to odom. Error was Could not find a connection between 'odom' and 'cust_robot/base_link' because they are not part of the same tree.Tf has two or more un
connected trees.
[ WARN] [1611055721.572495570]: Could not obtain transform from cust_robot/base_link to odom. Error was Could not find a connection between 'odom' and 'cust_robot/base_link' because they are not part of the same tree.Tf has two or more un
connected trees.
[ WARN] [1611055722.572482436]: Could not obtain odom->cust_robot/base_link transform. Will not remove offset of navsat device from robot's origin.

The robot and RVIZ configuration:

    <arg name="namespace" default=""/>
    <arg name="use_gui" default="false"/>
    <param name="/use_sim_time" value="false"/>

    <param name="robot_description" command="xacro --inorder '$(find cust_robot_description)/robots/cust_robot_default.urdf.xacro'" />

    <!-- Publish transform for rotations to world frame -->
    <node pkg="tf" type="static_transform_publisher" name="base_link_tf" args="0 0 0 0 0 0 1 map cust_robot/base_link 30"/>

    <param name="use_gui" value="$(arg use_gui)"/>

    <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
    <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
    <node name="rviz" pkg="rviz" type="rviz" args="-d $(find ...
edit retag flag offensive close merge delete


Why would robot_localization help your robot move? What do you mean by that? To get the robot to move you should be using something like move_base. Localization will just be used to track its motion right?

JackB gravatar image JackB  ( 2021-01-19 09:31:49 -0500 )edit

Apologies, when I mean "move" I mean to track its real-world motion. The platform will more or less currently just be a suite of sensors that need monitoring/visualised (GPS, IMU, Camer, LiDAR, etc,). Actual control will come much further down the line which I guess what move_base is intended for.

kamcnally gravatar image kamcnally  ( 2021-01-19 09:42:39 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-01-24 10:27:50 -0500

These things are quite difficult to debug but here are some tips how to get started on that.

  1. Have a good read of, especially focus on building an intuition on map and odom frames (it took me quite a while to figure out how they are supposed to work)
  2. Afterwards read this: that should give you an idea how to use robot localization with GPS (spoiler alert: you will need to run 2 instances of ekf, one will provide odom->base_link transform and will contain continuous measurements (IMU and odom) and the second one will provide map->odom frame and it will fuse gps odometry (this change will be non-continuous, you can expect odom to jump in map frame a lot)
  3. Move your config to .yaml file so that it's more convenient to debug. In your yaml file set the parameter print_diagnostics to true - sometimes it will provide you insights into what's wrong in your setup
  4. Start tuning with the continuous frame just with the odometry and imu fused. Then in rviz make sure that you set the fixed frame to odom and double check that the localization works. Once you complete this step move over to implementing the second ekf that will additionally fuse the GPS.
  5. For fusing gps you will most likely need to run navsat_transform node. Ideally you should have a heading from your GPS unit.
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2021-01-19 05:40:03 -0500

Seen: 361 times

Last updated: Jan 24