How to manage extrinsic sensor calibration dynamically with urdf?

asked 2022-01-04 04:19:00 -0500

Mehdi. gravatar image

Is there a standard way of doing this in ROS? The idea is to have a base URDF created from CAD data that can be supplemented by an extrinsic calibration file that contains the pose deltas (offsets from CAD model) for different sensors after calibrating them. Those offsets then could be applied to the URDF before loading the robot description.

I was thinking about implementing something like that but wanted to check if it already exists.

edit retag flag offensive close merge delete

Comments

Does it have to be URDF? Or would .xacro also be acceptable?

Xacro has support for loading .yaml files, which would make "updating" a template rather trivial.

ubi-agni/human_hand is a rather complex -- but very nice -- example of this.

It's also used by UniversalRobots/Universal_Robots_ROS_Driver to load the factory-provided calibration data.

gvdhoorn gravatar image gvdhoorn  ( 2022-01-04 04:29:14 -0500 )edit

Yes I was thinking about xacro/urdf actually I will check it out thanks! Feel free to post it as an answer

Mehdi. gravatar image Mehdi.  ( 2022-01-04 04:33:37 -0500 )edit

My comment was really more of a hint I believe.

If you figure out how to do this in your specific application (based on what I wrote), I'd really appreciate you posting an answer yourself showing a concrete (ie: stand-alone) example.

That would be infinitely more valuable than two links to some Github repositories.

gvdhoorn gravatar image gvdhoorn  ( 2022-01-04 07:39:47 -0500 )edit
1

Hmm, haven't known about load_yaml() support in Xacro. That looks definitely interesting and like one of the good ways to tackle this.

We use a custom piece of code that can load the calibration either from ROS params or YAML files. With YAML files, we support "hierarchy" of them, so you have e.g. some configs common to all robots of a given type and then you have specific configs for each robot. This logic is performed by a Python script, which at the end calls this snippet to render the URDF. Note that this snippet expects that each key from config has a corresponding <xacro:arg> in the XACRO file.

doc = xacro.parse(None, xacro_file)
config = ... # load the config from either ROS params or YAML files
mappings = dict()
mappings.update(config)

xacro.process_doc(doc, mappings=dict([(key, str(val)) for (key, val) in mappings.iteritems()]), in_order=True)

return ...
(more)
peci1 gravatar image peci1  ( 2022-01-09 15:06:47 -0500 )edit

The reason to support rendering of the robot model from ROS params is that is allows easy online calibration. When connected with https://github.com/peci1/dynamic_robo..., you can notify the state publisher that the URDF has changed and it automatically re-computes and re-publishes all of the static transforms that correspond to the updated calibration.

peci1 gravatar image peci1  ( 2022-01-09 15:10:50 -0500 )edit