gazebosim / gazebosim/sdformat

Support for <fluid_added_mass> definition in URDF files

Open
#1,467 3 comments 1 reaction 1 assignee Claimed by @azeey View on GitHub
enhancement
Dominant language
C++
Stars
216
Forks
125
Avg merge
1d 14h
Merged PRs (30d)
14

Description

After https://github.com/gazebosim/sdformat/pull/1077, SDFormat v1.10 introduced [](http://sdformat.org/spec?ver=1.10&elem=link#inertial_fluid_added_mass) to the link's ``. However, the corresponding support to set this property from a URDF file has not been created. This issue aims to discuss potential solution paths.

## Desired behavior

An URDF with a `` tag defining the fluid added mass for the link

```xml










1
0
0
0
0
0
1
0
0
0
0
1
0
0
0
1
0
0
1
0
1

````

Should generate a corresponding SDF as follows:

```xml




1 2 3 -0.099999999999999992 0.20000000000000001 -0.29999999999999999
1

1
0
0
1
0
1


1
0
0
0
0
0
1
0
0
0
0
1
0
0
0
1
0
0
1
0
1



````

## Alternatives considered

Within a `` tag:

1. Handle `` as other link-specific properties, such as `mu1` and `mu2`, and place it directly into `` where it belongs since a link is always supposed to have one, and only one, inertial element. This is the expected behavior shown in the previous section.

2. Handle the entire `` block similarly to ``/ ``, i.e.: the content of the element will be inserted into each `inertial` (expected only one) of the `SDFormat` link. This is described below by using existing behavior for the `` element to insert the fluid added mass content into a link's visual element.

Original "test.urdf" example using "visual" capabilities

```xml















1
0
0
0
0
0
1
0
0
0
0
1
0
0
0
1
0
0
1
0
1


```

SDF result, inserting the desired fluid added mass into "visual". Behavior to be replicated for "inertial"

```console
$ gz sdf -p test.urdf
Warning [Utils.cc:132] [/sdf/model[@name="added_mass_example"]/link[@name="base_link"]/visual[@name="base_link_visual"]/fluid_added_mass:/home/ksim_harmonic/dev/ksim_harmonic/sdformat/test.urdf:L0]: XML Element[fluid_added_mass], child of element[visual], not defined in SDF. Copying[fluid_added_mass] as children of [visual].




0 0 0 0 0 0
1

1
0
0
1
0
1



0 0 0 0 0 0


1 1 1



1
0
0
0
0
0
1
0
0
0
0
1
0
0
0
1
0
0
1
0
1



```

## Implementation suggestion

As the URDF specification does not define fluid added mass matrix, this inertial property is only necessary for Gazebo and the `CreateInertial` method would be kept the same.

https://github.com/gazebosim/sdformat/blob/f3607761d3846dba0b660880484ff1e5eb1e9425/src/parser_urdf.cc#L2970

Depending on the preferred alternative, update `ParseSDFExtension` to either include `` directly into SDF `` or change the whole inertial behavior to be such as <`` which might require the creation of a `InsertSDFExtensionInertial` similar to [InsertSDFExtensionCollision](https://github.com/gazebosim/sdformat/blob/f3607761d3846dba0b660880484ff1e5eb1e9425/src/parser_urdf.cc#L1604) and [InsertSDFExtensionVisual](https://github.com/gazebosim/sdformat/blob/f3607761d3846dba0b660880484ff1e5eb1e9425/src/parser_urdf.cc#L1914).

https://github.com/gazebosim/sdformat/blob/f3607761d3846dba0b660880484ff1e5eb1e9425/src/parser_urdf.cc#L1273

## Additional context

If there is a clear solution path which would best fit the package design, I would be more than happy to contribute with a PR.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.