Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

OldHeadPointerMC Class Reference

#include <OldHeadPointerMC.h>

Inheritance diagram for OldHeadPointerMC:

Inheritance graph
[legend]
List of all members.

Detailed Description

This class gives some quick and easy functions to point the head at things.

Definition at line 10 of file OldHeadPointerMC.h.

Public Types

 BodyRelative
 holds neck at a specified position, like a PostureEngine, but neck specific
 GravityRelative
 uses accelerometers to keep a level head, doesn't apply for pan joint, but in future could use localization for pan
enum  CoordFrame_t { BodyRelative, GravityRelative }
 Various modes the head can be in. In the future may want to add ability to explicitly track an object or point in the world model. More...

Public Member Functions

 OldHeadPointerMC ()
 constructor, defaults to active, BodyRelative, all joints at 0
virtual ~OldHeadPointerMC ()
 destructor
void setWeight (double w)
 sets the weight values for all the neck joints
void setWeight (RobotInfo::TPROffset_t i, double weight)
 set a specific head joint weight, pass one of RobotInfo::TPROffset_t, not a full offset!
void setActive (bool a)
 sets active flag; see isDirty()
bool getActive () const
 returns active flag, see isDirty()
void noMaxSpeed ()
 sets maxSpeed to 0 (no maximum)
void defaultMaxSpeed ()
 restores maxSpeed to default settings from Config::Motion_Config
void setMaxSpeed (TPROffset_t i, float x)
 sets maxSpeed in rad/sec
float getMaxSpeed (TPROffset_t i)
 returns maxSpeed in rad/sec
double convert (RobotInfo::TPROffset_t i, double v, CoordFrame_t srcmode, CoordFrame_t tgtmode) const
 converts a value v in srcmode to a value in tgtmode that would leave the joint angle for joint i constant (you probably won't need to call this directly)
Joint Accessors
Note that none of these are virtual, so you don't have to checkout to use them, you should be able to use MotionManager::peekMotion()

void setJoints (double tilt, double pan, double roll)
 Directly sets the neck values (radians), uses current mode.
void setMode (CoordFrame_t m, bool convert=true)
 sets all the joints to the given mode, will convert the values to the new mode if convert is true
void setJointMode (RobotInfo::TPROffset_t i, CoordFrame_t m, bool convert=true)
 sets a specific head joint's mode; will convert from previous mode's value to next mode's value if convert is true. Pass one of RobotInfo::TPROffset_t, not a full offset!
void setJointValue (RobotInfo::TPROffset_t i, double value)
 set a specific head joint's value (in radians, for whatever mode it's in), pass one of RobotInfo::TPROffset_t, not a full offset!
void setJointValueAndMode (RobotInfo::TPROffset_t i, double value, CoordFrame_t m)
 set a specific head joint (in radians), pass one of RobotInfo::TPROffset_t, not a full offset!
void setJointValueFromMode (RobotInfo::TPROffset_t i, double value, CoordFrame_t m)
 set a specific head joint (in radians) auto converting value from mode m to the current mode, pass one of RobotInfo::TPROffset_t, not a full offset!
CoordFrame_t getJointMode (RobotInfo::TPROffset_t i) const
 returns the current mode for joint i (use RobotInfo::TPROffset_t, not global offset)
double getJointValue (RobotInfo::TPROffset_t i) const
 returns the target value (relative to the current mode) of joint i. Use getOutputCmd() if you want to know the current commanded joint value; To get the current joint position, look in WorldState
Inherited:
virtual int updateOutputs ()
 Updates where the head is looking.
virtual const OutputCmdgetOutputCmd (unsigned int i)
 returns one of the headCmds entries or unusedJoint if not a head joint
virtual int isDirty ()
 true if a change has been made since the last updateJointCmds() and we're active
virtual int isAlive ()
 Updates where the head is looking.
virtual void DoStart ()
 Updates where the head is looking.

Protected Member Functions

double convToBodyRelative (TPROffset_t i, double v, CoordFrame_t mode) const
 converts to a body relative measurement for joint i
double convFromBodyRelative (TPROffset_t i, double v, CoordFrame_t mode) const
 converts from a body relative measurement for joint i

Static Protected Member Functions

static float normalizeAngle (float x)
static float clipAngularRange (unsigned int i, float x)
 if x is outside of the range of joint i, it is set to either the min or the max, whichever is closer

Protected Attributes

bool dirty
 true if a change has been made since last call to updateJointCmds()
bool active
 set by accessor functions, defaults to true
bool targetReached
 false if the head is still moving towards its target
OutputCmd headCmds [NumHeadJoints]
 stores the last values we sent from updateOutputs
float headTargets [NumHeadJoints]
 stores the target value of each joint, relative to headModes
CoordFrame_t headModes [NumHeadJoints]
 stores the current mode of each joint, for instance so tilt can be GravityRelative while pan is static
float maxSpeed [NumHeadJoints]
 initialized from Config::motion_config, but can be overridden by setMaxSpeed(); rad per frame


Member Enumeration Documentation

Various modes the head can be in. In the future may want to add ability to explicitly track an object or point in the world model.

Enumerator:
BodyRelative  holds neck at a specified position, like a PostureEngine, but neck specific
GravityRelative  uses accelerometers to keep a level head, doesn't apply for pan joint, but in future could use localization for pan

Definition at line 19 of file OldHeadPointerMC.h.


Constructor & Destructor Documentation

OldHeadPointerMC::OldHeadPointerMC (  ) 

constructor, defaults to active, BodyRelative, all joints at 0

Definition at line 8 of file OldHeadPointerMC.cc.

virtual OldHeadPointerMC::~OldHeadPointerMC (  )  [inline, virtual]

destructor

Definition at line 16 of file OldHeadPointerMC.h.


Member Function Documentation

static float OldHeadPointerMC::clipAngularRange ( unsigned int  i,
float  x 
) [inline, static, protected]

if x is outside of the range of joint i, it is set to either the min or the max, whichever is closer

Definition at line 91 of file OldHeadPointerMC.h.

Referenced by setJointValue(), and setJointValueAndMode().

double OldHeadPointerMC::convert ( RobotInfo::TPROffset_t  i,
double  v,
CoordFrame_t  srcmode,
CoordFrame_t  tgtmode 
) const [inline]

converts a value v in srcmode to a value in tgtmode that would leave the joint angle for joint i constant (you probably won't need to call this directly)

Definition at line 42 of file OldHeadPointerMC.h.

Referenced by setJointMode(), and setJointValueFromMode().

double OldHeadPointerMC::convFromBodyRelative ( TPROffset_t  i,
double  v,
CoordFrame_t  mode 
) const [protected]

converts from a body relative measurement for joint i

Todo:
this is perhaps a bit amateurish - could be more accurate

Definition at line 140 of file OldHeadPointerMC.cc.

Referenced by convert().

double OldHeadPointerMC::convToBodyRelative ( TPROffset_t  i,
double  v,
CoordFrame_t  mode 
) const [protected]

converts to a body relative measurement for joint i

Todo:
this is perhaps a bit amateurish - could be more accurate

Definition at line 106 of file OldHeadPointerMC.cc.

Referenced by convert(), and updateOutputs().

void OldHeadPointerMC::defaultMaxSpeed (  ) 

restores maxSpeed to default settings from Config::Motion_Config

Definition at line 31 of file OldHeadPointerMC.cc.

Referenced by OldHeadPointerMC().

virtual void OldHeadPointerMC::DoStart (  )  [inline, virtual]

Updates where the head is looking.

Reimplemented from MotionCommand.

Definition at line 83 of file OldHeadPointerMC.h.

bool OldHeadPointerMC::getActive (  )  const [inline]

returns active flag, see isDirty()

Definition at line 31 of file OldHeadPointerMC.h.

Referenced by getOutputCmd().

CoordFrame_t OldHeadPointerMC::getJointMode ( RobotInfo::TPROffset_t  i  )  const [inline]

returns the current mode for joint i (use RobotInfo::TPROffset_t, not global offset)

Definition at line 71 of file OldHeadPointerMC.h.

double OldHeadPointerMC::getJointValue ( RobotInfo::TPROffset_t  i  )  const [inline]

returns the target value (relative to the current mode) of joint i. Use getOutputCmd() if you want to know the current commanded joint value; To get the current joint position, look in WorldState

Definition at line 74 of file OldHeadPointerMC.h.

float OldHeadPointerMC::getMaxSpeed ( TPROffset_t  i  )  [inline]

returns maxSpeed in rad/sec

Definition at line 39 of file OldHeadPointerMC.h.

const OutputCmd & OldHeadPointerMC::getOutputCmd ( unsigned int  i  )  [virtual]

returns one of the headCmds entries or unusedJoint if not a head joint

Definition at line 97 of file OldHeadPointerMC.cc.

virtual int OldHeadPointerMC::isAlive (  )  [inline, virtual]

Updates where the head is looking.

Implements MotionCommand.

Definition at line 82 of file OldHeadPointerMC.h.

virtual int OldHeadPointerMC::isDirty (  )  [inline, virtual]

true if a change has been made since the last updateJointCmds() and we're active

Implements MotionCommand.

Definition at line 81 of file OldHeadPointerMC.h.

Referenced by updateOutputs().

void OldHeadPointerMC::noMaxSpeed (  )  [inline]

sets maxSpeed to 0 (no maximum)

Definition at line 34 of file OldHeadPointerMC.h.

static float OldHeadPointerMC::normalizeAngle ( float  x  )  [inline, static, protected]

puts x in the range (-pi,pi)

Definition at line 89 of file OldHeadPointerMC.h.

Referenced by clipAngularRange().

void OldHeadPointerMC::setActive ( bool  a  )  [inline]

sets active flag; see isDirty()

Definition at line 30 of file OldHeadPointerMC.h.

void OldHeadPointerMC::setJointMode ( RobotInfo::TPROffset_t  i,
CoordFrame_t  m,
bool  convert = true 
)

sets a specific head joint's mode; will convert from previous mode's value to next mode's value if convert is true. Pass one of RobotInfo::TPROffset_t, not a full offset!

Definition at line 42 of file OldHeadPointerMC.cc.

Referenced by setMode().

void OldHeadPointerMC::setJoints ( double  tilt,
double  pan,
double  roll 
)

Directly sets the neck values (radians), uses current mode.

Definition at line 19 of file OldHeadPointerMC.cc.

void OldHeadPointerMC::setJointValue ( RobotInfo::TPROffset_t  i,
double  value 
) [inline]

set a specific head joint's value (in radians, for whatever mode it's in), pass one of RobotInfo::TPROffset_t, not a full offset!

Definition at line 59 of file OldHeadPointerMC.h.

Referenced by setJoints().

void OldHeadPointerMC::setJointValueAndMode ( RobotInfo::TPROffset_t  i,
double  value,
CoordFrame_t  m 
) [inline]

set a specific head joint (in radians), pass one of RobotInfo::TPROffset_t, not a full offset!

Definition at line 63 of file OldHeadPointerMC.h.

void OldHeadPointerMC::setJointValueFromMode ( RobotInfo::TPROffset_t  i,
double  value,
CoordFrame_t  m 
) [inline]

set a specific head joint (in radians) auto converting value from mode m to the current mode, pass one of RobotInfo::TPROffset_t, not a full offset!

Definition at line 67 of file OldHeadPointerMC.h.

void OldHeadPointerMC::setMaxSpeed ( TPROffset_t  i,
float  x 
) [inline]

sets maxSpeed in rad/sec

Definition at line 38 of file OldHeadPointerMC.h.

void OldHeadPointerMC::setMode ( CoordFrame_t  m,
bool  convert = true 
)

sets all the joints to the given mode, will convert the values to the new mode if convert is true

Definition at line 37 of file OldHeadPointerMC.cc.

void OldHeadPointerMC::setWeight ( RobotInfo::TPROffset_t  i,
double  weight 
) [inline]

set a specific head joint weight, pass one of RobotInfo::TPROffset_t, not a full offset!

Definition at line 27 of file OldHeadPointerMC.h.

void OldHeadPointerMC::setWeight ( double  w  ) 

sets the weight values for all the neck joints

Definition at line 25 of file OldHeadPointerMC.cc.

Referenced by OldHeadPointerMC().

int OldHeadPointerMC::updateOutputs (  )  [virtual]

Updates where the head is looking.

Implements MotionCommand.

Definition at line 49 of file OldHeadPointerMC.cc.


Member Data Documentation

bool OldHeadPointerMC::active [protected]

set by accessor functions, defaults to true

Definition at line 106 of file OldHeadPointerMC.h.

Referenced by getActive(), isDirty(), and setActive().

bool OldHeadPointerMC::dirty [protected]

true if a change has been made since last call to updateJointCmds()

Definition at line 105 of file OldHeadPointerMC.h.

Referenced by DoStart(), isDirty(), setJointMode(), setJointValue(), setJointValueAndMode(), setJointValueFromMode(), setWeight(), and updateOutputs().

stores the last values we sent from updateOutputs

Definition at line 108 of file OldHeadPointerMC.h.

Referenced by getOutputCmd(), OldHeadPointerMC(), setWeight(), and updateOutputs().

stores the current mode of each joint, for instance so tilt can be GravityRelative while pan is static

Definition at line 110 of file OldHeadPointerMC.h.

Referenced by getJointMode(), OldHeadPointerMC(), setJointMode(), setJointValue(), setJointValueAndMode(), setJointValueFromMode(), and updateOutputs().

stores the target value of each joint, relative to headModes

Definition at line 109 of file OldHeadPointerMC.h.

Referenced by getJointValue(), OldHeadPointerMC(), setJointMode(), setJointValue(), setJointValueAndMode(), setJointValueFromMode(), and updateOutputs().

initialized from Config::motion_config, but can be overridden by setMaxSpeed(); rad per frame

Definition at line 111 of file OldHeadPointerMC.h.

Referenced by defaultMaxSpeed(), getMaxSpeed(), noMaxSpeed(), setMaxSpeed(), and updateOutputs().

false if the head is still moving towards its target

Definition at line 107 of file OldHeadPointerMC.h.

Referenced by DoStart(), isDirty(), setJointMode(), setJointValue(), setJointValueAndMode(), setJointValueFromMode(), setWeight(), and updateOutputs().


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

Tekkotsu v3.0
Generated Wed Oct 4 00:05:09 2006 by Doxygen 1.4.7