/** * \brief Resends this goal [with the same GoalID] to the ActionServer * * Useful if the user thinks that the goal may have gotten lost in transit */ public void resend() { if (!isActive) { ROS.Error("actionlib", "Trying to resend() on an inactive ClientGoalHandle. You are incorrectly using a ClientGoalHandle"); } DestructionGuard.ScopedProtector protector = new DestructionGuard.ScopedProtector(guard); if (!protector.isProtected()) { ROS.Error("actionlib", "This action client associated with the goal handle has already been destructed. Ignoring this resend() call"); return; } UnityEngine.Debug.Assert(goalManager != null); AActionGoal actionGoal = null; lock ( lockObject ) { actionGoal = listHandle.GetElement().getActionGoal(); // actionGoal = listHandle.getElem()->getActionGoal(); } if (actionGoal == null) { ROS.Error("actionlib", "BUG: Got a NULL actionGoal"); } if (goalManager.sendGoalDelegate != null) { goalManager.sendGoalDelegate(actionGoal); } }
public CommStateMachine(AActionGoal actionGoal, TransitionCallback <ActionSpec> transitionCallback, FeedbackCallback <ActionSpec> feedbackCallback) { UnityEngine.Debug.Assert(actionGoal != null); this.actionGoal = actionGoal; this.transitionCallback = transitionCallback; this.feedbackCallback = feedbackCallback; state = CommState.StateEnum.WAITING_FOR_GOAL_ACK; }
/** * \brief Sends a cancel message for this specific goal to the ActionServer * * Also transitions the Communication State Machine to WAITING_FOR_CANCEL_ACK */ public void cancel() { if (!isActive) { ROS.Error("actionlib", "Trying to cancel() on an inactive ClientGoalHandle. You are incorrectly using a ClientGoalHandle"); return; } UnityEngine.Debug.Assert(goalManager != null); DestructionGuard.ScopedProtector protector = new DestructionGuard.ScopedProtector(guard); if (!protector.isProtected()) { ROS.Error("actionlib", "This action client associated with the goal handle has already been destructed. Ignoring this call"); return; } lock ( lockObject ) { switch (listHandle.GetElement().getCommState().state) { case CommState.StateEnum.WAITING_FOR_GOAL_ACK: case CommState.StateEnum.PENDING: case CommState.StateEnum.ACTIVE: case CommState.StateEnum.WAITING_FOR_CANCEL_ACK: break; // Continue standard processing case CommState.StateEnum.WAITING_FOR_RESULT: case CommState.StateEnum.RECALLING: case CommState.StateEnum.PREEMPTING: case CommState.StateEnum.DONE: ROS.Debug("actionlib", "Got a cancel() request while in state [%s], so ignoring it", listHandle.GetElement().getCommState().toString()); return; default: ROS.Error("actionlib", "BUG: Unhandled CommState: %u", listHandle.GetElement().getCommState().state); return; } } AActionGoal actionGoal = listHandle.GetElement().getActionGoal(); Messages.actionlib_msgs.GoalID cancelMsg = new Messages.actionlib_msgs.GoalID(); cancelMsg.stamp = ROS.GetTime(); cancelMsg.id = listHandle.GetElement().getActionGoal().GoalID.id; // cancelMsg.id = listHandle.GetElement ().getActionGoal ()->goal_id.id; if (goalManager.cancelDelegate != null) { goalManager.cancelDelegate(cancelMsg); } listHandle.GetElement().transitionToState(this, CommState.StateEnum.WAITING_FOR_CANCEL_ACK); }
void SendGoalFunc(AActionGoal actionGoal) { goalPublisher.publish(new ActionGoalDecorator(actionGoal)); }
public ActionGoalDecorator(AActionGoal ag) { _actionGoal = ag; }