Пример #1
0
/*		public void updateFeedback<TFeedback> (ClientGoalHandle<ActionSpec> gh, TFeedback actionFeedback) where TFeedback : AActionFeedback, new()
 *              {
 *                      // Check if this feedback is for us
 *                      if ( actionGoal.GoalID.id != actionFeedback.GoalStatus.goal_id.id )
 * //			if ( actionGoal.goal_id.id != actionFeedback.status.goal_id.id )
 *                              return;
 *
 *                      if ( feedbackCallback != null )
 *                      {
 * //				EnclosureDeleter<const ActionFeedback> d(actionFeedback);
 * //				FeedbackConstPtr feedback(&(actionFeedback->feedback), d);
 *                              AFeedback feedback = actionFeedback.Feedback.Clone ();
 *                              feedbackCallback ( gh, feedback );
 *                      }
 *              }*/

        public void updateResult(ClientGoalHandle <ActionSpec> gh, AActionResult actionResult)
        {
            // Check if this feedback is for us
            if (actionGoal.GoalID.id != actionResult.GoalStatus.goal_id.id)
            {
//			if ( actionGoal.goal_id.id != actionResult.status.goal_id.id )
                return;
            }
            latest_goal_status_ = actionResult.GoalStatus;
//			latest_goal_status_ = actionResult.status;
            latestResult = actionResult;
            switch (state.state)
            {
            case CommState.StateEnum.WAITING_FOR_GOAL_ACK:
            case CommState.StateEnum.PENDING:
            case CommState.StateEnum.ACTIVE:
            case CommState.StateEnum.WAITING_FOR_RESULT:
            case CommState.StateEnum.WAITING_FOR_CANCEL_ACK:
            case CommState.StateEnum.RECALLING:
            case CommState.StateEnum.PREEMPTING:
            {
                // A little bit of hackery to call all the right state transitions before processing result
                gsarray      statusArray = new gsarray();
                List <gstat> list        = new List <gstat> (statusArray.status_list);
                list.Add(actionResult.GoalStatus);
//					list.Add ( actionResult.status );
                statusArray.status_list = list.ToArray();
                updateStatus(gh, statusArray);

                transitionToState(gh, CommState.StateEnum.DONE);
                break;
            }

            case CommState.StateEnum.DONE:
                ROS.Error("actionlib", "Got a result when we were already in the DONE state");
                break;

            default:
                ROS.Error("actionlib", "In a funny comm state: %u", state.state);
                break;
            }
        }
Пример #2
0
        public void updateResults(AActionResult actionResult)
        {
            lock ( lockObject )
            {
                var iter = list.GetIterator();
                while (iter.GetElement() != null)
                {
                    ClientGoalHandle <ActionSpec> gh = new ClientGoalHandle <ActionSpec> (this, iter.CreateHandle(), guard);
                    iter.GetElement().updateResult(gh, actionResult);
                    iter++;
                }
//				for ( int i = 0; i < list.Count; i++ )
//				foreach ( CommStateMachine<ActionSpec> item in list )
//				{
//					CommStateMachine<ActionSpec> item = list [ i ];
//					ClientGoalHandle<ActionSpec> gh = new ClientGoalHandle<ActionSpec> ( this, item.createHandle (), guard );
//					item.updateResult ( gh, actionResult );
//				}
            }
        }
 public ActionResultDecorator(AActionResult ar)
 {
     _actionResult = ar;
 }