Skip to content

Commit

Permalink
Merge branch 'master' of github.com:graspit-simulator/graspit into re…
Browse files Browse the repository at this point in the history
…factor_src
  • Loading branch information
jvarley committed Jun 30, 2016
2 parents 480b0a9 + 0e151bd commit 8e72bf7
Show file tree
Hide file tree
Showing 53 changed files with 479 additions and 362 deletions.
38 changes: 29 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ set (GRASPIT_INCLUDEDIR_HEADERS
${GSRC}/include/worldElement.h
${GSRC}/include/worldElementFactory.h
${GSRC}/include/world.h
${GSRC}/include/graspitGUI.h
${GSRC}/include/graspitCore.h
${GSRC}/include/graspitServer.h
${GSRC}/include/graspitApp.h
${GSRC}/include/arch.h
Expand All @@ -160,7 +160,6 @@ set (GRASPIT_EGPLANNER_HEADERS
${GSRC}/include/EGPlanner/simAnn.h
${GSRC}/include/EGPlanner/searchState.h
${GSRC}/include/EGPlanner/searchStateImpl.h
${GSRC}/include/EGPlanner/energy/searchEnergy.h
${GSRC}/include/EGPlanner/onLinePlanner.h
${GSRC}/include/EGPlanner/egPlanner.h
${GSRC}/include/EGPlanner/simAnnPlanner.h
Expand All @@ -170,6 +169,11 @@ set (GRASPIT_EGPLANNER_HEADERS
${GSRC}/include/EGPlanner/graspTesterThread.h
${GSRC}/include/EGPlanner/onLineGraspInterface.h
${GSRC}/include/EGPlanner/listPlanner.h

)

set (GRASPIT_EGPLANNER_ENERGY_HEADERS
${GSRC}/include/EGPlanner/energy/searchEnergy.h
${GSRC}/include/EGPlanner/energy/autograspQualityEnergy.h
${GSRC}/include/EGPlanner/energy/closureSearchEnergy.h
${GSRC}/include/EGPlanner/energy/compliantEnergy.h
Expand All @@ -178,10 +182,9 @@ set (GRASPIT_EGPLANNER_HEADERS
${GSRC}/include/EGPlanner/energy/guidedAutoGraspEnergy.h
${GSRC}/include/EGPlanner/energy/guidedPotentialQualityEnergy.h
${GSRC}/include/EGPlanner/energy/potentialQualityEnergy.h
${GSRC}/include/EGPlanner/energy/strictAutoGraspEnergy.h
${GSRC}/include/EGPlanner/energy/strictAutoGraspEnergy.h
)


# all headers which are in the cmdline
# directory and should be included
# in the installation should be listed in the
Expand Down Expand Up @@ -342,7 +345,7 @@ set (GRASPIT_CORE_SOURCES
${GSRC}/src/eigenGrasp.cpp
${GSRC}/src/gloveInterface.cpp
${GSRC}/src/grasp.cpp
${GSRC}/src/graspitGUI.cpp
${GSRC}/src/graspitCore.cpp
${GSRC}/src/graspitServer.cpp
${GSRC}/src/graspitApp.cpp
${GSRC}/src/graspRecord.cpp
Expand Down Expand Up @@ -827,6 +830,13 @@ install(FILES
DESTINATION ${INCLUDE_DESTINATION}/EGPlanner
)

install(FILES
${GRASPIT_EGPLANNER_ENERGY_HEADERS}
DESTINATION ${INCLUDE_DESTINATION}/EGPlanner/energy
)



if (PQP_COLLISION)
install(FILES
${GRASPIT_INCLUDEDIR_HEADERS}
Expand Down Expand Up @@ -881,20 +891,30 @@ endif (PLY)
install(TARGETS
graspit
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ
EXPORT graspit-lib-targets
EXPORT graspit-targets
DESTINATION ${LIB_DESTINATION})

install(EXPORT graspit-lib-targets
install(EXPORT graspit-targets
DESTINATION ${LIB_DESTINATION})

# For future reference: install graspitConfig.cmake as well as soon
# as it is added to the repository.
# set (GRASPIT_CONFIG_CMAKE graspitConfig.cmake)
install(FILES
# cmake/${GRASPIT_CONFIG_CMAKE}
CMakeMacros/FindBULLET.cmake
CMakeMacros/FindSoQt4.cmake
CMakeMacros/FindQhull.cmake
DESTINATION ${LIB_DESTINATION}/${PROJECT_NAME}
)

## ---
## comment for future reference: This is required to build a static library
# install(TARGETS
# graspit_static
# EXPORT graspit-static-lib-targets
# EXPORT graspit-static-targets
# DESTINATION ${LIB_DESTINATION})
# install(EXPORT graspit-static-lib-targets
# install(EXPORT graspit-static-targets
# DESTINATION ${LIB_DESTINATION})
## ---

Expand Down
6 changes: 3 additions & 3 deletions include/DBase/dbase_grasp.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class EGPlanner;
class Hand;
class Body;
class GraspableBody;
class GraspItGUI;
class GraspitCore;
class GraspPlanningState;
class SoSensor;
class SoTimerSensor;
Expand All @@ -60,7 +60,7 @@ class DBaseBatchPlanner : public QObject
GraspableBody *mObject;
Hand *mHand;
IVmgr *ivmgr;
GraspItGUI *mGui;
GraspitCore *mGui;
EGPlanner *mPlanner;
//maybe one day we'll use streams here...
FILE *mResultFile;
Expand Down Expand Up @@ -90,7 +90,7 @@ public Q_SLOTS:
//this one gets called when the inner planner stops
void plannerComplete();
public:
DBaseBatchPlanner(IVmgr *mgr, GraspItGUI *gui);
DBaseBatchPlanner(IVmgr *mgr, GraspitCore *gui);
~DBaseBatchPlanner();
bool processArguments(int argc, char **argv);
bool startPlanner();
Expand Down
2 changes: 1 addition & 1 deletion include/DBase/graspit_db_grasp.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <vector>
#include <string>

#include "graspitGUI.h"
#include "graspitCore.h"
#include "world.h"
#include "ivmgr.h"

Expand Down
2 changes: 1 addition & 1 deletion include/EGPlanner/energy/searchEnergy.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <QObject>

#include "search.h"
#include "include/matvec3D.h"
#include "matvec3D.h"

class Hand;
class Body;
Expand Down
2 changes: 1 addition & 1 deletion include/EGPlanner/searchState.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <QString>

#include "search.h"
#include "include/matvec3D.h"
#include "matvec3D.h"

class Hand;
class Body;
Expand Down
2 changes: 1 addition & 1 deletion include/EGPlanner/simAnn.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Body;
class SoSensor;

#include <stdio.h>
#include "include/matvec3D.h"
#include "matvec3D.h"
#include <vector>

/*! This class performs simulated annealing on a collection of variables
Expand Down
52 changes: 38 additions & 14 deletions include/graspitGUI.h → include/graspitCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,28 @@
//
// Author(s): Andrew T. Miller
//
// $Id: graspitGUI.h,v 1.5 2010/08/11 02:45:37 cmatei Exp $
// $Id: graspitCore.h,v 1.5 2010/08/11 02:45:37 cmatei Exp $
//
//######################################################################

/*! \file
\brief Defines a graspit user interface class that contains subpieces of the UI.
\brief Defines the GraspIt! core class. It holds pointers the mainwindow, ivmgr, world.
*/

#ifndef GRASPITGUI_HXX
#ifndef GRASPIT_CORE_H

#include <string>
#include <vector>
#include <list>

namespace cmdline{
class parser;
}

namespace db_planner {
class DatabaseManager;
}

class MainWindow;
class IVmgr;
class TaskDispatcher;
Expand All @@ -53,14 +61,17 @@ class World;
This class can also initialize a task dispatcher which is then in charge of
batch execution of tasks based on information form a grasp database.
*/
class GraspItGUI
class GraspitCore
{
//! A pointer to the MainWindow.
MainWindow *mainWindow;

//! A pointer to the IVmgr.
//! A pointer to the IVmgr. This will be NULL if in headless mode.
IVmgr *ivmgr;

//! A pointer to the world
World *world;

//! A pointer to the Task Dispatcher, if any
TaskDispatcher *mDispatch;

Expand All @@ -82,14 +93,14 @@ class GraspItGUI
//! Idle sensor for calling the plugins from GraspIt's event loop
SoIdleSensor *mPluginSensor;

protected:
int processArgs(int argc, char **argv);
//! The main and only interface for the CGDB; all interaction with the CGDB should go through this.
db_planner::DatabaseManager *mDBMgr;

public:
GraspItGUI(int argc,char **argv);
~GraspItGUI();
GraspitCore(int argc, char **argv);
~GraspitCore();

/*! Returns whether the UI pieces were successfully initialized. */
/*! Returns whether GraspIt! was successfully initialized. */
bool terminalFailure() const;

//! Returns the exit code (set internally based on the application)
Expand All @@ -98,8 +109,8 @@ class GraspItGUI
/*! Returns a pointer to the MainWindow. */
MainWindow *getMainWindow() const {return mainWindow;}

/*! Returns a pointer to the World (obtained through the main window) */
World *getMainWorld() const;
/*! Returns a pointer to the World */
World *getWorld() const {return world;}

/*! Returns a pointer to the IVmgr. */
IVmgr *getIVmgr() const {return ivmgr;}
Expand All @@ -121,6 +132,19 @@ class GraspItGUI

void startMainLoop();
void exitMainLoop();

/*! Deletes the existing world and creates a new (empty) one */
void emptyWorld(const char* name="MainWorld");

//! Get the main database manager, when CGDB support is enabled
db_planner::DatabaseManager* getDBMgr(){return mDBMgr;}
//! Set the main database manager. Should only be called by the DB connection dialog
#ifdef CGDB_ENABLED
void setDBMgr(db_planner::DatabaseManager *mgr){mDBMgr = mgr;}
#else
void setDBMgr(db_planner::DatabaseManager*){}
#endif

};

#if defined(WIN32) && !defined(__MINGW32__)
Expand All @@ -133,7 +157,7 @@ class GraspItGUI
#define GRASPIT_API
#endif

extern GRASPIT_API GraspItGUI *graspItGUI;
extern GRASPIT_API GraspitCore *graspitCore;

#define GRASPITGUI_HXX
#define GRASPIT_CORE_H
#endif
1 change: 1 addition & 0 deletions include/graspitParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class GraspitParser
static const std::string obstacle_help;
static const std::string robot_help;
static const std::string version_help;
static const std::string headless_help;

private:
cmdline::parser *parser;
Expand Down
27 changes: 3 additions & 24 deletions include/ivmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ class GWSprojection;
class QualityMeasure;
struct DraggerInfo;

namespace db_planner {
class DatabaseManager;
}

#define HANDS_DIR "../../hands/"
#define OBJECTS_DIR "../../objects/"
#define MAX_POLYTOPES 15
Expand Down Expand Up @@ -175,9 +171,6 @@ class IVmgr : public QWidget {
//! Pointer to the material node controlling the color of dynamic force indicatores
SoMaterial *dynForceMat;

//! The main and only interface for the CGDB; all interaction with the CGDB should go through this.
db_planner::DatabaseManager *mDBMgr;

void setupPointers();
void transRot(DraggerInfo *dInfo);
void revoluteJointChanged(DraggerInfo *dInfo);
Expand Down Expand Up @@ -239,16 +232,12 @@ public Q_SLOTS:
void restoreCameraPos();

public:
IVmgr(QWidget *parent=0,const char *name=0,Qt::WFlags f=0);
IVmgr(World *w, QWidget *parent=0,const char *name=0, Qt::WFlags f=0);
~IVmgr();

void deselectBody(Body *b);
void setWorld(World *w);

/*!
Returns a pointer to the main World that the user interacts with through
this manager.
*/
World *getWorld() const {return world;}
void deselectBody(Body *b);

/*!
Returns a pointer to the Inventor examiner viewer.
Expand All @@ -262,7 +251,6 @@ public Q_SLOTS:
SoSeparator *getPointers() const {return pointers;}

void setTool(ToolType newTool);
void emptyWorld();
void hilightObjContact(int contactNum);
void unhilightObjContact(int contactNum);

Expand All @@ -277,20 +265,11 @@ public Q_SLOTS:
transf getCameraTransf();

void saveImage(QString filename);
void beginMainLoop();

void setStereo(bool s);
//! Not implemented
void flipStereo();

//! Get the main database manager, when CGDB support is enabled
db_planner::DatabaseManager* getDBMgr(){return mDBMgr;}
//! Set the main database manager. Should only be called by the DB connection dialog
#ifdef CGDB_ENABLED
void setDBMgr(db_planner::DatabaseManager *mgr){mDBMgr = mgr;}
#else
void setDBMgr(db_planner::DatabaseManager*){}
#endif
void setStereoWindow(QWidget *parent);
};
#define IVMGR_HXX
Expand Down
8 changes: 7 additions & 1 deletion include/world.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class World : public QObject {

public:
//! public constructor
World(QObject *parent=0,const char *name=0, IVmgr *mgr=NULL);
World(QObject *parent=0, const char *name=0);

//! Saves the current user settings in the registry and clears the world
~World();
Expand Down Expand Up @@ -314,6 +314,9 @@ class World : public QObject {
//! Returns the root of the Inventor scene graph for this world
SoSeparator *getIVRoot() const {return IVRoot;}

//! Returns axis-aligned bounding box min and max points of the world
void getBoundingBox(vec3& minPoint, vec3& maxPoint);

//! Returns a pointer to the i-th body defined in this world
Body *getBody(int i) const {return bodyVec[i];}

Expand Down Expand Up @@ -344,6 +347,9 @@ class World : public QObject {
//! Sets all world settings to their original default values.
void setDefaults();

//! Sets the ivmgr for the world.
void setIVMgr(IVmgr *ivmgr){myIVmgr = ivmgr;}

//! Sets the world modified flag. Should be done when a change has since the last save.
void setModified() {modified = true;}

Expand Down
Loading

0 comments on commit 8e72bf7

Please sign in to comment.