better_launch.elements.ros2_launch_wrapper moduleο
- class better_launch.elements.ros2_launch_wrapper.Ros2LaunchWrapper(name: str = 'LaunchService', launchservice_args: list[str] | None = None, output: Literal['screen', 'log', 'own_log', 'none'] | set[Literal['screen', 'log', 'own_log', 'none']] = 'screen')ο
Bases:
AbstractNode
- describe_launch_actions() str ο
Returns a best-effort summary of all LaunchDescriptions that have been loaded so far.
Since ROS2 does not provide a way to serialize its slew of launch actions (beyond maybe pickle), it is not possible to create a full representation without special handlers. However, most launch actions expose their relevant data as properties. This function will look for these and recurse into them if they return launch actions.
Returnsο
- str
A formatted and indented representation of the launch descriptions scheduled for loading thus far.
- is_lifecycle_node(timeout: float | None = None) bool ο
This is never a lifecycle node.
- is_ros2_connected(timeout: float | None = None) bool ο
Equal to
is_running()
for this class.
- property is_running: boolο
True if the node is currently running.
- join(timeout: float | None = None) None ο
Wait for the underlying process to terminate and return its exit code. Returns immediately if the process is not running.
Parametersο
- timeoutfloat, optional
How long to wait for the process to finish. Wait forever if None.
Returnsο
- int
The exit code of the process, or None if it is already terminated.
Raisesο
- TimeoutError
If a timeout was specified and the process is still running by the time the timeout expires.
- property launchservice_args: list[str]ο
Additional arguments that are passed to the launch service.
- property pid: intο
The process ID of the node process. Will be -1 if the process is not running.
- queue_ros2_actions(*actions) None ο
Add ROS2 actions that will be loaded asynchronously by the launch service once it is running. Actions are bundled as a LaunchDescription before sending them off.
- send_signal(signum: int) None ο
- shutdown(reason: str, signum: int = Signals.SIGTERM, timeout: float = 0.0) None ο
Shutdown this node. Once this succeeds,
is_running()
will return False.Parametersο
- reasonstr
A human-readable string describing why this node is being shutdown.
- signumint, optional
The signal that should be send to the node (if supported).
- timeoutfloat, optional
How long to wait for the node to shutdown before returning. Donβt wait if timeout is 0.0. Wait forever if timeout is None.
Raisesο
- TimeoutError
If a timeout > 0 was set and the node did not shutdown before then.
- start() None ο
Start this node. Once this succeeds,
is_running()
will return True.