MoveIt Serialization

Serializer for multiple ros messages including moveit_msgs. Supports yaml serialization through rapidyaml.

Rapidyaml

One of the fastest yaml parser and emiter available.

  • Current version: captain-yoshi/rapidyaml/e9ec9fc.
  • Built internally to avoid unwanted changes to the global error handler.
  • Custom Tree::has_all method for subset node comparaison (not yet merged).
  • C4_DEBUG_BREAK is disabled at runtime in the error handler.

ROS Messages

The serialization uses the same ros messages built-in types convention except for the bool/bool[] types. These types are encoded as boolean's true/false instead of uint8_t 1/0.

Encoding a message will give an exact representation of the message (except for boolean's). Decoding a message follows the exact message structure. There are some messages that have optional decoding utilities:

ROS Msg Type Alternate Decoding Option
geometry_msgs::Point [x, y, z]
geometry_msgs::Vector3 [x, y, x]
geometry_msgs::Quaternion [x, y, z, w]
shape_msgs::Mesh resource: package://my_pkg_name/mesh.stl
dimensions: [x, y, z]

Caveats

Encoding for bool MUST be formatted using fmt::boolalpha.

Encoding for floats/double MUST be formated using freal. This is to ensure that the conversion of a floating-point value to text and back is exact. The drawback is that it needs 9 and 17 digits respectively for floats and doubles, thus increasing the size of memory needed.

When emitting to JSON, some floating numbers will automatically be converted. This is to ensure a valid JSON format. Parsing the 8e888 value with a JavaScript parser, e.g. JSON.parse(), will revert the value to Infinity, thus retaining the original value.

Number YAML JSON
-Infinity inf 8e888
+Infinity -inf -8e888
NaN nan null

Contribution

The initial serialization using yaml-cpp was done by Zachary Kingston from the robowflex project.