BCLab-UNM / SwarmBaseCode-ROS

The base code provided to teams participating in NASA Swarmathon IV.
http://nasaswarmathon.com
MIT License
46 stars 46 forks source link

Patch robot localization frames #251

Open darrenchurchill opened 5 years ago

darrenchurchill commented 5 years ago

Hi guys,

A recent update to robot_localization added a new parameter, base_link_frame_output, which is used as the child_frame_id in published Odometry messages and the odom->base_link transform.

The new parameter defaults to the base_link parameter's value, before prepending the tf_prefix. However, the base_link_frame_output parameter doesn't currently get the tf_prefix prepended to its value. As a result, the /<rovername>_ODOM node generates a <rovername>/odom -> base_link transform and publishes messages to /<rovername>/odom/filtered with frame_id=<rovername>/odom and child_frame_id=base_link, causing the /<rovername>_MAP node to fail while looking up a required transform.

The disconnected and invalid tf tree looks like this:

brokenframes

And the warning message logged by /<rovername>_MAP looks like this:

[ WARN] [1552193204.070637937, 662.963000000]: Could not obtain transform from base_link to achilles/base_link. Error was Could not find a connection between 'achilles/base_link' and 'base_link' because they are not part of the same tree.Tf has two or more unconnected trees.

There are a couple of ways to fix this issue. One is here in this PR, which is to simply set the base_link_frame_output parameter explicitly, prefixed with the rover name. However, if the robot_localization package begins using the tf_prefix for this parameter, it will break this, and you'll have to pull these lines out again.

Another option is to remove the tf_prefix parameter altogether, and set any robot_localization parameters with explicit prefixes for the rover name. I'll put that fix up on a different PR.

It's important to patch this so you can hopefully provide an image with a much later freeze date than Jan 7th. I'm sure many developers are updating packages on their workstations, and I've encountered binary incompatibilities between released versions of at least one package on the Preinstalled Packages list, causing seg faults while running code built on a up-to-date laptop and deployed to a rover with older packages installed.