public override void deserialize(MemoryStream stream, sensor_msgs.msg.LaserEcho data)
 {
     using (BinaryReader reader = new BinaryReader(stream))
     {
         Halodi.CDR.CDRDeserializer cdr = new Halodi.CDR.CDRDeserializer(reader);
         read(data, cdr);
     }
 }
 public override void serialize(sensor_msgs.msg.LaserEcho data, MemoryStream stream)
 {
     using (BinaryWriter writer = new BinaryWriter(stream))
     {
         Halodi.CDR.CDRSerializer cdr = new Halodi.CDR.CDRSerializer(writer);
         write(data, cdr);
     }
 }
        public static void read(sensor_msgs.msg.LaserEcho data, Halodi.CDR.CDRDeserializer cdr)
        {
            int echoes_length = cdr.read_type_2();

            data.echoes = new System.Collections.Generic.List <float>(echoes_length);
            for (int i = 0; i < echoes_length; i++)
            {
                data.echoes.Add(cdr.read_type_5());
            }
        }
        public static int getCdrSerializedSize(sensor_msgs.msg.LaserEcho data, int current_alignment)
        {
            int initial_alignment = current_alignment;

            current_alignment += 4 + Halodi.CDR.CDRCommon.alignment(current_alignment, 4);
            current_alignment += (data.echoes.Count * 4) + Halodi.CDR.CDRCommon.alignment(current_alignment, 4);


            return(current_alignment - initial_alignment);
        }
 public static void write(sensor_msgs.msg.LaserEcho data, Halodi.CDR.CDRSerializer cdr)
 {
     if (data.echoes == null)
     {
         cdr.write_type_2(0);
     }
     else
     {
         int echoes_length = data.echoes.Count;
         cdr.write_type_2(echoes_length);
         for (int i0 = 0; i0 < echoes_length; i0++)
         {
             cdr.write_type_5(data.echoes[i0]);
         }
     }
 }
Example #6
0
        public static void read(sensor_msgs.msg.MultiEchoLaserScan data, Halodi.CDR.CDRDeserializer cdr)
        {
            data.header = std_msgs.msg.HeaderPubSubType.Create();
            std_msgs.msg.HeaderPubSubType.read(data.header, cdr);

            data.angle_min = cdr.read_type_5();

            data.angle_max = cdr.read_type_5();

            data.angle_increment = cdr.read_type_5();

            data.time_increment = cdr.read_type_5();

            data.scan_time = cdr.read_type_5();

            data.range_min = cdr.read_type_5();

            data.range_max = cdr.read_type_5();


            int ranges_length = cdr.read_type_2();

            data.ranges = new System.Collections.Generic.List <sensor_msgs.msg.LaserEcho>(ranges_length);
            for (int i = 0; i < ranges_length; i++)
            {
                sensor_msgs.msg.LaserEcho new_ranges = sensor_msgs.msg.LaserEchoPubSubType.Create();
                sensor_msgs.msg.LaserEchoPubSubType.read(new_ranges, cdr);
                data.ranges.Add(new_ranges);
            }



            int intensities_length = cdr.read_type_2();

            data.intensities = new System.Collections.Generic.List <sensor_msgs.msg.LaserEcho>(intensities_length);
            for (int i = 0; i < intensities_length; i++)
            {
                sensor_msgs.msg.LaserEcho new_intensities = sensor_msgs.msg.LaserEchoPubSubType.Create();
                sensor_msgs.msg.LaserEchoPubSubType.read(new_intensities, cdr);
                data.intensities.Add(new_intensities);
            }
        }
        public void Set(MultiEchoLaserScan other)
        {
            std_msgs.msg.HeaderPubSubType.Copy(other.header, header);

            angle_min = other.angle_min;

            angle_max = other.angle_max;

            angle_increment = other.angle_increment;

            time_increment = other.time_increment;

            scan_time = other.scan_time;

            range_min = other.range_min;

            range_max = other.range_max;


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

            if (other.intensities == null)
            {
                intensities = null;
            }
            else
            {
                intensities = new System.Collections.Generic.List <sensor_msgs.msg.LaserEcho>(other.intensities.Count);
                for (int i2 = 0; i2 < other.intensities.Count; i2++)
                {
                    if (other.intensities[i2] == null)
                    {
                        intensities.Add(null);
                    }
                    else
                    {
                        sensor_msgs.msg.LaserEcho newElement = sensor_msgs.msg.LaserEchoPubSubType.Create();
                        sensor_msgs.msg.LaserEchoPubSubType.Copy(other.intensities[i2], newElement);
                        intensities.Add(newElement);
                    }
                }
            }
        }
 public static void Copy(sensor_msgs.msg.LaserEcho src, sensor_msgs.msg.LaserEcho target)
 {
     target.Set(src);
 }
 public static int getCdrSerializedSize(sensor_msgs.msg.LaserEcho data)
 {
     return(getCdrSerializedSize(data, 0));
 }