示例#1
0
        public override void OnVisualize(Visualizer visualizer)
        {
            foreach (var signal in Visualized)
            {
                Color color;
                switch (signal.CurrentState)
                {
                case "green":
                    color = Color.green;
                    break;

                case "yellow":
                    color = Color.yellow;
                    break;

                case "red":
                    color = Color.red;
                    break;

                default:
                    color = Color.black;
                    break;
                }

                WireframeBoxes.Draw(signal.gameObject.transform.localToWorldMatrix, signal.boundOffsets, signal.boundScale, color);
            }
        }
示例#2
0
        void Update()
        {
            foreach (var v in Visualized)
            {
                var collider = v.Key;
                var box      = v.Value;

                WireframeBoxes.Draw(collider.gameObject.transform.localToWorldMatrix, new Vector3(0f, collider.bounds.extents.y, 0f), box.Size, box.Color);
            }

            if (Bridge == null || Bridge.Status != Status.Connected)
            {
                return;
            }

            if (Time.time < nextSend)
            {
                return;
            }

            Writer.Write(new Detected3DObjectData()
            {
                Name     = Name,
                Frame    = Frame,
                Time     = SimulatorManager.Instance.CurrentTime,
                Sequence = seqId++,

                Data = Detected.Values.ToArray(),
            });
        }
示例#3
0
        private void Update()
        {
            if (Visualize)
            {
                foreach (var v in Visualized)
                {
                    var collider = v.Key;
                    var box      = v.Value;
                    if (collider.gameObject.activeInHierarchy)
                    {
                        WireframeBoxes.Draw(collider.gameObject.transform.localToWorldMatrix, collider is MeshCollider ? Vector3.zero : new Vector3(0f, collider.bounds.extents.y, 0f), box.Size, box.Color);
                    }
                }
            }

            if (Bridge == null || Bridge.Status != Status.Connected)
            {
                return;
            }

            if (Time.time < nextPublish)
            {
                return;
            }

            Writer.Write(new DetectedRadarObjectData()
            {
                Name     = Name,
                Frame    = Frame,
                Time     = SimulatorManager.Instance.CurrentTime,
                Sequence = seqId++,
                Data     = Detected.Values.ToArray(),
            });
        }
示例#4
0
        public override void OnVisualize(Visualizer visualizer)
        {
            foreach (var detected in Detected)
            {
                Color color;
                switch (detected.Label)
                {
                case "Car":
                    color = Color.green;
                    break;

                case "Pedestrian":
                    color = Color.yellow;
                    break;

                case "bicycle":
                    color = Color.cyan;
                    break;

                default:
                    color = Color.magenta;
                    break;
                }

                // TODO: inverse transfrom for these?
                // relPos.Set(-relPos.y, relPos.z, relPos.x);
                // relRot.Set(-relRot.y, relRot.z, relRot.x, relRot.w);

                var transform = Matrix4x4.TRS((float3)detected.Position, detected.Rotation, Vector3.one);
                WireframeBoxes.Draw(transform, Vector3.zero, detected.Scale, color);
            }
        }
        public override void OnVisualize(Visualizer visualizer)
        {
            foreach (uint id in CurrentIDs)
            {
                var col = Detected[id].Item2;
                if (col.gameObject.activeInHierarchy)
                {
                    GameObject parent = col.gameObject.transform.parent.gameObject;
                    Color      color  = Color.green;
                    if (parent.layer == LayerMask.NameToLayer("Pedestrian"))
                    {
                        color = Color.yellow;
                    }

                    BoxCollider box = col as BoxCollider;
                    WireframeBoxes.Draw
                    (
                        box.transform.localToWorldMatrix,
                        new Vector3(0f, box.bounds.extents.y, 0f),
                        box.size,
                        color
                    );
                }
            }
        }
示例#6
0
 public override void OnVisualize(Visualizer visualizer)
 {
     foreach (var v in Visualized)
     {
         var collider = v.Key;
         var box      = v.Value;
         if (collider.gameObject.activeInHierarchy)
         {
             WireframeBoxes.Draw(collider.gameObject.transform.localToWorldMatrix, collider is MeshCollider ? Vector3.zero : new Vector3(0f, collider.bounds.extents.y, 0f), box.Size, box.Color);
         }
     }
 }
        public override void OnVisualize(Visualizer visualizer)
        {
            foreach (var other in Visualized)
            {
                if (!other.gameObject.activeInHierarchy)
                {
                    return;
                }

                Vector3 size = Vector3.zero;
                if (other is MeshCollider)
                {
                    var mesh = other as MeshCollider;
                    var npcC = mesh.gameObject.GetComponentInParent <NPCController>();
                    if (npcC != null)
                    {
                        size = npcC.bounds.size;
                    }
                    else
                    {
                        var egoA = mesh.GetComponent <VehicleActions>();
                        size = egoA.bounds.size;
                    }
                }
                else if (other is CapsuleCollider)
                {
                    var capsule = other as CapsuleCollider;
                    size = new Vector3(capsule.radius * 2, capsule.height, capsule.radius * 2);
                }

                Color color = Color.magenta;
                if (other.gameObject.layer == LayerMask.NameToLayer("NPC"))
                {
                    color = Color.green;
                }
                else if (other.gameObject.layer == LayerMask.NameToLayer("Pedestrian"))
                {
                    color = Color.yellow;
                }
                else if (other.gameObject.layer == LayerMask.NameToLayer("Bicycle"))
                {
                    color = Color.cyan;
                }

                WireframeBoxes.Draw(other.gameObject.transform.localToWorldMatrix, other is MeshCollider ? Vector3.zero : new Vector3(0f, other.bounds.extents.y, 0f), size, color);
            }
        }
示例#8
0
        public override void OnVisualize(Visualizer visualizer)
        {
            foreach (var v in Visualized)
            {
                var collider = v.Key;
                var box      = v.Value;
                if (collider.gameObject.activeInHierarchy)
                {
                    WireframeBoxes.Draw(collider.gameObject.transform.localToWorldMatrix, collider is MeshCollider ? Vector3.zero : new Vector3(0f, collider.bounds.extents.y, 0f), box.Size, box.Color);
                }
            }

            foreach (var radar in radars)
            {
                Graphics.DrawMesh(radar.GetComponent <MeshFilter>().sharedMesh, transform.localToWorldMatrix, radar.RadarMeshRenderer.sharedMaterial, LayerMask.NameToLayer("Sensor"));
            }
        }
        public override void OnVisualize(Visualizer visualizer)
        {
            foreach (var other in Visualized)
            {
                if (other.gameObject.activeInHierarchy)
                {
                    GameObject parent = other.gameObject.transform.parent.gameObject;
                    Color      color  = Color.green;
                    if (parent.layer == LayerMask.NameToLayer("Pedestrian"))
                    {
                        color = Color.yellow;
                    }

                    BoxCollider box = other as BoxCollider;
                    WireframeBoxes.Draw(box.transform.localToWorldMatrix, new UnityEngine.Vector3(0f, box.bounds.extents.y, 0f), box.size, color);
                }
            }
        }
示例#10
0
        public override void OnVisualize(Visualizer visualizer)
        {
            MaxTracked = Math.Max(MaxTracked, Detected.Length);
            foreach (var detected in Detected)
            {
                Color color;
                switch (detected.Label)
                {
                case "Car":
                    color = Color.green;
                    break;

                case "Pedestrian":
                    color = Color.yellow;
                    break;

                case "Bicycle":
                    color = Color.cyan;
                    break;

                default:
                    color = Color.magenta;
                    break;
                }

                if (MapOrigin == null)
                {
                    Debug.LogError("Fail to visualize Apollo perceptions due to null MapOrigin.");
                    return;
                }

                var position = MapOrigin.NorthingEastingToPosition(detected.Gps.Northing, detected.Gps.Easting);
                position.y = (float)detected.Gps.Altitude - MapOrigin.AltitudeOffset;

                var        mapRotation = MapOrigin.transform.localRotation;
                var        rotationY   = detected.Heading + mapRotation.eulerAngles.y;
                Quaternion rotation    = Quaternion.Euler(0, (float)rotationY, 0);

                var transform = Matrix4x4.TRS(position, rotation, Vector3.one);
                WireframeBoxes.Draw(transform, Vector3.zero, detected.Scale, color);
            }
        }
示例#11
0
        void Update()
        {
            if (Detected == null)
            {
                return;
            }

            foreach (var detected in Detected)
            {
                Color color;
                switch (detected.Label)
                {
                case "Car":
                    color = Color.green;
                    break;

                case "Pedestrian":
                    color = Color.yellow;
                    break;

                case "bicycle":
                    color = Color.cyan;
                    break;

                default:
                    color = Color.magenta;
                    break;
                }

                // TODO: inverse transfrom for these?
                // relPos.Set(-relPos.y, relPos.z, relPos.x);
                // relRot.Set(-relRot.y, relRot.z, relRot.x, relRot.w);

                var transform = Matrix4x4.TRS(detected.Position, detected.Rotation, Vector3.one);
                WireframeBoxes.Draw(transform, Vector3.zero, detected.Scale, color);
            }
        }