0
$\begingroup$

Rosanswers logo

I am trying to create the standard tf frames specified in REP 105 (map, odom, and base_link) using the robot_localization package. I only have GPS and IMU sensors available. So far I have been able to create the odom and base_link frames, but I am having trouble creating the map frame.

This is my launch file:

<launch>
  <node pkg="robot_localization" type="ukf_localization_node"
     name="ukf_localization" clear_params="true" ns="ackermann_vehicle">

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

    <param name="imu0" value="imu/data_compass"/>
    <rosparam param="imu0_config">[false, false, false,
                                   true,  true,  true,
                                   true,  true,  true,
                                   true,  true,  true,
                                   true,  true,  true]</rosparam>
    <param name="imu0_differential" value="true"/>
    <param name="imu0_remove_gravitational_acceleration" value="true"/>

    <param name="gps0" value="odometry/gps"/>
    <rosparam param="gps0_config">[true,  true,  true,
                                   false, false, false,
                                   false, false, false,
                                   false, false, false,
                                   false, false, false]</rosparam>
    <param name="gps0_differential" value="false"/>
  </node>

  <node pkg="robot_localization" type="navsat_transform_node"
      name="navsat_transform_node" ns="ackermann_vehicle" respawn="true" output="screen">
    <param name="magnetic_declination_radians" value="0"/>
    <remap from="imu/data" to="imu/data_compass" />
    <remap from="gps/fix" to="navsat/fix" />
  </node>
</launch>

If I set the world_frame parameter to "odom", then things seem to work but I only have odom and base_link frames. If I set the world_frame to be "map", like above, then I get this error message: Could not obtain transform from odom->base_link.

Note that I am new to ROS, so my trouble may be conceptual. I would appreciate any help someone is willing to offer. Thank you!


Originally posted by Sam Bishop on ROS Answers with karma: 131 on 2015-03-01

Post score: 1


Original comments

Comment by Tom Moore on 2015-03-01:
You also appear to have X, Y, and Z velocity set to true for your IMU. Does it report velocities?

Comment by Sam Bishop on 2015-03-01:
No. I had intended to review all of my use/don't-use settings after getting the frames sorted out, but those three are obviously wrong. Thank you!

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Starting with REP-105 was the right move. Your answer lies in the section marked "Frame Authorities." The odom and map frames are both world-fixed frames. If you are running two instances of ekf_localizaton_node or ukf_localization_node, then instance 1 provides the odom->base_link transform, and you want instance 2 to generate a map->base_link transform. However, tf structures the transforms as a tree, and so base_link cannot have two parents. Therefore, instance 2 uses its internal map->base_link transform, combined with the odom->base_link transform being generated by instance 1, and creates a map->odom transform. This allows the user to still transform from map->base_link (map->odom->base_link).

However, the use case above is really only necessary if you have some source of odometry, such as from wheel encoders. In that case, you'd fuse the IMU and odometry in instance 1, and the IMU, wheel odometry, and GPS in instance 2. Since you only have an IMU and GPS, just run a single instance, and set the world_frame to odom. Note that your position will jump around as you get new GPS measurements, however.


Originally posted by Tom Moore with karma: 13689 on 2015-03-01

This answer was ACCEPTED on the original site

Post score: 8


Original comments

Comment by Sam Bishop on 2015-03-01:
Thank you! Your answer has helped a few things finally click for me.

$\endgroup$
0
$\begingroup$

Rosanswers logo

Tom Moore's answer is correct (thanks again!), but I want to report what my final launch file looks like.

There is an error with my launch file above, and I would hate for someone to be misled by it. I was under the impression that the sensor variable prefixes ("odom", "imu", "pose", and "twist") used in the documentation were simply convention, and that the localization nodes keyed off of the types of the messages coming from each sensor. But that isn't true--the prefixes are the key--and variables that don't have the right prefix are ignored. So if you are feeding data from navsat_transform_node, then use an "odom" prefix!

I also removed some redundant configuration from my launch file.

<launch>
  <node pkg="robot_localization" type="ukf_localization_node"
    name="ukf_localization" clear_params="true" ns="ackermann_vehicle">

    <param name="frequency" value="30"/>
    <param name="sensor_timeout" value="2"/>

    <param name="imu0" value="imu/data"/>
    <rosparam param="imu0_config">[false, false, false,
                                   true,  true,  true,
                                   false, false, false,
                                   false, false, false,
                                   true,  true,  true]</rosparam>
    <param name="imu0_differential" value="true"/>
    <param name="imu0_remove_gravitational_acceleration" 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>

  <node pkg="robot_localization" type="navsat_transform_node"
      name="navsat_transform_node" ns="ackermann_vehicle" respawn="true" output="screen">
    <param name="magnetic_declination_radians" value="0"/>
  </node>
</launch>

Originally posted by Sam Bishop with karma: 131 on 2015-03-09

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by Anirvan0102 on 2016-06-09:
Hello Sam, I want to know tha does'nt the Navsat_transform_node also need odometry data as mentioned in the http://wiki.ros.org/robot_localization/Tutorials/GPS%20Integration ? Does the Navsat_transform_node run without odom data ? Please specify I really need the information

$\endgroup$

Your Answer

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