Public Member Functions | Protected Member Functions | Private Types | Private Attributes
GraspIt::GraspItSimpleDBManager Class Reference

Very simple implementation of GraspItDatabaseManager which just keeps loaded objects in a std::map. More...

#include <GraspItSimpleDBManager.h>

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

List of all members.

Public Member Functions

virtual void getAllLoadedObjectIDs (std::vector< int > &ids) const
virtual void getAllLoadedObjectNames (std::vector< std::string > &names) const
virtual void getAllLoadedRobotIDs (std::vector< int > &ids) const
virtual void getAllLoadedRobotNames (std::vector< std::string > &names) const
virtual bool getModelNameAndType (const int modelID, std::string &name, bool &isRobot) const
virtual bool getObjectModelID (const std::string &objectName, int &id) const
virtual bool getRobotJointNames (const std::string &robotName, std::vector< std::string > &jointNames) const
virtual bool getRobotModelID (const std::string &robotName, int &id) const
 GraspItSimpleDBManager (const std::string &objectName, const SHARED_PTR< GraspItSceneManager > &interface)
virtual int loadObjectToDatabase (const std::string &filename, const std::string &robotName, const bool asGraspable)
virtual int loadRobotToDatabase (const std::string &filename, const std::string &robotName, const std::vector< std::string > &jointNames)
virtual ~GraspItSimpleDBManager ()

Protected Member Functions

virtual int getModelType (const int modelID) const
virtual Body * getObjectFromDatabase (const std::string &objectName)
virtual Body * getObjectFromDatabase (const int modelID)
virtual Robot * getRobotFromDatabase (const std::string &robotName)
virtual Robot * getRobotFromDatabase (const int modelID)
virtual void idleEventFromSceneManager ()
virtual void onSceneManagerShutdown ()

Private Types

typedef std::map< int,
std::pair< std::string, bool > > 
ModelIdMap
typedef std::map< std::string,
std::vector< std::string > > 
RobotJointNamesMap

Private Attributes

RECURSIVE_MUTEX dbMtx
int modelIdCounter
ModelIdMap modelIDs
std::map< std::string, Body * > objects
RobotJointNamesMap robotJointNames
std::map< std::string, Robot * > robots

Detailed Description

Very simple implementation of GraspItDatabaseManager which just keeps loaded objects in a std::map.

Author:
Jennifer Buehler
Date:
January 2016

Definition at line 44 of file GraspItSimpleDBManager.h.


Member Typedef Documentation

typedef std::map<int, std::pair<std::string, bool> > GraspIt::GraspItSimpleDBManager::ModelIdMap [private]

Definition at line 107 of file GraspItSimpleDBManager.h.

typedef std::map<std::string, std::vector<std::string> > GraspIt::GraspItSimpleDBManager::RobotJointNamesMap [private]

Definition at line 111 of file GraspItSimpleDBManager.h.


Constructor & Destructor Documentation

GraspIt::GraspItSimpleDBManager::GraspItSimpleDBManager ( const std::string &  objectName,
const SHARED_PTR< GraspItSceneManager > &  interface 
) [inline]

Definition at line 49 of file GraspItSimpleDBManager.h.

Definition at line 54 of file GraspItSimpleDBManager.h.


Member Function Documentation

void GraspItSimpleDBManager::getAllLoadedObjectIDs ( std::vector< int > &  ids) const [virtual]

Adds the ids of all objects currently loaded in the GraspIt world in the vector Does not clear the vector!

Implements GraspIt::GraspItDatabaseManager.

Definition at line 319 of file GraspItSimpleDBManager.cpp.

void GraspItSimpleDBManager::getAllLoadedObjectNames ( std::vector< std::string > &  names) const [virtual]

Adds the names of all objects currently loaded in the GraspIt world in the vector Does not clear the vector!

Implements GraspIt::GraspItDatabaseManager.

Definition at line 306 of file GraspItSimpleDBManager.cpp.

void GraspItSimpleDBManager::getAllLoadedRobotIDs ( std::vector< int > &  ids) const [virtual]

Adds the ids of all robots currently loaded in the GraspIt world in the vector Does not clear the vector!

Implements GraspIt::GraspItDatabaseManager.

Definition at line 292 of file GraspItSimpleDBManager.cpp.

void GraspItSimpleDBManager::getAllLoadedRobotNames ( std::vector< std::string > &  names) const [virtual]

Adds the names of all robots currently loaded in the GraspIt world in the vector. Does not clear the vector!

Implements GraspIt::GraspItDatabaseManager.

Definition at line 279 of file GraspItSimpleDBManager.cpp.

bool GraspItSimpleDBManager::getModelNameAndType ( const int  modelID,
std::string &  name,
bool &  isRobot 
) const [virtual]

Returns the name and type of the model with this ID which is also used in the GraspIt world.

Parameters:
isRobottrue if model is a robot, false if it is an object.

Implements GraspIt::GraspItDatabaseManager.

Definition at line 264 of file GraspItSimpleDBManager.cpp.

int GraspItSimpleDBManager::getModelType ( const int  modelID) const [protected, virtual]

Checks whether this model ID is a robot or an object

Return values:
2is an object
1is a robot
-1does not exist

Implements GraspIt::GraspItDatabaseManager.

Definition at line 250 of file GraspItSimpleDBManager.cpp.

Body * GraspItSimpleDBManager::getObjectFromDatabase ( const std::string &  objectName) [protected, virtual]

Retrieves the Body object from the database, if it exists in there.

Implements GraspIt::GraspItDatabaseManager.

Definition at line 186 of file GraspItSimpleDBManager.cpp.

Body * GraspItSimpleDBManager::getObjectFromDatabase ( const int  modelID) [protected, virtual]

Retrieves the Body object from the database, if it exists in there.

Returns:
return NULL if not in the database, or a robot and not an object.

Implements GraspIt::GraspItDatabaseManager.

Definition at line 211 of file GraspItSimpleDBManager.cpp.

bool GraspItSimpleDBManager::getObjectModelID ( const std::string &  objectName,
int &  id 
) const [virtual]
Parameters:
idthe model ID of the object with this name
Returns:
false if this object is not in the database.

Implements GraspIt::GraspItDatabaseManager.

Definition at line 351 of file GraspItSimpleDBManager.cpp.

Robot * GraspItSimpleDBManager::getRobotFromDatabase ( const std::string &  robotName) [protected, virtual]

Retrieves the Robot object from the database, if it exists in there.

Implements GraspIt::GraspItDatabaseManager.

Definition at line 198 of file GraspItSimpleDBManager.cpp.

Robot * GraspItSimpleDBManager::getRobotFromDatabase ( const int  modelID) [protected, virtual]

Retrieves the Robot object from the database, if it exists in there.

Returns:
return NULL if not in the database, or an object and not a robot.

Implements GraspIt::GraspItDatabaseManager.

Definition at line 229 of file GraspItSimpleDBManager.cpp.

bool GraspItSimpleDBManager::getRobotJointNames ( const std::string &  robotName,
std::vector< std::string > &  jointNames 
) const [virtual]

Returns the joint names for this robot as used in loadRobotToDatabase(). These are all joints that are involved in resulting grasps, so mostly these are only the fingers.

Returns:
false if this robot is not in the database.

Implements GraspIt::GraspItDatabaseManager.

Definition at line 168 of file GraspItSimpleDBManager.cpp.

bool GraspItSimpleDBManager::getRobotModelID ( const std::string &  robotName,
int &  id 
) const [virtual]
Parameters:
idthe model ID of the robot with this name
Returns:
false if this robot is not in the database.

Implements GraspIt::GraspItDatabaseManager.

Definition at line 335 of file GraspItSimpleDBManager.cpp.

virtual void GraspIt::GraspItSimpleDBManager::idleEventFromSceneManager ( ) [inline, protected, virtual]

No need for getting updates from inventor thread.

Implements GraspIt::GraspItDatabaseManager.

Definition at line 86 of file GraspItSimpleDBManager.h.

int GraspItSimpleDBManager::loadObjectToDatabase ( const std::string &  filename,
const std::string &  objectName,
const bool  asGraspable 
) [virtual]

Loads an object from XML file and adds it to the database. See also GraspItSceneManager::loadObject(). After it has been loaded to the database, it is open to the actual GraspItDatabaseManager implementation wheter the object is left in the graspit world, or removed from it.

Parameters:
objectNamethe name to store this object with, and also the name to use for this object in the graspit world.
Return values:
>=0success, and returns int ID of this model (model IDs are for robots and objects)
-1failed to load world with graspit source.
-2graspit not initialized.
-3file does not exist.
-4could not add object to database because it already exists
-5no object name specified
-6other error when adding the object to the database.

Implements GraspIt::GraspItDatabaseManager.

Definition at line 104 of file GraspItSimpleDBManager.cpp.

int GraspItSimpleDBManager::loadRobotToDatabase ( const std::string &  filename,
const std::string &  robotName,
const std::vector< std::string > &  jointNames 
) [virtual]

Loads robot (hand) from XML file and adds it to the database. See also GraspItSceneManager::loadRobot(). After it has been loaded to the database, it is open to the actual GraspItDatabaseManager implementation wheter the robot is left in the graspit world, or removed from it.

Parameters:
robotNamethe name to store this robot with, and also the name to use for this robot in the graspit world.
jointNamesThe URDF names of the joints in the order as they appear in the graspit file These are all joints that are involved in resulting grasps, so mostly these are only the fingers.
Return values:
>=0success, and returns int ID of this model (model IDs are for robots and objects)
-1failed to load world with graspit source.
-2graspit not initialized.
-3file does not exist.
-4could not add robot to database because it already exists
-5no robot name specified
-6other error when adding the robot to the database.

Implements GraspIt::GraspItDatabaseManager.

Definition at line 33 of file GraspItSimpleDBManager.cpp.

virtual void GraspIt::GraspItSimpleDBManager::onSceneManagerShutdown ( ) [inline, protected, virtual]

This class is meant to remain abstract. Subclasses can decide whether they need access to the inventor thread.

Implements GraspIt::GraspItDatabaseManager.

Definition at line 87 of file GraspItSimpleDBManager.h.


Member Data Documentation

Definition at line 120 of file GraspItSimpleDBManager.h.

Definition at line 123 of file GraspItSimpleDBManager.h.

Definition at line 113 of file GraspItSimpleDBManager.h.

std::map<std::string, Body*> GraspIt::GraspItSimpleDBManager::objects [private]

Definition at line 99 of file GraspItSimpleDBManager.h.

Definition at line 115 of file GraspItSimpleDBManager.h.

std::map<std::string, Robot*> GraspIt::GraspItSimpleDBManager::robots [private]

Definition at line 102 of file GraspItSimpleDBManager.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