ros2cli.helpers module
- ros2cli.helpers.before_invocation(func, hook)
Invoke a hook before every func invocation.
hook may take no arguments or take the func and arbitrary positional and keyword arguments.
- ros2cli.helpers.bind(func, *args, **kwargs)
Bind a function with a set of arguments.
A functools.partial equivalent that is actually a function.
- ros2cli.helpers.check_discovery_configuration()
Check for invalid ROS discovery configuration and print warning if needed.
Warns when ROS_AUTOMATIC_DISCOVERY_RANGE=OFF is set without ROS_STATIC_PEERS, which results in no discovery mechanism being available.
The warning is only shown once per process to avoid duplicate warnings when multiple nodes are created.
- ros2cli.helpers.collect_stdin()
- ros2cli.helpers.get_rmw_additional_env(rmw_implementation: str) Dict[str, str]
Get a dictionary of additional environment variables based on rmw.
- ros2cli.helpers.get_ros_domain_id()
- ros2cli.helpers.interactive_select(items: list[str], prompt: str = 'Select an item:') str | None
Launch interactive fuzzy search using fzf to select from a list of items.
- Parameters:
items – List of items to select from
prompt – Prompt message to display in fzf
- Returns:
Selected item or None if user cancelled or fzf not available
- ros2cli.helpers.pretty_print_call(func, *args, **kwargs)
Print a function invocation.
See before_invocation for usage as a hook.
- ros2cli.helpers.unsigned_int(string)
- ros2cli.helpers.wait_for(predicate, timeout, period=0.1)
Wait for a predicate to evaluate to True.
- Parameters:
timeout – duration, in seconds, to wait for the predicate to evaluate to True. Non-positive durations will result in an indefinite wait.
period – predicate evaluation period, in seconds.
- Returns:
predicate result