Homepage Demos Overview Downloads Tutorials Reference
Credits

HeadPointerMC Class Reference

#include <HeadPointerMC.h>

Inheritance diagram for HeadPointerMC:

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 HeadPointerMC.h.

Public Types

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

 HeadPointerMC ()
 constructor, defaults to active, BodyRelative, all joints at 0

virtual ~HeadPointerMC ()
 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, pass it 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, 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)
 set 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 (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, 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 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 current value (relative to the current mode) of joint i, use getOutputCmd() if you want to know the actual target joint value (to get the actual 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 headJoints 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.


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


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

OutputCmd headJoints [NumHeadJoints]
 stores the last values we sent from updateOutputs

float headValues [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

enum HeadPointerMC::CoordFrame_t
 

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.

Enumeration values:
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 18 of file HeadPointerMC.h.

Referenced by getJointMode().


Constructor & Destructor Documentation

HeadPointerMC::HeadPointerMC  ) 
 

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

Definition at line 8 of file HeadPointerMC.cc.

virtual HeadPointerMC::~HeadPointerMC  )  [inline, virtual]
 

destructor

Definition at line 15 of file HeadPointerMC.h.


Member Function Documentation

double HeadPointerMC::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 34 of file HeadPointerMC.h.

Referenced by setJointMode(), and setJointValueFromMode().

double HeadPointerMC::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 132 of file HeadPointerMC.cc.

Referenced by convert().

double HeadPointerMC::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 98 of file HeadPointerMC.cc.

Referenced by convert(), and updateOutputs().

void HeadPointerMC::defaultMaxSpeed  ) 
 

restores maxSpeed to default settings from Config::Motion_Config

Definition at line 32 of file HeadPointerMC.cc.

Referenced by HeadPointerMC().

bool HeadPointerMC::getActive  )  const [inline]
 

returns active flag, see isDirty()

Definition at line 26 of file HeadPointerMC.h.

Referenced by getOutputCmd().

CoordFrame_t HeadPointerMC::getJointMode RobotInfo::TPROffset_t  i  )  const [inline]
 

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

Definition at line 46 of file HeadPointerMC.h.

double HeadPointerMC::getJointValue RobotInfo::TPROffset_t  i  )  const [inline]
 

returns the current value (relative to the current mode) of joint i, use getOutputCmd() if you want to know the actual target joint value (to get the actual current joint position, look in WorldState

Definition at line 47 of file HeadPointerMC.h.

float HeadPointerMC::getMaxSpeed TPROffset_t  i  )  [inline]
 

returns maxSpeed in rad/sec

Definition at line 31 of file HeadPointerMC.h.

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

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

Definition at line 89 of file HeadPointerMC.cc.

virtual int HeadPointerMC::isAlive  )  [inline, virtual]
 

Updates where the head is looking.

Implements MotionCommand.

Definition at line 54 of file HeadPointerMC.h.

virtual int HeadPointerMC::isDirty  )  [inline, virtual]
 

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

Implements MotionCommand.

Definition at line 53 of file HeadPointerMC.h.

Referenced by updateOutputs().

void HeadPointerMC::noMaxSpeed  )  [inline]
 

sets maxSpeed to 0 (no maximum)

Definition at line 28 of file HeadPointerMC.h.

void HeadPointerMC::setActive bool  a  )  [inline]
 

sets active flag, see isDirty()

Definition at line 25 of file HeadPointerMC.h.

void HeadPointerMC::setJointMode RobotInfo::TPROffset_t  i,
CoordFrame_t  m,
bool  convert = true
 

set 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 43 of file HeadPointerMC.cc.

Referenced by setMode().

void HeadPointerMC::setJoints double  tilt,
double  pan,
double  roll
 

Directly sets the neck values, uses current mode.

Definition at line 19 of file HeadPointerMC.cc.

Referenced by WalkToTargetMachine::processEvent(), StareAtBallBehavior::processEvent(), and ChaseBallBehavior::processEvent().

void HeadPointerMC::setJointValue RobotInfo::TPROffset_t  i,
double  value
[inline]
 

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

Definition at line 43 of file HeadPointerMC.h.

void HeadPointerMC::setJointValueAndMode RobotInfo::TPROffset_t  i,
double  value,
CoordFrame_t  m
[inline]
 

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

Definition at line 44 of file HeadPointerMC.h.

void HeadPointerMC::setJointValueFromMode RobotInfo::TPROffset_t  i,
double  value,
CoordFrame_t  m
[inline]
 

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

Definition at line 45 of file HeadPointerMC.h.

void HeadPointerMC::setMaxSpeed TPROffset_t  i,
float  x
[inline]
 

sets maxSpeed, pass it rad/sec

Definition at line 30 of file HeadPointerMC.h.

void HeadPointerMC::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 38 of file HeadPointerMC.cc.

void HeadPointerMC::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 24 of file HeadPointerMC.h.

void HeadPointerMC::setWeight double  w  ) 
 

sets the weight values for all the neck joints

Definition at line 26 of file HeadPointerMC.cc.

Referenced by HeadPointerMC().

int HeadPointerMC::updateOutputs  )  [virtual]
 

Updates where the head is looking.

Implements MotionCommand.

Definition at line 50 of file HeadPointerMC.cc.


Member Data Documentation

bool HeadPointerMC::active [protected]
 

set by accessor functions, defaults to true

Definition at line 62 of file HeadPointerMC.h.

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

bool HeadPointerMC::dirty [protected]
 

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

Definition at line 61 of file HeadPointerMC.h.

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

OutputCmd HeadPointerMC::headJoints[NumHeadJoints] [protected]
 

stores the last values we sent from updateOutputs

Definition at line 63 of file HeadPointerMC.h.

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

CoordFrame_t HeadPointerMC::headModes[NumHeadJoints] [protected]
 

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

Definition at line 65 of file HeadPointerMC.h.

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

float HeadPointerMC::headValues[NumHeadJoints] [protected]
 

stores the target value of each joint, relative to headModes

Definition at line 64 of file HeadPointerMC.h.

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

float HeadPointerMC::maxSpeed[NumHeadJoints] [protected]
 

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

Definition at line 67 of file HeadPointerMC.h.

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


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

Tekkotsu v2.1
Generated Tue Mar 16 23:22:11 2004 by Doxygen 1.3.5