@@ -103,7 +103,7 @@ void AMLifeCycle::lifecycleCB(const brain_box_msgs::LifeCycleCommand::ConstPtr m
103103 configure ();
104104 break ;
105105 case LifeCycleCommand::CREATE:
106- ROS_WARN_STREAM (" illegal command " << life_cycle_mediator_.commandToString (LifeCycleCommand::CREATE));
106+ ROS_WARN_STREAM (" illegal command " << life_cycle_mediator_.commandToString (LifeCycleCommand::CREATE) << " [7YT8] " );
107107 break ;
108108 case LifeCycleCommand::DEACTIVATE:
109109 transition (" deactivate" , LifeCycleState::ACTIVE, LifeCycleState::DEACTIVATING, LifeCycleState::INACTIVE,
@@ -124,17 +124,17 @@ void AMLifeCycle::transition(std::string transition_name, LifeCycleState initial
124124{
125125 if (life_cycle_info_.state == initial_state)
126126 {
127- ROS_INFO_STREAM (transition_name << " , current state: " << life_cycle_mediator_.stateToString (life_cycle_info_.state ));
127+ ROS_INFO_STREAM (transition_name << " , current state: " << life_cycle_mediator_.stateToString (life_cycle_info_.state ) << " [ASWU] " );
128128 setState (transition_state);
129129 on_function ();
130130 }
131131 else if (life_cycle_info_.state == transition_state || life_cycle_info_.state == final_state)
132132 {
133- ROS_DEBUG_STREAM (" ignoring redundant " << transition_name);
133+ ROS_DEBUG_STREAM (" ignoring redundant " << transition_name << " [0393] " );
134134 }
135135 else
136136 {
137- ROS_WARN_STREAM (" received illegal " << transition_name << " in state " << life_cycle_mediator_.stateToString (life_cycle_info_.state ));
137+ ROS_WARN_STREAM (" received illegal " << transition_name << " in state " << life_cycle_mediator_.stateToString (life_cycle_info_.state ) << " [JGV5] " );
138138 }
139139}
140140
@@ -237,12 +237,12 @@ void AMLifeCycle::destroy()
237237{
238238 if (life_cycle_mediator_.illegalDestroy (life_cycle_info_))
239239 {
240- ROS_INFO_STREAM (" received illegal activate in state " << life_cycle_mediator_.stateToString (life_cycle_info_.state ));
240+ ROS_INFO_STREAM (" received illegal activate in state " << life_cycle_mediator_.stateToString (life_cycle_info_.state ) << " [45RT] " );
241241 }
242242 /* This condition is hit only if state equals FINALIZED. Checking SHUTTING_DOWN is redundant */
243243 else
244244 {
245- ROS_INFO_STREAM (" current state: " << life_cycle_mediator_.stateToString (life_cycle_info_.state ));
245+ ROS_INFO_STREAM (" current state: " << life_cycle_mediator_.stateToString (life_cycle_info_.state ) << " [RE45] " );
246246 onDestroy ();
247247 }
248248}
@@ -281,22 +281,29 @@ void AMLifeCycle::error(std::string error_code, bool forced)
281281
282282void AMLifeCycle::error (std::string message, std::string error_code, bool forced)
283283{
284- std::string error_code_message = " [" + error_code + " ] " ;
285- if (!forced && life_cycle_mediator_.redundantError (life_cycle_info_))
286- {
287- ROS_WARN_STREAM (" Error called again, but previously reported." << error_code_message);
288- }
289- else if (!forced && withinConfigureTolerance ())
284+ std::string error_code_message = " Error[" + error_code + " ] " ;
285+ if (withinConfigureTolerance () && !forced)
290286 {
291- ROS_WARN_STREAM_THROTTLE (throttle_info_.warn_throttle_s ," Ignoring" << error_code_message << " during configure tolerance of " << configure_tolerance_s << " seconds [GFRT]" );
287+ ROS_WARN_STREAM_THROTTLE (throttle_info_.warn_throttle_s ," Ignoring tolerant error for ( " << configure_tolerance_s << " s) ` " << message << " ` " << error_code_message << " [GFRT]" );
292288 }
293289 else
294290 {
295- std::string forced_prefix = forced?" Terminal " :" " ;
296- ROS_ERROR_STREAM (message << " state: " << life_cycle_mediator_.stateToString (life_cycle_info_.state ) << error_code_message << " [R45Y]" );
297- setState (LifeCycleState::ERROR_PROCESSING);
298- setStatus (LifeCycleStatus::ERROR);
299- onError ();
291+ std::string forced_prefix = forced?" Terminal " :" " ;
292+ std::string repeat_prefix = " " ;
293+
294+ // only change the state if
295+ if (!life_cycle_mediator_.redundantError (life_cycle_info_))
296+ {
297+ setState (LifeCycleState::ERROR_PROCESSING);
298+ setStatus (LifeCycleStatus::ERROR);
299+ onError ();
300+ }
301+ else
302+ {
303+ repeat_prefix = " Repeated " ;
304+ }
305+ std::string error_explanation=forced_prefix + repeat_prefix + error_code_message;
306+ ROS_ERROR_STREAM (message << " state: " << life_cycle_mediator_.stateToString (life_cycle_info_.state ) << error_explanation << " [R45Y]" );
300307 }
301308}
302309
@@ -371,7 +378,11 @@ void AMLifeCycle::addStatistics(diagnostic_updater::DiagnosticStatusWrapper& dsw
371378 }
372379 else
373380 {
374- setStatus (status);
381+ // only report status if not already errored
382+ if (!life_cycle_mediator_.redundantError (life_cycle_info_))
383+ {
384+ setStatus (status);
385+ }
375386
376387 // configuring is a special case where tolerance for errors is allowed
377388 if (getState () == LifeCycleState::CONFIGURING)
@@ -495,9 +506,8 @@ bool AMLifeCycle::setStatus(const LifeCycleStatus status)
495506 // if we are in error and want to leave it
496507 if (life_cycle_info_.status == LifeCycleStatus::ERROR && status != LifeCycleStatus::ERROR)
497508 {
498- ROS_WARN_STREAM_THROTTLE (getThrottle (), " requested to change status from ERROR to " << life_cycle_mediator_.statusToString (status));
509+ ROS_WARN_STREAM_THROTTLE (getThrottle (), " requested to change status from ERROR to " << life_cycle_mediator_.statusToString (status) << " [DFRE] " );
499510 }
500-
501511 else if (life_cycle_mediator_.setStatus (status, life_cycle_info_))
502512 {
503513 sendNodeUpdate ();
0 commit comments