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.

Note that this is different from the params used to start the node. This method will directly query the ROS node for its parameters, while params is used to pass arguments on startup.

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.

Note that this is different from the params used to start the node. This method will directly query the ROS node for its parameters, while params is used to pass arguments on startup.

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.

Note that this is different from the params used to start the node. This method will directly query the ROS node for its parameters, while params is used to pass arguments on startup.

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.

Note that this is different from the params used to start the node. This method will directly query the ROS node for its parameters, while params is used to pass arguments on startup.

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.