#include <graspTesterThread.h>
Public Member Functions | |
void | clearBuffers () |
Clear both the candidate and the solution buffer. | |
int | getNumCandidates () |
Returns the number of candidates currently queued for testing. | |
virtual PlannerType | getType () |
The type of this planner, for easier run-time check. | |
GraspTester (Hand *h) | |
Hard coded to loop forever and use STRICT_AUTOGRASP energy. | |
GraspPlanningState * | popSolution () |
Retrieve the least recently posted solution in the list. | |
bool | postCandidate (GraspPlanningState *s) |
Add another candidate to the back of list for testing, if there is room. | |
virtual bool | resetPlanner () |
Also clears internal buffers for candidates and solutions. | |
void | setEnergyType (SearchEnergyType) |
Hard-coded to only accept STRICT_AUTOGRASP energy, which is also set in constructor. | |
~GraspTester () | |
Also clears the internal buffers. | |
Private Member Functions | |
void | mainLoop () |
Keeps checking the buffer of candidates and tests them when they are available. | |
GraspPlanningState * | popCandidate () |
Retrieves the next candidate in line for testing. | |
void | postSolution (GraspPlanningState *) |
Posts a new solution in the list. | |
void | testGrasp (GraspPlanningState *s) |
The actual testing routine. | |
Private Attributes | |
std::list< GraspPlanningState * > | mCandidateList |
Stores candidates queued up for testing. | |
QMutex | mListMutex |
The mutex used for synchronizig access to the candidate list and the solution list. | |
int | mMaxCandidates |
The max number of candidates that this will accept to buffer for testing. | |
int | mNumCandidates |
The current number of candidates that have been queued for testing. | |
std::list< GraspPlanningState * > | mSolutionList |
Saves the results of testing the candidates. |
The GraspTesterThread is a helper class for the OnLinePlanner. It is designed to have a list of possible grasps that is tests in its own thread. The main characteristic is that is allows external access to its list of "candidates": the user can place candidates in this planner's list, which will be tested when their turn comes. This class will place the results of testing in a "solution" list, where an external user can retrieve them from.
How exactly the testing is being done should be more modular, right now it is hard-coded in. A lot of the functionality of how candidates are tested and solutions saved are customized for the on-line planner needs.
Definition at line 52 of file graspTesterThread.h.
GraspTester::GraspTester | ( | Hand * | h | ) |
Hard coded to loop forever and use STRICT_AUTOGRASP energy.
Definition at line 36 of file graspTesterThread.cpp.
GraspTester::~GraspTester | ( | ) |
Also clears the internal buffers.
Definition at line 46 of file graspTesterThread.cpp.
void GraspTester::clearBuffers | ( | ) |
Clear both the candidate and the solution buffer.
Definition at line 145 of file graspTesterThread.cpp.
int GraspTester::getNumCandidates | ( | ) | [inline] |
Returns the number of candidates currently queued for testing.
Definition at line 96 of file graspTesterThread.h.
virtual PlannerType GraspTester::getType | ( | ) | [inline, virtual] |
The type of this planner, for easier run-time check.
Implements EGPlanner.
Definition at line 81 of file graspTesterThread.h.
void GraspTester::mainLoop | ( | ) | [private, virtual] |
Keeps checking the buffer of candidates and tests them when they are available.
Implements EGPlanner.
Definition at line 66 of file graspTesterThread.cpp.
GraspPlanningState * GraspTester::popCandidate | ( | ) | [private] |
Retrieves the next candidate in line for testing.
Definition at line 116 of file graspTesterThread.cpp.
GraspPlanningState * GraspTester::popSolution | ( | ) |
Retrieve the least recently posted solution in the list.
Definition at line 95 of file graspTesterThread.cpp.
bool GraspTester::postCandidate | ( | GraspPlanningState * | s | ) |
Add another candidate to the back of list for testing, if there is room.
Definition at line 130 of file graspTesterThread.cpp.
void GraspTester::postSolution | ( | GraspPlanningState * | s | ) | [private] |
Posts a new solution in the list.
Definition at line 108 of file graspTesterThread.cpp.
bool GraspTester::resetPlanner | ( | ) | [virtual] |
Also clears internal buffers for candidates and solutions.
Reimplemented from EGPlanner.
Definition at line 58 of file graspTesterThread.cpp.
void GraspTester::setEnergyType | ( | SearchEnergyType | ) | [virtual] |
Hard-coded to only accept STRICT_AUTOGRASP energy, which is also set in constructor.
Reimplemented from EGPlanner.
Definition at line 52 of file graspTesterThread.cpp.
void GraspTester::testGrasp | ( | GraspPlanningState * | s | ) | [private] |
The actual testing routine.
Definition at line 163 of file graspTesterThread.cpp.
std::list<GraspPlanningState*> GraspTester::mCandidateList [private] |
Stores candidates queued up for testing.
Definition at line 60 of file graspTesterThread.h.
QMutex GraspTester::mListMutex [private] |
The mutex used for synchronizig access to the candidate list and the solution list.
Definition at line 56 of file graspTesterThread.h.
int GraspTester::mMaxCandidates [private] |
The max number of candidates that this will accept to buffer for testing.
Definition at line 62 of file graspTesterThread.h.
int GraspTester::mNumCandidates [private] |
The current number of candidates that have been queued for testing.
Definition at line 64 of file graspTesterThread.h.
std::list<GraspPlanningState*> GraspTester::mSolutionList [private] |
Saves the results of testing the candidates.
Definition at line 58 of file graspTesterThread.h.