Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
SimulatorConfiguration.cs
Go to the documentation of this file.
1 using System;
7 using UnityEngine;
8 
9 namespace droid.Runtime.Utilities.Structs {
14  [CreateAssetMenu(fileName = "SimulatorConfiguration",
15  menuName = ScriptableObjectMenuPath._ScriptableObjectMenuPath + "SimulatorConfiguration",
16  order = 1)]
17  [Serializable]
18  public class SimulatorConfiguration : ScriptableObject,
20  [Header("Performance (Disable for faster serialisation, but with loss of functionality)")]
21  [SerializeField]
22  bool _always_serialise_unobservables = true;
23 
24  [SerializeField] bool _always_serialise_individual_observables = true;
25 
26  [SerializeField] bool _always_serialise_aggregated_float_array = true;
27 
28  [Header("Graphics")] [SerializeField] bool _apply_resolution_settings = false;
29 
30  [SerializeField] bool _optimiseWindow_for_speed = false;
31 
32  [SerializeField] bool _apply_quality_settings = false;
33 
34  [SerializeField] [Range(1, 9999)] int _height = 500;
35 
36  [SerializeField] [Range(1, 9999)] int _width = 500;
37  [SerializeField] [Range(1, 4)] int _quality_level = 1;
38  [SerializeField] [Range(0, 4)] int _v_sync_count = 0;
39  [SerializeField] bool _full_screen = false;
40  [SerializeField] bool _resizable_window = true;
41  [SerializeField] ColorSpace _color_space = ColorSpace.Linear;
42 
45  [Header("Simulation")]
46  [SerializeField]
47  [SearchableEnum]
48  FrameFinishes _frame_finishes = FrameFinishes.On_post_render_;
49 
52  [SerializeField]
53  [Range(0, 99)]
54  int _frame_skips = 0;
55 
58  [Header("Connection")]
59  [SerializeField]
60  string _ip_address = "localhost";
61 
64  [SerializeField]
65  [Range(0, 9999)]
66  float _max_reply_interval = 0;
67 
70  [SerializeField]
71  [Range(0, 999)]
72  int _num_of_environments = 0;
73 
76  [SerializeField]
77  int _port = 6969;
78 
79  [SerializeField] bool _replay_reaction_in_skips;
80 
84  [SerializeField]
85  [Range(1, 99)]
86  int _reset_iterations = 1;
87 
90  [SerializeField]
91  [SearchableEnum]
92  SimulationType _simulation_type = SimulationType.Independent_;
93 
96  [SerializeField]
97  [SearchableEnum]
98  ExecutionPhase _step_execution_phase = ExecutionPhase.Middle_;
99 
104  [SerializeField]
105  [Range(-1, 9999)]
106  int _target_frame_rate = -1;
107 
111  [Header("Time")]
112  [SerializeField]
113  [Range(0f, 100f)]
114  float _time_scale = 1;
115 
119  [Header("Experimental (Warning, it is important to read docs before use!)")]
120  [SerializeField]
121  bool _update_fixed_time_scale = false;
122 
125  public void SetToDefault() {
126  this.Width = 500;
127  this.Height = 500;
128  this.FullScreen = false;
129  this.QualityLevel = 1;
130  this.TimeScale = 1;
131  this.TargetFrameRate = -1;
132  this.SimulationType = SimulationType.Frame_dependent_;
133  this.FrameFinishes = FrameFinishes.Late_update_;
134  this.FrameSkips = 0;
135  this.ResetIterations = 1;
136  this.MaxReplyInterval = 0;
137  this.NumOfEnvironments = 1;
138  this.ResizableWindow = true;
139  this.ColorSpace = ColorSpace.Linear;
140  this.VSyncCount = 0;
141  }
142 
143  #region Getter Setters
144 
147  public int FrameSkips {
148  get { return this._frame_skips; }
149  set {
150  if (value >= 0) {
151  this._frame_skips = value;
152  }
153  }
154  }
155 
158  public int ResetIterations {
159  get { return this._reset_iterations; }
160  set {
161  if (value >= 1) {
162  this._reset_iterations = value;
163  }
164  }
165  }
166  //When resetting transforms we run multiple times to ensure that we properly reset hierachies of objects
167 
171  get { return this._simulation_type; }
172  set { this._simulation_type = value; }
173  }
174 
178  public bool ApplyResolutionSettings {
179  get { return this._apply_resolution_settings; }
180  set { this._apply_resolution_settings = value; }
181  }
182 
186  public bool ApplyQualitySettings {
187  get { return this._apply_quality_settings; }
188  set { this._apply_quality_settings = value; }
189  }
190 
191  public Boolean ResizableWindow {
192  get { return this._resizable_window; }
193  set { this._resizable_window = value; }
194  }
195 
196  public ColorSpace ColorSpace { get { return this._color_space; } set { this._color_space = value; } }
197 
201  public int VSyncCount { get { return this._v_sync_count = 0; } set { this._v_sync_count = value; } }
202 
205  public int Width {
206  get { return this._width; }
207  set {
208  if (value >= 0) {
209  this._width = value;
210  }
211  }
212  }
213 
216  public int Height {
217  get { return this._height; }
218  set {
219  if (value >= 0) {
220  this._height = value;
221  }
222  }
223  }
224 
227  public bool FullScreen { get { return this._full_screen; } set { this._full_screen = value; } }
228 
231  public int NumOfEnvironments {
232  get { return this._num_of_environments; }
233  set { this._num_of_environments = value; }
234  }
235 
238  public int TargetFrameRate {
239  get { return this._target_frame_rate; }
240  set {
241  if (value >= -1) {
242  this._target_frame_rate = value;
243  }
244  }
245  }
246 
249  public int QualityLevel {
250  get { return this._quality_level; }
251  set {
252  if (value >= 1 && value <= 4) {
253  this._quality_level = value;
254  }
255  }
256  }
257 
260  public float TimeScale {
261  get { return this._time_scale; }
262  set {
263  if (value >= 0) {
264  this._time_scale = value;
265  }
266  }
267  }
268 
271  public float MaxReplyInterval {
272  get { return this._max_reply_interval; }
273  set { this._max_reply_interval = value; }
274  }
275 
279  get { return this._frame_finishes; }
280  set { this._frame_finishes = value; }
281  }
282 
285  public ExecutionPhase StepExecutionPhase {
286  get { return this._step_execution_phase; }
287  set { this._step_execution_phase = value; }
288  }
289 
293  public bool UpdateFixedTimeScale {
294  get { return this._update_fixed_time_scale; }
295  set { this._update_fixed_time_scale = value; }
296  }
297 
298  public Boolean AlwaysSerialiseAggregatedFloatArray {
299  get { return this._always_serialise_aggregated_float_array; }
300  set { this._always_serialise_aggregated_float_array = value; }
301  }
302 
306  public bool AlwaysSerialiseUnobservables {
307  get { return this._always_serialise_unobservables; }
308  set { this._always_serialise_unobservables = value; }
309  }
310 
314  public bool AlwaysSerialiseIndividualObservables {
315  get { return this._always_serialise_individual_observables; }
316  set { this._always_serialise_individual_observables = value; }
317  }
318 
322  public bool ReplayReactionInSkips {
323  get { return this._replay_reaction_in_skips; }
324  set { this._replay_reaction_in_skips = value; }
325  }
326 
330  public Int32 Port { get { return this._port; } set { this._port = value; } }
331 
334  public String IpAddress { get { return this._ip_address; } set { this._ip_address = value; } }
335 
336  public Boolean OptimiseWindowForSpeed {
337  get { return this._optimiseWindow_for_speed; }
338  set { this._optimiseWindow_for_speed = value; }
339  }
340 
341  #endregion
342  }
343 }
Contains everything relevant to configuring simulation environments engine specific settings ...
FrameFinishes
Determines where in the monobehaviour cycle a frame/step is finished
Definition: FrameFinishes.cs:5
SimulationType
Determines the discrete timesteps of the simulation environment.