twizy_bringup Python API

twizyparam

Enhanced YAML parsing for roslaunch

This script can be used to parse YAML-files before uploading the contents as parameters to the ROS parameter server in launch files. The following entry in a roslaunch file accomplishes this:

<rosparam subst_value="true">
    $(eval exec('global load; from twizy_bringup.twizyparam import load') or load(f'{find("my_pkg")}/my_params.yaml'))
</rosparam>

This is quite the hack, but it’s atleast something before the launching system is overhauled in ROS 2

twizy_bringup.twizyparam.load(path)[source]

Load/convert a YAML file

See parse() for more information.

Parameters:path (str) – Path to a YAML file
Returns:A plain YAML string where the tags defined above have been expanded
twizy_bringup.twizyparam.parse(path)[source]

Parse a YAML file

The following extra tags are supported:

  • !eval: Evaluates a Python expression
  • !include: Includes another YAML file by path
  • !variable: A variable to be used in !eval expressions
Parameters:path (str) – Path to a YAML file
Returns:A parsed YAML object where the tags defined above have been expanded

Indices and tables