0
$\begingroup$

Rosanswers logo

I am using the robot_localization package on a turtlebot running ROS Indigo. I would like the turtlebot to autonomously navigate a space and update it's position based on AprilTag landmarks. It seems that the way to do this is to take advantage of a map frame. However, when I publish landmark data, the map frame does not update in the discrete jumps I am hoping for. Perhaps I am doing something wrong with the launch file or with the way I am publishing tag data? How do you make sure robot_localization pays attention to the tags? Should I be using the set_pose service instead, or is that only meant to set initial position?

EDIT: Ideally, I would like the map frame to be updated discontinuously when it encounters a landmark, much as the GPS package in robot_localization allows the map frame to be discretely updated. The data published on the apriltags topic is relative to the map frame. There is not currently a transform between the apriltags frame and odom (I am a bit uncertain as to how to approach this). Will publishing a transform as well give discrete updates to position?

FINAL EDIT: Looks like figuring out the tf transformation is the key. I added a tf.TransformBroadcaster to go along with the apriltags publisher, and there were discrete updates; however, it doesn't seem to do what I want with non-zero data. If I publish a zeroed out message and a zeroed out transform, it zeros out the turtlebot. But if I do anything else, the map doesn't update.

My launch file looks like this:

<launch>

<!-- Set up the odom frame (local, continuous navigation) --> 
<node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization_imu" respawn="true" output="screen">
    <param name="map_frame" value="map"/>
    <param name="odom_frame" value="odom"/>
    <param name="base_link_frame" value="base_footprint"/>      
    <param name="world_frame" value="odom"/>                
    <param name="two_d_mode" value="true"/>
        
    <param name="imu0" value="imu_data"/>
    <rosparam param="imu0_config">
        [false, false, false,
        false, false, true,
        false, false, false,
        false, false, true,
        true, false, false]
    </rosparam>
    <param name="imu0_differential" value="false"/>
    
    <param name="odom0" value="odom"/>
    <rosparam param="odom0_config">
        [false, false, false,
        false, false, false,
        true, true, false,
        false, false, true,
        false, false, false]
    </rosparam>
    <param name="odom0_differential" value="true"/>
    
</node>

<!-- Set up the map frame (global, includes jumps) --> 
<node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization_map" respawn="true" output="screen">
    <param name="map_frame" value="map"/>
    <param name="odom_frame" value="odom"/>
    <param name="base_link_frame" value="base_footprint"/>      
    <param name="world_frame" value="map"/>                
    <param name="two_d_mode" value="true"/>
        
    <param name="imu0" value="imu_data"/>
    <rosparam param="imu0_config">
        [false, false, false,
        false, false, true,
        false, false, false,
        false, false, true,
        true, false, false]
    </rosparam>
    <param name="imu0_differential" value="false"/>
    
    <param name="odom0" value="odom"/>
    <rosparam param="odom0_config">
        [false, false, false,
        false, false, false,
        true, true, false,
        false, false, true,
        false, false, false]
    </rosparam>
    <param name="odom0_differential" value="true"/>
    
    <param name="pose0" value = "apriltags"/>
    <rosparam param="pose0_config">
        [true, true, false, 
        false, false, false, 
        false, false, false, 
        false, false, false]
    </rosparam>
    <param name="pose0_differential" value="false"/>
</node>

The data is being published with a zero covariance for the time being. The published AprilTag messages look like this:

header: 
  seq: 33
  stamp: 
    secs: 1485289501
    nsecs: 913736104
  frame_id: apriltags
pose: 
  pose: 
    position: 
      x: -0.817676304593
      y: 0.229189579954
      z: 0
    orientation: 
      x: 0.0
      y: 0.0
      z: 0.00247093385679
      w: 0.999996947238
  covariance: [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.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, 0.0, 0.0, 0.0, 0.0, 0.0]

But the map frame fails to update to reflect this position. Any help would be greatly appreciated.


Originally posted by haelannaleah on ROS Answers with karma: 28 on 2017-01-24

Post score: 0


Original comments

Comment by Tom Moore on 2017-02-01:
Are you certain that the apriltags data is in the map frame, and not relative to the robot? How do you define the global pose of every apriltag? Is there some database that says what their poses in the map frame are?

Comment by haelannaleah on 2017-02-02:
I'm manually publishing the topic, so I know that I intend for it to be in the global frame. The raw tag data is relative to the robot base, but I've been converting it manually for the time being. I need the tag data to tell me where the robot is, so there's an offset from the tag to the robot base

Comment by haelannaleah on 2017-02-02:
As to the position of the april tag in the map frame, yes, there is a database containing that information.

Comment by Tom Moore on 2017-03-01:
Can you post either a bag file or the code you're using to generate the apriltags -> map transform?

Comment by Jad on 2018-08-07:
Would you like to say the name of the package the you have used ?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Your apriltags messages are in the apriltags frame (see the frame_id). Have you provided a transform from apriltags to odom? What is the apriltags frame? Is it relative to the camera? If the filter can't transform the data, it will ignore it. Also, the filter will adjust the measurement covariances to some small epsilon, but you should fill those out.

The set_pose service is not meant to be used for fusion. It's just a way to reset the filter to a specific state.


Originally posted by Tom Moore with karma: 13689 on 2017-01-26

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

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