示例#1
0
 private static double[] GetNeuralInputFromSensorReading(CarSensorReadingSnapshot sensorReading)
 {
     return(new[] {
         sensorReading.CenterSensor?.Distance ?? 0,
         sensorReading.LeftSensor?.Distance ?? 0,
         sensorReading.RightSensor?.Distance ?? 0
     });
 }
示例#2
0
        private CarSensorReadingSnapshot GetSensorReadings()
        {
            var mapLines = map.Nodes
                           .SelectMany(x => x.WallLines)
                           .Select(x => x.Line)
                           .ToArray();
            var sensorReadingCached = new CarSensorReadingSnapshot()
            {
                LeftSensor   = GetSensorReading(mapLines, -360 / 8),
                CenterSensor = GetSensorReading(mapLines, 0),
                RightSensor  = GetSensorReading(mapLines, 360 / 8)
            };

            return(sensorReadingCached);
        }