Ask Your Question
1

setting frame ids for ekf localization

asked 2019-01-29 17:44:29 -0500

eric_cartman gravatar image

I am using wheel encoders and visual odometry(rtabmap) to perform ekf localization. This is the tf tree of rtabmap in localization mode. map->odom->camera_link(->other camera frames) I am trying to inculcate my wheel encoders and use ekf for better localization as rtabmap drifts a lot. How do i set my frames for wheel encoder odometry publisher and broadcaster? Also, what goes in the base_link_frame in ekf_localization_node param file?

Thank you

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
3

answered 2019-01-30 04:50:45 -0500

Tom Moore gravatar image

updated 2019-01-31 11:09:10 -0500

I'd recommend having a quick look at REP-105, just so you have a solid understanding of the assumptions about coordinate frames in ROS. With the exception of the earth frame, r_l conforms to those standards.

In your case, you want the base_link_frame to be the coordinate frame that is "affixed" to your robot's origin. All velocities that you generate from your wheel encoder data should be given in this frame. So, if your robot is moving forward at 1.0 meters/sec, the x component of velocity in the base_link frame will be 1.0, no matter which way your robot is facing.

For your wheel odometry, you need to at least fill out your base_link velocity, and set the child_frame_id in the nav_msgs/Odometry message to be base_link (or whatever you want to name your robot's base frame).

EDIT in response to comment questions:

what about the parent frame id of wheel odometry as "odom" is already being used by rtabmap?

That's up to you. Nothing will happen if you also make that frame odom, since publishing odometry messages doesn't actually do anything to the tf tree. Those frame_id values just describe what frame the data is in. However, if you make that frame odom and then try to fuse the pose data from both rtabmap and your odometry into the EKF, you definitely will have problems, because, as you stated, they aren't the same frame. But you should just use the velocity data from your odometry anyway. The EKF doesn't like having two sources of pose data, unless they both agree, and they won't.

also, the camera_link frame is not at the center of the robot. Lets say i publish a static transform from camera_link to base_link, what do i set my wheel odom child frame to be? Sorry. I'm very confused about this.

Wheel odometry child_frame_id should be the base_link_frame value, whatever that is. Doesn't matter if there are sensors mounted to your robot. The robot's velocity is relative to its centroid, no matter what's affixed to it.

I'm afraid this particular setup is a bit awkward for r_l. First, if rtabmap is publishing data into a frame that is relative to base_link, that's going to be an issue. All pose data for the EKF needs to either be in the world frame (e.g., odom), or needs to have a transform _to_ that world frame. The rule basically comes down to this: don't fuse pose data that comes from a frame_id that is a child of the base_link_frame.

If your camera is not mounted at the origin, you'll actually have to do some extra legwork. I really don't know enough about rtabmap to say with certainty what its data looks like. If it were me, I'd do this:

  • Set the rtabmap frame_id for pose data to, e.g., odom_camera.
  • Set your EKF frames to odom_frame: odom, base_link_frame: base_link ...
(more)
edit flag offensive delete link more

Comments

what about the parent frame id of wheel odometry as "odom" is already being used by rtabmap?

eric_cartman gravatar image eric_cartman  ( 2019-01-30 13:12:19 -0500 )edit

@Tom Moore also, the camera_link frame is not at the center of the robot. Lets say i publish a static transform from camera_link to base_link, what do i set my wheel odom child frame to be? Sorry. I'm very confused about this.

eric_cartman gravatar image eric_cartman  ( 2019-01-30 15:41:51 -0500 )edit

Great. I understand it better now. Thank you

eric_cartman gravatar image eric_cartman  ( 2019-01-31 15:03:21 -0500 )edit

For rtabmap, if frame_id parameter of visual odometry (vo) is set to base_link, the pose computed is already transformed into base_link frame, i.e., the odom topic published by vo will really mean odom -> base_link. Set also publish_tf for vo to false to avoid TF conflicts.

matlabbe gravatar image matlabbe  ( 2019-02-01 16:56:23 -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

2 followers

Stats

Asked: 2019-01-29 17:44:29 -0500

Seen: 1,173 times

Last updated: Jan 31 '19