Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

PostureEngine Class Reference

A class for storing a set of positions and weights for all the outputs. More...

#include <PostureEngine.h>

Inheritance diagram for PostureEngine:

Detailed Description

A class for storing a set of positions and weights for all the outputs.

File Format: ([..] indicates an optional parameter)

  • First line: '#POS'
  • Followed by a series of:
    • 'specialize [regex]' - only robots whose model name matches the regular expression will attempt to parse lines between this and the next 'specialize' command. An empty (absent) regex matches all robots (equivalent to 'specialize .*')
    • 'condensed model' - specifies model name for which condensed specifications will be interpreted
    • 'verbose' - switches the load/save format back to "verbose" style, where each output/sensor value is listed individually
    • '<section> ... </section>' - specifies a section for following "verbose" style lines (valid section values listed below)
    • 'section value1 value2 value3 ...' - specify all values for a section in one line, "condensed" style (valid section values listed below). Must have a value for every item in the section (no extra or missing values)
    • 'output-name value [weight]' - specifies an output value, with optional weighting value (if no weight specified, '1' is assumed)
  • Last line: '#END'

Note that '=' can be used to separate tokens as well as any whitespace character. All angle values should be specified in radians.

Valid section names are:

  • meta-info - only recognizes two fields: timestamp and framenumber
  • outputs - supports all output names (e.g. ERS7Info::outputNames)
  • buttons - supports all button names (e.g. ERS7Info::buttonNames)
  • sensors - supports all sensor names (e.g. ERS7Info::sensorNames)
  • pidduties - supports output names corresponding to PID joints (this is the "duty cycle" for the joint)

Additionally 'weights' can be used as a condensed section name (but not a verbose tag-style section, since weights are specified on each line). The 'weights' specification must follow the 'outputs' specification to be effective.

Data following '#' is ignored as comments. Be aware if you load the file and then save it again, these comments will be lost.

Example 1: Specifies only neck joints, looks forward and up a little

#POS 
NECK:tilt	0
NECK:pan	0
NECK:nod	0.2
#END

All other, unspecified, joints will be set to weight=0.

Example 2: Logged sensor data from an ERS-7 robot

#POS
condensed ERS-7
meta-info = 1439041 178803
outputs = -0.131722 0.148077 1.74592 -0.30276 0.341717 2.13361 -1.03935 0.091124 2.18958 -0.804097 0.034171 1.67458 -0.016362 -0.089143 0.125563 0.407243 -0.054399 -0.064704 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
buttons = 0 0 0 0 0 0 0 0 0 1
sensors = 500 860.139 425 -2.06456 -0.516139 -8.94642 0.99 30.63 2200 8.265 0
pidduties = -0.164062 0.0878906 0.0957031 0.246094 -0.0195312 -0.0546875 -0.164062 -0.0195312 0.164062 0.0273438 0 -0.0683594 -0.00585938 -0.00390625 0.0820312 -0.0390625 0.015625 0.00390625
#END

Condensed posture files can still be loaded on other models. For each entry, RobotInfo::Capabilities will be used to map from the model specified by the condensed command to the current host.

See also:
PostureMC
Tekkotsu's Kinematics page
David Touretzky's "Postures and Motion Sequences" Chapter
David Touretzky's "Forward Kinematics" Chapter
CMU's Cognitive Robotics posture slides
CMU's Cognitive Robotics kinematics slides

Definition at line 80 of file PostureEngine.h.

List of all members.

Classes

struct  SensorInfo
 used for storing sensor data loaded from file More...

Public Member Functions

Constructors

 PostureEngine ()
 constructor
 PostureEngine (const std::string &filename)
 constructor, loads a position from a file
 PostureEngine (const WorldState *st)
 constructor, initializes joint positions to the current state of the outputs as defined by state
 PostureEngine (const PostureEngine &pe)
 copy constructor
PostureEngineoperator= (const PostureEngine &pe)
 assignment operator
virtual ~PostureEngine ()
 destructor
Output Value Access/Control

You should be able to call the non-virtual functions without checking out, just a MotionManager::peekMotion(). Theoretically.

virtual void takeSnapshot ()
 sets the values of cmds to the current state of the outputs (doesn't change the weights)
virtual void takeSnapshot (const WorldState &st)
 sets the values of cmds to the current state of the outputs as defined by state (doesn't change the weights)
virtual void setWeights (float w)
 set the weights of all cmds
virtual void setWeights (float w, unsigned int lowjoint, unsigned int highjoint)
 the the weights of a range of cmds
virtual void clear ()
 sets all joints to unused
PostureEnginesetOutputCmd (unsigned int i, const OutputCmd &c)
 sets output i to OutputCmd c, returns *this so you can chain them; also remember that OutputCmd support implicit conversion from floats (so you can just pass a float)
OutputCmdoperator() (unsigned int i)
 returns output i, returns a reference so you can also set through an assignment to this call, e.g. pose(MouthOffset)=.1; (remember that OutputCmd support implicit conversion from floats)
const OutputCmdoperator() (unsigned int i) const
 returns output i
OutputCmdgetOutputCmd (unsigned int i)
 returns output i, returns a reference so you can also set through an assignment
const OutputCmdgetOutputCmd (unsigned int i) const
 returns output i
LoadSave

Uses LoadSave interface so you can load/save to files, uses a human-readable storage format

virtual void setSaveFormat (bool condensed, WorldState *ws)
 sets saveFormatCondensed and loadSaveSensors (pass state for ws if you want to use current sensor values)
virtual unsigned int getBinSize () const
 sets saveFormatCondensed and loadSaveSensors (pass state for ws if you want to use current sensor values)
virtual unsigned int loadBuffer (const char buf[], unsigned int len, const char *filename=NULL)
 sets saveFormatCondensed and loadSaveSensors (pass state for ws if you want to use current sensor values)
virtual unsigned int saveBuffer (char buf[], unsigned int len) const
 sets saveFormatCondensed and loadSaveSensors (pass state for ws if you want to use current sensor values)
virtual unsigned int loadFile (const char filename[])
 sets saveFormatCondensed and loadSaveSensors (pass state for ws if you want to use current sensor values)
virtual unsigned int saveFile (const char filename[]) const
 sets saveFormatCondensed and loadSaveSensors (pass state for ws if you want to use current sensor values)
virtual void setLoadedSensors (SensorInfo *si)
 if ws is non-NULL, any sensor values in loaded postures will be stored there (otherwise they are ignored)
virtual SensorInfogetLoadedSensors () const
 returns value previously stored by setLoadSensors()
Kinematics

virtual bool solveLinkPosition (const fmat::SubVector< 3, const float > &Ptgt, unsigned int link, const fmat::SubVector< 3, const float > &Peff)
 Performs inverse kinematics to solve for positioning Peff on link j as close as possible to Ptgt (base coordinates in homogenous form); if solution found, stores result in this posture and returns true.
virtual bool solveLinkPosition (float Ptgt_x, float Ptgt_y, float Ptgt_z, unsigned int link, float Peff_x, float Peff_y, float Peff_z)
 Performs inverse kinematics to solve for positioning Peff on link j as close as possible to Ptgt (base coordinates); if solution found, stores result in this posture and returns true.
virtual bool solveLinkVector (const fmat::SubVector< 3, const float > &Ptgt, unsigned int link, const fmat::SubVector< 3, const float > &Peff)
 Performs inverse kinematics to solve for aligning the vector through Peff on link j and the link's origin to point at Ptgt (base coordinates in homogenous form); if solution found, stores result in this posture and returns true.
virtual bool solveLinkVector (float Ptgt_x, float Ptgt_y, float Ptgt_z, unsigned int link, float Peff_x, float Peff_y, float Peff_z)
 Performs inverse kinematics to solve for aligning the vector through Peff on link j and the link's origin to point at Ptgt (base coordinates); if solution found, stores result in this posture and returns true.
virtual bool solveLinkOrientation (const fmat::Quaternion &oriTgt, unsigned int link, const fmat::Quaternion &oriOffset)
 Performs inverse kinematics to solve for positioning Peff on link j as close as possible to Ptgt (base coordinates in homogenous form); if solution found, stores result in this posture and returns true.
virtual bool solveLink (const fmat::SubVector< 3, const float > &posTgt, const fmat::Quaternion &oriTgt, unsigned int link, const fmat::SubVector< 3, const float > &posOffset, const fmat::Quaternion &oriOffset)
 Performs inverse kinematics to solve for both a position and orientation, bringing posOffset on link to posTgt, in the orientation specified.
Combining Postures

virtual PostureEnginesetOverlay (const PostureEngine &pe)
 sets joints of this to all joints of pe which are not equal to unused (layers pe over this) stores into this
virtual PostureEngine createOverlay (const PostureEngine &pe) const
 sets joints of this to all joints of pe which are not equal to unused (layers pe over this) returns new PostureEngine
virtual PostureEnginesetUnderlay (const PostureEngine &pe)
 sets joints of this which are equal to unused to pe, (layers this over pe) stores into this
virtual PostureEngine createUnderlay (const PostureEngine &pe) const
 sets joints of this which are equal to unused to pe, (layers this over pe) returns new PostureEngine
virtual PostureEnginesetAverage (const PostureEngine &pe, float w=0.5)
 computes a weighted average of this vs. pe, w being the weight towards pe (so w==1 just copies pe)
virtual PostureEngine createAverage (const PostureEngine &pe, float w=0.5) const
 computes a weighted average of this vs. pe, w being the weight towards pe (so w==1 just copies pe)
virtual PostureEnginesetCombine (const PostureEngine &pe)
 computes a weighted average of this vs. pe, using the weight values of the joints, storing the total weight in the result's weight value
virtual PostureEngine createCombine (const PostureEngine &pe) const
 computes a weighted average of this vs. pe, using the weight values of the joints, storing the total weight in the result's weight value
virtual float diff (const PostureEngine &pe) const
 returns the sum squared error between this and pe's output values, but only between outputs which are both not unused
virtual float avgdiff (const PostureEngine &pe) const
 returns the average sum squared error between this and pe's output values for outputs which are both not unused
virtual float maxdiff (const PostureEngine &pe) const
 returns the max error between this and pe's output values for outputs which are both not unused

Protected Types

enum  section_t {
  SECTION_METAINFO, SECTION_OUTPUTS, SECTION_BUTTONS, SECTION_SENSORS,
  SECTION_PIDDUTIES
}
 

enumeration of the different section types that may be used as section tags in verbose mode

More...

Protected Member Functions

virtual bool loadLine (unsigned int linenum, const char *filename, const std::map< std::string, section_t > &sectionMap, std::vector< std::string > &words, section_t &curSection, const Capabilities *&caps, bool &filtered)
 helper function for loadBuffer, called for each individual line
void stripTildes (std::string &str)
 helper function for loadLine, strips trailing '~'s from output names to provide backward compatability (note pass by reference, operates 'in-place' on word)
virtual void update () const
 overriding Kinematics::update, make all updates come from this posture engine's own state, not WorldState

Protected Attributes

OutputCmd cmds [NumOutputs]
 the table of outputs' values and weights, can be accessed through setOutputCmd() and getOutputCmd()
bool saveFormatCondensed
 requests a condensed file format, smaller but less readable
WorldStatesaveSensors
 If non-null, saves will include sensor readings from here.
SensorInfoloadSensors
 if non-null, loads will store any included sensor information here

Member Enumeration Documentation

enum PostureEngine::section_t [protected]

enumeration of the different section types that may be used as section tags in verbose mode

Enumerator:
SECTION_METAINFO 

includes timestamp and framenumber

SECTION_OUTPUTS 

entries corresponding to NumOutputs

SECTION_BUTTONS 

entries corresponding to NumButtons

SECTION_SENSORS 

entries corresponding to NumSensors

SECTION_PIDDUTIES 

entries corresponding to NumPIDJoints

Definition at line 286 of file PostureEngine.h.


Constructor & Destructor Documentation

PostureEngine::PostureEngine (  ) 

constructor

Definition at line 86 of file PostureEngine.h.

PostureEngine::PostureEngine ( const std::string &  filename  ) 

constructor, loads a position from a file

Todo:
might want to make a library stored in memory of common positions so they don't have to be loaded repeatedly from memstick

Definition at line 89 of file PostureEngine.h.

PostureEngine::PostureEngine ( const WorldState st  ) 

constructor, initializes joint positions to the current state of the outputs as defined by state

Definition at line 91 of file PostureEngine.h.

PostureEngine::PostureEngine ( const PostureEngine pe  ) 

copy constructor

Definition at line 94 of file PostureEngine.h.

PostureEngine::~PostureEngine (  )  [virtual]

destructor

Definition at line 14 of file PostureEngine.cc.


Member Function Documentation

float PostureEngine::avgdiff ( const PostureEngine pe  )  const [virtual]

returns the average sum squared error between this and pe's output values for outputs which are both not unused

Todo:
create a version which does weighted summing? This treats weights as all or nothing

Definition at line 113 of file PostureEngine.cc.

void PostureEngine::clear (  )  [virtual]

sets all joints to unused

Reimplemented in PostureMC.

Definition at line 30 of file PostureEngine.cc.

Referenced by loadBuffer().

PostureEngine PostureEngine::createAverage ( const PostureEngine pe,
float  w = 0.5 
) const [virtual]

computes a weighted average of this vs. pe, w being the weight towards pe (so w==1 just copies pe)

joints being averaged with weight<=0 have their weights averaged, but not their values (so an output can crossfade properly)

Parameters:
pe the other PostureEngine
w amount to weight towards pe

  • if w < .001, nothing is done
  • if w > .999, a straight copy of pe occurs (sets joints to unused properly at end of fade)
  • .001 and .999 is used instead of 0 and 1 to allow for slight addition errors in a loop (if using repeated additions of a delta value instead of repeated divisions)
Returns:
a new posture containing the results

Definition at line 87 of file PostureEngine.cc.

PostureEngine PostureEngine::createCombine ( const PostureEngine pe  )  const [virtual]

computes a weighted average of this vs. pe, using the weight values of the joints, storing the total weight in the result's weight value

Definition at line 98 of file PostureEngine.cc.

PostureEngine PostureEngine::createOverlay ( const PostureEngine pe  )  const [virtual]

sets joints of this to all joints of pe which are not equal to unused (layers pe over this) returns new PostureEngine

Definition at line 41 of file PostureEngine.cc.

PostureEngine PostureEngine::createUnderlay ( const PostureEngine pe  )  const [virtual]

sets joints of this which are equal to unused to pe, (layers this over pe) returns new PostureEngine

Definition at line 51 of file PostureEngine.cc.

float PostureEngine::diff ( const PostureEngine pe  )  const [virtual]

returns the sum squared error between this and pe's output values, but only between outputs which are both not unused

Todo:
create a version which does weighted summing? This treats weights as all or nothing

Definition at line 103 of file PostureEngine.cc.

unsigned int PostureEngine::getBinSize (  )  const [virtual]

sets saveFormatCondensed and loadSaveSensors (pass state for ws if you want to use current sensor values)

Implements LoadSave.

Definition at line 141 of file PostureEngine.cc.

Referenced by CameraStreamBehavior::sendSensors().

virtual SensorInfo* PostureEngine::getLoadedSensors (  )  const [virtual]

returns value previously stored by setLoadSensors()

Definition at line 153 of file PostureEngine.h.

const OutputCmd& PostureEngine::getOutputCmd ( unsigned int  i  )  const

returns output i

Definition at line 129 of file PostureEngine.h.

OutputCmd& PostureEngine::getOutputCmd ( unsigned int  i  ) 
unsigned int PostureEngine::loadBuffer ( const char  buf[],
unsigned int  len,
const char *  filename = NULL 
) [virtual]

sets saveFormatCondensed and loadSaveSensors (pass state for ws if you want to use current sensor values)

Implements LoadSave.

Reimplemented in PostureMC.

Definition at line 214 of file PostureEngine.cc.

Referenced by MotionSequenceEngine::loadBuffer().

unsigned int PostureEngine::loadFile ( const char  filename[]  )  [virtual]

sets saveFormatCondensed and loadSaveSensors (pass state for ws if you want to use current sensor values)

Definition at line 721 of file PostureEngine.cc.

Referenced by MotionSequenceEngine::loadBuffer(), PostureNode::loadFile(), PostureEngine(), PostureMC::PostureMC(), PostureNode::PostureNode(), and PostureEditor::refresh().

bool PostureEngine::loadLine ( unsigned int  linenum,
const char *  filename,
const std::map< std::string, section_t > &  sectionMap,
std::vector< std::string > &  words,
section_t curSection,
const Capabilities *&  caps,
bool &  filtered 
) [protected, virtual]

helper function for loadBuffer, called for each individual line

Definition at line 303 of file PostureEngine.cc.

Referenced by loadBuffer().

float PostureEngine::maxdiff ( const PostureEngine pe  )  const [virtual]

returns the max error between this and pe's output values for outputs which are both not unused

Todo:
create a version which does weighted summing? This treats weights as all or nothing

Definition at line 125 of file PostureEngine.cc.

const OutputCmd& PostureEngine::operator() ( unsigned int  i  )  const

returns output i

Definition at line 127 of file PostureEngine.h.

OutputCmd& PostureEngine::operator() ( unsigned int  i  ) 

returns output i, returns a reference so you can also set through an assignment to this call, e.g. pose(MouthOffset)=.1; (remember that OutputCmd support implicit conversion from floats)

Definition at line 126 of file PostureEngine.h.

PostureEngine& PostureEngine::operator= ( const PostureEngine pe  ) 

assignment operator

Definition at line 102 of file PostureEngine.h.

unsigned int PostureEngine::saveBuffer ( char  buf[],
unsigned int  len 
) const [virtual]

sets saveFormatCondensed and loadSaveSensors (pass state for ws if you want to use current sensor values)

Implements LoadSave.

Definition at line 620 of file PostureEngine.cc.

Referenced by CameraStreamBehavior::sendSensors().

unsigned int PostureEngine::saveFile ( const char  filename[]  )  const [virtual]

sets saveFormatCondensed and loadSaveSensors (pass state for ws if you want to use current sensor values)

Definition at line 724 of file PostureEngine.cc.

Referenced by Kinematics::calculateGroundPlane(), PostureEditor::refresh(), and SavePostureControl::takeInput().

PostureEngine & PostureEngine::setAverage ( const PostureEngine pe,
float  w = 0.5 
) [virtual]

computes a weighted average of this vs. pe, w being the weight towards pe (so w==1 just copies pe)

joints being averaged with unused joints have their weights averaged, but not their values (so an output can crossfade properly)

Parameters:
pe the other PostureEngine
w amount to weight towards pe

  • if w < .001, nothing is done
  • if w > .999, a straight copy of pe occurs (sets joints to unused properly at end of fade)
  • .001 and .999 is used instead of 0 and 1 to allow for slight addition errors in a loop (if using repeated additions of a delta value instead of repeated divisions)
Returns:
*this, stores results into this

Reimplemented in PostureMC.

Definition at line 63 of file PostureEngine.cc.

Referenced by createAverage().

PostureEngine & PostureEngine::setCombine ( const PostureEngine pe  )  [virtual]

computes a weighted average of this vs. pe, using the weight values of the joints, storing the total weight in the result's weight value

Reimplemented in PostureMC.

Definition at line 91 of file PostureEngine.cc.

Referenced by createCombine().

virtual void PostureEngine::setLoadedSensors ( SensorInfo si  )  [virtual]

if ws is non-NULL, any sensor values in loaded postures will be stored there (otherwise they are ignored)

Definition at line 152 of file PostureEngine.h.

PostureEngine& PostureEngine::setOutputCmd ( unsigned int  i,
const OutputCmd c 
)

sets output i to OutputCmd c, returns *this so you can chain them; also remember that OutputCmd support implicit conversion from floats (so you can just pass a float)

Reimplemented in PostureMC.

Definition at line 125 of file PostureEngine.h.

Referenced by PostureEditor::activate(), Grasper::PlanBodyApproach::doStart(), MotionSequenceEngine::getPose(), ArmMC::setFingerGap(), solveLink(), solveLinkOrientation(), and solveLinkPosition().

PostureEngine & PostureEngine::setOverlay ( const PostureEngine pe  )  [virtual]

sets joints of this to all joints of pe which are not equal to unused (layers pe over this) stores into this

Reimplemented in PostureMC.

Definition at line 35 of file PostureEngine.cc.

Referenced by createOverlay().

void PostureEngine::setSaveFormat ( bool  condensed,
WorldState ws 
) [virtual]

sets saveFormatCondensed and loadSaveSensors (pass state for ws if you want to use current sensor values)

Definition at line 136 of file PostureEngine.cc.

Referenced by Kinematics::calculateGroundPlane(), CameraStreamBehavior::sendSensors(), and LogNode::writeSensor().

PostureEngine & PostureEngine::setUnderlay ( const PostureEngine pe  )  [virtual]

sets joints of this which are equal to unused to pe, (layers this over pe) stores into this

Reimplemented in PostureMC.

Definition at line 45 of file PostureEngine.cc.

Referenced by createUnderlay().

void PostureEngine::setWeights ( float  w,
unsigned int  lowjoint,
unsigned int  highjoint 
) [virtual]

the the weights of a range of cmds

Reimplemented in PostureMC.

Definition at line 25 of file PostureEngine.cc.

virtual void PostureEngine::setWeights ( float  w  )  [virtual]
bool PostureEngine::solveLink ( const fmat::SubVector< 3, const float > &  posTgt,
const fmat::Quaternion oriTgt,
unsigned int  link,
const fmat::SubVector< 3, const float > &  posOffset,
const fmat::Quaternion oriOffset 
) [virtual]

Performs inverse kinematics to solve for both a position and orientation, bringing posOffset on link to posTgt, in the orientation specified.

Parameters:
posTgt the target point, in base coordinates
oriTgt the target orientation, as a quaternion relative to base frame
link the output offset of the joint to move
posOffset the point (relative to link) which you desire to have moved to posTgt (it's the desired "effector")
oriOffset an orientation offset (relative to link) which you desire to have moved to oriTgt

The quaternion functions of fmat are helpful for creating axis-aligned rotations: fmat::quatX(r), fmat::quatY(r), fmat::quatZ(r), and fmat::QUAT_IDENTITY

Definition at line 778 of file PostureEngine.cc.

bool PostureEngine::solveLinkOrientation ( const fmat::Quaternion oriTgt,
unsigned int  link,
const fmat::Quaternion oriOffset 
) [virtual]

Performs inverse kinematics to solve for positioning Peff on link j as close as possible to Ptgt (base coordinates in homogenous form); if solution found, stores result in this posture and returns true.

Parameters:
oriTgt the target orientation, as a quaternion relative to base frame
link the output offset of the joint to move
oriOffset an orientation offset (relative to link) which you desire to have moved to oriTgt

The quaternion functions of fmat are helpful for creating axis-aligned rotations: fmat::quatX(r), fmat::quatY(r), fmat::quatZ(r), and fmat::QUAT_IDENTITY

Definition at line 762 of file PostureEngine.cc.

virtual bool PostureEngine::solveLinkPosition ( float  Ptgt_x,
float  Ptgt_y,
float  Ptgt_z,
unsigned int  link,
float  Peff_x,
float  Peff_y,
float  Peff_z 
) [virtual]

Performs inverse kinematics to solve for positioning Peff on link j as close as possible to Ptgt (base coordinates); if solution found, stores result in this posture and returns true.

Parameters:
Ptgt_x the target x position (relative to base frame)
Ptgt_y the target y position (relative to base frame)
Ptgt_z the target z position (relative to base frame)
link the output offset of the joint to move
Peff_x the x position (relative to link) which you desire to have moved to Ptgt (it's a point on the effector)
Peff_y the y position (relative to link) which you desire to have moved to Ptgt (it's a point on the effector)
Peff_z the z position (relative to link) which you desire to have moved to Ptgt (it's a point on the effector)

The difference between solveLinkPosition() and solveLinkVector() is typically small, but critical when you're trying to look at something -- the solution obtained by simplying trying to solve for the position may not align the vector with the target -- solveLinkVector() tries to ensure the vector is aligned with the target, even if that isn't the closest solution position-wise.

Reimplemented in PostureMC.

Definition at line 188 of file PostureEngine.h.

Referenced by solveLinkPosition().

bool PostureEngine::solveLinkPosition ( const fmat::SubVector< 3, const float > &  Ptgt,
unsigned int  link,
const fmat::SubVector< 3, const float > &  Peff 
) [virtual]

Performs inverse kinematics to solve for positioning Peff on link j as close as possible to Ptgt (base coordinates in homogenous form); if solution found, stores result in this posture and returns true.

Parameters:
Ptgt the target point, in base coordinates
link the output offset of the joint to move
Peff the point (relative to link) which you desire to have moved to Ptgt (it's a point on the effector, e.g. (0,0,0) if you want to move the effector's origin to the target)

The difference between solveLinkPosition() and solveLinkVector() is typically small, but critical when you're trying to look at something -- the solution obtained by simplying trying to solve for the position may not align the vector with the target -- solveLinkVector() tries to ensure the vector is aligned with the target, even if that isn't the closest solution position-wise.

Reimplemented in PostureMC.

Definition at line 729 of file PostureEngine.cc.

Referenced by Grasper::PlanArmDeliver::doStart(), Grasper::ArmRaise::doStart(), Grasper::ArmNudge::doStart(), Grasper::PlanArmApproach::doStart(), and solveLinkVector().

virtual bool PostureEngine::solveLinkVector ( float  Ptgt_x,
float  Ptgt_y,
float  Ptgt_z,
unsigned int  link,
float  Peff_x,
float  Peff_y,
float  Peff_z 
) [virtual]

Performs inverse kinematics to solve for aligning the vector through Peff on link j and the link's origin to point at Ptgt (base coordinates); if solution found, stores result in this posture and returns true.

Parameters:
Ptgt_x the target x position (relative to base frame)
Ptgt_y the target y position (relative to base frame)
Ptgt_z the target z position (relative to base frame)
link the output offset of the joint to move
Peff_x the x position (relative to link) which you desire to have moved to Ptgt (it's the desired "effector")
Peff_y the y position (relative to link) which you desire to have moved to Ptgt (it's the desired "effector")
Peff_z the z position (relative to link) which you desire to have moved to Ptgt (it's the desired "effector")
Todo:
this method is an approximation, could be more precise, and perhaps faster, although this is pretty good.

The difference between solveLinkPosition() and solveLinkVector() is typically small, but critical when you're trying to look at something -- the solution obtained by simplying trying to solve for the position may not align the vector with the target -- solveLinkVector() tries to ensure the vector is aligned with the target, even if that isn't the closest solution position-wise.

Reimplemented in PostureMC.

Definition at line 221 of file PostureEngine.h.

Referenced by solveLinkVector().

bool PostureEngine::solveLinkVector ( const fmat::SubVector< 3, const float > &  Ptgt,
unsigned int  link,
const fmat::SubVector< 3, const float > &  Peff 
) [virtual]

Performs inverse kinematics to solve for aligning the vector through Peff on link j and the link's origin to point at Ptgt (base coordinates in homogenous form); if solution found, stores result in this posture and returns true.

Parameters:
Ptgt the target point, in base coordinates
link the output offset of the joint to move
Peff the point (relative to link) which you desire to have moved to Ptgt (it's the desired "effector")

The difference between solveLinkPosition() and solveLinkVector() is typically small, but critical when you're trying to look at something -- the solution obtained by simplying trying to solve for the position may not align the vector with the target -- solveLinkVector() tries to ensure the vector is aligned with the target, even if that isn't the closest solution position-wise.

Reimplemented in PostureMC.

Definition at line 745 of file PostureEngine.cc.

void PostureEngine::stripTildes ( std::string &  str  )  [protected]

helper function for loadLine, strips trailing '~'s from output names to provide backward compatability (note pass by reference, operates 'in-place' on word)

(originally, all output names were uniform length and used '~'s as padding... ugh.)

Definition at line 297 of file PostureEngine.h.

Referenced by loadLine().

void PostureEngine::takeSnapshot ( const WorldState st  )  [virtual]

sets the values of cmds to the current state of the outputs as defined by state (doesn't change the weights)

Reimplemented in PostureMC.

Definition at line 20 of file PostureEngine.cc.

void PostureEngine::takeSnapshot (  )  [virtual]

sets the values of cmds to the current state of the outputs (doesn't change the weights)

Reimplemented in PostureMC.

Definition at line 16 of file PostureEngine.cc.

Referenced by PostureEditor::activate(), Kinematics::calculateGroundPlane(), PostureEngine(), PostureEditor::processEvent(), CameraStreamBehavior::sendSensors(), and SavePostureControl::takeInput().

void PostureEngine::update (  )  const [protected, virtual]

overriding Kinematics::update, make all updates come from this posture engine's own state, not WorldState

Reimplemented from Kinematics.

Definition at line 795 of file PostureEngine.cc.

Referenced by solveLink(), solveLinkOrientation(), and solveLinkPosition().


Member Data Documentation

if non-null, loads will store any included sensor information here

Definition at line 309 of file PostureEngine.h.

Referenced by getLoadedSensors(), loadLine(), and setLoadedSensors().

requests a condensed file format, smaller but less readable

Definition at line 307 of file PostureEngine.h.

Referenced by getBinSize(), loadBuffer(), loadLine(), operator=(), saveBuffer(), and setSaveFormat().

If non-null, saves will include sensor readings from here.

Definition at line 308 of file PostureEngine.h.

Referenced by getBinSize(), operator=(), saveBuffer(), and setSaveFormat().


The documentation for this class was generated from the following files:

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:14 2016 by Doxygen 1.6.3