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 11 of file HeadPointerMC.h.

Public Member Functions

 HeadPointerMC ()
 Constructor, defaults to all joints to current value in state.
virtual ~HeadPointerMC ()
 Destructor.
Speed Control
void noMaxSpeed ()
 Sets maxSpeed to 0 (no maximum).
void defaultMaxSpeed ()
 Restores maxSpeed to default settings from Config::Motion_Config.
void setMaxSpeed (unsigned int i, float x)
 Sets maxSpeed in rad/sec.
float getMaxSpeed (unsigned int i)
 Returns maxSpeed in rad/sec.
Joint Accessors
void setWeight (float w)
 Sets the weight values for all the neck joints.
void setJoints (float j1, float j2, float j3)
 Directly sets the neck values (all values in radians).
void setJointValue (unsigned int i, float value)
 Directly set a single neck joint value.
float getJointValue (unsigned int i) const
 Returns the target value of joint i. Use this if you want to know the current commanded joint value; To get the current joint position, look in WorldState::outputs.
bool lookAtPoint (float x, float y, float z)
 Centers the camera on a point in space, attempting to keep the camera as far away from the point as possible.
bool lookAtPoint (float x, float y, float z, float d)
 Centers the camera on a point in space, attempting to move the camera d millimeters away from the point.
bool lookInDirection (float x, float y, float z)
 Points the camera in a given direction.
Inherited:
virtual int updateOutputs ()
 Updates where the head is looking.
virtual int isDirty ()
 true if a change has been made since the last updateJointCmds() and we're active
virtual int isAlive ()
 always true, doesn't autoprune (yet)
virtual void DoStart ()
 marks this as dirty each time it is added

Protected Member Functions

void markDirty ()
 if targetReached, reassigns headCmds from state, then sets dirty to true and targetReached to false

Static Protected Member Functions

float normalizeAngle (float x)
 puts x in the range (-pi,pi)
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 targetReached
 false if the head is still moving towards its target
float headTargets [NumHeadJoints]
 stores the target value of each joint
OutputCmd headCmds [NumHeadJoints]
 stores the last values we sent from updateOutputs
float maxSpeed [NumHeadJoints]
 initialized from Config::motion_config, but can be overridden by setMaxSpeed(); rad per frame
ROBOOP::Robot headkin
 provides kinematics computations


Constructor & Destructor Documentation

HeadPointerMC::HeadPointerMC  ) 
 

Constructor, defaults to all joints to current value in state.

Definition at line 8 of file HeadPointerMC.cc.

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

Destructor.

Definition at line 17 of file HeadPointerMC.h.


Member Function Documentation

float HeadPointerMC::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 93 of file HeadPointerMC.h.

Referenced by setJoints(), and setJointValue().

void HeadPointerMC::defaultMaxSpeed  ) 
 

Restores maxSpeed to default settings from Config::Motion_Config.

Definition at line 18 of file HeadPointerMC.cc.

Referenced by HeadPointerMC().

virtual void HeadPointerMC::DoStart  )  [inline, virtual]
 

marks this as dirty each time it is added

Reimplemented from MotionCommand.

Definition at line 85 of file HeadPointerMC.h.

float HeadPointerMC::getJointValue unsigned int  i  )  const [inline]
 

Returns the target value of joint i. Use this if you want to know the current commanded joint value; To get the current joint position, look in WorldState::outputs.

Parameters:
i joint offset relative to HeadOffset (i.e. one of TPROffset_t)

Definition at line 57 of file HeadPointerMC.h.

float HeadPointerMC::getMaxSpeed unsigned int  i  )  [inline]
 

Returns maxSpeed in rad/sec.

Parameters:
i joint offset relative to HeadOffset (i.e. one of TPROffset_t)
Returns:
the maximum speed of joint i in radians per second

Definition at line 35 of file HeadPointerMC.h.

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

always true, doesn't autoprune (yet)

Implements MotionCommand.

Definition at line 84 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 83 of file HeadPointerMC.h.

Referenced by updateOutputs().

bool HeadPointerMC::lookAtPoint float  x,
float  y,
float  z,
float  d
 

Centers the camera on a point in space, attempting to move the camera d millimeters away from the point.

Parameters:
x location in millimeters
y location in millimeters
z location in millimeters
d target distance from point in millimeters

Definition at line 48 of file HeadPointerMC.cc.

bool HeadPointerMC::lookAtPoint float  x,
float  y,
float  z
 

Centers the camera on a point in space, attempting to keep the camera as far away from the point as possible.

Parameters:
x location in millimeters
y location in millimeters
z location in millimeters

Definition at line 37 of file HeadPointerMC.cc.

bool HeadPointerMC::lookInDirection float  x,
float  y,
float  z
 

Points the camera in a given direction.

Parameters:
x component of the direction vector
y component of the direction vector
z component of the direction vector

Definition at line 59 of file HeadPointerMC.cc.

void HeadPointerMC::markDirty  )  [protected]
 

if targetReached, reassigns headCmds from state, then sets dirty to true and targetReached to false

should be called each time a joint value gets modified in case the head isn't where it's supposed to be, it won't jerk around

Definition at line 106 of file HeadPointerMC.cc.

Referenced by DoStart(), setJoints(), setJointValue(), and setWeight().

void HeadPointerMC::noMaxSpeed  )  [inline]
 

Sets maxSpeed to 0 (no maximum).

Definition at line 22 of file HeadPointerMC.h.

float HeadPointerMC::normalizeAngle float  x  )  [inline, static, protected]
 

puts x in the range (-pi,pi)

Definition at line 90 of file HeadPointerMC.h.

Referenced by clipAngularRange().

void HeadPointerMC::setJoints float  j1,
float  j2,
float  j3
 

Directly sets the neck values (all values in radians).

Parameters:
j1 value for first neck joint (tilt on all ERS models)
j2 value for second neck joint (pan on all ERS models)
j3 value for third neck joint (nod on ERS-7, roll on ERS-2xx)

Definition at line 30 of file HeadPointerMC.cc.

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

void HeadPointerMC::setJointValue unsigned int  i,
float  value
[inline]
 

Directly set a single neck joint value.

Parameters:
i joint offset relative to HeadOffset (i.e. one of TPROffset_t)
value the value to be assigned to join i, in radians

Definition at line 53 of file HeadPointerMC.h.

Referenced by lookAtPoint(), and lookInDirection().

void HeadPointerMC::setMaxSpeed unsigned int  i,
float  x
[inline]
 

Sets maxSpeed in rad/sec.

Parameters:
i joint offset relative to HeadOffset (i.e. one of TPROffset_t)
x maximum radians per second to move

Definition at line 30 of file HeadPointerMC.h.

void HeadPointerMC::setWeight float  w  ) 
 

Sets the weight values for all the neck joints.

Definition at line 24 of file HeadPointerMC.cc.

Referenced by HeadPointerMC().

int HeadPointerMC::updateOutputs  )  [virtual]
 

Updates where the head is looking.

Implements MotionCommand.

Definition at line 70 of file HeadPointerMC.cc.


Member Data Documentation

bool HeadPointerMC::dirty [protected]
 

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

Definition at line 111 of file HeadPointerMC.h.

Referenced by isDirty(), markDirty(), and updateOutputs().

OutputCmd HeadPointerMC::headCmds[NumHeadJoints] [protected]
 

stores the last values we sent from updateOutputs

Definition at line 114 of file HeadPointerMC.h.

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

ROBOOP::Robot HeadPointerMC::headkin [protected]
 

provides kinematics computations

Definition at line 116 of file HeadPointerMC.h.

Referenced by lookAtPoint(), and lookInDirection().

float HeadPointerMC::headTargets[NumHeadJoints] [protected]
 

stores the target value of each joint

Definition at line 113 of file HeadPointerMC.h.

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

float HeadPointerMC::maxSpeed[NumHeadJoints] [protected]
 

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

Definition at line 115 of file HeadPointerMC.h.

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

bool HeadPointerMC::targetReached [protected]
 

false if the head is still moving towards its target

Definition at line 112 of file HeadPointerMC.h.

Referenced by markDirty(), and updateOutputs().


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

Tekkotsu v2.2
Generated Tue Oct 19 14:20:18 2004 by Doxygen 1.3.9.1