Grip-Reloaded
Grip version visualizaiton interface for DART (DynamicAnimationandRoboticsToolkits)
|
00001 /* 00002 * Copyright (c) 2014, Georgia Tech Research Corporation 00003 * All rights reserved. 00004 * 00005 * Author: Shailesh Lohia <shailesh.lohia@gatech.edu> 00006 * Date: Jan 2014 00007 * 00008 * Humanoid Robotics Lab Georgia Institute of Technology 00009 * Director: Mike Stilman http://www.golems.org 00010 * 00011 * 00012 * This file is provided under the following "BSD-style" License: 00013 * Redistribution and use in source and binary forms, with or 00014 * without modification, are permitted provided that the following 00015 * conditions are met: 00016 * 00017 * * Redistributions of source code must retain the above copyright 00018 * notice, this list of conditions and the following disclaimer. 00019 * 00020 * * Redistributions in binary form must reproduce the above 00021 * copyright notice, this list of conditions and the following 00022 * disclaimer in the documentation and/or other materials provided 00023 * with the distribution. 00024 * 00025 * * Neither the name of the Humanoid Robotics Lab nor the names of 00026 * its contributors may be used to endorse or promote products 00027 * derived from this software without specific prior written 00028 * permission 00029 * 00030 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 00031 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 00032 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00033 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00034 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00035 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00036 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00037 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00038 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 00039 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00040 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00041 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00042 * POSSIBILITY OF SUCH DAMAGE. 00043 */ 00044 00050 #ifndef GRIPMAINWINDOW_H 00051 #define GRIPMAINWINDOW_H 00052 00053 // C++ Standard includes 00054 #include <iostream> 00055 #include <cstdio> 00056 00057 // Base class include 00058 #include "MainWindow.h" 00059 00060 // Local includes 00061 #include "ViewerWidget.h" 00062 #include "TreeView.h" 00063 #include "InspectorTab.h" 00064 #include "VisualizationTab.h" 00065 #include "PlaybackWidget.h" 00066 #include "ui_VisualizationTab.h" 00067 #include "ui_InspectorTab.h" 00068 #include "ui_TreeView.h" 00069 #include "ui_PlaybackWidget.h" 00070 #include "DartNode.h" 00071 #include "GripSimulation.h" 00072 #include "GripTab.h" 00073 #include "GripTimeslice.h" 00074 00075 // Qt includes 00076 #include <QDir> 00077 #include <QtXml> 00078 00084 class GripMainWindow : public MainWindow 00085 { 00086 public: 00096 GripMainWindow(bool debug=false, std::string sceneFile="", std::string configFile=""); 00097 00101 ~GripMainWindow(); 00102 00107 dart::dynamics::Skeleton *createGround(); 00108 00110 ViewerWidget *viewWidget; 00111 00113 TreeView *treeviewer; 00114 00116 InspectorTab *inspectorTab; 00117 00119 VisualizationTab *visualizationTab; 00120 00122 std::vector<GripTimeslice> *timeline; 00123 00125 PlaybackWidget *playbackWidget; 00126 00132 TreeViewReturn *activeItem; 00133 00135 osgDart::DartNode *worldNode; 00136 00138 dart::simulation::World *world; 00139 00141 GripSimulation *simulation; 00142 00144 //void resizeEvent(QResizeEvent* event); 00145 00146 public slots: 00152 void slotSetWorldFromPlayback(int sliderTick); 00153 00157 void slotPlaybackStart(); 00158 00162 void slotPlaybackPause(); 00163 00167 void slotPlaybackReverse(); 00168 00172 void slotPlaybackBeginning(); 00173 00179 void slotPlaybackTimeStep(bool playForward); 00180 00181 protected slots: 00182 00188 void setSimulationRelativeTime(double time); 00189 00194 void front(); 00195 00200 void top(); 00201 00206 void side(); 00207 00212 void startSimulation(); 00213 00218 void stopSimulation(); 00219 00224 void simulateSingleStep(); 00225 00230 void renderDuringSimulation(); 00231 00236 void white(); 00237 00242 void gray(); 00243 00248 void black(); 00249 00254 void resetCamera(); 00255 00259 void xga1024x768(); 00260 00264 void vga640x480(); 00265 00269 void hd1280x720(); 00270 00274 void close(); 00275 00280 void simulationStopped(); 00281 00282 protected: 00284 00285 00286 00287 00288 00289 00290 QList<GripTab*> *pluginList; 00291 00293 QMenu *pluginMenu; 00294 00296 QList<QString*>* pluginPathList; 00297 00299 QString* sceneFilePath; 00300 00306 QDomDocument* generateWorkspaceXML(); 00307 00312 void parseConfig(QDomDocument config); 00313 00318 void createRenderingWindow(); 00319 00324 void createTreeView(); 00325 00330 void createTabs(); 00331 00336 void manageLayout(); 00337 00342 void createPluginMenu(); 00343 00348 void clear(); 00349 00355 bool stopSimulationWithDialog(); 00356 00361 void swapStartStopButtons(); 00362 00369 void doLoad(std::string sceneFileName); 00370 00375 int saveText(std::string scenepath, const QString &filename); 00376 00377 00382 void loadPluginDirectory(QDir pluginsDirName); 00383 00389 void loadPluginFile(QString pluginFileName); 00390 00397 void setWorldState_Issue122(const Eigen::VectorXd &newState); 00398 00400 QGridLayout *gridLayout; 00401 00402 bool _playingBack; 00403 int _curPlaybackTick; 00404 int _playbackSpeed; 00405 bool _simulationDirty; 00406 bool _simulating; 00407 bool _debug; 00408 }; 00409 00410 00411 #endif // GRIPMAINWINDOW_H