Esempio n. 1
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);
        }
            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. 3
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. 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;


            //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. 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;

            //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);
        }