Example #1
0
            public override void Randomize()
            {
                int    arraylength = -1;
                Random rand        = new Random();
                int    strlength;

                byte[] strbuf, myByte;

                //path
                arraylength = rand.Next(10);
                if (path == null)
                {
                    path = new Messages.geometry_msgs.PoseStamped[arraylength];
                }
                else
                {
                    Array.Resize(ref path, arraylength);
                }
                for (int i = 0; i < path.Length; i++)
                {
                    //path[i]
                    path[i] = new Messages.geometry_msgs.PoseStamped();
                    path[i].Randomize();
                }
                //error_code
                error_code = new Messages.moveit_msgs.MoveItErrorCodes();
                error_code.Randomize();
            }
            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);
            }
Example #3
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;

                //path
                hasmetacomponents |= false;
                arraylength        = BitConverter.ToInt32(serializedMessage, currentIndex);
                currentIndex      += Marshal.SizeOf(typeof(System.Int32));
                if (path == null)
                {
                    path = new Messages.geometry_msgs.PoseStamped[arraylength];
                }
                else
                {
                    Array.Resize(ref path, arraylength);
                }
                for (int i = 0; i < path.Length; i++)
                {
                    //path[i]
                    path[i] = new Messages.geometry_msgs.PoseStamped(serializedMessage, ref currentIndex);
                }
                //error_code
                error_code = new Messages.moveit_msgs.MoveItErrorCodes(serializedMessage, ref currentIndex);
            }
Example #4
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;

                //solutions
                hasmetacomponents |= true;
                if (solutions == null)
                {
                    solutions = new Messages.xamlamoveit_msgs.JointValuesPoint[0];
                }
                pieces.Add(BitConverter.GetBytes(solutions.Length));
                for (int i = 0; i < solutions.Length; i++)
                {
                    //solutions[i]
                    if (solutions[i] == null)
                    {
                        solutions[i] = new Messages.xamlamoveit_msgs.JointValuesPoint();
                    }
                    pieces.Add(solutions[i].Serialize(true));
                }
                //error_codes
                hasmetacomponents |= false;
                if (error_codes == null)
                {
                    error_codes = new Messages.moveit_msgs.MoveItErrorCodes[0];
                }
                pieces.Add(BitConverter.GetBytes(error_codes.Length));
                for (int i = 0; i < error_codes.Length; i++)
                {
                    //error_codes[i]
                    if (error_codes[i] == null)
                    {
                        error_codes[i] = new Messages.moveit_msgs.MoveItErrorCodes();
                    }
                    pieces.Add(error_codes[i].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);
            }
Example #5
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;
     
     //path
     hasmetacomponents |= true;
     if (path == null)
         path = new Messages.xamlamoveit_msgs.JointPathPoint[0];
     pieces.Add(BitConverter.GetBytes(path.Length));
     for (int i=0;i<path.Length; i++) {
         //path[i]
         if (path[i] == null)
             path[i] = new Messages.xamlamoveit_msgs.JointPathPoint();
         pieces.Add(path[i].Serialize(true));
     }
     //joint_names
     hasmetacomponents |= false;
     if (joint_names == null)
         joint_names = new string[0];
     pieces.Add(BitConverter.GetBytes(joint_names.Length));
     for (int i=0;i<joint_names.Length; i++) {
         //joint_names[i]
         if (joint_names[i] == null)
             joint_names[i] = "";
         scratch1 = Encoding.ASCII.GetBytes((string)joint_names[i]);
         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);
     }
     //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;
 }
            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);
            }
Example #8
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;

                //solutions
                hasmetacomponents |= true;
                arraylength        = BitConverter.ToInt32(serializedMessage, currentIndex);
                currentIndex      += Marshal.SizeOf(typeof(System.Int32));
                if (solutions == null)
                {
                    solutions = new Messages.xamlamoveit_msgs.JointValuesPoint[arraylength];
                }
                else
                {
                    Array.Resize(ref solutions, arraylength);
                }
                for (int i = 0; i < solutions.Length; i++)
                {
                    //solutions[i]
                    solutions[i] = new Messages.xamlamoveit_msgs.JointValuesPoint(serializedMessage, ref currentIndex);
                }
                //error_codes
                hasmetacomponents |= false;
                arraylength        = BitConverter.ToInt32(serializedMessage, currentIndex);
                currentIndex      += Marshal.SizeOf(typeof(System.Int32));
                if (error_codes == null)
                {
                    error_codes = new Messages.moveit_msgs.MoveItErrorCodes[arraylength];
                }
                else
                {
                    Array.Resize(ref error_codes, arraylength);
                }
                for (int i = 0; i < error_codes.Length; i++)
                {
                    //error_codes[i]
                    error_codes[i] = new Messages.moveit_msgs.MoveItErrorCodes(serializedMessage, ref currentIndex);
                }
            }
Example #9
0
            public override void Randomize()
            {
                int    arraylength = -1;
                Random rand        = new Random();
                int    strlength;

                byte[] strbuf, myByte;

                //solutions
                arraylength = rand.Next(10);
                if (solutions == null)
                {
                    solutions = new Messages.xamlamoveit_msgs.JointValuesPoint[arraylength];
                }
                else
                {
                    Array.Resize(ref solutions, arraylength);
                }
                for (int i = 0; i < solutions.Length; i++)
                {
                    //solutions[i]
                    solutions[i] = new Messages.xamlamoveit_msgs.JointValuesPoint();
                    solutions[i].Randomize();
                }
                //error_codes
                arraylength = rand.Next(10);
                if (error_codes == null)
                {
                    error_codes = new Messages.moveit_msgs.MoveItErrorCodes[arraylength];
                }
                else
                {
                    Array.Resize(ref error_codes, arraylength);
                }
                for (int i = 0; i < error_codes.Length; i++)
                {
                    //error_codes[i]
                    error_codes[i] = new Messages.moveit_msgs.MoveItErrorCodes();
                    error_codes[i].Randomize();
                }
            }
Example #10
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;
     
     //path
     hasmetacomponents |= true;
     arraylength = BitConverter.ToInt32(serializedMessage, currentIndex);
     currentIndex += Marshal.SizeOf(typeof(System.Int32));
     if (path == null)
         path = new Messages.xamlamoveit_msgs.JointPathPoint[arraylength];
     else
         Array.Resize(ref path, arraylength);
     for (int i=0;i<path.Length; i++) {
         //path[i]
         path[i] = new Messages.xamlamoveit_msgs.JointPathPoint(serializedMessage, ref currentIndex);
     }
     //joint_names
     hasmetacomponents |= false;
     arraylength = BitConverter.ToInt32(serializedMessage, currentIndex);
     currentIndex += Marshal.SizeOf(typeof(System.Int32));
     if (joint_names == null)
         joint_names = new string[arraylength];
     else
         Array.Resize(ref joint_names, arraylength);
     for (int i=0;i<joint_names.Length; i++) {
         //joint_names[i]
         joint_names[i] = "";
         piecesize = BitConverter.ToInt32(serializedMessage, currentIndex);
         currentIndex += 4;
         joint_names[i] = Encoding.ASCII.GetString(serializedMessage, currentIndex, piecesize);
         currentIndex += piecesize;
     }
     //error_code
     error_code = new Messages.moveit_msgs.MoveItErrorCodes(serializedMessage, ref currentIndex);
 }
Example #11
0
 public override void Randomize()
 {
     int arraylength = -1;
     Random rand = new Random();
     int strlength;
     byte[] strbuf, myByte;
     
     //path
     arraylength = rand.Next(10);
     if (path == null)
         path = new Messages.xamlamoveit_msgs.JointPathPoint[arraylength];
     else
         Array.Resize(ref path, arraylength);
     for (int i=0;i<path.Length; i++) {
         //path[i]
         path[i] = new Messages.xamlamoveit_msgs.JointPathPoint();
         path[i].Randomize();
     }
     //joint_names
     arraylength = rand.Next(10);
     if (joint_names == null)
         joint_names = new string[arraylength];
     else
         Array.Resize(ref joint_names, arraylength);
     for (int i=0;i<joint_names.Length; i++) {
         //joint_names[i]
         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
         joint_names[i] = Encoding.ASCII.GetString(strbuf);
     }
     //error_code
     error_code = new Messages.moveit_msgs.MoveItErrorCodes();
     error_code.Randomize();
 }
Example #12
0
            public override void Randomize()
            {
                int    arraylength = -1;
                Random rand        = new Random();
                int    strlength;

                byte[] strbuf, myByte;

                //solutions
                arraylength = rand.Next(10);
                if (solutions == null)
                {
                    solutions = new Messages.geometry_msgs.PoseStamped[arraylength];
                }
                else
                {
                    Array.Resize(ref solutions, arraylength);
                }
                for (int i = 0; i < solutions.Length; i++)
                {
                    //solutions[i]
                    solutions[i] = new Messages.geometry_msgs.PoseStamped();
                    solutions[i].Randomize();
                }
                //error_codes
                arraylength = rand.Next(10);
                if (error_codes == null)
                {
                    error_codes = new Messages.moveit_msgs.MoveItErrorCodes[arraylength];
                }
                else
                {
                    Array.Resize(ref error_codes, arraylength);
                }
                for (int i = 0; i < error_codes.Length; i++)
                {
                    //error_codes[i]
                    error_codes[i] = new Messages.moveit_msgs.MoveItErrorCodes();
                    error_codes[i].Randomize();
                }
                //error_msgs
                arraylength = rand.Next(10);
                if (error_msgs == null)
                {
                    error_msgs = new string[arraylength];
                }
                else
                {
                    Array.Resize(ref error_msgs, arraylength);
                }
                for (int i = 0; i < error_msgs.Length; i++)
                {
                    //error_msgs[i]
                    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
                    error_msgs[i]         = Encoding.ASCII.GetString(strbuf);
                }
            }
Example #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;
                IntPtr        ptr;
                int           x__size;

                //solutions
                hasmetacomponents |= false;
                if (solutions == null)
                {
                    solutions = new Messages.geometry_msgs.PoseStamped[0];
                }
                pieces.Add(BitConverter.GetBytes(solutions.Length));
                for (int i = 0; i < solutions.Length; i++)
                {
                    //solutions[i]
                    if (solutions[i] == null)
                    {
                        solutions[i] = new Messages.geometry_msgs.PoseStamped();
                    }
                    pieces.Add(solutions[i].Serialize(true));
                }
                //error_codes
                hasmetacomponents |= false;
                if (error_codes == null)
                {
                    error_codes = new Messages.moveit_msgs.MoveItErrorCodes[0];
                }
                pieces.Add(BitConverter.GetBytes(error_codes.Length));
                for (int i = 0; i < error_codes.Length; i++)
                {
                    //error_codes[i]
                    if (error_codes[i] == null)
                    {
                        error_codes[i] = new Messages.moveit_msgs.MoveItErrorCodes();
                    }
                    pieces.Add(error_codes[i].Serialize(true));
                }
                //error_msgs
                hasmetacomponents |= false;
                if (error_msgs == null)
                {
                    error_msgs = new string[0];
                }
                pieces.Add(BitConverter.GetBytes(error_msgs.Length));
                for (int i = 0; i < error_msgs.Length; i++)
                {
                    //error_msgs[i]
                    if (error_msgs[i] == null)
                    {
                        error_msgs[i] = "";
                    }
                    scratch1  = Encoding.ASCII.GetBytes((string)error_msgs[i]);
                    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);
            }
Example #14
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;

                //solutions
                hasmetacomponents |= false;
                arraylength        = BitConverter.ToInt32(serializedMessage, currentIndex);
                currentIndex      += Marshal.SizeOf(typeof(System.Int32));
                if (solutions == null)
                {
                    solutions = new Messages.geometry_msgs.PoseStamped[arraylength];
                }
                else
                {
                    Array.Resize(ref solutions, arraylength);
                }
                for (int i = 0; i < solutions.Length; i++)
                {
                    //solutions[i]
                    solutions[i] = new Messages.geometry_msgs.PoseStamped(serializedMessage, ref currentIndex);
                }
                //error_codes
                hasmetacomponents |= false;
                arraylength        = BitConverter.ToInt32(serializedMessage, currentIndex);
                currentIndex      += Marshal.SizeOf(typeof(System.Int32));
                if (error_codes == null)
                {
                    error_codes = new Messages.moveit_msgs.MoveItErrorCodes[arraylength];
                }
                else
                {
                    Array.Resize(ref error_codes, arraylength);
                }
                for (int i = 0; i < error_codes.Length; i++)
                {
                    //error_codes[i]
                    error_codes[i] = new Messages.moveit_msgs.MoveItErrorCodes(serializedMessage, ref currentIndex);
                }
                //error_msgs
                hasmetacomponents |= false;
                arraylength        = BitConverter.ToInt32(serializedMessage, currentIndex);
                currentIndex      += Marshal.SizeOf(typeof(System.Int32));
                if (error_msgs == null)
                {
                    error_msgs = new string[arraylength];
                }
                else
                {
                    Array.Resize(ref error_msgs, arraylength);
                }
                for (int i = 0; i < error_msgs.Length; i++)
                {
                    //error_msgs[i]
                    error_msgs[i] = "";
                    piecesize     = BitConverter.ToInt32(serializedMessage, currentIndex);
                    currentIndex += 4;
                    error_msgs[i] = Encoding.ASCII.GetString(serializedMessage, currentIndex, piecesize);
                    currentIndex += piecesize;
                }
            }