better_launch.elements.lifecycle_manager moduleο
- class better_launch.elements.lifecycle_manager.AbstractNodeο
Bases:
object
- class better_launch.elements.lifecycle_manager.LifecycleManager(node: AbstractNode)ο
Bases:
object
- property current_stage: LifecycleStageο
The nodeβs current (that is, last known) lifecycle stage.
- classmethod find_transition_path(start_ros_state: int, goal_ros_state: int) list[int] ο
Finds a sequence of transitions that will bring a node from an initial lifecycle state (the ROS state, not our LifecycleStage enum) to a target lifecycle state.
This is fairly low level and probably never needed.
Parametersο
- start_ros_stateint
The initial ROS lifecycle state.
- goal_ros_stateint
The final ROS lifecycle state.
Returnsο
- list[int]
A sequence of ROS lifecycle transitions that form a path from the start state to the goal state.
- classmethod is_lifecycle(node: AbstractNode, timeout: float = None) bool ο
Checks whether a node supports lifecycle management.
For a node to support lifecycle management, it must be running, be registered with ROS and offer the ROS lifecycle management services. This method only checks whether one of the key services is present.
If a timeout is specified, the check will be repeated until it succeeds or the specified amount of time has passed. This is to ensure that a freshly started node had enough time to create its topics, especially on slower devices. See
AbstractNode.is_lifecycle_node()
for additional information.Parametersο
- nodeAbstractNode
The node object to check for lifecycle support.
- timeoutfloat
How long to wait at most for the lifecycle services to appear. Wait forever if None.
Returnsο
- bool
True if the node supports lifecycle management, False otherwise.
- property ros_state: intο
The nodeβs current (that is, last known) ROS lifecycle state ID.
- transition(target_stage: LifecycleStage) bool ο
Transition the managed node into the target lifecycle stage. Does nothing if the node is already in the desired stage.
Note that you donβt have to do step-by-step transitions - simply specify the stage you want the node to end up in and it will go through all the intermediate steps (assuming a path exists).
Parametersο
- target_stageLifecycleStage
The lifecycle stage you want the node to end up in.
Returnsο
- bool
True if the transition sequence succeeded, False if one of the steps failed.
Raisesο
- ValueError
If no path to the target stage could be found.