better_launch.elements.live_params_mixin module

class better_launch.elements.live_params_mixin.LiveParamsMixin

Bases: object

Mixin class to add interactions with ROS parameters for running nodes. This class must be mixed in with an object providing a fullname member.

get_live_params(*params: str, timeout: float = 5.0) dict[str, Any]

Retrieves the values for the specified ROS parameters of this node. If no parameters are provided, all parameters will be listed.

This will only work if the node is up and running. Note that this is different from params() in that this method will directly query the ROS node, while params is only used when starting the node.

Parameters

*paramsstr

ROS parameter names to retrieve.

timeoutfloat, optional

How long to wait for the service to connect.

Returns

Any

The names and values of the ROS parameters of this node as specified.

Raises

TimeoutError

If the service fails to connect.

list_live_params(*, timeout: float = 5.0) list[str]

List the names of the ROS parameters this node has registered.

This will only work if the node is up and running. Note that this is different from params() in that this method will directly query the ROS node, while params is only used when starting the node.

Parameters

timeoutfloat, optional

How long to wait for the service to connect.

Returns

list[str]

A list of this node’s ROS parameters.

Raises

TimeoutError

If the service fails to connect.

set_live_params(params: dict[str, Any], *, timeout: float = 5.0) dict[str, bool]

Sets the specified ROS parameters on this node.

This will only work if the node is up and running. This will also not change params(), which is used for starting the node.

Parameters

paramsdict[str, Any]

The parameters to update.

timeoutfloat, optional

How long to wait for the service to connect.

Returns

dict[str, bool]:

A dict showing which parameter updates succeeded.

Raises

TimeoutError

If the service fails to connect.

set_live_params_atomic(params: dict[str, Any], *, timeout: float = 5.0) bool

Sets the specified ROS parameters on this node. No updates will be performed if any of the operations fail.

This will only work if the node is up and running. This will also not change params(), which is used for starting the node.

Parameters

paramsdict[str, Any]

The parameters to update.

timeoutfloat, optional

How long to wait for the service to connect.

Returns

bool:

True if all updates succeeded, False otherwise.

Raises

TimeoutError

If the service fails to connect.