File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -281,6 +281,11 @@ class SuperNodeMediator
281
281
*/
282
282
bool transitionIsValid (const StateTransition&);
283
283
284
+ /* *
285
+ * @returns true - if we are allowed to transition to this state regardless of the state we are currently in
286
+ */
287
+ bool forceTransition (const SuperState& to_state);
288
+
284
289
private:
285
290
/* * name of supervisor node */
286
291
const std::string SUPER_NODE_NAME;
@@ -295,7 +300,7 @@ class SuperNodeMediator
295
300
/* * @brief temporary hack to allow manifested nodes to not halt transitions.*/
296
301
bool lifeCycleNotYetImplemented (string node_name);
297
302
298
- bool forceTransition (StateTransition transition);
303
+
299
304
};
300
305
}
301
306
Original file line number Diff line number Diff line change @@ -606,8 +606,9 @@ class AMSuper : AMLifeCycle
606
606
{
607
607
ROS_INFO_STREAM (state_mediator_.stateToString (supervisor_.system_state ) << " --> "
608
608
<< state_mediator_.stateToString (state));
609
-
610
- bool legal = state_mediator_.allowsTransition (supervisor_.system_state , state);
609
+ bool legal = true ;
610
+ if (!node_mediator_.forceTransition (state))
611
+ legal = state_mediator_.allowsTransition (supervisor_.system_state , state);
611
612
612
613
if (!legal)
613
614
{
Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ SuperNodeMediator::TransitionInstructions SuperNodeMediator::transitionReady(Sup
170
170
171
171
// transition to new state if checks passed or forced
172
172
bool checks_passed = check_results.first ;
173
- if (checks_passed || forceTransition (transition))
173
+ if (checks_passed || forceTransition (transition. to_state ))
174
174
{
175
175
transition_instructions.ready_for_transition = true ;
176
176
transition_instructions.new_state = transition.to_state ;
@@ -196,9 +196,9 @@ SuperNodeMediator::TransitionInstructions SuperNodeMediator::transitionReady(Sup
196
196
}
197
197
198
198
199
- bool SuperNodeMediator::forceTransition (StateTransition transition )
199
+ bool SuperNodeMediator::forceTransition (const SuperState& to_state )
200
200
{
201
- return transition. to_state == SuperState::MANUAL || transition. to_state == SuperState::SHUTDOWN;
201
+ return to_state == SuperState::MANUAL || to_state == SuperState::SHUTDOWN;
202
202
}
203
203
204
204
bool SuperNodeMediator::lifeCycleNotYetImplemented (string node_name)
You can’t perform that action at this time.
0 commit comments