PostureMC Class Reference#include <PostureMC.h>
Inheritance diagram for PostureMC:
[legend]List of all members.
Detailed Description
a MotionCommand shell for PostureEngine
Will autoprune by default once it reaches the target pose.
If you want to keep it alive so your behavior can use the posture to move around, either call setAutoPrune(false ), or pass false to the MotionManager::addMotion() function.
Definition at line 16 of file PostureMC.h.
|
Public Member Functions |
| PostureMC () |
| constructor
|
| PostureMC (const char *filename) |
| constructor, loads from filename
|
virtual | ~PostureMC () |
| destructor
|
|
PostureMC & | setDirty (bool d=true) |
| call this if you call PostureEngine::setOutputCmd(), that doesn't know about dirty flags
|
bool | isDirty () const |
| if you want to check the dirty flag
|
virtual PostureMC & | setTolerance (float t) |
| sets tolerance, returns *this
|
virtual float | getTolerance () |
| returns tolerance
|
|
virtual int | updateOutputs () |
| is called once per update cycle, can do any processing you need to change your priorities or set output commands on the MotionManager
|
virtual int | isDirty () |
| not used by MotionManager at the moment, but could be used to reduce recomputation, and you may find it useful
|
virtual int | isAlive () |
| returns non-zero (true) if PostureEngine::maxdiff() between this and the current position is over tolerance
|
|
Had to override stuff to manage a dirty flag
|
virtual void | takeSnapshot () |
| sets the internal cmds to the current state of the outputs
|
virtual void | clear () |
| sets all joints to unused
|
virtual PostureEngine & | setOverlay (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 & | setUnderlay (const PostureEngine &pe) |
| sets joints of this which are equal to unused to pe, (layers this over pe) stores into this
|
virtual PostureEngine & | setAverage (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 & | setCombine (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
|
PostureEngine & | setOutputCmd (unsigned int i, const OutputCmd &c) |
| sets output i to OutputCmd c, returns *this so you can chain them
|
virtual unsigned int | LoadBuffer (const char buf[], unsigned int len) |
| Load from a saved buffer.
|
Protected Attributes |
bool | dirty |
| true if changes have been made since last updateOutputs()
|
float | tolerance |
| when autopruning, if the maxdiff() of this posture and the robot's current position is below this value, isAlive() will be false, defaults to 0.01 (5.7 degree error)
|
Constructor & Destructor Documentation
PostureMC::PostureMC |
( |
|
) |
[inline] |
|
PostureMC::PostureMC |
( |
const char * |
filename |
) |
[inline] |
|
|
constructor, loads from filename
Definition at line 21 of file PostureMC.h. |
virtual PostureMC::~PostureMC |
( |
|
) |
[inline, virtual] |
|
Member Function Documentation
virtual void PostureMC::clear |
( |
|
) |
[inline, virtual] |
|
virtual float PostureMC::getTolerance |
( |
|
) |
[inline, virtual] |
|
virtual int PostureMC::isAlive |
( |
|
) |
[inline, virtual] |
|
|
returns non-zero (true) if PostureEngine::maxdiff() between this and the current position is over tolerance
This is handy so you can set to have the robot go to a position and then automatically remove the MotionCommand when it gets there - but beware fighting Postures which average out and neither succeeds
Implements MotionCommand.
Definition at line 52 of file PostureMC.h. |
virtual int PostureMC::isDirty |
( |
|
) |
[inline, virtual] |
|
|
not used by MotionManager at the moment, but could be used to reduce recomputation, and you may find it useful
- Returns:
- zero if none of the commands have changed since last getJointCmd(), else non-zero
Implements MotionCommand.
Definition at line 46 of file PostureMC.h. |
bool PostureMC::isDirty |
( |
|
) |
const [inline] |
|
|
if you want to check the dirty flag
Definition at line 33 of file PostureMC.h. |
virtual unsigned int PostureMC::LoadBuffer |
( |
const char |
buf[], |
|
|
unsigned int |
len |
|
) |
[inline, virtual] |
|
|
Load from a saved buffer.
- Parameters:
-
buf | pointer to the memory where you should begin loading |
len | length of buf available (this isn't all yours, might be more stuff saved after yours) |
- Returns:
- the number of bytes actually used
Reimplemented from PostureEngine.
Definition at line 70 of file PostureMC.h. |
|
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 from PostureEngine.
Definition at line 67 of file PostureMC.h. |
|
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 from PostureEngine.
Definition at line 68 of file PostureMC.h. |
PostureMC& PostureMC::setDirty |
( |
bool |
d = true |
) |
[inline] |
|
|
sets joints of this to all joints of pe which are not equal to unused (layers pe over this) stores into this
Reimplemented from PostureEngine.
Definition at line 65 of file PostureMC.h. |
virtual PostureMC& PostureMC::setTolerance |
( |
float |
t |
) |
[inline, virtual] |
|
|
sets joints of this which are equal to unused to pe, (layers this over pe) stores into this
Reimplemented from PostureEngine.
Definition at line 66 of file PostureMC.h. |
virtual void PostureMC::takeSnapshot |
( |
|
) |
[inline, virtual] |
|
virtual int PostureMC::updateOutputs |
( |
|
) |
[inline, virtual] |
|
Member Data Documentation
|
true if changes have been made since last updateOutputs()
Definition at line 74 of file PostureMC.h.
Referenced by clear(), isAlive(), isDirty(), LoadBuffer(), PostureMC(), setAverage(), setCombine(), setDirty(), setOutputCmd(), setOverlay(), setUnderlay(), takeSnapshot(), and updateOutputs(). |
The documentation for this class was generated from the following file:
|