rosidl_runtime_py.convert module

rosidl_runtime_py.convert.get_message_slot_types(msg: Any) OrderedDict

Return an OrderedDict of the slot types of a message.

Parameters:

msg – The ROS message to get members types from.

Returns:

An OrderedDict with message member names as keys and slot types as values.

rosidl_runtime_py.convert.message_to_csv(msg: Any, *, truncate_length: int | None = None, no_arr: bool = False, no_str: bool = False) str

Convert a ROS message to string of comma-separated values.

Parameters:
  • msg – The ROS message to convert.

  • truncate_length – Truncate values for all message fields to this length. This does not truncate the list of message fields.

  • no_arr – Exclude array fields of the message.

  • no_str – Exclude string fields of the message.

Returns:

A string of comma-separated values representing the input message.

rosidl_runtime_py.convert.message_to_ordereddict(msg: Any, *, truncate_length: int | None = None, no_arr: bool = False, no_str: bool = False) OrderedDict

Convert a ROS message to an OrderedDict.

Parameters:
  • msg – The ROS message to convert.

  • truncate_length – Truncate values for all message fields to this length. This does not truncate the list of fields (ie. the dictionary keys).

  • no_arr – Exclude array fields of the message.

  • no_str – Exclude string fields of the message.

Returns:

An OrderedDict where the keys are the ROS message fields and the values are set to the values of the input message.

rosidl_runtime_py.convert.message_to_yaml(msg: Any, *, truncate_length: int | None = None, no_arr: bool = False, no_str: bool = False, flow_style: bool = False) str

Convert a ROS message to a YAML string.

Parameters:
  • msg – The ROS message to convert.

  • truncate_length – Truncate values for all message fields to this length. This does not truncate the list of message fields.

  • no_arr – Exclude array fields of the message.

  • no_str – Exclude string fields of the message.

  • flow_style – Whether to use block style or flow style; defaults to block style.

Returns:

A YAML string representation of the input ROS message.