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;
                IntPtr        ptr;
                int           x__size;

                //solution
                if (solution == null)
                {
                    solution = new Messages.trajectory_msgs.JointTrajectory();
                }
                pieces.Add(solution.Serialize(true));
                //error_code
                if (error_code == null)
                {
                    error_code = new Messages.moveit_msgs.MoveItErrorCodes();
                }
                pieces.Add(error_code.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);
            }
Esempio n. 2
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;
            IntPtr        ptr;
            int           x__size;


            //trajectory
            if (trajectory == null)
            {
                trajectory = new Messages.trajectory_msgs.JointTrajectory();
            }
            pieces.Add(trajectory.Serialize(true));
            //check_collision
            thischunk    = new byte[1];
            thischunk[0] = (byte)((bool)check_collision ? 1 : 0);
            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);
        }
Esempio n. 3
0
        public override void Deserialize(byte[] serializedMessage, ref int currentIndex)
        {
            int    arraylength       = -1;
            bool   hasmetacomponents = false;
            object __thing;
            int    piecesize = 0;

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


            //trajectory
            trajectory = new Messages.trajectory_msgs.JointTrajectory(serializedMessage, ref currentIndex);
            //check_collision
            check_collision = serializedMessage[currentIndex++] == 1;
            //veloctiy_scaling
            piecesize = Marshal.SizeOf(typeof(double));
            h         = IntPtr.Zero;
            if (serializedMessage.Length - currentIndex != 0)
            {
                h = Marshal.AllocHGlobal(piecesize);
                Marshal.Copy(serializedMessage, currentIndex, h, piecesize);
            }
            if (h == IntPtr.Zero)
            {
                throw new Exception("Memory allocation failed");
            }
            veloctiy_scaling = (double)Marshal.PtrToStructure(h, typeof(double));
            Marshal.FreeHGlobal(h);
            currentIndex += piecesize;
        }
Esempio n. 4
0
            public override void Randomize()
            {
                int    arraylength = -1;
                Random rand        = new Random();
                int    strlength;

                byte[] strbuf, myByte;

                //model_name
                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
                model_name            = Encoding.ASCII.GetString(strbuf);
                //joint_trajectory
                joint_trajectory = new Messages.trajectory_msgs.JointTrajectory();
                joint_trajectory.Randomize();
                //model_pose
                model_pose = new Pose();
                model_pose.Randomize();
                //set_model_pose
                set_model_pose = rand.Next(2) == 1;
                //disable_physics_updates
                disable_physics_updates = rand.Next(2) == 1;
            }
Esempio n. 5
0
            public override void Deserialize(byte[] SERIALIZEDSTUFF, ref int currentIndex)
            {
                int  arraylength       = -1;
                bool hasmetacomponents = false;

                byte[] thischunk, scratch1, scratch2;
                object __thing;
                int    piecesize = 0;
                IntPtr h;

                //model_name
                model_name    = "";
                piecesize     = BitConverter.ToInt32(SERIALIZEDSTUFF, currentIndex);
                currentIndex += 4;
                model_name    = Encoding.ASCII.GetString(SERIALIZEDSTUFF, currentIndex, piecesize);
                currentIndex += piecesize;
                //joint_trajectory
                joint_trajectory = new Messages.trajectory_msgs.JointTrajectory(SERIALIZEDSTUFF, ref currentIndex);
                //model_pose
                model_pose = new Pose(SERIALIZEDSTUFF, ref currentIndex);
                //set_model_pose
                set_model_pose = SERIALIZEDSTUFF[currentIndex++] == 1;
                //disable_physics_updates
                disable_physics_updates = SERIALIZEDSTUFF[currentIndex++] == 1;
            }
Esempio n. 6
0
            public override void Randomize()
            {
                int    arraylength = -1;
                Random rand        = new Random();
                int    strlength;

                byte[] strbuf, myByte;

                //trajectory
                trajectory = new Messages.trajectory_msgs.JointTrajectory();
                trajectory.Randomize();
            }
Esempio n. 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;

            //trajectory
            trajectory = new Messages.trajectory_msgs.JointTrajectory(SERIALIZEDSTUFF, ref currentIndex);
            //path_tolerance
            hasmetacomponents |= true;
            arraylength        = BitConverter.ToInt32(SERIALIZEDSTUFF, currentIndex);
            currentIndex      += Marshal.SizeOf(typeof(System.Int32));
            if (path_tolerance == null)
            {
                path_tolerance = new Messages.control_msgs.JointTolerance[arraylength];
            }
            else
            {
                Array.Resize(ref path_tolerance, arraylength);
            }
            for (int i = 0; i < path_tolerance.Length; i++)
            {
                //path_tolerance[i]
                path_tolerance[i] = new Messages.control_msgs.JointTolerance(SERIALIZEDSTUFF, ref currentIndex);
            }
            //goal_tolerance
            hasmetacomponents |= true;
            arraylength        = BitConverter.ToInt32(SERIALIZEDSTUFF, currentIndex);
            currentIndex      += Marshal.SizeOf(typeof(System.Int32));
            if (goal_tolerance == null)
            {
                goal_tolerance = new Messages.control_msgs.JointTolerance[arraylength];
            }
            else
            {
                Array.Resize(ref goal_tolerance, arraylength);
            }
            for (int i = 0; i < goal_tolerance.Length; i++)
            {
                //goal_tolerance[i]
                goal_tolerance[i] = new Messages.control_msgs.JointTolerance(SERIALIZEDSTUFF, ref currentIndex);
            }
            //goal_time_tolerance
            goal_time_tolerance = new Duration(new TimeData(
                                                   BitConverter.ToUInt32(SERIALIZEDSTUFF, currentIndex),
                                                   BitConverter.ToUInt32(SERIALIZEDSTUFF, currentIndex + Marshal.SizeOf(typeof(System.Int32)))));
            currentIndex += 2 * Marshal.SizeOf(typeof(System.Int32));
        }
Esempio n. 8
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;

                //model_name
                if (model_name == null)
                {
                    model_name = "";
                }
                scratch1  = Encoding.ASCII.GetBytes((string)model_name);
                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);
                //joint_trajectory
                if (joint_trajectory == null)
                {
                    joint_trajectory = new Messages.trajectory_msgs.JointTrajectory();
                }
                pieces.Add(joint_trajectory.Serialize(true));
                //model_pose
                if (model_pose == null)
                {
                    model_pose = new Pose();
                }
                pieces.Add(model_pose.Serialize(true));
                //set_model_pose
                thischunk    = new byte[1];
                thischunk[0] = (byte)((bool)set_model_pose ? 1 : 0);
                pieces.Add(thischunk);
                //disable_physics_updates
                thischunk    = new byte[1];
                thischunk[0] = (byte)((bool)disable_physics_updates ? 1 : 0);
                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);
            }
Esempio n. 9
0
            public override void Deserialize(byte[] serializedMessage, ref int currentIndex)
            {
                int  arraylength       = -1;
                bool hasmetacomponents = false;
                int  piecesize         = 0;

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

                //trajectory
                trajectory = new Messages.trajectory_msgs.JointTrajectory(serializedMessage, ref currentIndex);
            }
Esempio n. 10
0
        public override void Randomize()
        {
            int    arraylength = -1;
            Random rand        = new Random();
            int    strlength;

            byte[] strbuf, myByte;


            //trajectory
            trajectory = new Messages.trajectory_msgs.JointTrajectory();
            trajectory.Randomize();
            //check_collision
            check_collision = rand.Next(2) == 1;
        }
            public override void Randomize()
            {
                int    arraylength = -1;
                Random rand        = new Random();
                int    strlength;

                byte[] strbuf, myByte;

                //solution
                solution = new Messages.trajectory_msgs.JointTrajectory();
                solution.Randomize();
                //error_code
                error_code = new Messages.moveit_msgs.MoveItErrorCodes();
                error_code.Randomize();
            }
            public override void Deserialize(byte[] serializedMessage, ref int currentIndex)
            {
                int  arraylength       = -1;
                bool hasmetacomponents = false;
                int  piecesize         = 0;

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

                //solution
                solution = new Messages.trajectory_msgs.JointTrajectory(serializedMessage, ref currentIndex);
                //error_code
                error_code = new Messages.moveit_msgs.MoveItErrorCodes(serializedMessage, ref currentIndex);
            }
Esempio n. 13
0
        public override void Randomize()
        {
            int    arraylength = -1;
            Random rand        = new Random();
            int    strlength;

            byte[] strbuf, myByte;

            //trajectory
            trajectory = new Messages.trajectory_msgs.JointTrajectory();
            trajectory.Randomize();
            //path_tolerance
            arraylength = rand.Next(10);
            if (path_tolerance == null)
            {
                path_tolerance = new Messages.control_msgs.JointTolerance[arraylength];
            }
            else
            {
                Array.Resize(ref path_tolerance, arraylength);
            }
            for (int i = 0; i < path_tolerance.Length; i++)
            {
                //path_tolerance[i]
                path_tolerance[i] = new Messages.control_msgs.JointTolerance();
                path_tolerance[i].Randomize();
            }
            //goal_tolerance
            arraylength = rand.Next(10);
            if (goal_tolerance == null)
            {
                goal_tolerance = new Messages.control_msgs.JointTolerance[arraylength];
            }
            else
            {
                Array.Resize(ref goal_tolerance, arraylength);
            }
            for (int i = 0; i < goal_tolerance.Length; i++)
            {
                //goal_tolerance[i]
                goal_tolerance[i] = new Messages.control_msgs.JointTolerance();
                goal_tolerance[i].Randomize();
            }
            //goal_time_tolerance
            goal_time_tolerance = new Duration(new TimeData(
                                                   Convert.ToUInt32(rand.Next()),
                                                   Convert.ToUInt32(rand.Next())));
        }
Esempio n. 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;
            IntPtr        ptr;
            int           x__size;


            //trajectory
            if (trajectory == null)
            {
                trajectory = new Messages.trajectory_msgs.JointTrajectory();
            }
            pieces.Add(trajectory.Serialize(true));
            //check_collision
            thischunk    = new byte[1];
            thischunk[0] = (byte)((bool)check_collision ? 1 : 0);
            pieces.Add(thischunk);
            //veloctiy_scaling
            scratch1 = new byte[Marshal.SizeOf(typeof(double))];
            h        = GCHandle.Alloc(scratch1, GCHandleType.Pinned);
            Marshal.StructureToPtr(veloctiy_scaling, h.AddrOfPinnedObject(), false);
            h.Free();
            pieces.Add(scratch1);

            // 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);
        }
Esempio n. 15
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;

            //trajectory
            if (trajectory == null)
            {
                trajectory = new Messages.trajectory_msgs.JointTrajectory();
            }
            pieces.Add(trajectory.Serialize(true));
            //path_tolerance
            hasmetacomponents |= true;
            if (path_tolerance == null)
            {
                path_tolerance = new Messages.control_msgs.JointTolerance[0];
            }
            pieces.Add(BitConverter.GetBytes(path_tolerance.Length));
            for (int i = 0; i < path_tolerance.Length; i++)
            {
                //path_tolerance[i]
                if (path_tolerance[i] == null)
                {
                    path_tolerance[i] = new Messages.control_msgs.JointTolerance();
                }
                pieces.Add(path_tolerance[i].Serialize(true));
            }
            //goal_tolerance
            hasmetacomponents |= true;
            if (goal_tolerance == null)
            {
                goal_tolerance = new Messages.control_msgs.JointTolerance[0];
            }
            pieces.Add(BitConverter.GetBytes(goal_tolerance.Length));
            for (int i = 0; i < goal_tolerance.Length; i++)
            {
                //goal_tolerance[i]
                if (goal_tolerance[i] == null)
                {
                    goal_tolerance[i] = new Messages.control_msgs.JointTolerance();
                }
                pieces.Add(goal_tolerance[i].Serialize(true));
            }
            //goal_time_tolerance
            pieces.Add(BitConverter.GetBytes(goal_time_tolerance.data.sec));
            pieces.Add(BitConverter.GetBytes(goal_time_tolerance.data.nsec));
            //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);
        }