Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
GraspIt::GraspItSceneManagerHeadless Class Reference

Provides scene manager which can be used to load and access the GraspIt! world without the need to run the GUI. More...

#include <GraspItSceneManagerHeadless.h>

Inheritance diagram for GraspIt::GraspItSceneManagerHeadless:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 GraspItSceneManagerHeadless ()
virtual bool isReady () const
virtual void waitUntilReady () const
virtual ~GraspItSceneManagerHeadless ()

Protected Member Functions

virtual World * createNewGraspitWorld ()
virtual void destroyCore ()
virtual bool eventThreadRunsQt () const
virtual void initializeCore ()
bool isInventorReady () const
virtual bool scheduleIdleEvent ()

Private Member Functions

void createIdleSensor ()
void deleteIdleSensor ()
 GraspItSceneManagerHeadless (const GraspItSceneManagerHeadless &o)
void setInventorReady (const bool flag)
void waitForInventorState (const bool value) const

Static Private Member Functions

static void ivThreadLoop (GraspItSceneManagerHeadless *_this)
static void sensorCB (void *data, SoSensor *)

Private Attributes

bool ivReady
MUTEX ivReadyMtx
THREADivThread
SoSensor * mIdleSensor

Detailed Description

Provides scene manager which can be used to load and access the GraspIt! world without the need to run the GUI.

In this initial implementation, this interface will be running the **SoQt** loop in a separate thread. This is also the scene manager thread to which GraspItAccessor instances may get access to via GraspItAccessor::addAsIdleListener().

Subclasses which want to make use of QT signals and slots, or any other mechanisms proivded by QObject and the Qt metaobject system, will have to additionally derive from QObject, and the MOC files have to be generated for it.

**Important note:** While this implementation is still using Qt, you **may not** touch any Qt stuff before creating an intance of this class. This means, you cannot create any QObject instances either. Otherwise you will get the Qt warning "WARNING: QApplication was not created in the main() thread". Mostly this should not matter, but it could cause problems, e.g. with QPixmap, if you are using them.

Author:
Jennifer Buehler
Date:
January 2016

Definition at line 51 of file GraspItSceneManagerHeadless.h.


Constructor & Destructor Documentation

Definition at line 35 of file GraspItSceneManagerHeadless.cpp.

Definition at line 43 of file GraspItSceneManagerHeadless.cpp.

Definition at line 87 of file GraspItSceneManagerHeadless.h.


Member Function Documentation

Creates the SoIdleSensor object which will keep running from the Inventor thread and schedules it. Should be called from within the thread that runs the inventor loop.

Definition at line 174 of file GraspItSceneManagerHeadless.cpp.

World * GraspItSceneManagerHeadless::createNewGraspitWorld ( ) [protected, virtual]

Creates a new graspit world object. In case the world needs special initializing, the implementation is left to the subclasses.

Returns:
pointer to the new world object which is now maintained by GraspitCore.

Implements GraspIt::GraspItSceneManager.

Definition at line 92 of file GraspItSceneManagerHeadless.cpp.

Definition at line 164 of file GraspItSceneManagerHeadless.cpp.

void GraspItSceneManagerHeadless::destroyCore ( ) [protected, virtual]

Stops the scene manager thread, the event loop, and everything which needs to be destroyed/shut down (basically reverting what was initialized in initializeCore()). Also is expected to destroy the core object and sets it to NULL.

Implements GraspIt::GraspItSceneManager.

Definition at line 58 of file GraspItSceneManagerHeadless.cpp.

virtual bool GraspIt::GraspItSceneManagerHeadless::eventThreadRunsQt ( ) const [inline, protected, virtual]

Subclasses which support Qt and which use the same thread which runs the SoQt loop for the event loop as well, should return true here. This can be used by GraspItAccessor classes to ensure that Qt is supported in the event thread.

Reimplemented from GraspIt::GraspItSceneManager.

Definition at line 68 of file GraspItSceneManagerHeadless.h.

void GraspItSceneManagerHeadless::initializeCore ( ) [protected, virtual]

This method is supposed to initialize the Core instance (field core). If any other threads are started by this function which need to complete initialization routines, this method has to block until all initialization is finished and the Core instance is fully initialized. This method is expected to also create a scene manager event loop thread which regularly should call processIdleEvent() (each time after scheduleIdleEvent() has been called).

Implements GraspIt::GraspItSceneManager.

Definition at line 48 of file GraspItSceneManagerHeadless.cpp.

returns ivReady flag

Definition at line 151 of file GraspItSceneManagerHeadless.cpp.

bool GraspItSceneManagerHeadless::isReady ( ) const [virtual]

Returns true if interface has finished initialziing (which may happen in a separate thread initiated in constructor) and the interface is ready to use

Implements GraspIt::GraspItSceneManager.

Definition at line 136 of file GraspItSceneManagerHeadless.cpp.

Method for thread to run the inventor manager main loop (CoreHeadless::beginMainLoop()). This thread callback also needs to be used to initialize the CoreHeadless, because initialisation and main loop have to be handled by the same thread.

Definition at line 106 of file GraspItSceneManagerHeadless.cpp.

bool GraspItSceneManagerHeadless::scheduleIdleEvent ( ) [protected, virtual]

Simulates the creation of an "Idle Event" by scheduling mIdleSensor (if it is not already scheduled).

Return values:
falseInventor is not ready yet.

Implements GraspIt::GraspItSceneManager.

Definition at line 208 of file GraspItSceneManagerHeadless.cpp.

void GraspItSceneManagerHeadless::sensorCB ( void *  data,
SoSensor *   
) [static, private]

the SoIdleSensor callback function

Definition at line 187 of file GraspItSceneManagerHeadless.cpp.

void GraspItSceneManagerHeadless::setInventorReady ( const bool  flag) [private]

Threadsafe method to set flag ivReady

Definition at line 157 of file GraspItSceneManagerHeadless.cpp.

void GraspItSceneManagerHeadless::waitForInventorState ( const bool  value) const [private]

Before any methods are called which rely on the Inventor stuff to run, this method can be called with true to wait for the initialization of Inventor to be ready. If the method needs to wait until Inventor is shut down, call this method with false.

Definition at line 146 of file GraspItSceneManagerHeadless.cpp.

Waits until isReady() returns true

Implements GraspIt::GraspItSceneManager.

Definition at line 141 of file GraspItSceneManagerHeadless.cpp.


Member Data Documentation

Definition at line 124 of file GraspItSceneManagerHeadless.h.

Definition at line 125 of file GraspItSceneManagerHeadless.h.

Definition at line 121 of file GraspItSceneManagerHeadless.h.

Definition at line 127 of file GraspItSceneManagerHeadless.h.


The documentation for this class was generated from the following files:


grasp_planning_graspit
Author(s): Jennifer Buehler
autogenerated on Wed May 8 2019 02:53:36