Skip to content

Commit

Permalink
EGPlanner working in headless mode from grasp_planning_graspit
Browse files Browse the repository at this point in the history
  • Loading branch information
JenniferBuehler committed Jun 28, 2016
1 parent be05910 commit e5dc095
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 25 deletions.
16 changes: 13 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,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 @@ -169,6 +168,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 @@ -177,10 +181,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 @@ -826,6 +829,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
2 changes: 1 addition & 1 deletion cmake/graspitConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ endif (graspit_LIBRARY_RELEASE)
if (NOT CATKIN_DEVEL_PREFIX)
# We also need to include the graspit targets file if not using catkin
get_filename_component(LIB_SUFFIX ${graspit_LIBRARY_RELEASE} EXT)
message("Graspit library suffix: ${LIB_SUFFIX}, shared lib suffix: ${CMAKE_SHARED_LIBRARY_SUFFIX}")
# message("Graspit library suffix: ${LIB_SUFFIX}, shared lib suffix: ${CMAKE_SHARED_LIBRARY_SUFFIX}")
if (LIB_SUFFIX STREQUAL CMAKE_SHARED_LIBRARY_SUFFIX)
message(STATUS "Using graspit SHARED lib")
include(${SELF_DIR}/../graspit-targets.cmake)
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
3 changes: 2 additions & 1 deletion include/graspitCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ class GraspitCore
void startMainLoop();
void exitMainLoop();

void emptyWorld();
/*! 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;}
Expand Down
43 changes: 26 additions & 17 deletions src/graspitCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,30 +104,38 @@ GraspitCore::GraspitCore(int argc, char **argv):
bool headless = args->exist("headless");

if(headless){
SoQt::init(argc, argv, "SOQT");
if (argc < 1)
{
DBGA("At least 1 command line argument required");
initResult=FAILURE;
return;
}
// need to initialize with this init() instead of passing argc, argv
// or it segfaults
SoQt::init(argv[0], "SOQT");
}
else{
mainWindow = new MainWindow;
SoQt::init(mainWindow->mWindow);
}

//Initialize the world. It has no parent,
world = new World(NULL, //QObject parent
"mainWorld"); // World Name
//Initialize the world. It has no parent,
world = new World(NULL, //QObject parent
"mainWorld"); // World Name

// initialize Inventor additions
SoComplexShape::initClass();
SoArrow::initClass();
SoTorquePointer::initClass();
// initialize Inventor additions
SoComplexShape::initClass();
SoArrow::initClass();
SoTorquePointer::initClass();

//Do not initialize the IVmgr if we are running headless. ivmgr will stay NULL
if(!headless){
ivmgr = new IVmgr(world, (QWidget *)mainWindow->mUI->viewerHolder,"myivmgr");
ivmgr->getViewer()->getWidget()->setFocusPolicy(Qt::StrongFocus);
}
//Do not initialize the IVmgr if we are running headless. ivmgr will stay NULL
if(!headless){
ivmgr = new IVmgr(world, (QWidget *)mainWindow->mUI->viewerHolder,"myivmgr");
ivmgr->getViewer()->getWidget()->setFocusPolicy(Qt::StrongFocus);
}

graspitCore = this;
mExitCode = 0;
graspitCore = this;
mExitCode = 0;

int errorFlag=0;

Expand Down Expand Up @@ -283,14 +291,15 @@ GraspitCore::exitMainLoop()
SoQt::exitMainLoop();
}


/*!
Deletes the world, and creates a new one.
*/
void
GraspitCore::emptyWorld()
GraspitCore::emptyWorld(const char * name)
{
delete world;
world = new World(NULL, "MainWorld");
world = new World(NULL, name);
if(ivmgr)
{
ivmgr->setWorld(world);
Expand Down

0 comments on commit e5dc095

Please sign in to comment.