Grip-Reloaded
Grip version visualizaiton interface for DART (DynamicAnimationandRoboticsToolkits)
|
Class that subclasses MainWindow in order to create the whole Grip interface. More...
#include <GripMainWindow.h>
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 | |
ViewerWidget * | viewWidget |
OpenSceneGraph Qt composite viewer widget, which can hold more than one view. | |
TreeView * | treeviewer |
QDockWidget that contains a QTreeWidget. It is used as an object explorer for the loaded skeletons or robots. | |
InspectorTab * | inspectorTab |
Tab for manually manipulating objects in the world. | |
VisualizationTab * | visualizationTab |
Tab for changing visualization settings of the render window. | |
std::vector< GripTimeslice > * | timeline |
Array of GripTimeSlice objects stored for simulation/kinematic playback. | |
PlaybackWidget * | playbackWidget |
Widget for playing back the simulation or kinematic states in the timeline. | |
TreeViewReturn * | activeItem |
osgDart::DartNode * | worldNode |
Main OpenSceneGraph node for the main view of the composite viewer. | |
dart::simulation::World * | world |
The world object that is being rendered and simulated. | |
GripSimulation * | simulation |
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. |
Class that subclasses MainWindow in order to create the whole Grip interface.
GripMainWindow::GripMainWindow | ( | bool | debug = false , |
std::string | sceneFile = "" , |
||
std::string | configFile = "" |
||
) |
Constructs a GripMainWindow object.
debug | Whether or not to print debug statements. This gets passed to local class objects |
sceneFile | String representing the scene file to load on startup. If empty or unspecified, a scene will not be loaded. |
configFile | String 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
void GripMainWindow::black | ( | ) | [protected, virtual, slot] |
void GripMainWindow::clear | ( | ) | [protected] |
Clears the world, simulation and widgets.
dart::dynamics::Skeleton * GripMainWindow::createGround | ( | ) |
Convenience function for creating a ground skeleton.
void GripMainWindow::createPluginMenu | ( | ) | [protected] |
creates the Plugin Menu
void GripMainWindow::createRenderingWindow | ( | ) | [protected, virtual] |
void GripMainWindow::createTabs | ( | ) | [protected, virtual] |
void GripMainWindow::createTreeView | ( | ) | [protected, virtual] |
void GripMainWindow::doLoad | ( | std::string | sceneFileName | ) | [protected, virtual] |
Load the scene and renders it. This function resets everything on each load.
fileName | Name of scene file to load |
Implements MainWindow.
void GripMainWindow::front | ( | ) | [protected, virtual, slot] |
QDomDocument * GripMainWindow::generateWorkspaceXML | ( | ) | [protected, virtual] |
Create an XML file for the workspace contains the list of plugins, status of DockWidgets and the loaded scene.
Implements MainWindow.
void GripMainWindow::gray | ( | ) | [protected, virtual, slot] |
void GripMainWindow::loadPluginDirectory | ( | QDir | pluginsDirName | ) | [protected, virtual] |
Reads a QDir directory and loads all the plugins inside it.
pluginsDirName | Name 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.
pluginFileName | String representing the path of the plugin |
Implements MainWindow.
void GripMainWindow::manageLayout | ( | ) | [protected] |
Manage layout of the main window.
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.
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.
Implements MainWindow.
int GripMainWindow::saveText | ( | std::string | scenepath, |
const QString & | filename | ||
) | [protected] |
Saves the loaded scene to file for quick load functionality.
void GripMainWindow::setSimulationRelativeTime | ( | double | time | ) | [protected, virtual, slot] |
Sets the time box for simulation time relative to real time.
time | The simulation time relative to real time |
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.
newState | New state for the world |
void GripMainWindow::side | ( | ) | [protected, virtual, slot] |
void GripMainWindow::simulateSingleStep | ( | ) | [protected, virtual, slot] |
void GripMainWindow::simulationStopped | ( | ) | [protected, virtual, slot] |
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)
playForward | Whether 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
sliderTick | Position of the playback widget's slider |
Implements MainWindow.
void GripMainWindow::startSimulation | ( | ) | [protected, virtual, slot] |
void GripMainWindow::stopSimulation | ( | ) | [protected, virtual, slot] |
bool GripMainWindow::stopSimulationWithDialog | ( | ) | [protected] |
Pops up a dialog box for the user to confirm if he wants to stop the currently running simulation.
void GripMainWindow::swapStartStopButtons | ( | ) | [protected] |
Swaps the start and stop buttons for covenience. It just shows and hides them.
void GripMainWindow::top | ( | ) | [protected, virtual, slot] |
void GripMainWindow::white | ( | ) | [protected, virtual, slot] |
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.