Manages the various components of the grasp planning system. More...
#include <grasp_manager.h>
Public Member Functions | |
void | chooseGrasp () |
void | generateGrasps () |
bool | get_doIteration () const |
grasp_planner * | get_graspPlanner () const |
grasp_tester * | get_graspTester () const |
void | get_iterationParameters (double &, double &) const |
bool | get_render () const |
grasp_manager () | |
int | readCandidateGraspsFile (const QString &filename) |
void | set_doIteration (bool) |
bool | set_iterationParameters (double, double) |
void | set_render (bool) |
void | showGrasps (int next) |
void | testGrasps () |
~grasp_manager () | |
Private Member Functions | |
void | compareGraspListsByDist (std::list< plannedGrasp * > &, std::list< plannedGrasp * >) |
void | loadPrimitives () |
Private Attributes | |
bool | doIteration |
if TRUE, previously generated grasps (if there are any) are used to pick those out of the current set to be tested that are near to stable grasps. | |
std::list< plannedGrasp * > | graspList |
A list of candidate grasps, before testing. After testing, contains a sorted list of force closure grasps. | |
int | graspsNotShown |
TRUE if the graspList has not yet been sent to the presenter. | |
double | itQualThresh |
a quality threshold value for determining if a grasp in the first set of tested grasps can be considered "good" | |
IVmgr * | ivmgr |
a pointer to the inventor manager | |
double | maxdist |
a threshold value for deteriming if grasps in a new set are close enough to previously found good grasp | |
GraspableBody * | my_body |
A pointer to the grasped object. | |
grasp_planner * | myPlanner |
a pointer to the grasp planner | |
grasp_presenter * | myPresent |
a pointer to the grasp presenter | |
int | nrOfPlannedGrasps |
Counter for keeping statistics. | |
int | nrOfStableGrasps |
Counter for keeping statistics. | |
SoGroup * | primitives |
a pointer to the shape primitive scene graph | |
bool | renderIt |
if TRUE, the whole testing process is visualized. |
Manages the various components of the grasp planning system.
This controls the grasp planning process. It is responsible for reading the shape primitives of the grasped object and calling the planner to generate candidate grasps, or it can read a set of candidate grasps from a text file. Then it calls the tester to test the candidates. The tester returns a sorted list of the force closure grasps which are then sent to the presenter to allow the user to view each grasp in succession.
Definition at line 96 of file grasp_manager.h.
grasp_manager::grasp_manager | ( | ) |
Initializes the planning system. Creates a new planner, a new tester, and a new presenter.
Definition at line 99 of file grasp_manager.cpp.
grasp_manager::~grasp_manager | ( | ) |
Deletes any grasps in the graspList , and deletes the planner, tester, and presenter.
Definition at line 119 of file grasp_manager.cpp.
void grasp_manager::chooseGrasp | ( | ) |
Not used. Would be for the user to select one of the grasps to use in some way.
Definition at line 462 of file grasp_manager.cpp.
void grasp_manager::compareGraspListsByDist | ( | std::list< plannedGrasp * > & | newList, | |
std::list< plannedGrasp * > | criteriaList | |||
) | [private] |
This takes a list of grasps newList, and a set of grasp to compare them to, criteriaList. For each grasp in newList, it checks the distance of that grasp configuration to each of the grasps in the criteriaList that have a quality greater than the current itQualThresh. If the distance is less than the current maxdist, it keeps the grasp in newList, otherwise it is erased. The idea is to keep only those grasps that are near other high quality grasps. However, this is not currently part of the user interface and does not get used.
Definition at line 335 of file grasp_manager.cpp.
void grasp_manager::generateGrasps | ( | ) |
This method is used to automatically generate grasps for a given object. It loads the shape primitives for the grasped object, then calls the planner to return a set of candidate grasps for the given object. Then it creates a window that shows the shape primitives and the candidate grasps.
Definition at line 277 of file grasp_manager.cpp.
bool grasp_manager::get_doIteration | ( | ) | const |
Returns the value of the doIteration flag.
Definition at line 498 of file grasp_manager.cpp.
grasp_planner * grasp_manager::get_graspPlanner | ( | ) | const |
Returns a pointer to the graspPlanner.
Definition at line 532 of file grasp_manager.cpp.
grasp_tester * grasp_manager::get_graspTester | ( | ) | const |
Returns a pointer to the graspTester.
Definition at line 540 of file grasp_manager.cpp.
void grasp_manager::get_iterationParameters | ( | double & | a, | |
double & | b | |||
) | const |
Returns the iteration parameters, itQualThresh and maxdist, as a and b.
Definition at line 522 of file grasp_manager.cpp.
bool grasp_manager::get_render | ( | ) | const |
Returns the value of the render it flag.
Definition at line 479 of file grasp_manager.cpp.
void grasp_manager::loadPrimitives | ( | ) | [private] |
Tries to load the shape primitives file for the grasped object. It uses the same file name as the current object, but looks in the primitives folder within the objects directory. If the primitives are not found, it uses the original geometry of the object, the IVGeomRoot.
Definition at line 143 of file grasp_manager.cpp.
int grasp_manager::readCandidateGraspsFile | ( | const QString & | filename | ) |
If the grasps are not being automatically generated, and only the tester is being used, then this method is used to read in the list of candidate grasps that should be tested. It first clears the current graspList , then it reads one grasp per line in the file. Each line should be formatted in the following way (including brackets):
[0 0 0][0 0 1][0 1 0]60
The first vector is the position of the palm. The second is the palm approach direction. The third is the thumb direction, and the last number is the spread angle of the fingers in degrees.
Each grasp is added to the graspList and the primitives are set to the geometry of the object itself (IVGeomRoot), since the planner won't be used. However, a window that shows the object and the set of grasps to be tested is created in the same way that happens after the planner completes the automatic grasp generation.
This function returns SUCCESS or FAILURE depending on whether it was able to read the grasps from the file.
Definition at line 202 of file grasp_manager.cpp.
void grasp_manager::set_doIteration | ( | bool | in | ) |
Not used. Sets the doIteration flag to in. If a set of grasps has previously been tested and the user wants to compare a new set of grasps to the old ones to keep only those close to the old ones, in should be TRUE.
Definition at line 490 of file grasp_manager.cpp.
bool grasp_manager::set_iterationParameters | ( | double | a, | |
double | b | |||
) |
Not used because there is no UI for this. It sets the quality and distance thresholds, a and b, for further iterations of the grasp testing process. Returns FALSE and does not perform the operation if either parameter is not between 0.0 and 1.0.
Definition at line 509 of file grasp_manager.cpp.
void grasp_manager::set_render | ( | bool | in | ) |
Sets the renderIt flag to in. Each step of the grasp testing will be rendered if in is TRUE.
Definition at line 471 of file grasp_manager.cpp.
void grasp_manager::showGrasps | ( | int | next | ) |
After the tester has completed testing all grasps, the graspList contains all the form closure grasps of the object sorted in quality order (best to worst). This method presents the grasp number next from that list to the user. If no grasps have been shown yet, it passes the list to the grasp presenter. Then it calls the presenter's showGrasp for the next grasp.
Definition at line 413 of file grasp_manager.cpp.
void grasp_manager::testGrasps | ( | ) |
Calls the grasp tester with the current set of grasps in the graspList .
Definition at line 318 of file grasp_manager.cpp.
bool grasp_manager::doIteration [private] |
if TRUE, previously generated grasps (if there are any) are used to pick those out of the current set to be tested that are near to stable grasps.
Definition at line 108 of file grasp_manager.h.
std::list<plannedGrasp*> grasp_manager::graspList [private] |
A list of candidate grasps, before testing. After testing, contains a sorted list of force closure grasps.
Definition at line 102 of file grasp_manager.h.
int grasp_manager::graspsNotShown [private] |
TRUE if the graspList has not yet been sent to the presenter.
Definition at line 111 of file grasp_manager.h.
double grasp_manager::itQualThresh [private] |
a quality threshold value for determining if a grasp in the first set of tested grasps can be considered "good"
Definition at line 135 of file grasp_manager.h.
IVmgr* grasp_manager::ivmgr [private] |
a pointer to the inventor manager
Definition at line 120 of file grasp_manager.h.
double grasp_manager::maxdist [private] |
a threshold value for deteriming if grasps in a new set are close enough to previously found good grasp
Definition at line 132 of file grasp_manager.h.
GraspableBody* grasp_manager::my_body [private] |
A pointer to the grasped object.
Definition at line 99 of file grasp_manager.h.
grasp_planner* grasp_manager::myPlanner [private] |
a pointer to the grasp planner
Definition at line 114 of file grasp_manager.h.
grasp_presenter* grasp_manager::myPresent [private] |
a pointer to the grasp presenter
Definition at line 117 of file grasp_manager.h.
int grasp_manager::nrOfPlannedGrasps [private] |
Counter for keeping statistics.
Definition at line 140 of file grasp_manager.h.
int grasp_manager::nrOfStableGrasps [private] |
Counter for keeping statistics.
Definition at line 143 of file grasp_manager.h.
SoGroup* grasp_manager::primitives [private] |
a pointer to the shape primitive scene graph
Definition at line 123 of file grasp_manager.h.
bool grasp_manager::renderIt [private] |
if TRUE, the whole testing process is visualized.
Definition at line 105 of file grasp_manager.h.