Exemplo n.º 1
0
 public static LGSVL.Detection2DArray ConvertFrom(Detected2DObjectData data)
 {
     return(new LGSVL.Detection2DArray()
     {
         header = new Header()
         {
             seq = data.Sequence,
             stamp = Conversions.ConvertTime(data.Time),
             frame_id = data.Frame,
         },
         detections = data.Data.Select(d => new Detection2D()
         {
             id = d.Id,
             label = d.Label,
             score = d.Score,
             bbox = new BoundingBox2D()
             {
                 x = d.Position.x,
                 y = d.Position.y,
                 width = d.Scale.x,
                 height = d.Scale.y
             },
             velocity = new Twist()
             {
                 linear = ConvertToVector(d.LinearVelocity),
                 angular = ConvertToVector(d.AngularVelocity),
             }
         }).ToList(),
     });
 }
Exemplo n.º 2
0
        public static apollo.common.Detection2DArray ConvertFrom(Detected2DObjectData data)
        {
            var r = new apollo.common.Detection2DArray()
            {
                header = new apollo.common.Header()
                {
                    sequence_num  = data.Sequence,
                    frame_id      = data.Frame,
                    timestamp_sec = data.Time,
                },
            };

            foreach (var obj in data.Data)
            {
                r.detections.Add(new apollo.common.Detection2D()
                {
                    header = r.header,
                    id     = obj.Id,
                    label  = obj.Label,
                    score  = obj.Score,
                    bbox   = new apollo.common.BoundingBox2D()
                    {
                        x      = obj.Position.x,
                        y      = obj.Position.y,
                        width  = obj.Scale.x,
                        height = obj.Scale.y
                    },
                    velocity = new apollo.common.Twist()
                    {
                        linear  = ConvertToVector(obj.LinearVelocity),
                        angular = ConvertToVector(obj.LinearVelocity),
                    },
                });
            }

            return(r);
        }