BotNavSim  v0.4.3
Mobile Robot Simulation
UI_SimulationControl Class Reference

IToolbar class for simulation control. Provides controls for pausing, stopping or skipping the current test Provides a toggle for exhibition mode. Provides a slider for simulation timescale. More...

Inheritance diagram for UI_SimulationControl:
Collaboration diagram for UI_SimulationControl:

Public Member Functions

 UI_SimulationControl ()
 

Properties

bool contextual [get]
 
bool hidden [get, set]
 
string windowTitle [get]
 
Rect windowRect [get, set]
 
GUI.WindowFunction windowFunction [get]
 
- Properties inherited from IToolbar
bool contextual [get]
 Gets a value indicating whether this IToolbar is contextual. More...
 
bool hidden [get, set]
 Gets or sets a value indicating whether this IToolbar is hidden. More...
 
- Properties inherited from IWindowFunction
string windowTitle [get]
 Gets the window title. More...
 
Rect windowRect [get, set]
 Gets or sets the window rect (window size and position). More...
 
GUI.WindowFunction windowFunction [get]
 Gets the window function definition for GUILayout.Window() More...
 

Private Member Functions

void MainWindow (int windowID)
 Simulation settings window function called by UI_Toolbar. More...
 

Private Attributes

bool _liveEditSettings
 
UI_SimulationSettings _editSettings
 

Detailed Description

IToolbar class for simulation control. Provides controls for pausing, stopping or skipping the current test Provides a toggle for exhibition mode. Provides a slider for simulation timescale.

Definition at line 11 of file UI_SimulationControl.cs.

Constructor & Destructor Documentation

UI_SimulationControl.UI_SimulationControl ( )

Definition at line 13 of file UI_SimulationControl.cs.

13  {
15  hidden = true;
16  }
An instantiable class that provides a UI for editing a given Simulation.Settings object ...
static Settings settings
Gets or sets the settings for the current simulation.
Definition: Simulation.cs:241
UI_SimulationSettings _editSettings
This is a manager class used to overlook the running of a simulation.
Definition: Simulation.cs:8

Member Function Documentation

void UI_SimulationControl.MainWindow ( int  windowID)
private

Simulation settings window function called by UI_Toolbar.

Definition at line 52 of file UI_SimulationControl.cs.

52  {
53  float lw = 200f;
54 
55  // simulation information
56  GUILayout.BeginHorizontal(GUILayout.Width(UI_Toolbar.I.innerWidth));
57  GUILayout.Label(Simulation.settings.title + "(" + Simulation.simulationNumber + "/" +
58  Simulation.batch.Count + ") ", GUILayout.Width(lw));
59  GUILayout.Label("Test " + Simulation.testNumber + "/" + Simulation.settings.numberOfTests);
60  GUILayout.EndHorizontal();
61 
62  GUILayout.BeginHorizontal(GUILayout.Width(UI_Toolbar.I.innerWidth));
63  GUILayout.Label("Time (s): " + Simulation.time.ToString("G3") + "/" +
64  Simulation.settings.maximumTestTime, GUILayout.Width(lw));
65  GUILayout.EndHorizontal();
66 
67 
68  // exhbition mode tickbox
69  GUILayout.BeginHorizontal(GUILayout.Width(UI_Toolbar.I.innerWidth));
70  GUILayout.Label("Exhibition Mode: ", GUILayout.Width(lw));
71  Simulation.exhibitionMode = GUILayout.Toggle(Simulation.exhibitionMode, "");
72  GUILayout.EndHorizontal();
73 
74  // timescale slider
75  GUILayout.BeginHorizontal(GUILayout.Width(UI_Toolbar.I.innerWidth));
76  GUILayout.Label("Simulation Timescale: ", GUILayout.Width(lw));
77  Simulation.timeScale = GUILayout.HorizontalSlider(
79  0.5f, 4f);
80  GUILayout.EndHorizontal();
81 
82  // contextual control buttons
83  if (Simulation.isRunning) {
84  GUILayout.BeginHorizontal();
85  if (Simulation.paused) {
86  if (GUILayout.Button("Play"))
87  Simulation.paused = false;
88  }
89  else {
90  if (GUILayout.Button("Pause"))
91  Simulation.paused = true;
92  }
93  if (GUILayout.Button("Stop")) {
94  Simulation.exhibitionMode = false;
95  Simulation.End();
96  }
97  GUILayout.EndHorizontal();
98  if (GUILayout.Button("Next Test")) {
100  }
101 
102  }
103  if (Simulation.isFinished) {
104  if (GUILayout.Button("Start Again")) {
105  Simulation.Begin();
106  }
107  if (GUILayout.Button("New Simulation...")) {
108  Simulation.End();
109  }
110  }
111 
112  // show/hide button for edit settings window
113  if (_liveEditSettings) {
114  if (GUILayout.Button("Hide Settings")) {
115  _liveEditSettings = false;
117  }
118  }
119  else {
120  if (GUILayout.Button("Show Settings")) {
122  _liveEditSettings = true;
124  }
125  }
126 
127  // update controls when _editSettings is completed
128  if (_liveEditSettings) {
129  if (_editSettings.windowFunction == null) {
130  _liveEditSettings = false;
131  }
132  }
133 
134  }
int numberOfTests
The number of repeat tests with these parameters.
Definition: Simulation.cs:78
static List< Settings > batch
List of settings to iterate through in batch mode.
Definition: Simulation.cs:254
static void NextTest()
Stops the current test and starts the next test in current simulation.
Definition: Simulation.cs:461
static float timeScale
Gets or sets the time scale.
Definition: Simulation.cs:376
static int simulationNumber
Gets the simulation number (index in batch list, 1 to batch.Count).
Definition: Simulation.cs:259
float innerWidth
Definition: UI_Toolbar.cs:33
static UI_Toolbar I
Singleton pattern.
Definition: UI_Toolbar.cs:16
static void End()
Stop all simulations.
Definition: Simulation.cs:516
static bool paused
Gets or sets a value indicating whether this Simulation is paused.
Definition: Simulation.cs:354
An instantiable class that provides a UI for editing a given Simulation.Settings object ...
static Settings settings
Gets or sets the settings for the current simulation.
Definition: Simulation.cs:241
static bool exhibitionMode
Exhibition mode will run continually and randomly choose camera perspectives and simulation settings...
Definition: Simulation.cs:236
static bool isFinished
Gets a value indicating whether this Simulation is finished.
Definition: Simulation.cs:339
UI_SimulationSettings _editSettings
static bool isRunning
Gets a value indicating whether this Simulation is running.
Definition: Simulation.cs:325
UI Toolbar provides controls for choosing which UI windows to display
Definition: UI_Toolbar.cs:11
string title
The title of this simulation.
Definition: Simulation.cs:73
int maximumTestTime
The maximum test time in seconds.
Definition: Simulation.cs:112
static int testNumber
Gets the current test number (1 to settings.numberOfTests).
Definition: Simulation.cs:266
GUI.WindowFunction windowFunction
Edit Simulation.Settings window function. Note that when the back button is pressed on the main windo...
This is a manager class used to overlook the running of a simulation.
Definition: Simulation.cs:8
static void Begin()
Begin simulating.
Definition: Simulation.cs:412
Interface for classes that implement a GUI.WindowFunction
List< IWindowFunction > additionalWindows
The additional windows to be drawn outside the toolbar. used for classes like UI_SimulationSettings ...
Definition: UI_Toolbar.cs:27
static float time
Time (in seconds) since robot started searching for destination.
Definition: Simulation.cs:366

Here is the call graph for this function:

Member Data Documentation

UI_SimulationSettings UI_SimulationControl._editSettings
private

Definition at line 46 of file UI_SimulationControl.cs.

bool UI_SimulationControl._liveEditSettings
private

Definition at line 45 of file UI_SimulationControl.cs.

Property Documentation

bool UI_SimulationControl.contextual
get

Definition at line 18 of file UI_SimulationControl.cs.

bool UI_SimulationControl.hidden
getset

Definition at line 24 of file UI_SimulationControl.cs.

GUI.WindowFunction UI_SimulationControl.windowFunction
get

Definition at line 38 of file UI_SimulationControl.cs.

Rect UI_SimulationControl.windowRect
getset

Definition at line 34 of file UI_SimulationControl.cs.

string UI_SimulationControl.windowTitle
get

Definition at line 28 of file UI_SimulationControl.cs.


The documentation for this class was generated from the following file: