Set error message when there is an invalid goal transition

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
This commit is contained in:
Jacob Perron 2019-02-06 13:52:19 -08:00
parent b301180872
commit 8de90f66aa

View file

@ -88,6 +88,10 @@ rcl_action_update_goal_state(
rcl_action_goal_state_t new_state = rcl_action_transition_goal_state( rcl_action_goal_state_t new_state = rcl_action_transition_goal_state(
goal_handle->impl->state, goal_event); goal_handle->impl->state, goal_event);
if (GOAL_STATE_UNKNOWN == new_state) { if (GOAL_STATE_UNKNOWN == new_state) {
RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
"goal_handle attempted invalid transition from state %d with event %d",
goal_handle->impl->state,
goal_event);
return RCL_RET_ACTION_GOAL_EVENT_INVALID; return RCL_RET_ACTION_GOAL_EVENT_INVALID;
} }
goal_handle->impl->state = new_state; goal_handle->impl->state = new_state;