Ask Your Question
1

map frame from robot_localization

asked 2015-02-28 23:38:52 -0500

Sam Bishop gravatar image

updated 2015-03-01 09:34:21 -0500

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!

edit retag flag offensive close merge delete

Comments

You also appear to have X, Y, and Z velocity set to true for your IMU. Does it report velocities?

Tom Moore gravatar imageTom Moore ( 2015-03-01 13:02:38 -0500 )edit

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!

Sam Bishop gravatar imageSam Bishop ( 2015-03-01 13:40:07 -0500 )edit

2 Answers

Sort by » oldest newest most voted
6

answered 2015-03-01 12:40:11 -0500

Tom Moore gravatar image

updated 2015-03-01 12:40:45 -0500

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.

edit flag offensive delete link more

Comments

Thank you! Your answer has helped a few things finally click for me.

Sam Bishop gravatar imageSam Bishop ( 2015-03-01 13:35:46 -0500 )edit
2

answered 2015-03-09 22:33:29 -0500

Sam Bishop gravatar image

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>
edit flag offensive delete link more

Comments

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_localizatio... ? Does the Navsat_transform_node run without odom data ? Please specify I really need the information

Anirvan0102 gravatar imageAnirvan0102 ( 2016-06-09 07:10:52 -0500 )edit

Your Answer

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

Add Answer

Question Tools

4 followers

Stats

Asked: 2015-02-28 23:38:52 -0500

Seen: 3,087 times

Last updated: Mar 09 '15