示例#1
0
        protected virtual void DrawGUIStats()
        {
            m_GUIStats.Add(TargetSpeed, "Speed", "Target", Colors.Orange);
            m_GUIStats.Add(m_Body.AvgSpeed, "Speed", "Measured Avg.", Colors.Lightblue);

            m_GUIStats.Add(m_Body.TargetHeight, "Height", "Target", Colors.Orange);
            m_GUIStats.Add(m_Body.AvgHeight, "Height", "Measured Avg.", Colors.Lightblue);

            m_GUIStats.Add(m_Body.Inclination / 180f, "Inclination", "", Colors.Orange);

            m_GUIStats.Add(GetNormWalkDirectionError(), "Direction Errors", "Walk Direction", Colors.Orange);
            m_GUIStats.Add(GetNormLookDirectionError(), "Direction Errors", "Look Direction", Colors.Lightblue);

            var palette = Colors.Palette(4, 1, 0.5f, 0.2f, 0.8f);

            float sum =
                m_GUIStats.Add(GetHeightReward(), "Rewards", "Height", palette[0]) +
                m_GUIStats.Add(GetInclinationReward(), "Rewards", "Inclination", palette[1]) +
                m_GUIStats.Add(GetWalkDirectionReward(), "Rewards", "Walk Direction", palette[2]) +
                m_GUIStats.Add(GetLookDirectionReward(), "Rewards", "Look Direction", palette[3]);

            sum += m_GUIStats.Add(GetSpeedErrorPenalty(), "Penalties", "Speed Error", Colors.Orange);

            m_GUIStats.Add(sum, "Reward Sum", "", Colors.Lightblue);
        }
示例#2
0
        private void Start()
        {
            DriverAgent agent = GetComponent <DriverAgent>();

            agent.ResetEvent += OnAgentReset;
            agent.StatsEvent += OnAgentStats;

            buffers = new Dictionary <string, StatsBuffer>()
            {
                { "Action Accelerate", new StatsBuffer(bufferSize, "Normalized") },
                { "Action Steer", new StatsBuffer(bufferSize, "Normalized") },
                { "Current Steer", new StatsBuffer(bufferSize, "Normalized") },
                { "Forward Speed", new StatsBuffer(bufferSize, "Meters/Second") },
                { "Offset", new StatsBuffer(bufferSize, "Meters") },
                { "Orientation", new StatsBuffer(bufferSize, "Angle") },
                { "Collisions", new StatsBuffer(bufferSize, "Count") },
                { "Reward", new StatsBuffer(bufferSize, "Sum") }
            };

            int i   = 0;
            var col = Colors.Palette(buffers.Count);
            var gf  = FindObjectOfType <GraphFactory>(true);

            foreach (var kvp in buffers)
            {
                gf.AddGraph(kvp.Key).Add(kvp.Value, col[i++], true);
            }
        }