Grip-Reloaded
Grip version visualizaiton interface for DART (DynamicAnimationandRoboticsToolkits)
/home/pete/myRepos/grip2/include/GripSimulation.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2014, Georgia Tech Research Corporation
00003  * All rights reserved.
00004  *
00005  * Author: Pete Vieira <pete.vieira@gatech.edu>
00006  * Date: Feb 2014
00007  *
00008  * Humanoid skeletonics 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 GRIP_SIMULATION_H
00051 #define GRIP_SIMULATION_H
00052 
00053 // DART includes
00054 #include <dart/simulation/World.h>
00055 
00056 // Qt includes
00057 #include <QObject>
00058 #include <QMetaType>
00059 
00061 #include "MainWindow.h"
00062 #include "GripTab.h"
00063 #include "GripTimeslice.h"
00064 
00065 class GripMainWindow;
00066 
00074 class GripSimulation : public QObject
00075 {
00077     Q_OBJECT
00078 
00079 public:
00080 
00086     GripSimulation(dart::simulation::World* world, std::vector<GripTimeslice>* timeline,
00087                    QList<GripTab*>* pluginLinst, MainWindow *parent=0, bool debug=false);
00088 
00092     ~GripSimulation();
00093 
00099     void setWorld(dart::simulation::World* world);
00100 
00105     void reset();
00106 
00107 signals:
00114     void simulationStoppedSignal();
00115 
00121     void signalRelTimeChanged(double simTimeRelToRealTimeInstantaneous);
00122 
00128     void signalSendMessage(QString msg);
00129 
00130 public slots:
00136     virtual void startSimulation();
00137 
00142     virtual void stopSimulation();
00143 
00149     virtual void simulateTimeStep();
00150 
00155     virtual void simulateSingleTimeStep();
00156 
00157 protected:
00164     void addWorldToTimeline(const dart::simulation::World& worldToAdd);
00165 
00167     dart::simulation::World* _world;
00168 
00170     std::vector<GripTimeslice>* _timeline;
00171 
00173     QList<GripTab*>* _plugins;
00174 
00176     QThread* _thread;
00177 
00178     double _simulationDuration;  
00179     double _simulationStartTime; 
00180     double _simTimeRelToRealTimeInstantaneous; 
00181     double _prevTime; 
00182 
00183     bool _simulating; 
00184     bool _simulateOneFrame; 
00185     bool _debug; 
00186 };
00187 
00188 #endif // GRIP_SIMULATION_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator