VControlPanel Class Reference

#include <VControlPanel.h>

Inherits wxPanel.

Collaboration diagram for VControlPanel:

Collaboration graph
[legend]
List of all members.

Public Types

enum  GUIElements {
  PLAY_BTN, FF_BTN, RESTART_BTN, STATUS_BTN,
  SPEED_CHOICE, ACCURACY_CHOICE, SPEED_DISPLAY, FPS_DISPLAY
}

Public Member Functions

 VControlPanel (wxFrame *frame, VWorld *world, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
bool initFromXML (const wxXmlNode &node)
void onPlayBtn (wxCommandEvent &event)
 Play button callback. Toggles between play and stop.
void onFFBtn (wxCommandEvent &event)
void onResetBtn (wxCommandEvent &event)
 Reset button callback. Reloads the XML file and re-starts the sim.
void onSpeedChoice (wxCommandEvent &event)
 Speed choice callback. Sets the time zoom factor for the model.
void onAccuracyChoice (wxCommandEvent &event)
 Accuracy choice callback. Sets the stepsize for the model.
void runModel ()
void updateGUI (const long double curTime)
bool isPlaying () const

Protected Attributes

VWorldmyModel
 The World that I am controling.
bool myIsPlaying
 Set true if I am currently running the model forward.
long double myLastModelUpdate
 The time of the last model update.
long double myLastGUIUpdate
 The time of the last GUI update (used to calculate FPS).
double myDesiredSpeedFactor
 The desired time acceleration factor (from the GUI).
double myActualSpeedFactor
double myStepSize
 The step size to use.
GUI elements
wxButton * myPlayBtn
wxButton * myFFBtn
wxButton * myRestartBtn
wxButton * myStatusBtn
wxChoice * mySpeedChoice
wxChoice * myAccuracyChoice
wxTextCtrl * myActualSpeed
wxTextCtrl * myFPS

Detailed Description

The model control panel. Allows start/stop of model time, control of the modeling speed and accuracy. The model speed is a time acceleration. The user can run the model at 10-1000% of real-time. This will cause the model to be advanced speed*time after time has passed. This panel has an automatic speed control to limit the speed if it is taking too long. Too long is defined as >time seconds to run speed*time. If it takes longer than this, we aren't keeping up and the speed will be reduced until we can keep up.
Author:
Chad Weisshaar
Date:
2005

Definition at line 26 of file VControlPanel.h.


Member Enumeration Documentation

enum VControlPanel::GUIElements
 

Enumerator:
PLAY_BTN 
FF_BTN 
RESTART_BTN 
STATUS_BTN 
SPEED_CHOICE 
ACCURACY_CHOICE 
SPEED_DISPLAY 
FPS_DISPLAY 

Definition at line 29 of file VControlPanel.h.


Constructor & Destructor Documentation

VControlPanel::VControlPanel wxFrame frame,
VWorld world,
wxWindowID  id = wxID_ANY,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize
 

Create a VControlPanel

Parameters:
frame The parent. Normally the ViewerGUI
world A pointer to the world that I am controling. I don't take ownership of this world

Definition at line 33 of file VControlPanel.cpp.

References memTraceMsg.


Member Function Documentation

bool VControlPanel::initFromXML const wxXmlNode &  node  ) 
 

Initialize the GUI from an XML node. This should be the <application> node.

Definition at line 112 of file VControlPanel.cpp.

References traceId.

bool VControlPanel::isPlaying  )  const [inline]
 

Definition at line 72 of file VControlPanel.h.

References myIsPlaying.

Referenced by ViewerGUI::onIdle().

void VControlPanel::onAccuracyChoice wxCommandEvent &  event  ) 
 

Accuracy choice callback. Sets the stepsize for the model.

Definition at line 166 of file VControlPanel.cpp.

References myAccuracyChoice, myStepSize, and traceId.

void VControlPanel::onFFBtn wxCommandEvent &  event  ) 
 

Fast foward button callback. Pops up a dialog to get the number of seconds to advance the model. Model is advanced and paused

Definition at line 131 of file VControlPanel.cpp.

References MWorld::advanceModel(), myIsPlaying, myModel, myStepSize, onPlayBtn(), and traceId.

Here is the call graph for this function:

void VControlPanel::onPlayBtn wxCommandEvent &  event  ) 
 

Play button callback. Toggles between play and stop.

Definition at line 118 of file VControlPanel.cpp.

References myFPS, myIsPlaying, myLastModelUpdate, myPlayBtn, and pcTimer().

Referenced by onFFBtn(), and onResetBtn().

Here is the call graph for this function:

void VControlPanel::onResetBtn wxCommandEvent &  event  ) 
 

Reset button callback. Reloads the XML file and re-starts the sim.

Definition at line 147 of file VControlPanel.cpp.

References myIsPlaying, onPlayBtn(), ViewerApp::reInit(), ViewerApp::theApp, and traceId.

Here is the call graph for this function:

void VControlPanel::onSpeedChoice wxCommandEvent &  event  ) 
 

Speed choice callback. Sets the time zoom factor for the model.

Definition at line 158 of file VControlPanel.cpp.

References myActualSpeedFactor, myDesiredSpeedFactor, mySpeedChoice, and traceId.

void VControlPanel::runModel  ) 
 

Advance the physics model. This will calculate how much real-time has passed since the last time this function was called and will advance the model the correct amount. This function could potentially take a long time if you wait too long between calls. This function is part of the automatic speed control. If it takes longer to move the model forward than it should, I slow down the time acceleration

Definition at line 201 of file VControlPanel.cpp.

References MWorld::advanceModel(), myActualSpeedFactor, myIsPlaying, myLastModelUpdate, myModel, myStepSize, and pcTimer().

Referenced by ViewerGUI::onIdle().

Here is the call graph for this function:

void VControlPanel::updateGUI const long double  curTime  ) 
 

Update the GUI. This will calculate the time since it was last called and if it has been more than 1/5th of a second, the GUI elements will be re-drawn. This function is also part of the automatic speed control. It will increase the speed if we are getting a good FPS

Definition at line 173 of file VControlPanel.cpp.

References TemplateUtil::min(), myActualSpeed, myActualSpeedFactor, myDesiredSpeedFactor, myFPS, myLastGUIUpdate, and traceId.

Referenced by ViewerGUI::onIdle().

Here is the call graph for this function:


Member Data Documentation

wxChoice* VControlPanel::myAccuracyChoice [protected]
 

Definition at line 104 of file VControlPanel.h.

Referenced by onAccuracyChoice().

wxTextCtrl* VControlPanel::myActualSpeed [protected]
 

Definition at line 106 of file VControlPanel.h.

Referenced by updateGUI().

double VControlPanel::myActualSpeedFactor [protected]
 

The actual time acceleration factor that I am using (might not be able to do what the user wants because they have a slow computer)

Definition at line 90 of file VControlPanel.h.

Referenced by onSpeedChoice(), runModel(), and updateGUI().

double VControlPanel::myDesiredSpeedFactor [protected]
 

The desired time acceleration factor (from the GUI).

Definition at line 87 of file VControlPanel.h.

Referenced by onSpeedChoice(), and updateGUI().

wxButton* VControlPanel::myFFBtn [protected]
 

Definition at line 99 of file VControlPanel.h.

wxTextCtrl* VControlPanel::myFPS [protected]
 

Definition at line 107 of file VControlPanel.h.

Referenced by onPlayBtn(), and updateGUI().

bool VControlPanel::myIsPlaying [protected]
 

Set true if I am currently running the model forward.

Definition at line 79 of file VControlPanel.h.

Referenced by isPlaying(), onFFBtn(), onPlayBtn(), onResetBtn(), and runModel().

long double VControlPanel::myLastGUIUpdate [protected]
 

The time of the last GUI update (used to calculate FPS).

Definition at line 84 of file VControlPanel.h.

Referenced by updateGUI().

long double VControlPanel::myLastModelUpdate [protected]
 

The time of the last model update.

Definition at line 82 of file VControlPanel.h.

Referenced by onPlayBtn(), and runModel().

VWorld* VControlPanel::myModel [protected]
 

The World that I am controling.

Definition at line 76 of file VControlPanel.h.

Referenced by onFFBtn(), and runModel().

wxButton* VControlPanel::myPlayBtn [protected]
 

Definition at line 98 of file VControlPanel.h.

Referenced by onPlayBtn().

wxButton* VControlPanel::myRestartBtn [protected]
 

Definition at line 100 of file VControlPanel.h.

wxChoice* VControlPanel::mySpeedChoice [protected]
 

Definition at line 103 of file VControlPanel.h.

Referenced by onSpeedChoice().

wxButton* VControlPanel::myStatusBtn [protected]
 

Definition at line 101 of file VControlPanel.h.

double VControlPanel::myStepSize [protected]
 

The step size to use.

Definition at line 93 of file VControlPanel.h.

Referenced by onAccuracyChoice(), onFFBtn(), and runModel().


The documentation for this class was generated from the following files:
Generated on Sat Dec 3 10:48:22 2005 for Robotics by  doxygen 1.4.5