Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
AngularVelocitySensor.cs
Go to the documentation of this file.
1 using System.Collections.Generic;
5 using UnityEngine;
6 
7 namespace droid.Runtime.Prototyping.Sensors.Rigidbody {
8  public class AngularVelocitySensor : Sensor,
9  IHasTriple {
10  [SerializeField] Vector3 _angular_velocity;
11  [SerializeField] Space3 _angular_velocity_space = new Space3(new DistributionSampler(), 10);
12 
13  [SerializeField] UnityEngine.Rigidbody _rigidbody;
14 
15  public Vector3 ObservationValue {
16  get { return this._angular_velocity; }
17  set { this._angular_velocity = value; }
18  }
19 
20  public Space3 TripleSpace { get { return this._angular_velocity_space; } }
21 
22  protected override void PreSetup() { this._rigidbody = this.GetComponent<UnityEngine.Rigidbody>(); }
23 
24  public override IEnumerable<float> FloatEnumerable {
25  get { return new[] {this.ObservationValue.x, this.ObservationValue.y, this.ObservationValue.z}; }
26  }
27 
28  public override void UpdateObservation() { this.ObservationValue = this._rigidbody.angularVelocity; }
29  }
30 }