Superclass for all interfaces which want to access the GraspIt world for database management purposes. More...
#include <GraspItDatabaseManager.h>
Public Member Functions | |
virtual void | getAllLoadedObjectIDs (std::vector< int > &ids) const =0 |
virtual void | getAllLoadedObjectNames (std::vector< std::string > &names) const =0 |
virtual void | getAllLoadedRobotIDs (std::vector< int > &ids) const =0 |
virtual void | getAllLoadedRobotNames (std::vector< std::string > &names) const =0 |
virtual bool | getModelNameAndType (const int modelID, std::string &name, bool &isRobot) const =0 |
virtual bool | getObjectModelID (const std::string &objectName, int &id) const =0 |
virtual bool | getRobotJointNames (const std::string &robotName, std::vector< std::string > &jointNames) const =0 |
virtual bool | getRobotModelID (const std::string &robotName, int &id) const =0 |
GraspItDatabaseManager (const std::string &name, const SHARED_PTR< GraspItSceneManager > &interface) | |
int | isModelLoaded (const int modelID) const |
virtual int | loadObjectToDatabase (const std::string &filename, const std::string &objectName, const bool asGraspable)=0 |
int | loadObjectToWorld (const std::string &objectName, const EigenTransform &transform) |
virtual int | loadRobotToDatabase (const std::string &filename, const std::string &robotName, const std::vector< std::string > &jointNames)=0 |
int | loadRobotToWorld (const std::string &robotName, const EigenTransform &transform) |
int | loadToWorld (const int modelID, const EigenTransform &transform) |
bool | saveLoadedWorld (const std::string &filename, const bool asInventor, const bool createDir=false) |
int | unloadFromWorld (const int modelID) |
int | unloadObjectFromWorld (const std::string &objectName) |
int | unloadRobotFromWorld (const std::string &robotName) |
virtual | ~GraspItDatabaseManager () |
Protected Member Functions | |
virtual int | getModelType (const int modelID) const =0 |
virtual Body * | getObjectFromDatabase (const std::string &objectName)=0 |
virtual Body * | getObjectFromDatabase (const int modelID)=0 |
virtual Robot * | getRobotFromDatabase (const std::string &robotName)=0 |
virtual Robot * | getRobotFromDatabase (const int modelID)=0 |
virtual void | idleEventFromSceneManager ()=0 |
virtual void | onSceneManagerShutdown ()=0 |
Superclass for all interfaces which want to access the GraspIt world for database management purposes.
This interface identifies robots and objects with names (strings) which have to be unique among all robots and among all objects. The names identify a particular robot/object, so several robots or objects of same type can be maintained with different names.
When an object or robot is added to the database, they also get a uniqe model int ID which can be used to access the model, independent of the fact whether it is a robot or an object. The int id's are unique among *both* robots and objects.
In ROS moveit_msgs/GraspPlanning.srv, a body (object/obstacle) has an int ID (see also moveit_msgs/CollisionObject.msg) and a robot/hand has a string name. This interface allows to handle both of these conventions. While robots will then also have an int id, and objects also a string name, it is optional to the user of this interface which of the identifiers to use.
This interface allows to:
Definition at line 63 of file GraspItDatabaseManager.h.
GraspIt::GraspItDatabaseManager::GraspItDatabaseManager | ( | const std::string & | name, |
const SHARED_PTR< GraspItSceneManager > & | interface | ||
) | [inline] |
name | the name of this GraspItDatabaseManager object |
Definition at line 69 of file GraspItDatabaseManager.h.
virtual GraspIt::GraspItDatabaseManager::~GraspItDatabaseManager | ( | ) | [inline, virtual] |
Definition at line 73 of file GraspItDatabaseManager.h.
virtual void GraspIt::GraspItDatabaseManager::getAllLoadedObjectIDs | ( | std::vector< int > & | ids | ) | const [pure virtual] |
Adds the ids of all objects currently loaded in the GraspIt world in the vector Does not clear the vector!
Implemented in GraspIt::GraspItSimpleDBManager.
virtual void GraspIt::GraspItDatabaseManager::getAllLoadedObjectNames | ( | std::vector< std::string > & | names | ) | const [pure virtual] |
Adds the names of all objects currently loaded in the GraspIt world in the vector Does not clear the vector!
Implemented in GraspIt::GraspItSimpleDBManager.
virtual void GraspIt::GraspItDatabaseManager::getAllLoadedRobotIDs | ( | std::vector< int > & | ids | ) | const [pure virtual] |
Adds the ids of all robots currently loaded in the GraspIt world in the vector Does not clear the vector!
Implemented in GraspIt::GraspItSimpleDBManager.
virtual void GraspIt::GraspItDatabaseManager::getAllLoadedRobotNames | ( | std::vector< std::string > & | names | ) | const [pure virtual] |
Adds the names of all robots currently loaded in the GraspIt world in the vector. Does not clear the vector!
Implemented in GraspIt::GraspItSimpleDBManager.
virtual bool GraspIt::GraspItDatabaseManager::getModelNameAndType | ( | const int | modelID, |
std::string & | name, | ||
bool & | isRobot | ||
) | const [pure virtual] |
Returns the name and type of the model with this ID which is also used in the GraspIt world.
isRobot | true if model is a robot, false if it is an object. |
Implemented in GraspIt::GraspItSimpleDBManager.
virtual int GraspIt::GraspItDatabaseManager::getModelType | ( | const int | modelID | ) | const [protected, pure virtual] |
Checks whether this model ID is a robot or an object
2 | is an object |
1 | is a robot |
-1 | does not exist |
Implemented in GraspIt::GraspItSimpleDBManager.
virtual Body* GraspIt::GraspItDatabaseManager::getObjectFromDatabase | ( | const std::string & | objectName | ) | [protected, pure virtual] |
Retrieves the Body object from the database, if it exists in there.
Implemented in GraspIt::GraspItSimpleDBManager.
virtual Body* GraspIt::GraspItDatabaseManager::getObjectFromDatabase | ( | const int | modelID | ) | [protected, pure virtual] |
Retrieves the Body object from the database, if it exists in there.
Implemented in GraspIt::GraspItSimpleDBManager.
virtual bool GraspIt::GraspItDatabaseManager::getObjectModelID | ( | const std::string & | objectName, |
int & | id | ||
) | const [pure virtual] |
id | the model ID of the object with this name |
Implemented in GraspIt::GraspItSimpleDBManager.
virtual Robot* GraspIt::GraspItDatabaseManager::getRobotFromDatabase | ( | const std::string & | robotName | ) | [protected, pure virtual] |
Retrieves the Robot object from the database, if it exists in there.
Implemented in GraspIt::GraspItSimpleDBManager.
virtual Robot* GraspIt::GraspItDatabaseManager::getRobotFromDatabase | ( | const int | modelID | ) | [protected, pure virtual] |
Retrieves the Robot object from the database, if it exists in there.
Implemented in GraspIt::GraspItSimpleDBManager.
virtual bool GraspIt::GraspItDatabaseManager::getRobotJointNames | ( | const std::string & | robotName, |
std::vector< std::string > & | jointNames | ||
) | const [pure 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.
Implemented in GraspIt::GraspItSimpleDBManager.
virtual bool GraspIt::GraspItDatabaseManager::getRobotModelID | ( | const std::string & | robotName, |
int & | id | ||
) | const [pure virtual] |
id | the model ID of the robot with this name |
Implemented in GraspIt::GraspItSimpleDBManager.
virtual void GraspIt::GraspItDatabaseManager::idleEventFromSceneManager | ( | ) | [protected, pure virtual] |
This class is meant to remain abstract. Subclasses can decide whether they need access to the inventor thread.
Implements GraspIt::GraspItAccessor.
Implemented in GraspIt::GraspItSimpleDBManager.
int GraspItDatabaseManager::isModelLoaded | ( | const int | modelID | ) | const |
Checks if this model is currently loaded in the graspit world
1 | model is loaded |
0 | model is not loaded |
-1 | model ID could not be found in database |
Definition at line 223 of file GraspItDatabaseManager.cpp.
virtual int GraspIt::GraspItDatabaseManager::loadObjectToDatabase | ( | const std::string & | filename, |
const std::string & | objectName, | ||
const bool | asGraspable | ||
) | [pure 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.
objectName | the name to store this object with, and also the name to use for this object in the graspit world. |
>=0 | success, and returns int ID of this model (model IDs are for robots and objects) |
-1 | failed to load world with graspit source. |
-2 | graspit not initialized. |
-3 | file does not exist. |
-4 | could not add object to database because it already exists |
-5 | no object name specified |
-6 | other error when adding the object to the database. |
Implemented in GraspIt::GraspItSimpleDBManager.
int GraspItDatabaseManager::loadObjectToWorld | ( | const std::string & | objectName, |
const EigenTransform & | transform | ||
) |
Loads this object into the GraspIt world
0 | success |
-1 | object not in database |
-2 | graspit not initialized or other error adding robot to graspIt |
Definition at line 50 of file GraspItDatabaseManager.cpp.
virtual int GraspIt::GraspItDatabaseManager::loadRobotToDatabase | ( | const std::string & | filename, |
const std::string & | robotName, | ||
const std::vector< std::string > & | jointNames | ||
) | [pure 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.
robotName | the name to store this robot with, and also the name to use for this robot in the graspit world. |
jointNames | The 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. |
>=0 | success, and returns int ID of this model (model IDs are for robots and objects) |
-1 | failed to load world with graspit source. |
-2 | graspit not initialized. |
-3 | file does not exist. |
-4 | could not add robot to database because it already exists |
-5 | no robot name specified |
-6 | other error when adding the robot to the database. |
Implemented in GraspIt::GraspItSimpleDBManager.
int GraspItDatabaseManager::loadRobotToWorld | ( | const std::string & | robotName, |
const EigenTransform & | transform | ||
) |
Loads this robot into the GraspIt world
0 | success |
-1 | robot not in database |
-2 | graspit not initialized or other error adding robot to graspIt |
Definition at line 31 of file GraspItDatabaseManager.cpp.
int GraspItDatabaseManager::loadToWorld | ( | const int | modelID, |
const EigenTransform & | transform | ||
) |
loads the model with this ID (returned by load*ToDatabase() functions) into the graspit world
0 | success |
-1 | model not in database |
-2 | graspit not initialized or other error adding robot to graspIt |
Definition at line 69 of file GraspItDatabaseManager.cpp.
virtual void GraspIt::GraspItDatabaseManager::onSceneManagerShutdown | ( | ) | [protected, pure virtual] |
This class is meant to remain abstract. Subclasses can decide whether they need access to the inventor thread.
Implements GraspIt::GraspItAccessor.
Implemented in GraspIt::GraspItSimpleDBManager.
bool GraspItDatabaseManager::saveLoadedWorld | ( | const std::string & | filename, |
const bool | asInventor, | ||
const bool | createDir = false |
||
) |
Save the currently loaded world in the given file
asInventor | if true, the world is going to be saved as inventor file. Otherwise, it will be saved as $GraspIt XML world file. |
createDir | if true, the directory in which the file is to be saved is created if it does not exist. |
Definition at line 191 of file GraspItDatabaseManager.cpp.
int GraspItDatabaseManager::unloadFromWorld | ( | const int | modelID | ) |
Unloads this robot or object from the graspit world
0 | success |
-1 | model not loaded in the world |
-2 | model not in the database |
-3 | graspit not initialized or other error removing the model from graspit |
Definition at line 137 of file GraspItDatabaseManager.cpp.
int GraspItDatabaseManager::unloadObjectFromWorld | ( | const std::string & | objectName | ) |
Unloads this object from the graspit world
0 | success |
-1 | object not loaded in the world |
-2 | object not in the database |
-3 | graspit not initialized or other error removing the object from graspit |
Definition at line 126 of file GraspItDatabaseManager.cpp.
int GraspItDatabaseManager::unloadRobotFromWorld | ( | const std::string & | robotName | ) |
Unloads this robot from the graspit world
0 | success |
-1 | robot not loaded in the world |
-2 | robot not in the database |
-3 | graspit not initialized or other error removing the robot from graspIt |
Definition at line 115 of file GraspItDatabaseManager.cpp.