Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

DualCoding::Lookout Class Reference

The Lookout accepts LookoutRequests to move the head and collect sensor information. More...

#include <Lookout.h>

Inheritance diagram for DualCoding::Lookout:

Detailed Description

The Lookout accepts LookoutRequests to move the head and collect sensor information.

HeadMotionType can be none (user will point the head himself), pointAt, scan, track, or search. The data collected can be an image or distance reading, or for scan operations, it can be a list of locations where certain VisionObject or VisionRegion streams reported hits.

Definition at line 25 of file Lookout.h.

List of all members.

Public Member Functions

 Lookout ()
 Constructor.
virtual void doStart ()
 Delegate function for subclasses to be notified when the behavior starts up.
virtual void doStop ()
 Delegate function for subclasses to be notified when the behavior starts up.
virtual void doEvent ()
 Delegate function for event processing, the event itself is pointed to (only for the duration of the doEvent() call!) by event.
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).
virtual unsigned int executeRequest (const LookoutRequest &)
bool busy ()
void stopTrack ()
void moveHeadToPoint ()
void relax ()
 Inactivates all Lookout motion commands; called when MapBuilder finishes.

Static Public Member Functions

static std::string getClassDescription ()
 Gives a short description of what this class of behaviors does... you should override this (but don't have to).
static std::vector
< DualCoding::Point > 
groundSearchPoints ()
 returns a vector of points for searching the ground around the robot
static Point findLocationFor (const float normX, const float normY)

Static Public Attributes

static const unsigned int invalid_LO_ID = (unsigned int)-1

Protected Types

enum  TrackerStates {
  inactive, moveToAcquire, tracking, searching,
  centering, lost
}
enum  LookoutTimerSourceId_t { settle_timer = 1, sample_timer, lost_timer, scan_timer }

Protected Member Functions

virtual void executeRequest ()
virtual void requestComplete (bool result=true)
template<class T >
void pushRequest (const LookoutRequest &req)

void processPointAtEvent (const EventBase &event)
bool findPixelModes ()

void setupTrack ()
void processTrackEvent (const EventBase &event)

Protected Attributes

std::vector< std::map< uchar,
unsigned int > > 
pixelHistograms
std::priority_queue< floatdistanceSamples
MC_ID pointer_id
 id for HeadPointerMC for pointing the camera
MC_ID posture_id
 id for PostureMC for pointing the IR sensors
MC_ID sequence_id
 id for MotionSequenceMC for scanning
std::queue< LookoutRequest * > requests
 queue of pending LookoutRequest instances, including the current request
LookoutRequestcurReq
 pointer to request currently being executed
LookoutPointRequestcurPAR
 current Point-At request (same object as curReq)
bool successSave
enum
DualCoding::Lookout::TrackerStates 
trackerState
unsigned int idCounter

Private Member Functions

Lookoutoperator= (const Lookout &)
 Lookout (const Lookout &)



void setupScan ()
void triggerScanMotionSequence ()
void processScanEvent (const EventBase &event)
void scanAlongLine (const Point &start, const Point &end)
void scanAlongPolygon (const std::vector< Point > &vertices, const bool closed=false)
void scanArea (const Point &topLeft, const Point &topRight, const Point &bottomLeft, const Point &bottomRight)
void storeVisionRegionDataTo (std::vector< Point > &, const std::set< color_index > &, int)
static Point findLocationFor (const VisionObjectEvent &visev)
static Point findLocationFor (const CMVision::region *reg)



void setupSearch ()
void processSearchEvent (const EventBase &event)
void triggerSearchMotionSequence ()
static void searchAt (HeadPointerMC &hpmc_temp, std::vector< float > &jointvals, const Point &target)

Member Enumeration Documentation

Enumerator:
settle_timer 
sample_timer 
lost_timer 
scan_timer 

Definition at line 141 of file Lookout.h.

Enumerator:
inactive 
moveToAcquire 
tracking 
searching 
centering 
lost 

Definition at line 131 of file Lookout.h.


Constructor & Destructor Documentation

DualCoding::Lookout::Lookout (  ) 

Constructor.

Definition at line 31 of file Lookout.cc.

DualCoding::Lookout::Lookout ( const Lookout  )  [private]

Member Function Documentation

bool DualCoding::Lookout::busy (  ) 

Definition at line 38 of file Lookout.h.

void DualCoding::Lookout::doEvent (  )  [virtual]

Delegate function for event processing, the event itself is pointed to (only for the duration of the doEvent() call!) by event.

Default implementation watches for 'private' text message events (those forwarded by a BehaviorSwitchControl from ControllerGUI input) and will publically rebroadcast them. The idea is that your own processEvent gets first dibs, but if the behavior doesn't handle the text message, it will be handed off for others.

Reimplemented from BehaviorBase.

Definition at line 209 of file Lookout.cc.

void DualCoding::Lookout::doStart (  )  [virtual]

Delegate function for subclasses to be notified when the behavior starts up.

Should be overridden by subclasses to subscribe to events, install motion commands, etc.

doStart() is basically a hook to allow subclasses to jump in and do some customization of behavior parameters while the behavior is starting. If you are writing a behavior class and do not expect further derivation, just override doStart() yourself. However, if you do expect further derivation of your class, consider using preStart() or postStart() instead, and leave doStart() for the 'leaf' classes.

Reimplemented from BehaviorBase.

Definition at line 41 of file Lookout.cc.

void DualCoding::Lookout::doStop (  )  [virtual]

Delegate function for subclasses to be notified when the behavior starts up.

May be overridden to cleanup when the behavior is shutting down. However events will automatically be unsubscribed, and by using addMotion(), motions will automatically be removed by stop(), so you may not need any cleanup.

Reimplemented from BehaviorBase.

Definition at line 57 of file Lookout.cc.

void DualCoding::Lookout::executeRequest (  )  [protected, virtual]

Definition at line 117 of file Lookout.cc.

Referenced by executeRequest(), and requestComplete().

unsigned int DualCoding::Lookout::executeRequest ( const LookoutRequest req  )  [virtual]

Definition at line 94 of file Lookout.cc.

Point DualCoding::Lookout::findLocationFor ( const CMVision::region reg  )  [static, protected]

Definition at line 415 of file Lookout.cc.

static Point DualCoding::Lookout::findLocationFor ( const VisionObjectEvent visev  )  [static, protected]

Definition at line 81 of file Lookout.h.

Point DualCoding::Lookout::findLocationFor ( const float  normX,
const float  normY 
) [static]
bool DualCoding::Lookout::findPixelModes (  )  [protected]

Definition at line 301 of file Lookout.cc.

Referenced by processPointAtEvent().

static std::string DualCoding::Lookout::getClassDescription (  )  [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 34 of file Lookout.h.

Referenced by getDescription().

virtual std::string DualCoding::Lookout::getDescription (  )  const [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 35 of file Lookout.h.

vector< DualCoding::Point > DualCoding::Lookout::groundSearchPoints (  )  [static]

returns a vector of points for searching the ground around the robot

Definition at line 73 of file Lookout.cc.

void DualCoding::Lookout::moveHeadToPoint (  ) 

Definition at line 171 of file Lookout.cc.

Referenced by executeRequest().

Lookout& DualCoding::Lookout::operator= ( const Lookout  )  [private]
void DualCoding::Lookout::processPointAtEvent ( const EventBase event  )  [protected]

Definition at line 242 of file Lookout.cc.

Referenced by doEvent().

void DualCoding::Lookout::processScanEvent ( const EventBase event  )  [protected]

Definition at line 449 of file Lookout.cc.

Referenced by doEvent().

void DualCoding::Lookout::processSearchEvent ( const EventBase event  )  [protected]

Definition at line 868 of file Lookout.cc.

Referenced by doEvent().

void DualCoding::Lookout::processTrackEvent ( const EventBase event  )  [protected]

Definition at line 670 of file Lookout.cc.

Referenced by doEvent().

template<class T >
void DualCoding::Lookout::pushRequest ( const LookoutRequest req  )  [protected]

Definition at line 56 of file Lookout.h.

void DualCoding::Lookout::relax (  ) 

Inactivates all Lookout motion commands; called when MapBuilder finishes.

Definition at line 165 of file Lookout.cc.

void DualCoding::Lookout::requestComplete ( bool  result = true  )  [protected, virtual]
void DualCoding::Lookout::scanAlongLine ( const Point &  start,
const Point &  end 
) [protected]

Definition at line 560 of file Lookout.cc.

Referenced by setupScan().

void DualCoding::Lookout::scanAlongPolygon ( const std::vector< Point > &  vertices,
const bool  closed = false 
) [protected]

Definition at line 601 of file Lookout.cc.

Referenced by setupScan().

void DualCoding::Lookout::scanArea ( const Point &  topLeft,
const Point &  topRight,
const Point &  bottomLeft,
const Point &  bottomRight 
) [protected]
void DualCoding::Lookout::searchAt ( HeadPointerMC hpmc_temp,
std::vector< float > &  jointvals,
const Point &  target 
) [static, protected]

Definition at line 957 of file Lookout.cc.

Referenced by triggerSearchMotionSequence().

void DualCoding::Lookout::setupScan (  )  [protected]

Definition at line 515 of file Lookout.cc.

Referenced by executeRequest().

void DualCoding::Lookout::setupSearch (  )  [protected]

Definition at line 851 of file Lookout.cc.

Referenced by executeRequest().

void DualCoding::Lookout::setupTrack (  )  [protected]

Definition at line 648 of file Lookout.cc.

Referenced by executeRequest().

void DualCoding::Lookout::stopTrack (  ) 

Definition at line 720 of file Lookout.cc.

Referenced by processTrackEvent().

void DualCoding::Lookout::storeVisionRegionDataTo ( std::vector< Point > &  data,
const std::set< color_index > &  colors,
int  minArea 
) [protected]

Definition at line 422 of file Lookout.cc.

Referenced by processScanEvent().

void DualCoding::Lookout::triggerScanMotionSequence (  )  [protected]

Definition at line 539 of file Lookout.cc.

Referenced by processScanEvent().

void DualCoding::Lookout::triggerSearchMotionSequence (  )  [protected]

Definition at line 920 of file Lookout.cc.

Referenced by processSearchEvent().


Member Data Documentation

current Point-At request (same object as curReq)

Definition at line 128 of file Lookout.h.

Referenced by doStop(), executeRequest(), findPixelModes(), moveHeadToPoint(), processPointAtEvent(), and requestComplete().

std::priority_queue<float> DualCoding::Lookout::distanceSamples [protected]

Definition at line 121 of file Lookout.h.

Referenced by executeRequest().

unsigned int DualCoding::Lookout::idCounter [protected]

Definition at line 139 of file Lookout.h.

Referenced by executeRequest().

const unsigned int DualCoding::Lookout::invalid_LO_ID = (unsigned int)-1 [static]

Definition at line 49 of file Lookout.h.

std::vector<std::map<uchar,unsigned int> > DualCoding::Lookout::pixelHistograms [protected]

Definition at line 120 of file Lookout.h.

Referenced by executeRequest(), and findPixelModes().

queue of pending LookoutRequest instances, including the current request

Definition at line 126 of file Lookout.h.

Referenced by doStop(), executeRequest(), pushRequest(), and requestComplete().

Definition at line 129 of file Lookout.h.

Referenced by moveHeadToPoint(), processPointAtEvent(), and setupTrack().


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

Tekkotsu v5.1CVS
Generated Tue Jan 31 04:32:30 2012 by Doxygen 1.6.3