SensorInputDlg Class Reference

A dialog that allows the world elements to be controlled by a Cyberglove of Flock of Birds. More...

#include <sensorInputDlg.h>

List of all members.

Public Types

enum  FlockMode { FLOCK_RELATIVE, FLOCK_ABSOLUTE, FLOCK_CAMERA }
 

The possible running modes of the Flock of Birds.

More...

Public Slots

void exitButton_clicked ()
 Stops the timers and cleans up.
void flockStartButton_clicked ()
 Starts or stops the Flock of Birds use.
void gloveStartButton_clicked ()
 Starts or stops the Cyberglove use.

Public Member Functions

 SensorInputDlg (World *w, QWidget *parent=0)

Private Slots

void resetFlock ()
 Resets all relative positions that new flock positions are computed relative to.

Private Member Functions

void flockAndGloveFuzzyGrasp (std::vector< transf > &birdTransf)
 Attempts to find a legal grasp in the vicinity of the state set by glove and flock.
transf getBirdTran (int b)
 Helper function that reads in a raw bird transform and returns it as a GraspIt transf.
void init (World *w)
 Acts as a constructor, called on initialization.
bool initFlock ()
 Initialized the flock of birds.
bool initGlove ()
 Initializes the Cyberglove.
void processFlockBodies (std::vector< transf > &birdTransf)
 Moves bodies to the position set by the Flock, resolving collisions and contacts.
void processFlockCamera (std::vector< transf > &birdTransf)
 If the mode of operation requires it, sets the camera based on the flock.
void processFlockRobots (std::vector< transf > &birdTransf)
 Moves robots to the position set by the Flock, resolving collisions and contacts.
void processGlove ()
 The actual processing of a new glove reading.
void timerInternalCB ()
 Called when the timer sensor fires.

Static Private Member Functions

static void timerStaticCB (void *data, SoSensor *)
 The static version of the timer callback, just calls the internal version.

Private Attributes

FlockTransf mCameraFlockTran
 Keeps track of the camera flock transform, for the CAMERA flock mode of operation.
Flock * mFlock
 Interface to the raw Flock of Birds.
FlockMode mFlockMode
 The current running mode of the Flock.
bool mFlockRunning
 Shows if the flock is currently being used.
CyberGlove * mGlove
 Interface to raw Cyberglove.
bool mGloveRunning
 Shows if the glove is currently being used.
int mMasterBird
 Which bird is the master bird, the one that evertyhing else is set relative to.
int mNumBirds
 The number of birds in the Flock. For now, it's hard-coded in.
SoTimerSensor * mTimerSensor
 The timer that fires at discrete intervals so we can update the readings.
WorldmWorld
 The world that this dialog is connected to.

Detailed Description

A dialog that allows the world elements to be controlled by a Cyberglove of Flock of Birds.

This is the main interface between the GraspIt world and external sensors such as the Flock of Birds or Cyberglove. It uses an internal timer to wake up periodically and query the sensors that have been enabled by the user. It then sets the positions or postures of the world elements that are controlled by the sensor.

The Flock of Birds has multiple modes of operation and for some of those we must keep track of base transforms that all other transforms are computed relative to. This is also the job of this dialog. See the FlockMode enum for possible running modes for the Flock.

Definition at line 53 of file sensorInputDlg.h.


Member Enumeration Documentation

The possible running modes of the Flock of Birds.

ABSOLUTE: each object controlled by a bird gets exactly the transform of the bird read from the sensor. The base of the Flock of Birds becomes the origin of the world coordinate system.

RELATIVE: one of the birds in the Flock is considered to be the master bird. The objects run by the master bird do not change their positions when we turn on the flock. Rather, all subsequent movement of the bird is interpreted as relative to the starting position. All objects run by other birds than the master are repositioned relative to the master. In this way, distances between different birds in the real world are kept in the GraspIt! world.

CAMERA: just as in RELATIVE mode, except that the master bird controls the position of the camera in GraspIt.

Enumerator:
FLOCK_RELATIVE 
FLOCK_ABSOLUTE 
FLOCK_CAMERA 

Definition at line 72 of file sensorInputDlg.h.


Constructor & Destructor Documentation

SensorInputDlg::SensorInputDlg ( World w,
QWidget *  parent = 0 
) [inline]

Definition at line 128 of file sensorInputDlg.h.


Member Function Documentation

void SensorInputDlg::exitButton_clicked (  )  [slot]

Stops the timers and cleans up.

Definition at line 155 of file sensorInputDlg.cpp.

void SensorInputDlg::flockAndGloveFuzzyGrasp ( std::vector< transf > &  birdTransf  )  [private]

Attempts to find a legal grasp in the vicinity of the state set by glove and flock.

Definition at line 410 of file sensorInputDlg.cpp.

void SensorInputDlg::flockStartButton_clicked (  )  [slot]

Starts or stops the Flock of Birds use.

If the raw flock has not yet been initialized, it initializes it. When this is called *for the first time* it calls the reset function of this dialog to set base positions and reference transforms. Subsequent calls no longer trigger a reset, allowing the user to reset only when he/she wants to. This not ideal from a UI perspective, but it is what we have so far.

Definition at line 195 of file sensorInputDlg.cpp.

transf SensorInputDlg::getBirdTran ( int  b  )  [private]

Helper function that reads in a raw bird transform and returns it as a GraspIt transf.

Definition at line 225 of file sensorInputDlg.cpp.

void SensorInputDlg::gloveStartButton_clicked (  )  [slot]

Starts or stops the Cyberglove use.

If the raw glove has not yet been initialized, it initializes it. Also schedules the timer.

Definition at line 167 of file sensorInputDlg.cpp.

void SensorInputDlg::init ( World w  )  [private]

Acts as a constructor, called on initialization.

Acts as a contructor. Sets the default Flock mode (RELATIVE) and default master bird (1).

Definition at line 49 of file sensorInputDlg.cpp.

bool SensorInputDlg::initFlock (  )  [private]

Initialized the flock of birds.

Initialized the Flock of Birds. For now, no check is done to see if the initialization was successful.

Definition at line 127 of file sensorInputDlg.cpp.

bool SensorInputDlg::initGlove (  )  [private]

Initializes the Cyberglove.

Inits the raw Glove, checks if initialization was successful. Then, it passes the raw glove to all the cyberglove interfaces of individual robots. The interfaces of each robot know how to translate glove information to DOF values.

Definition at line 139 of file sensorInputDlg.cpp.

void SensorInputDlg::processFlockBodies ( std::vector< transf > &  birdTransf  )  [private]

Moves bodies to the position set by the Flock, resolving collisions and contacts.

For each body, computes an absolute transform in the GraspIt world based on it. This computation depends on the mode of operation of the Flock, and uses the base transforms that have been previously set by resetFlock()

Definition at line 363 of file sensorInputDlg.cpp.

void SensorInputDlg::processFlockCamera ( std::vector< transf > &  birdTransf  )  [private]

If the mode of operation requires it, sets the camera based on the flock.

Definition at line 350 of file sensorInputDlg.cpp.

void SensorInputDlg::processFlockRobots ( std::vector< transf > &  birdTransf  )  [private]

Moves robots to the position set by the Flock, resolving collisions and contacts.

Definition at line 382 of file sensorInputDlg.cpp.

void SensorInputDlg::processGlove (  )  [private]

The actual processing of a new glove reading.

Definition at line 400 of file sensorInputDlg.cpp.

void SensorInputDlg::resetFlock (  )  [private, slot]

Resets all relative positions that new flock positions are computed relative to.

Computes and sets the "base" tranforms for each object, which is the transform that each later Bird transform will be computed relatiev to. This allows for multiple modes of operation for the Flock, see the definition of FlockMode for details.

The Flock must be initialized and operational when this is called, as readings from the Flock are needed to set the base transforms.

Definition at line 252 of file sensorInputDlg.cpp.

void SensorInputDlg::timerInternalCB (  )  [private]

Called when the timer sensor fires.

Refreshes all sensor readings, so that is only done once. Then, is calls the appropriate processing routines, based on the operation mode selected by the user. If any sensor is active it also reschedules the timer.

Definition at line 83 of file sensorInputDlg.cpp.

void SensorInputDlg::timerStaticCB ( void *  data,
SoSensor *   
) [static, private]

The static version of the timer callback, just calls the internal version.

Definition at line 71 of file sensorInputDlg.cpp.


Member Data Documentation

Keeps track of the camera flock transform, for the CAMERA flock mode of operation.

Definition at line 89 of file sensorInputDlg.h.

Flock* SensorInputDlg::mFlock [private]

Interface to the raw Flock of Birds.

Definition at line 83 of file sensorInputDlg.h.

The current running mode of the Flock.

Definition at line 87 of file sensorInputDlg.h.

Shows if the flock is currently being used.

Definition at line 77 of file sensorInputDlg.h.

CyberGlove* SensorInputDlg::mGlove [private]

Interface to raw Cyberglove.

Definition at line 85 of file sensorInputDlg.h.

Shows if the glove is currently being used.

Definition at line 79 of file sensorInputDlg.h.

Which bird is the master bird, the one that evertyhing else is set relative to.

Definition at line 93 of file sensorInputDlg.h.

The number of birds in the Flock. For now, it's hard-coded in.

Definition at line 91 of file sensorInputDlg.h.

SoTimerSensor* SensorInputDlg::mTimerSensor [private]

The timer that fires at discrete intervals so we can update the readings.

Definition at line 81 of file sensorInputDlg.h.

The world that this dialog is connected to.

Definition at line 75 of file sensorInputDlg.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


graspit
Author(s):
autogenerated on Wed Jan 25 11:00:24 2012