Homepage Demos Overview Downloads Tutorials Reference
Credits
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Search

HeadPointControllerBehavior Class Reference

#include <HeadPointControllerBehavior.h>

Inheritance diagram for HeadPointControllerBehavior:

Inheritance graph
[legend]
List of all members.

Detailed Description

Listens to control commands coming in from the command port for remotely controlling the head.

Definition at line 15 of file HeadPointControllerBehavior.h.

Public Member Functions

 HeadPointControllerBehavior ()
 constructor

virtual ~HeadPointControllerBehavior ()
 destructor

virtual void DoStart ()
 By default, merely adds to the reference counter (through AddReference())
Note:
you should still call this from your overriding methods.


virtual void DoStop ()
 By default, subtracts from the reference counter, and deletes if zero
Note:
you should still call this when you override this
Warning:
call this at the end of your DoStop(), not beginning (it might delete this ).


virtual void processEvent (const EventBase &)
 The only event we could possibly receive is the stop-if-no-heartbeat timer.

virtual std::string getName () const
 Identifies the behavior in menus and such.


Static Public Member Functions

int mechacmd_callback (char *buf, int bytes)
 called by wireless when there's new data

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


Static Public Attributes

HeadPointControllerBehaviortheOne = NULL

Protected Attributes

MotionManager::MC_ID head_id
 the HeadPointerMC to use


Private Member Functions

void runCommand (unsigned char *command)
 Executes a command. Called by mechacmd_callback.

 HeadPointControllerBehavior (const HeadPointControllerBehavior &)
 don't call

HeadPointControllerBehavior operator= (const HeadPointControllerBehavior &)
 don't call


Private Attributes

float t
 head parameter

float p
 head parameter

float r
 head parameter

HeadPointControllerBehaviortheLastOne
Socketcmdsock
 The input command stream socket.


Static Private Attributes

Command Bytes
const char CMD_tilt = 't'
 handy symbol for matching incoming communication

const char CMD_pan = 'p'
 handy symbol for matching incoming communication

const char CMD_roll = 'r'
 handy symbol for matching incoming communication


Constructor & Destructor Documentation

HeadPointControllerBehavior::HeadPointControllerBehavior const HeadPointControllerBehavior  )  [private]
 

don't call

HeadPointControllerBehavior::HeadPointControllerBehavior  )  [inline]
 

constructor

Definition at line 56 of file HeadPointControllerBehavior.h.

References cmdsock, head_id, p, r, SocketNS::SOCK_STREAM, t, theLastOne, theOne, and wireless.

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

destructor

Definition at line 64 of file HeadPointControllerBehavior.h.

References theLastOne, and theOne.


Member Function Documentation

void HeadPointControllerBehavior::DoStart  )  [virtual]
 

By default, merely adds to the reference counter (through AddReference())

Note:
you should still call this from your overriding methods.

Reimplemented from BehaviorBase.

Definition at line 52 of file HeadPointControllerBehavior.cc.

References EventRouter::addListener(), MotionManager::addMotion(), cmdsock, config, BehaviorBase::DoStart(), erouter, head_id, Config::main_config::headControl_port, Wireless::listen(), Controller::loadGUI(), Config::main, mechacmd_callback(), motman, Wireless::setReceiver(), Socket::sock, EventBase::timerEGID, and wireless.

void HeadPointControllerBehavior::DoStop  )  [virtual]
 

By default, subtracts from the reference counter, and deletes if zero

Note:
you should still call this when you override this
Warning:
call this at the end of your DoStop(), not beginning (it might delete this ).

Reimplemented from BehaviorBase.

Definition at line 66 of file HeadPointControllerBehavior.cc.

References Wireless::close(), Controller::closeGUI(), cmdsock, BehaviorBase::DoStop(), erouter, EventRouter::forgetListener(), head_id, motman, MotionManager::removeMotion(), and wireless.

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

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

Reimplemented from BehaviorBase.

Definition at line 74 of file HeadPointControllerBehavior.h.

References config, Config::main_config::headControl_port, and Config::main.

virtual std::string HeadPointControllerBehavior::getName  )  const [inline, virtual]
 

Identifies the behavior in menus and such.

Implements BehaviorBase.

Definition at line 73 of file HeadPointControllerBehavior.h.

int HeadPointControllerBehavior::mechacmd_callback char *  buf,
int  bytes
[static]
 

called by wireless when there's new data

Definition at line 80 of file HeadPointControllerBehavior.cc.

References runCommand(), and theOne.

HeadPointControllerBehavior HeadPointControllerBehavior::operator= const HeadPointControllerBehavior  )  [private]
 

don't call

virtual void HeadPointControllerBehavior::processEvent const EventBase  )  [inline, virtual]
 

The only event we could possibly receive is the stop-if-no-heartbeat timer.

Reimplemented from BehaviorBase.

Definition at line 71 of file HeadPointControllerBehavior.h.

void HeadPointControllerBehavior::runCommand unsigned char *  command  )  [private]
 

Executes a command. Called by mechacmd_callback.

Definition at line 7 of file HeadPointControllerBehavior.cc.

References EventRouter::addTimer(), CMD_pan, CMD_roll, CMD_tilt, erouter, head_id, ERS210Info::HeadOffset, ERS210Info::MaxRange, ERS210Info::outputRanges, p, ERS210Info::PanOffset, r, EventRouter::removeTimer(), ERS210Info::RollOffset, t, and ERS210Info::TiltOffset.


Member Data Documentation

const char HeadPointControllerBehavior::CMD_pan = 'p' [static, private]
 

handy symbol for matching incoming communication

Definition at line 30 of file HeadPointControllerBehavior.h.

const char HeadPointControllerBehavior::CMD_roll = 'r' [static, private]
 

handy symbol for matching incoming communication

Definition at line 31 of file HeadPointControllerBehavior.h.

const char HeadPointControllerBehavior::CMD_tilt = 't' [static, private]
 

handy symbol for matching incoming communication

Definition at line 29 of file HeadPointControllerBehavior.h.

Socket* HeadPointControllerBehavior::cmdsock [private]
 

The input command stream socket.

Definition at line 46 of file HeadPointControllerBehavior.h.

MotionManager::MC_ID HeadPointControllerBehavior::head_id [protected]
 

the HeadPointerMC to use

Definition at line 25 of file HeadPointControllerBehavior.h.

float HeadPointControllerBehavior::p [private]
 

head parameter

Definition at line 35 of file HeadPointControllerBehavior.h.

float HeadPointControllerBehavior::r [private]
 

head parameter

Definition at line 36 of file HeadPointControllerBehavior.h.

float HeadPointControllerBehavior::t [private]
 

head parameter

Definition at line 34 of file HeadPointControllerBehavior.h.

HeadPointControllerBehavior* HeadPointControllerBehavior::theLastOne [private]
 

The last HPCB object that was theOne, so we can restore it to prominence when we die. This is a nice gesture, but it doesn't really make sense since we're all using the same port. But just in case something changes and we don't do that, this mechanism is in place.

Definition at line 43 of file HeadPointControllerBehavior.h.

HeadPointControllerBehavior * HeadPointControllerBehavior::theOne = NULL [static]
 

Points to the one HeadPointControllerBehavior object that the input command stream is talking to. A kludge. Dunno how you're gonna make sure you're not using this uninitialized.

Definition at line 5 of file HeadPointControllerBehavior.cc.


The documentation for this class was generated from the following files:
Tekkotsu v1.4
Generated Sat Jul 19 00:08:58 2003 by Doxygen 1.3.2