Homepage Demos Overview Downloads Tutorials Reference
Credits

FollowHeadBehavior Class Reference

#include <FollowHeadBehavior.h>

Inheritance diagram for FollowHeadBehavior:

Inheritance graph
[legend]
List of all members.

Detailed Description

Will walk where the head is pointing.

Press the chin button to loosen the head to point it, release the button to lock it again

Tilt of head determines x axis (forward/backward)
Roll of head determines y axis (sideways strafing)
Pan of head determines z axis (rotational)

The zero point of joint position is zero motion. Since the tilt is asymmetric (can tilt down farther than it can tilt up), the full range of the down tilt isn't used - if you tilt down farther than you could tilt it back, it'll just clip the speed. Besides, if the head is all the way down, it screws up the walk because the center of balance is changed.

Definition at line 23 of file FollowHeadBehavior.h.

Public Member Functions

 FollowHeadBehavior ()
 just sets up the variables
virtual ~FollowHeadBehavior ()
 calls DoStop() if isActive()
virtual void DoStart ()
 Register for events and creates and adds two motion commands - a walker and a head pointer.
virtual void DoStop ()
 Removes its two motion commands.
virtual void processEvent (const EventBase &e)
 Handles event processing.
virtual std::string getDescription () const
 Gives a short description of what this particular instantiation does (in case a more specific description is needed on an individual basis).

Static Public Member Functions

std::string getClassDescription ()
 Gives a short description of what this class of behaviors does... you should override this (but don't have to).

Protected Attributes

const EventBase head_release
 event mask for releasing head (chin button down)
const EventBase head_lock
 event mask for locking head (chin button up)
const EventBase clock
 event mask for updating walk direction (every 150 ms)
MotionManager::MC_ID walker_id
 MC_ID for walker.


Constructor & Destructor Documentation

FollowHeadBehavior::FollowHeadBehavior  ) 
 

just sets up the variables

Definition at line 10 of file FollowHeadBehavior.cc.

FollowHeadBehavior::~FollowHeadBehavior  )  [virtual]
 

calls DoStop() if isActive()

Definition at line 18 of file FollowHeadBehavior.cc.


Member Function Documentation

void FollowHeadBehavior::DoStart  )  [virtual]
 

Register for events and creates and adds two motion commands - a walker and a head pointer.

Reimplemented from BehaviorBase.

Definition at line 23 of file FollowHeadBehavior.cc.

void FollowHeadBehavior::DoStop  )  [virtual]
 

Removes its two motion commands.

Reimplemented from BehaviorBase.

Definition at line 35 of file FollowHeadBehavior.cc.

Referenced by ~FollowHeadBehavior().

std::string FollowHeadBehavior::getClassDescription  )  [inline, static]
 

Gives a short description of what this class of behaviors does... you should override this (but don't have to).

If you do override this, also consider overriding getDescription() to return it

Reimplemented from BehaviorBase.

Definition at line 42 of file FollowHeadBehavior.h.

Referenced by getDescription().

virtual std::string FollowHeadBehavior::getDescription  )  const [inline, virtual]
 

Gives a short description of what this particular instantiation does (in case a more specific description is needed on an individual basis).

By default simply returns getName(), because any calls from a BehaviorBase function to getClassDescription() are going to call BehaviorBase::getClassDescription(), not ~YourSubClass~::getClassDescription(), because static functions can't be virtual in C++ (doh!)

This means that getDescription called on a pointer to a BehaviorBase of unknown subtype would always return an empty string, which is pretty useless. So instead we return the name in this situation. If you want getDescription to return getClassDescription, you'll have to override it in your subclass to do so.

Reimplemented from BehaviorBase.

Definition at line 43 of file FollowHeadBehavior.h.

void FollowHeadBehavior::processEvent const EventBase e  )  [virtual]
 

Handles event processing.

After every clock pulse, sets walk in direction of head

Reimplemented from BehaviorBase.

Definition at line 44 of file FollowHeadBehavior.cc.

Referenced by DoStart().


Member Data Documentation

const EventBase FollowHeadBehavior::clock [protected]
 

event mask for updating walk direction (every 150 ms)

Definition at line 48 of file FollowHeadBehavior.h.

Referenced by DoStart(), and processEvent().

const EventBase FollowHeadBehavior::head_lock [protected]
 

event mask for locking head (chin button up)

Definition at line 47 of file FollowHeadBehavior.h.

Referenced by DoStart().

const EventBase FollowHeadBehavior::head_release [protected]
 

event mask for releasing head (chin button down)

Definition at line 46 of file FollowHeadBehavior.h.

Referenced by DoStart().

MotionManager::MC_ID FollowHeadBehavior::walker_id [protected]
 

MC_ID for walker.

Definition at line 49 of file FollowHeadBehavior.h.

Referenced by DoStart(), DoStop(), and processEvent().


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

Tekkotsu v2.2.1
Generated Tue Nov 23 16:37:46 2004 by Doxygen 1.3.9.1