Computes the "quality" of a HandObjectState, which encapsulates the state of the hand. More...
#include <searchEnergy.h>
Public Member Functions | |
virtual void | analyzeCurrentPosture (Hand *h, Body *o, bool &isLegal, double &stateEnergy, bool noChange=true) |
Works the same way as analyzeState, but analyzes the hand as it is when the function is called. | |
virtual void | analyzeState (bool &isLegal, double &stateEnergy, const GraspPlanningState *state, bool noChange=true) |
void | disableRendering (bool dr) |
SearchContactType | getContactType () const |
double | getEpsQual () |
double | getVolQual () |
SearchEnergy () | |
void | setContactType (SearchContactType t) |
void | setStatStream (std::ostream *out) const |
Sets the stat file where results are to be written. | |
void | setType (SearchEnergyType t) |
~SearchEnergy () | |
Protected Member Functions | |
double | approachAutograspQualityEnergy () const |
double | autograspQualityEnergy () const |
double | compliantEnergy () const |
Used for project with Harvard hand. | |
double | contactEnergy () const |
bool | contactSlip () const |
Helper function for dynamics energy; returns true if any contacts are slipping. | |
void | createQualityMeasures () |
double | distanceFunction (double d) const |
bool | dynamicAutograspComplete () const |
Another helper function for dynamics energy. | |
double | dynamicAutograspEnergy () const |
Closes the hand in dynamics mode, then computes grasp quality. | |
double | energy () const |
This is where the decision is made of which type of energy value should be computed and returned. | |
double | guidedAutograspEnergy () const |
double | guidedPotentialQualityEnergy () const |
bool | legal () const |
Checks if the current state is legal or not (usually legal means no interpenetrations). | |
double | potentialQualityEnergy (bool verbose=false) const |
double | potentialQualityScalingFunction (double dist, double cosTheta) const |
void | setHandAndObject (Hand *h, Body *o) |
double | strictAutograspEnergy () const |
Protected Attributes | |
bool | mCompUnbalanced |
Used only by compliant energy to keep track of its internal state. | |
SearchContactType | mContactType |
bool | mDisableRendering |
bool | mDynamicsError |
Used by dynamic energy to keep track of the dynamic autograsp. | |
QualityMeasure * | mEpsQual |
Hand * | mHand |
vec3 | mMaxUnbalancedForce |
Body * | mObject |
std::ostream * | mOut |
If not null, it will print its output here. | |
SearchEnergyType | mType |
QualityMeasure * | mVolQual |
Private Slots | |
void | autoGraspStep (int numCols, bool &stopRequest) const |
Called to compute compliant force balances during autograsp. | |
void | dynamicsError (const char *) const |
Called to warn of a dynamics error in dynamic quality. |
Computes the "quality" of a HandObjectState, which encapsulates the state of the hand.
This class can compute the "quality" (or in other terms "energy") of a HandObjectState. There are many ways of doing this which are all right now hidden in the protected functions and managed by the mType flag. In the near future I plan to re-write this using inheritance instead of switch(...) but I never got around to doing that.
The various type of energy calculations used are a bit fuzzy too, re-organization will help when it happens. For now, I will not provide very detailed documentation here, as I am really embarassed by this code and plan to re-write it as soon as possible.
Definition at line 53 of file searchEnergy.h.
SearchEnergy::SearchEnergy | ( | ) |
Definition at line 53 of file searchEnergy.cpp.
SearchEnergy::~SearchEnergy | ( | ) |
Definition at line 85 of file searchEnergy.cpp.
void SearchEnergy::analyzeCurrentPosture | ( | Hand * | h, | |
Body * | o, | |||
bool & | isLegal, | |||
double & | stateEnergy, | |||
bool | noChange = true | |||
) | [virtual] |
Works the same way as analyzeState, but analyzes the hand as it is when the function is called.
Definition at line 114 of file searchEnergy.cpp.
void SearchEnergy::analyzeState | ( | bool & | isLegal, | |
double & | stateEnergy, | |||
const GraspPlanningState * | state, | |||
bool | noChange = true | |||
) | [virtual] |
This is the main interface to this class. It is passed a GraspPlanningState* and returns whether the HandObjectState is legal, and if so, it's energy. If noChange = true, it will re-set the world situation to what it was on entry. if not, it will leave the world in the state encapsulated in HandObjectState. if the HandObjectState is not legal, it will re-set the world before exiting regardless of the noChange flag.
Reimplemented in ClosureSearchEnergy.
Definition at line 135 of file searchEnergy.cpp.
double SearchEnergy::approachAutograspQualityEnergy | ( | ) | const [protected] |
This version moves the palm in the direction of the object, attempting to establish contact on the palm before closing the fingers and establishing contacts on the finger.
Definition at line 397 of file searchEnergy.cpp.
double SearchEnergy::autograspQualityEnergy | ( | ) | const [protected] |
This function simply closes the hand and computes the real grasp quality that results
Definition at line 380 of file searchEnergy.cpp.
void SearchEnergy::autoGraspStep | ( | int | numCols, | |
bool & | stopRequest | |||
) | const [private, slot] |
Called to compute compliant force balances during autograsp.
Definition at line 416 of file searchEnergy.cpp.
double SearchEnergy::compliantEnergy | ( | ) | const [protected] |
Used for project with Harvard hand.
Definition at line 448 of file searchEnergy.cpp.
double SearchEnergy::contactEnergy | ( | ) | const [protected] |
Definition at line 216 of file searchEnergy.cpp.
bool SearchEnergy::contactSlip | ( | ) | const [protected] |
Helper function for dynamics energy; returns true if any contacts are slipping.
Definition at line 521 of file searchEnergy.cpp.
void SearchEnergy::createQualityMeasures | ( | ) | [protected] |
Definition at line 66 of file searchEnergy.cpp.
void SearchEnergy::disableRendering | ( | bool | dr | ) | [inline] |
Definition at line 114 of file searchEnergy.h.
double SearchEnergy::distanceFunction | ( | double | d | ) | const [protected] |
Definition at line 657 of file searchEnergy.cpp.
bool SearchEnergy::dynamicAutograspComplete | ( | ) | const [protected] |
Another helper function for dynamics energy.
Implements the following heuristic: for each chain, either the last link must have a contact, or the last joint must be maxed out. If this is true the dynamic autograsp *might* have been completed
Definition at line 530 of file searchEnergy.cpp.
double SearchEnergy::dynamicAutograspEnergy | ( | ) | const [protected] |
Closes the hand in dynamics mode, then computes grasp quality.
Definition at line 536 of file searchEnergy.cpp.
void SearchEnergy::dynamicsError | ( | const char * | ) | const [private, slot] |
Called to warn of a dynamics error in dynamic quality.
Definition at line 514 of file searchEnergy.cpp.
double SearchEnergy::energy | ( | ) | const [protected] |
This is where the decision is made of which type of energy value should be computed and returned.
Definition at line 165 of file searchEnergy.cpp.
SearchContactType SearchEnergy::getContactType | ( | ) | const [inline] |
Definition at line 113 of file searchEnergy.h.
double SearchEnergy::getEpsQual | ( | ) |
Definition at line 701 of file searchEnergy.cpp.
double SearchEnergy::getVolQual | ( | ) |
Definition at line 707 of file searchEnergy.cpp.
double SearchEnergy::guidedAutograspEnergy | ( | ) | const [protected] |
This formulation combines virtual contact energy with autograsp energy. Virtual contact energy is used to "guide" initial stages of the search and to see if we should even bother computing autograsp quality. Autograsp is a couple of orders of magnitude higher and so should work very well with later stages of the sim ann search
Definition at line 255 of file searchEnergy.cpp.
double SearchEnergy::guidedPotentialQualityEnergy | ( | ) | const [protected] |
This version uses the contact energy to guide the search when quality energy is poor. If quality energy is ok then it uses it, scaled to about -10 so that in the early and middle stages of the search it will still jump out of it, but not in later stages
Definition at line 315 of file searchEnergy.cpp.
bool SearchEnergy::legal | ( | ) | const [protected] |
Checks if the current state is legal or not (usually legal means no interpenetrations).
Definition at line 92 of file searchEnergy.cpp.
double SearchEnergy::potentialQualityEnergy | ( | bool | verbose = false |
) | const [protected] |
Definition at line 325 of file searchEnergy.cpp.
double SearchEnergy::potentialQualityScalingFunction | ( | double | dist, | |
double | cosTheta | |||
) | const [protected] |
Definition at line 668 of file searchEnergy.cpp.
void SearchEnergy::setContactType | ( | SearchContactType | t | ) | [inline] |
Definition at line 110 of file searchEnergy.h.
Definition at line 76 of file searchEnergy.cpp.
void SearchEnergy::setStatStream | ( | std::ostream * | out | ) | const [inline] |
Sets the stat file where results are to be written.
Definition at line 126 of file searchEnergy.h.
void SearchEnergy::setType | ( | SearchEnergyType | t | ) | [inline] |
Definition at line 109 of file searchEnergy.h.
double SearchEnergy::strictAutograspEnergy | ( | ) | const [protected] |
This version behaves like the autograsp energy, except it returns a huge penalty if the grasp has 0 hull It is meant for searches that NEVER want to go where the grasp has no quality
Definition at line 647 of file searchEnergy.cpp.
bool SearchEnergy::mCompUnbalanced [mutable, protected] |
Used only by compliant energy to keep track of its internal state.
Definition at line 96 of file searchEnergy.h.
SearchContactType SearchEnergy::mContactType [protected] |
Definition at line 60 of file searchEnergy.h.
bool SearchEnergy::mDisableRendering [protected] |
If this flag is set, the hand is disconnected from the scene graph while the calculator does energy computations
Definition at line 63 of file searchEnergy.h.
bool SearchEnergy::mDynamicsError [mutable, protected] |
Used by dynamic energy to keep track of the dynamic autograsp.
Definition at line 99 of file searchEnergy.h.
QualityMeasure * SearchEnergy::mEpsQual [protected] |
Definition at line 58 of file searchEnergy.h.
Hand* SearchEnergy::mHand [protected] |
Definition at line 57 of file searchEnergy.h.
vec3 SearchEnergy::mMaxUnbalancedForce [mutable, protected] |
Definition at line 97 of file searchEnergy.h.
Body* SearchEnergy::mObject [protected] |
Definition at line 57 of file searchEnergy.h.
std::ostream* SearchEnergy::mOut [mutable, protected] |
If not null, it will print its output here.
Definition at line 66 of file searchEnergy.h.
SearchEnergyType SearchEnergy::mType [protected] |
Definition at line 59 of file searchEnergy.h.
QualityMeasure* SearchEnergy::mVolQual [protected] |
Definition at line 58 of file searchEnergy.h.