File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,7 @@ def trigger_shutdown(self):
163163 lifecycle_msgs .msg .Transition .TRANSITION_INACTIVE_SHUTDOWN )
164164 if current_state == 'active' :
165165 return self .__change_state (lifecycle_msgs .msg .Transition .TRANSITION_ACTIVE_SHUTDOWN )
166+ raise _rclpy .RCLError ('Shutdown transtion not possible' )
166167
167168 def trigger_activate (self ):
168169 return self .__change_state (lifecycle_msgs .msg .Transition .TRANSITION_ACTIVATE )
Original file line number Diff line number Diff line change @@ -69,7 +69,19 @@ def test_lifecycle_state_transitions():
6969 with pytest .raises (_rclpy .RCLError ):
7070 node .trigger_deactivate ()
7171 assert node .trigger_shutdown () == TransitionCallbackReturn .SUCCESS
72+ with pytest .raises (_rclpy .RCLError ):
73+ node .trigger_shutdown ()
7274 node .destroy_node ()
75+ # Again but trigger shutdown from 'inactive' instead of 'unconfigured'
76+ node = LifecycleNode (
77+ 'test_lifecycle_state_transitions_2' , enable_communication_interface = False )
78+ assert node .trigger_shutdown () == TransitionCallbackReturn .SUCCESS
79+ # Again but trigger shutdown from 'active'
80+ node = LifecycleNode (
81+ 'test_lifecycle_state_transitions_3' , enable_communication_interface = False )
82+ assert node .trigger_configure () == TransitionCallbackReturn .SUCCESS
83+ assert node .trigger_activate () == TransitionCallbackReturn .SUCCESS
84+ assert node .trigger_shutdown () == TransitionCallbackReturn .SUCCESS
7385
7486 class ErrorOnConfigureHandledCorrectlyNode (LifecycleNode ):
7587
You can’t perform that action at this time.
0 commit comments