gazebosim / gazebosim/sdformat

Add `gz sdf` command that converts a file to an older version of the spec

Open
#1,334 0 comments 2 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
216
Forks
125
Avg merge
1d 14h
Merged PRs (30d)
14

Description

## Desired behavior

If I have a file using new features of the SDFormat spec, it means that it can't be loaded in software that only supports older versions of the spec (such as [gzweb](https://github.com/osrf/gzweb/blob/master/gz3d/src/gzsdfparser.js), which only supports up to SDFormat 1.6). It would be helpful to have a tool that could convert a file with version 1.7 or newer back to 1.6.

## Alternatives considered

## Implementation suggestion

Provide the interface as a `--convert-to-version` option to `gz sdf --print`:

~~~
gz sdf --print --convert-to-version
~~~

A short list of the types of conversions to be expected when converting between each version:

* 1.7 -> 1.6: resolve all poses with the default value of `//pose/@relative_to`
* 1.8 -> 1.7:
* resolve joint parent/child frames to a link name or `world`
* error if ellipsoid geometry is detected, or replace it with an equivalently scaled mesh
* replace capsule geometries with equivalent cylinder and spheres
* 1.9 -> 1.8: convert all poses to use Euler angles in radians
* 1.10 -> 1.9: error if `//world/joint` tags are detected
* 1.11 -> 1.10: resolve all auto-inertial values and print in an `` block

It may be simplest to start with a tool that converts SDFormat 1.11 files to 1.10 by expanding any auto-inertial blocks to contain the full computed value.

## Additional context

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.