Exemple #1
0
 private void toolStripButton9_Click(object sender, EventArgs e)
 {
     am.GoalID goalID = new am.GoalID();
     goalID.id    = "";
     goalID.stamp = new Messages.std_msgs.Time();
     goalCancelPub.publish(goalID);
 }
Exemple #2
0
        public override void Randomize()
        {
            int    arraylength = -1;
            Random rand        = new Random();
            int    strlength;

            byte[] strbuf, myByte;

            //goal_id
            goal_id = new Messages.actionlib_msgs.GoalID();
            goal_id.Randomize();
            //status
            myByte = new byte[1];
            rand.NextBytes(myByte);
            status = myByte[0];
            //text
            strlength = rand.Next(100) + 1;
            strbuf    = new byte[strlength];
            rand.NextBytes(strbuf);  //fill the whole buffer with random bytes
            for (int __x__ = 0; __x__ < strlength; __x__++)
            {
                if (strbuf[__x__] == 0) //replace null chars with non-null random ones
                {
                    strbuf[__x__] = (byte)(rand.Next(254) + 1);
                }
            }
            strbuf[strlength - 1] = 0; //null terminate
            text = Encoding.ASCII.GetString(strbuf);
        }
Exemple #3
0
        /**
         * \brief Cancel all goals that were stamped at and before the specified time
         * \param time All goals stamped at or before `time` will be canceled
         */
        public void cancelGoalsAtAndBeforeTime(Time time)
        {
            goalid cancel_msg = new goalid();

            cancel_msg.stamp = time;
            cancel_msg.id    = "";
            cancelPublisher.publish(cancel_msg);
        }
Exemple #4
0
        /**
         * \brief Cancel all goals currently running on the action server
         *
         * This preempts all goals running on the action server at the point that
         * this message is serviced by the ActionServer.
         */
        public void cancelAllGoals()
        {
            goalid cancel_msg = new goalid();

            // CancelAll policy encoded by stamp=0, id=0
            cancel_msg.stamp = new Time();
            cancel_msg.id    = "";
            cancelPublisher.publish(cancel_msg);
        }
 public override void Randomize()
 {
     header = new Messages.std_msgs.Header();
     header.Randomize();
     goal_id = new Messages.actionlib_msgs.GoalID();
     goal_id.Randomize();
     goal = new LandingGoal();
     goal.Randomize();
 }
Exemple #6
0
        /**
         * \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);
        }
Exemple #7
0
        public override void Deserialize(byte[] SERIALIZEDSTUFF, ref int currentIndex)
        {
            int    arraylength       = -1;
            bool   hasmetacomponents = false;
            object __thing;
            int    piecesize = 0;

            byte[] thischunk, scratch1, scratch2;
            IntPtr h;

            //header
            header = new Header(SERIALIZEDSTUFF, ref currentIndex);
            //goal_id
            goal_id = new Messages.actionlib_msgs.GoalID(SERIALIZEDSTUFF, ref currentIndex);
            //goal
            goal = new Messages.object_recognition_msgs.ObjectRecognitionGoal(SERIALIZEDSTUFF, ref currentIndex);
        }
Exemple #8
0
        public override void Randomize()
        {
            int    arraylength = -1;
            Random rand        = new Random();
            int    strlength;

            byte[] strbuf, myByte;

            //header
            header = new Header();
            header.Randomize();
            //goal_id
            goal_id = new Messages.actionlib_msgs.GoalID();
            goal_id.Randomize();
            //goal
            goal = new Messages.object_recognition_msgs.ObjectRecognitionGoal();
            goal.Randomize();
        }
Exemple #9
0
        public override void Randomize()
        {
            int    arraylength = -1;
            Random rand        = new Random();
            int    strlength;

            byte[] strbuf, myByte;

            //header
            header = new Header();
            header.Randomize();
            //goal_id
            goal_id = new Messages.actionlib_msgs.GoalID();
            goal_id.Randomize();
            //goal
            goal = new Messages.control_msgs.SingleJointPositionGoal();
            goal.Randomize();
        }
        public override void Randomize()
        {
            int    arraylength = -1;
            Random rand        = new Random();
            int    strlength;

            byte[] strbuf, myByte;

            //header
            header = new Header();
            header.Randomize();
            //goal_id
            goal_id = new Messages.actionlib_msgs.GoalID();
            goal_id.Randomize();
            //goal
            goal = new Messages.tf2_msgs.LookupTransformGoal();
            goal.Randomize();
        }
Exemple #11
0
        public override void Randomize()
        {
            int    arraylength = -1;
            Random rand        = new Random();
            int    strlength;

            byte[] strbuf, myByte;

            //header
            header = new Header();
            header.Randomize();
            //goal_id
            goal_id = new Messages.actionlib_msgs.GoalID();
            goal_id.Randomize();
            //goal
            goal = new Messages.humanoid_nav_msgs.ExecFootstepsGoal();
            goal.Randomize();
        }
Exemple #12
0
        public override void Deserialize(byte[] SERIALIZEDSTUFF, ref int currentIndex)
        {
            int    arraylength       = -1;
            bool   hasmetacomponents = false;
            object __thing;
            int    piecesize = 0;

            byte[] thischunk, scratch1, scratch2;
            IntPtr h;

            //goal_id
            goal_id = new Messages.actionlib_msgs.GoalID(SERIALIZEDSTUFF, ref currentIndex);
            //status
            status = SERIALIZEDSTUFF[currentIndex++];
            //text
            text          = "";
            piecesize     = BitConverter.ToInt32(SERIALIZEDSTUFF, currentIndex);
            currentIndex += 4;
            text          = Encoding.ASCII.GetString(SERIALIZEDSTUFF, currentIndex, piecesize);
            currentIndex += piecesize;
        }
Exemple #13
0
        public override byte[] Serialize(bool partofsomethingelse)
        {
            int  currentIndex = 0, length = 0;
            bool hasmetacomponents = false;

            byte[]        thischunk, scratch1, scratch2;
            List <byte[]> pieces = new List <byte[]>();
            GCHandle      h;

            //goal_id
            if (goal_id == null)
            {
                goal_id = new Messages.actionlib_msgs.GoalID();
            }
            pieces.Add(goal_id.Serialize(true));
            //status
            pieces.Add(new[] { (byte)status });
            //text
            if (text == null)
            {
                text = "";
            }
            scratch1  = Encoding.ASCII.GetBytes((string)text);
            thischunk = new byte[scratch1.Length + 4];
            scratch2  = BitConverter.GetBytes(scratch1.Length);
            Array.Copy(scratch1, 0, thischunk, 4, scratch1.Length);
            Array.Copy(scratch2, thischunk, 4);
            pieces.Add(thischunk);
            //combine every array in pieces into one array and return it
            int __a_b__f = pieces.Sum((__a_b__c) => __a_b__c.Length);
            int __a_b__e = 0;

            byte[] __a_b__d = new byte[__a_b__f];
            foreach (var __p__ in pieces)
            {
                Array.Copy(__p__, 0, __a_b__d, __a_b__e, __p__.Length);
                __a_b__e += __p__.Length;
            }
            return(__a_b__d);
        }
Exemple #14
0
        public override byte[] Serialize(bool partofsomethingelse)
        {
            int  currentIndex = 0, length = 0;
            bool hasmetacomponents = false;

            byte[]        thischunk, scratch1, scratch2;
            List <byte[]> pieces = new List <byte[]>();
            GCHandle      h;

            //header
            if (header == null)
            {
                header = new Header();
            }
            pieces.Add(header.Serialize(true));
            //goal_id
            if (goal_id == null)
            {
                goal_id = new Messages.actionlib_msgs.GoalID();
            }
            pieces.Add(goal_id.Serialize(true));
            //goal
            if (goal == null)
            {
                goal = new Messages.object_recognition_msgs.ObjectRecognitionGoal();
            }
            pieces.Add(goal.Serialize(true));
            //combine every array in pieces into one array and return it
            int __a_b__f = pieces.Sum((__a_b__c) => __a_b__c.Length);
            int __a_b__e = 0;

            byte[] __a_b__d = new byte[__a_b__f];
            foreach (var __p__ in pieces)
            {
                Array.Copy(__p__, 0, __a_b__d, __a_b__e, __p__.Length);
                __a_b__e += __p__.Length;
            }
            return(__a_b__d);
        }
Exemple #15
0
 void sendCancelFunc(goalid cancel_msg)
 {
     cancelPublisher.publish(cancel_msg);
 }
 public override void Deserialize(byte[] SERIALIZEDSTUFF, ref int currentIndex)
 {
     header  = new Messages.std_msgs.Header(SERIALIZEDSTUFF, ref currentIndex);
     goal_id = new Messages.actionlib_msgs.GoalID(SERIALIZEDSTUFF, ref currentIndex);
     goal    = new LandingGoal(SERIALIZEDSTUFF, ref currentIndex);
 }