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

Robot Localization Wrong Settings or Odom message?

asked 2019-04-10 12:58:56 -0500

rukie gravatar image

updated 2019-04-12 09:03:31 -0500

BLUF (Bottom line up front): Using ackermann style odometry only, Robot_localization isn't providing an /odometry/filtered output.

Machine: Ubuntu 16 & ROS Kinetic

Details: I have an ackermann style vehicle with simulated sensors running in Unity and broadcasting to ROS.

For odometry, I wrote a bicycle model script to estimate position, orientation, and velocity. I publish this to /odometry/bicycle and its a child of /map. That looks like:

odom_quat = tf.transformations.quaternion_from_euler(0, 0, veh.yaw)
# first, we'll publish the transform over tf
odom_broadcaster.sendTransform(
            (veh.x, veh.y, 0.),
            odom_quat,
            current_time,
            "bicycle",
            "map"
            )
# next, we'll publish the odometry message over ROS
odom = Odometry()
odom.header.stamp = current_time
odom.header.frame_id = "map"

# set the position
odom.pose.pose = Pose(Point(veh.x, veh.y, 0.), Quaternion(*odom_quat))
odom.pose.covariance = [0.01,  0.0,  0.0,  0.0,  0.0,  0.0,
                        0.0,  0.01,  0.0,  0.0,  0.0,  0.0,
                        0.0,   0.0, 0.01,  0.0,  0.0,  0.0,
                        0.0,   0.0,  0.0,  0.1,  0.0,  0.0,
                        0.0,   0.0,  0.0,  0.0,  0.1,  0.0,
                        0.0,   0.0,  0.0,  0.0,  0.0,  0.1]
# set the velocity
odom.child_frame_id = "bicycle"
odom.twist.twist = Twist(Vector3(veh.xdot, veh.ydot, 0), Vector3(0, 0, veh.yawdot))
odom.twist.covariance = [0.01,  0.00,  0.00,  0.00,  0.00,  0.00,
                         0.00,  0.01,  0.00,  0.00,  0.00,  0.00,
                         0.00,  0.00,  0.01,  0.00,  0.00,  0.00,
                         0.00,  0.00,  0.00,  0.10,  0.00,  0.00,
                         0.00,  0.00,  0.00,  0.00,  0.10,  0.00,
                         0.00,  0.00,  0.00,  0.00,  0.00,  0.10]
# publish the message
odom_pub.publish(odom)

Some common errors I've read about include having a forward slash (/) before the tf. I don't think I have that issue.

I also have a simulated IMU broadcasting to /imu_data, and gps broadcasted to /gps/fix. I will probably have questions on them later, but right now I want to focus on filtering just the odometry message. Ideally I want to recreate the dual EKF setup described on the robot localization page.

When setting up the EKF for just odometry, I'm not getting an odometry filtered message. Diagnostics does give me an error about erroneous settings.

Odometry message:

header: 
  seq: 66
  stamp: 
    secs: 1554917950
    nsecs:  73329925
  frame_id: "map"
child_frame_id: "bicycle"
pose: 
  pose: 
    position: 
      x: 0.0
      y: 0.0
      z: 0.0
    orientation: 
      x: 0.0
      y: 0.0
      z: 0.0
      w: 1.0
  covariance: [0.01, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0 ...
(more)
edit retag flag offensive close merge delete

Comments

I think part of what I should be doing, is broadcasting the bicycle publisher on frame id "odom" to child "bicycle". I should create a static relationship between map and odom (until earth/etc is set up).

And in odom I should track vx, vy, and vyaw instead of positions.

odom0_config: [false,  false, false,
               false, false, false,
               true, true, false,
               false, false, true,
               false, false, false]

However, I still don't have a functioning robot localization.

rukie gravatar image rukie  ( 2019-04-11 11:08:26 -0500 )edit

from here: https://answers.ros.org/question/3141... I've confirmed my wheel odometry child frame should be "base link" and my frame id should be "odom" (I have map above)..

Still No improvement.

rukie gravatar image rukie  ( 2019-04-11 15:33:13 -0500 )edit

I've also gone ahead and simplified my ekf yaml file:

ekf_odom:
    frequency: 20
    sensor_timeout: 2.0
    two_d_mode: true
    transform_time_offset: 0.0
    transform_timeout: 1.0
    print_diagnostics: true
    debug: false
    publish_tf: true
    publish_acceleration: false
    map_frame: map              
    odom_frame: odom            # Defaults to "odom" if unspecified
    base_link_frame: base_link  # Defaults to "base_link" if unspecified
    world_frame: odom           # Defaults to the value of odom_frame if unspecified
    odom0: odometry/bicycle
    odom0_config: [false,  false,  false,
                   false, false, true,
                   true, true, false,
                   false, false, true,
                   false, false, false]
    odom0_queue_size: 5
    odom0_nodelay: false
    odom0_differential: false
    odom0_relative: false
rukie gravatar image rukie  ( 2019-04-11 18:01:37 -0500 )edit

And if anyone else is reading this: Many of the parameters added such as pose and twist thresholds, accel/decel limits, can cause the localization package to ignore the info...

However I still have the same error...

rukie gravatar image rukie  ( 2019-04-11 18:03:23 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-05-15 04:17:37 -0500

Tom Moore gravatar image

A bunch of things.

  1. First, do a rostopic info and make sure that the EKF is subscribed to the topic.
  2. You have your EKF world_frame set to odom. That means the EKF is going to try to transform all pose data into the odom frame before using it. If there's no transform available from map->odom, the EKF can't use your map frame data. So it ignores your odometry.
  3. You have your EKF base_link frame set to base_link, but your odometry data has a child_frame_id of bicycle. Again, the EKF will need to transform from bicyle->base_link if you want it to use that data.
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2019-04-10 12:58:56 -0500

Seen: 1,431 times

Last updated: May 15 '19