Grip-Reloaded
Grip version visualizaiton interface for DART (DynamicAnimationandRoboticsToolkits)
Public Slots | Public Member Functions | Public Attributes | Protected Slots | Protected Member Functions | Protected Attributes
GripMainWindow Class Reference

Class that subclasses MainWindow in order to create the whole Grip interface. More...

#include <GripMainWindow.h>

Inheritance diagram for GripMainWindow:
MainWindow

List of all members.

Public Slots

void slotSetWorldFromPlayback (int sliderTick)
 called when the window gets resized --> Avoid mixing resizing with layout manager. Unless you make a delicate resizing policy, it will mess up your window.
void slotPlaybackStart ()
 Slot for starting the playback.
void slotPlaybackPause ()
 Slot for pausing the playback.
void slotPlaybackReverse ()
 Slot for reversing the playback.
void slotPlaybackBeginning ()
 Slot for going to the beginning of the playback timeline.
void slotPlaybackTimeStep (bool playForward)
 Slot that recursively calls it self to run the playback loop. The recursive call allows the event loop to process other events, (eg. Stop Playback)

Public Member Functions

 GripMainWindow (bool debug=false, std::string sceneFile="", std::string configFile="")
 Constructs a GripMainWindow object.
 ~GripMainWindow ()
 Destructs a GripMainWindow object.
dart::dynamics::Skeleton * createGround ()
 Convenience function for creating a ground skeleton.

Public Attributes

ViewerWidgetviewWidget
 OpenSceneGraph Qt composite viewer widget, which can hold more than one view.
TreeViewtreeviewer
 QDockWidget that contains a QTreeWidget. It is used as an object explorer for the loaded skeletons or robots.
InspectorTabinspectorTab
 Tab for manually manipulating objects in the world.
VisualizationTabvisualizationTab
 Tab for changing visualization settings of the render window.
std::vector< GripTimeslice > * timeline
 Array of GripTimeSlice objects stored for simulation/kinematic playback.
PlaybackWidgetplaybackWidget
 Widget for playing back the simulation or kinematic states in the timeline.
TreeViewReturnactiveItem
osgDart::DartNodeworldNode
 Main OpenSceneGraph node for the main view of the composite viewer.
dart::simulation::World * world
 The world object that is being rendered and simulated.
GripSimulationsimulation
 Simulation thread doing the actually simluation loop.

Protected Slots

void setSimulationRelativeTime (double time)
 Sets the time box for simulation time relative to real time.
void front ()
 Set the view to front view.
void top ()
 Set the view to top view.
void side ()
 Set the view to side view.
void startSimulation ()
 Starts the simulation.
void stopSimulation ()
 Stops the simulation.
void simulateSingleStep ()
 Simulates a single time step of the simulation.
void renderDuringSimulation ()
 Turns on rendering during simulation, which will simulation slower than if rendering is turned off.
void white ()
 Sets the background color of the window to white.
void gray ()
 Sets the background color of the window to gray.
void black ()
 Sets the background color of the window to black.
void resetCamera ()
 Resets the camera position to a position so that you can see the front view of the rendered objects.
void xga1024x768 ()
 Change movie export mode to 1024x768.
void vga640x480 ()
 Change movie export mode to 640x480.
void hd1280x720 ()
 Change movie export mode to 1280x720.
void close ()
 Close current scene.
void simulationStopped ()
 Notifies thread that simulation has stopped.

Protected Member Functions

QDomDocument * generateWorkspaceXML ()
 Create an XML file for the workspace contains the list of plugins, status of DockWidgets and the loaded scene.
void parseConfig (QDomDocument config)
 Parses the configuration file and manipulates the workspace to match the settings in the configuration file.
void createRenderingWindow ()
 Creates the rendering window.
void createTreeView ()
 Creates the tree view.
void createTabs ()
 Creates the default tabs.
void manageLayout ()
 Manage layout of the main window.
void createPluginMenu ()
 creates the Plugin Menu
void clear ()
 Clears the world, simulation and widgets.
bool stopSimulationWithDialog ()
 Pops up a dialog box for the user to confirm if he wants to stop the currently running simulation.
void swapStartStopButtons ()
 Swaps the start and stop buttons for covenience. It just shows and hides them.
void doLoad (std::string sceneFileName)
 Load the scene and renders it. This function resets everything on each load.
int saveText (std::string scenepath, const QString &filename)
 Saves the loaded scene to file for quick load functionality.
void loadPluginDirectory (QDir pluginsDirName)
 Reads a QDir directory and loads all the plugins inside it.
void loadPluginFile (QString pluginFileName)
 Loads a plugin file (.so) by name. When loaded, the plugin will be added to the bottom tabs area.
void setWorldState_Issue122 (const Eigen::VectorXd &newState)
 Set state of world from an Eigen::VectorXd. Because DART has a major bug with the integration of free and ball joints, some extra work arounds have to been performed.

Protected Attributes

QList< GripTab * > * pluginList
QMenu * pluginMenu
 Plugin menu pointer for showing/hiding plugins.
QList< QString * > * pluginPathList
 Stores the path to all the plugins that are loaded.
QString * sceneFilePath
 Stores the path to the scene file.
QGridLayout * gridLayout
 used to maintain the layout of the widgets that are not QDockWidgets
bool _playingBack
 Whether or not playback is happening.
int _curPlaybackTick
 Current tick in playback.
int _playbackSpeed
 Additive value corresponding to playback speed.
bool _simulationDirty
 Whether or not the timeline has been messed with.
bool _simulating
 Whether or not simulation is happening.
bool _debug
 Whether or not to print debug statements.

Detailed Description

Class that subclasses MainWindow in order to create the whole Grip interface.


Constructor & Destructor Documentation

GripMainWindow::GripMainWindow ( bool  debug = false,
std::string  sceneFile = "",
std::string  configFile = "" 
)

Constructs a GripMainWindow object.

Parameters:
debugWhether or not to print debug statements. This gets passed to local class objects
sceneFileString representing the scene file to load on startup. If empty or unspecified, a scene will not be loaded.
configFileString representing the workspace file to load on startup. If empty or unspecified, a workspace will not be loaded.

object initialization

create objects for widget classes

load widgets in the user interface and manages the layout

set the status bar for the Grip Window


Member Function Documentation

void GripMainWindow::black ( ) [protected, virtual, slot]

Sets the background color of the window to black.

Returns:
void

Implements MainWindow.

void GripMainWindow::clear ( ) [protected]

Clears the world, simulation and widgets.

Returns:
void
dart::dynamics::Skeleton * GripMainWindow::createGround ( )

Convenience function for creating a ground skeleton.

Returns:
Ground object
void GripMainWindow::createPluginMenu ( ) [protected]

creates the Plugin Menu

Returns:
void
void GripMainWindow::createRenderingWindow ( ) [protected, virtual]

Creates the rendering window.

Returns:
void

Implements MainWindow.

void GripMainWindow::createTabs ( ) [protected, virtual]

Creates the default tabs.

Returns:
void

Implements MainWindow.

void GripMainWindow::createTreeView ( ) [protected, virtual]

Creates the tree view.

Returns:
void

Implements MainWindow.

void GripMainWindow::doLoad ( std::string  sceneFileName) [protected, virtual]

Load the scene and renders it. This function resets everything on each load.

Parameters:
fileNameName of scene file to load
Returns:
void

Implements MainWindow.

void GripMainWindow::front ( ) [protected, virtual, slot]

Set the view to front view.

Returns:
void

Implements MainWindow.

QDomDocument * GripMainWindow::generateWorkspaceXML ( ) [protected, virtual]

Create an XML file for the workspace contains the list of plugins, status of DockWidgets and the loaded scene.

Returns:
QDomDocument

Implements MainWindow.

void GripMainWindow::gray ( ) [protected, virtual, slot]

Sets the background color of the window to gray.

Returns:
void

Implements MainWindow.

void GripMainWindow::loadPluginDirectory ( QDir  pluginsDirName) [protected, virtual]

Reads a QDir directory and loads all the plugins inside it.

Parameters:
pluginsDirNameName of the QDir containing the plugins

Implements MainWindow.

void GripMainWindow::loadPluginFile ( QString  pluginFileName) [protected, virtual]

Loads a plugin file (.so) by name. When loaded, the plugin will be added to the bottom tabs area.

Parameters:
pluginFileNameString representing the path of the plugin

Implements MainWindow.

void GripMainWindow::manageLayout ( ) [protected]

Manage layout of the main window.

Returns:
void

viewWidget initial size: 800 x 600

adding tree view

adding the inspector and visualization tabs

void GripMainWindow::parseConfig ( QDomDocument  config) [protected, virtual]

Parses the configuration file and manipulates the workspace to match the settings in the configuration file.

Returns:
void

parse and load plugins

parse and set qDockWidget states

parse and load scene

parse and load cameras parse and load lightsources

Implements MainWindow.

void GripMainWindow::resetCamera ( ) [protected, virtual, slot]

Resets the camera position to a position so that you can see the front view of the rendered objects.

Returns:
void

Implements MainWindow.

int GripMainWindow::saveText ( std::string  scenepath,
const QString &  filename 
) [protected]

Saves the loaded scene to file for quick load functionality.

Returns:
void
void GripMainWindow::setSimulationRelativeTime ( double  time) [protected, virtual, slot]

Sets the time box for simulation time relative to real time.

Parameters:
timeThe simulation time relative to real time
Returns:
void

Implements MainWindow.

void GripMainWindow::setWorldState_Issue122 ( const Eigen::VectorXd &  newState) [protected]

Set state of world from an Eigen::VectorXd. Because DART has a major bug with the integration of free and ball joints, some extra work arounds have to been performed.

Parameters:
newStateNew state for the world
void GripMainWindow::side ( ) [protected, virtual, slot]

Set the view to side view.

Returns:
void

Implements MainWindow.

void GripMainWindow::simulateSingleStep ( ) [protected, virtual, slot]

Simulates a single time step of the simulation.

Returns:
void

Implements MainWindow.

void GripMainWindow::simulationStopped ( ) [protected, virtual, slot]

Notifies thread that simulation has stopped.

Returns:
void

Implements MainWindow.

void GripMainWindow::slotPlaybackTimeStep ( bool  playForward) [virtual, slot]

Slot that recursively calls it self to run the playback loop. The recursive call allows the event loop to process other events, (eg. Stop Playback)

Parameters:
playForwardWhether or not to play back in forward or reverse

Implements MainWindow.

void GripMainWindow::slotSetWorldFromPlayback ( int  sliderTick) [virtual, slot]

called when the window gets resized --> Avoid mixing resizing with layout manager. Unless you make a delicate resizing policy, it will mess up your window.

Slot for setting the state and time of the world based on the playback widget's slider position and the contents of the timeline

Parameters:
sliderTickPosition of the playback widget's slider

Implements MainWindow.

void GripMainWindow::startSimulation ( ) [protected, virtual, slot]

Starts the simulation.

Returns:
void

Implements MainWindow.

void GripMainWindow::stopSimulation ( ) [protected, virtual, slot]

Stops the simulation.

Returns:
void

Implements MainWindow.

Pops up a dialog box for the user to confirm if he wants to stop the currently running simulation.

Returns:
bool Whether or not the user want to stop the simulation or not

Swaps the start and stop buttons for covenience. It just shows and hides them.

Returns:
void
void GripMainWindow::top ( ) [protected, virtual, slot]

Set the view to top view.

Returns:
void

Implements MainWindow.

void GripMainWindow::white ( ) [protected, virtual, slot]

Sets the background color of the window to white.

Returns:
void

Implements MainWindow.


Member Data Documentation

TreeViewReturn class is defined in tree_view.h It contains two members: void* object and DataType dataType void* object can store a dart Skeleton object or BodyNode object DataType is an enumaration defined in tree_view.h which can take the values Return_Type_Robot and Return_Type_Node

QList<GripTab*>* GripMainWindow::pluginList [protected]

Protected Members Any plugin that is loaded successfully into the Grip will get stored in this QList The plugins are always going to be derived from the GripTab interface defined in qtWidgets/include/GripTab.h In order to execute one of the pure virtual functions defined in the GripTab declaration, you first need to perform a qobject_cast. An example for the same is GripTab* gt = qobject_cast<GripTab*>(plugin); Once a pointer of type GripTab is created you can then call the function directly.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator