Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
Occupancy3dSensor.cs
Go to the documentation of this file.
1 using System.Collections.Generic;
4 using UnityEngine;
5 
6 namespace droid.Runtime.Prototyping.Sensors.Occupancy {
10  [AddComponentMenu(SensorComponentMenuPath._ComponentMenuPath
11  + "Occupancy3d"
12  + SensorComponentMenuPath._Postfix)]
13  [ExecuteInEditMode]
14  public class Occupancy3dSensor : Sensor,
16  [Header("Observation", order = 103)]
17  [SerializeField]
18  Vector3[] _observation_value;
19 
20  [SerializeField] Space1 _observation_value_space;
21 
25  public Space1 SingleSpace { get { return this._observation_value_space; } }
26 
30  public Vector3[] ObservationArray {
31  get { return this._observation_value; }
32  set {
33  this._observation_value = this.SingleSpace.IsNormalised
34  ? value //this._observation_value_space.ClipNormaliseRound(value)
35  : value;
36  }
37  }
38 
39  protected override void PreSetup() { }
40 
41  public override IEnumerable<float> FloatEnumerable {
42  get {
43  var a = new float[this.ObservationArray.Length*3];
44  for (var i = 0; i < ObservationArray.Length * 3; i += 3) {
45  a[i] = this.ObservationArray[i].x;
46  a[i+1] = this.ObservationArray[i].y;
47  a[i+2] = this.ObservationArray[i].z;
48  }
49 
50  return a;
51  }
52  }
53 
54  public override void UpdateObservation() { ; }
55  public Space1[] ObservationSpace { get; } = new Space1[1];
56  }
57 }