EigenGraspInterface Class Reference

#include <eigenGrasp.h>

List of all members.

Public Member Functions

void checkOrigin ()
 Checks if the origin of the eigengrasp space is inside the legal range of the dofs.
 EigenGraspInterface (const EigenGraspInterface *orig)
 EigenGraspInterface (Robot *r)
void fixEigenGrasp (int i, double fa)
 Sets one of the eigengrasps as "fixed", meaning no movement is allowed along it.
void getAmp (double *amp, const double *dof) const
 Converts a set of dof values to eigengrasp amplitudes.
void getDOF (const double *amp, double *dof) const
 Converts a set of eigengrasp amplitudes into dof values.
const EigenGraspgetGrasp (int g)
 Returns the g-th eigengrasp.
const QString getName () const
 Gets the name of this space; used only for gui and debug purposes.
int getSize () const
 Returns the size of the eigengrasp space (the number of eigengrasps).
bool isRigid () const
 Returns whether the interface is rigid.
int readFromFile (QString filename)
 Loads all the eigengrasps, as well as the origin, from a file.
void setMinMax ()
 Re-computes the min and max allowable amplitudes along each EG direction.
void setName (QString n)
 Sets the name of this space; used used to show what file these eigengrasps were loaded from.
void setOrigin (const double *dof)
 Sets the origin of the eigengrasp space, as a point in the dof space.
void setRigid (bool r) const
 Sets the interface to rigid mode or non-rigis mode.
void setSimpleOrigin ()
 Sets the origin of eigengrasp space as the point halfway between each dof's range.
int setTrivial ()
 The trivial set of EG's is the identity set, where the EG (sub)space is identical to the dof space.
void unfixEigenGrasp (int i)
 Removes the "fixed" tag from an eigengrasp, allowing free movement.
int writeToFile (const char *filename)
 Saves all the eigengrasps that define the subspace to a file, then also writes the origin.
 ~EigenGraspInterface ()

Private Member Functions

void clear ()
void computeProjectionMatrices ()
 Builds the projection matrices based on eigengrasp definitions.
void toDOFSpace (const double *amp, double *dof, const double *origin) const
 Goes from EG space to DOF space.
void toEigenSpace (double *amp, const double *dof, const double *origin) const
 Goes from DOF space to EG space.

Private Attributes

int dSize
 The dimensionality of the dof space.
int eSize
 The dimensionality of the eigengrasp space.
std::vector< EigenGrasp * > mGrasps
 The eigengrasps themselves; the bases of the subspace.
QString mName
 Helper that allows us to display what file the EG's where loaded from .
EigenGraspmNorm
 Used if each EG has been "normalized".
EigenGraspmOrigin
 The origin of the EG subspace.
MatrixmP
 Matrix that projects from dof space to eigen space.
MatrixmPInv
 Matrix that projects from eigen space to dof space.
bool mRigid
 Shows if motion of the robot is RIGID.
RobotmRobot
 The robot that this interface refers to. Should have the right number of joints.

Detailed Description

This is the complete interface for controlling a robot in an eigengrasp subspace. It holds a set of eigengrasps for a particular robot. It also has AN ORIGIN OF MOTION which is VERY IMPORTANT: it completely defines the subspace of the eigengrasps.

The main role of this interface is to go back and forth between two spaces: the dof, of dimensionality dSize, and the eigengrasp space, of dimensionality eSize. It simply defines the eigengrasp subspace and provides a linear mapping between the two.

Definition at line 128 of file eigenGrasp.h.


Constructor & Destructor Documentation

EigenGraspInterface::EigenGraspInterface ( Robot r  ) 

Definition at line 150 of file eigenGrasp.cpp.

EigenGraspInterface::EigenGraspInterface ( const EigenGraspInterface orig  ) 

Definition at line 161 of file eigenGrasp.cpp.

EigenGraspInterface::~EigenGraspInterface (  ) 

Definition at line 184 of file eigenGrasp.cpp.


Member Function Documentation

void EigenGraspInterface::checkOrigin (  ) 

Checks if the origin of the eigengrasp space is inside the legal range of the dofs.

If the origin of the eigengrasp subspace is not inside the legal range of the dof, the coordinate of the origin along the offending axis is set to either the min or the max of that dof.

Definition at line 341 of file eigenGrasp.cpp.

void EigenGraspInterface::clear (  )  [private]

Definition at line 190 of file eigenGrasp.cpp.

void EigenGraspInterface::computeProjectionMatrices (  )  [private]

Builds the projection matrices based on eigengrasp definitions.

Computes the projection matrices that go between dof and eg space. This works in the general case; no assumptions are made about the basis of the eg space (the eigengrasps themselves) being orthonormal. In the case of orthonormal eg's, simple dot products would do as well, but this is more general and elegant.

In general, if we define the projection from dof space to eg space as P(x) = a and its inverse as PInv(a) = x, the following rules apply: P(PInv(a)) = a (always) PInv(P(x)) != x (usually)

Definition at line 393 of file eigenGrasp.cpp.

void EigenGraspInterface::fixEigenGrasp ( int  i,
double  fa 
) [inline]

Sets one of the eigengrasps as "fixed", meaning no movement is allowed along it.

This is relevant when a point in dof space has to be projected in eigengrasp space and then back to dof space; if a certain eigengrasp is fixed, the projection is forced to assume the fixed value for that eigengrasp.

Definition at line 216 of file eigenGrasp.h.

void EigenGraspInterface::getAmp ( double *  amp,
const double *  dof 
) const

Converts a set of dof values to eigengrasp amplitudes.

Given a set of dof values (a point in dof space), it computes its eigengrasp amplitudes (its projection in eg space). Just subtracts the origin of the eg space from the provided point, then projects the result along the eg subspace.

Definition at line 576 of file eigenGrasp.cpp.

void EigenGraspInterface::getDOF ( const double *  amp,
double *  dof 
) const

Converts a set of eigengrasp amplitudes into dof values.

Given a vector of EG amplitudes (a point in EG subspace) this function returns it's equivalent in DOF space. Essentially, it back-projects a point from eg space to dof space.

If the interface is rigid, we add the amplitudes to the pre-specified eigen space origin. This means we DISCARD whatever component was in the pose that was not from eigenspace.

If the interface is not rigid, we add the change in amplitudes to the current position of the robot. This means we KEEP the position component that was not in eigen space.

Definition at line 532 of file eigenGrasp.cpp.

const EigenGrasp* EigenGraspInterface::getGrasp ( int  g  )  [inline]

Returns the g-th eigengrasp.

Definition at line 177 of file eigenGrasp.h.

const QString EigenGraspInterface::getName (  )  const [inline]

Gets the name of this space; used only for gui and debug purposes.

Definition at line 199 of file eigenGrasp.h.

int EigenGraspInterface::getSize (  )  const [inline]

Returns the size of the eigengrasp space (the number of eigengrasps).

Definition at line 179 of file eigenGrasp.h.

bool EigenGraspInterface::isRigid (  )  const [inline]

Returns whether the interface is rigid.

Definition at line 182 of file eigenGrasp.h.

int EigenGraspInterface::readFromFile ( QString  filename  ) 

Loads all the eigengrasps, as well as the origin, from a file.

Reads the entire interface from a file, looking for keywords inside the file. Loads the size of the dof space, all eg's (which define the size of the eg space), any normalization factors (optional) and the origin of the eg space (optional).

The size of the dof space must be loaded before any eg's, origin, etc can be loaded; is must also match the number of dof's in this robot.

Definition at line 274 of file eigenGrasp.cpp.

void EigenGraspInterface::setMinMax (  ) 

Re-computes the min and max allowable amplitudes along each EG direction.

The boundary of the "legal" space forms a polygon in EG-subspace which is not axis-aligned. It is difficult to compute analytically so for any new hand configuration this function re-computes the min and max values. The min and max along each eigengrasp are then stored inside the eigengrasps themselves.

The behavior depends on whether EIGENGRASP_LOOSE is defined. If not, min and max have to be set so that not a single dof is taken outside of its range. If it is not set, then min and max have to be set so that at least one dof is inside the legal range, the others can go out as they will be clamped later.

For some reason, this apparently simple function has given me a ton of trouble, and I've never been completely happy with it.

Definition at line 447 of file eigenGrasp.cpp.

void EigenGraspInterface::setName ( QString  n  )  [inline]

Sets the name of this space; used used to show what file these eigengrasps were loaded from.

Definition at line 197 of file eigenGrasp.h.

void EigenGraspInterface::setOrigin ( const double *  dof  ) 

Sets the origin of the eigengrasp space, as a point in the dof space.

Definition at line 357 of file eigenGrasp.cpp.

void EigenGraspInterface::setRigid ( bool  r  )  const [inline]

Sets the interface to rigid mode or non-rigis mode.

In rigid motion, only configuration that are strictly inside the EG subspace are allowed. Otherwise, any configuration is allowed. This is relevant when getAmp(...) and getDOF(...) are used.

Definition at line 187 of file eigenGrasp.h.

void EigenGraspInterface::setSimpleOrigin (  ) 

Sets the origin of eigengrasp space as the point halfway between each dof's range.

Sets as origin of eigengrasp subspace the point which is halfway between min and max for each DOF of the robot.

Definition at line 367 of file eigenGrasp.cpp.

int EigenGraspInterface::setTrivial (  ) 

The trivial set of EG's is the identity set, where the EG (sub)space is identical to the dof space.

Definition at line 235 of file eigenGrasp.cpp.

void EigenGraspInterface::toDOFSpace ( const double *  amp,
double *  dof,
const double *  origin 
) const [private]

Goes from EG space to DOF space.

Definition at line 495 of file eigenGrasp.cpp.

void EigenGraspInterface::toEigenSpace ( double *  amp,
const double *  dof,
const double *  origin 
) const [private]

Goes from DOF space to EG space.

Definition at line 506 of file eigenGrasp.cpp.

void EigenGraspInterface::unfixEigenGrasp ( int  i  )  [inline]

Removes the "fixed" tag from an eigengrasp, allowing free movement.

Definition at line 218 of file eigenGrasp.h.

int EigenGraspInterface::writeToFile ( const char *  filename  ) 

Saves all the eigengrasps that define the subspace to a file, then also writes the origin.

Writes the entire interface to a file in the following order:

  • the size of the eg space
  • the size of the dof space
  • all eigengrasps
  • the origin Seems not to be compatible with the readFromFile fucntion of this class.

Definition at line 219 of file eigenGrasp.cpp.


Member Data Documentation

The dimensionality of the dof space.

Definition at line 134 of file eigenGrasp.h.

The dimensionality of the eigengrasp space.

Definition at line 136 of file eigenGrasp.h.

std::vector<EigenGrasp*> EigenGraspInterface::mGrasps [private]

The eigengrasps themselves; the bases of the subspace.

Definition at line 139 of file eigenGrasp.h.

QString EigenGraspInterface::mName [private]

Helper that allows us to display what file the EG's where loaded from .

Definition at line 149 of file eigenGrasp.h.

Used if each EG has been "normalized".

Values along each axis are first multiplied by the respective value in here, then added back to the origin (mean).

Definition at line 146 of file eigenGrasp.h.

The origin of the EG subspace.

Definition at line 141 of file eigenGrasp.h.

Matrix that projects from dof space to eigen space.

Definition at line 152 of file eigenGrasp.h.

Matrix that projects from eigen space to dof space.

Definition at line 154 of file eigenGrasp.h.

bool EigenGraspInterface::mRigid [mutable, private]

Shows if motion of the robot is RIGID.

In rigid motion, only configuration that are strictly inside the EG subspace are allowed. Otherwise, any configuration is allowed. This is relevant when getAmp(...) and getDOF(...) are used.

Definition at line 160 of file eigenGrasp.h.

The robot that this interface refers to. Should have the right number of joints.

Definition at line 132 of file eigenGrasp.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


graspit
Author(s):
autogenerated on Wed Jan 25 11:00:20 2012