public override void deserialize(MemoryStream stream, halodi_msgs.msg.ImuMeasurement data)
 {
     using (BinaryReader reader = new BinaryReader(stream))
     {
         Halodi.CDR.CDRDeserializer cdr = new Halodi.CDR.CDRDeserializer(reader);
         read(data, cdr);
     }
 }
 public override void serialize(halodi_msgs.msg.ImuMeasurement data, MemoryStream stream)
 {
     using (BinaryWriter writer = new BinaryWriter(stream))
     {
         Halodi.CDR.CDRSerializer cdr = new Halodi.CDR.CDRSerializer(writer);
         write(data, cdr);
     }
 }
        public static void write(halodi_msgs.msg.ImuMeasurement data, Halodi.CDR.CDRSerializer cdr)
        {
            halodi_msgs.msg.ImuNamePubSubType.write(data.imu, cdr);

            geometry_msgs.msg.QuaternionPubSubType.write(data.orientation, cdr);

            geometry_msgs.msg.Vector3PubSubType.write(data.angular_velocity, cdr);

            geometry_msgs.msg.Vector3PubSubType.write(data.linear_acceleration, cdr);
        }
        public static void read(halodi_msgs.msg.ImuMeasurement data, Halodi.CDR.CDRDeserializer cdr)
        {
            data.imu = halodi_msgs.msg.ImuNamePubSubType.Create();
            halodi_msgs.msg.ImuNamePubSubType.read(data.imu, cdr);

            data.orientation = geometry_msgs.msg.QuaternionPubSubType.Create();
            geometry_msgs.msg.QuaternionPubSubType.read(data.orientation, cdr);

            data.angular_velocity = geometry_msgs.msg.Vector3PubSubType.Create();
            geometry_msgs.msg.Vector3PubSubType.read(data.angular_velocity, cdr);

            data.linear_acceleration = geometry_msgs.msg.Vector3PubSubType.Create();
            geometry_msgs.msg.Vector3PubSubType.read(data.linear_acceleration, cdr);
        }
        public static int getCdrSerializedSize(halodi_msgs.msg.ImuMeasurement data, int current_alignment)
        {
            int initial_alignment = current_alignment;

            current_alignment += halodi_msgs.msg.ImuNamePubSubType.getCdrSerializedSize(data.imu, current_alignment);

            current_alignment += geometry_msgs.msg.QuaternionPubSubType.getCdrSerializedSize(data.orientation, current_alignment);

            current_alignment += geometry_msgs.msg.Vector3PubSubType.getCdrSerializedSize(data.angular_velocity, current_alignment);

            current_alignment += geometry_msgs.msg.Vector3PubSubType.getCdrSerializedSize(data.linear_acceleration, current_alignment);


            return(current_alignment - initial_alignment);
        }
        public void Set(WholeBodyState other)
        {
            std_msgs.msg.HeaderPubSubType.Copy(other.header, header);

            last_received_sequence_id = other.last_received_sequence_id;

            accepts_commands = other.accepts_commands;

            controller_state = other.controller_state;

            halodi_msgs.msg.BalanceModePubSubType.Copy(other.current_balance_mode, current_balance_mode);

            robot_status = other.robot_status;

            geometry_msgs.msg.PosePubSubType.Copy(other.pose, pose);

            geometry_msgs.msg.Vector3PubSubType.Copy(other.angular_velocity, angular_velocity);

            geometry_msgs.msg.Vector3PubSubType.Copy(other.linear_velocity, linear_velocity);

            geometry_msgs.msg.PosePubSubType.Copy(other.map_pose, map_pose);


            if (other.imu_measurements == null)
            {
                imu_measurements = null;
            }
            else
            {
                imu_measurements = new System.Collections.Generic.List <halodi_msgs.msg.ImuMeasurement>(other.imu_measurements.Count);
                for (int i1 = 0; i1 < other.imu_measurements.Count; i1++)
                {
                    if (other.imu_measurements[i1] == null)
                    {
                        imu_measurements.Add(null);
                    }
                    else
                    {
                        halodi_msgs.msg.ImuMeasurement newElement = halodi_msgs.msg.ImuMeasurementPubSubType.Create();
                        halodi_msgs.msg.ImuMeasurementPubSubType.Copy(other.imu_measurements[i1], newElement);
                        imu_measurements.Add(newElement);
                    }
                }
            }

            if (other.joint_states == null)
            {
                joint_states = null;
            }
            else
            {
                joint_states = new System.Collections.Generic.List <halodi_msgs.msg.JointMeasurement>(other.joint_states.Count);
                for (int i2 = 0; i2 < other.joint_states.Count; i2++)
                {
                    if (other.joint_states[i2] == null)
                    {
                        joint_states.Add(null);
                    }
                    else
                    {
                        halodi_msgs.msg.JointMeasurement newElement = halodi_msgs.msg.JointMeasurementPubSubType.Create();
                        halodi_msgs.msg.JointMeasurementPubSubType.Copy(other.joint_states[i2], newElement);
                        joint_states.Add(newElement);
                    }
                }
            }

            if (other.taskspace_feedback == null)
            {
                taskspace_feedback = null;
            }
            else
            {
                taskspace_feedback = new System.Collections.Generic.List <halodi_msgs.msg.TaskSpaceFeedback>(other.taskspace_feedback.Count);
                for (int i3 = 0; i3 < other.taskspace_feedback.Count; i3++)
                {
                    if (other.taskspace_feedback[i3] == null)
                    {
                        taskspace_feedback.Add(null);
                    }
                    else
                    {
                        halodi_msgs.msg.TaskSpaceFeedback newElement = halodi_msgs.msg.TaskSpaceFeedbackPubSubType.Create();
                        halodi_msgs.msg.TaskSpaceFeedbackPubSubType.Copy(other.taskspace_feedback[i3], newElement);
                        taskspace_feedback.Add(newElement);
                    }
                }
            }
        }
Exemple #7
0
        public static void read(halodi_msgs.msg.WholeBodyState data, Halodi.CDR.CDRDeserializer cdr)
        {
            data.header = std_msgs.msg.HeaderPubSubType.Create();
            std_msgs.msg.HeaderPubSubType.read(data.header, cdr);

            data.last_received_sequence_id = cdr.read_type_2();

            data.accepts_commands = cdr.read_type_7();

            data.controller_state     = cdr.read_type_d();
            data.current_balance_mode = halodi_msgs.msg.BalanceModePubSubType.Create();
            halodi_msgs.msg.BalanceModePubSubType.read(data.current_balance_mode, cdr);

            data.robot_status = cdr.read_type_9();

            data.pose = geometry_msgs.msg.PosePubSubType.Create();
            geometry_msgs.msg.PosePubSubType.read(data.pose, cdr);

            data.angular_velocity = geometry_msgs.msg.Vector3PubSubType.Create();
            geometry_msgs.msg.Vector3PubSubType.read(data.angular_velocity, cdr);

            data.linear_velocity = geometry_msgs.msg.Vector3PubSubType.Create();
            geometry_msgs.msg.Vector3PubSubType.read(data.linear_velocity, cdr);

            data.map_pose = geometry_msgs.msg.PosePubSubType.Create();
            geometry_msgs.msg.PosePubSubType.read(data.map_pose, cdr);


            int imu_measurements_length = cdr.read_type_2();

            data.imu_measurements = new System.Collections.Generic.List <halodi_msgs.msg.ImuMeasurement>(imu_measurements_length);
            for (int i = 0; i < imu_measurements_length; i++)
            {
                halodi_msgs.msg.ImuMeasurement new_imu_measurements = halodi_msgs.msg.ImuMeasurementPubSubType.Create();
                halodi_msgs.msg.ImuMeasurementPubSubType.read(new_imu_measurements, cdr);
                data.imu_measurements.Add(new_imu_measurements);
            }



            int joint_states_length = cdr.read_type_2();

            data.joint_states = new System.Collections.Generic.List <halodi_msgs.msg.JointMeasurement>(joint_states_length);
            for (int i = 0; i < joint_states_length; i++)
            {
                halodi_msgs.msg.JointMeasurement new_joint_states = halodi_msgs.msg.JointMeasurementPubSubType.Create();
                halodi_msgs.msg.JointMeasurementPubSubType.read(new_joint_states, cdr);
                data.joint_states.Add(new_joint_states);
            }



            int taskspace_feedback_length = cdr.read_type_2();

            data.taskspace_feedback = new System.Collections.Generic.List <halodi_msgs.msg.TaskSpaceFeedback>(taskspace_feedback_length);
            for (int i = 0; i < taskspace_feedback_length; i++)
            {
                halodi_msgs.msg.TaskSpaceFeedback new_taskspace_feedback = halodi_msgs.msg.TaskSpaceFeedbackPubSubType.Create();
                halodi_msgs.msg.TaskSpaceFeedbackPubSubType.read(new_taskspace_feedback, cdr);
                data.taskspace_feedback.Add(new_taskspace_feedback);
            }
        }
 public static void Copy(halodi_msgs.msg.ImuMeasurement src, halodi_msgs.msg.ImuMeasurement target)
 {
     target.Set(src);
 }
 public static int getCdrSerializedSize(halodi_msgs.msg.ImuMeasurement data)
 {
     return(getCdrSerializedSize(data, 0));
 }