BeoSub Class Reference

Definition and access functions for the BeoSub base class. More...

#include <BeoSub/BeoSub.H>

Inheritance diagram for BeoSub:
Inheritance graph
[legend]
Collaboration diagram for BeoSub:
Collaboration graph
[legend]

List of all members.

Public Member Functions

Constructors and Destructors

 BeoSub (OptionManager &mgr, const std::string &descrName="BeoSub", const std::string &tagName="BeoSub")
 Constructor.
virtual ~BeoSub ()
 Destructor.
Mid-level access functions

bool targetReached (const float tol=1.0F) const
 Have we reached the latest set target?
void waitMove (const double timeout)
 Wait until a move is complete. Timeout is in seconds.
void turnAbs (const Angle finalHeading, const bool blocking=false)
 Turn the sub to the given heading.
void turnRel (const Angle relHeading, const bool blocking=false)
 Turns the sub to the given heading relative to our current heading.
virtual void turnOpen (const Angle openHeading, const bool stop=true)=0
void pitchAbs (const Angle finalPitch, const bool blocking=false)
 Pitch the sub to a given angle.
void diveAbs (const float finalDepth, const bool blocking=false)
 Makes the sub dive to a specific depth in meters.
void diveRel (const float relDepth, const bool blocking=false)
 Makes the sub dive to a specific depth relative to current.
virtual void advanceRel (const float relDist, const bool stop=true)=0
 Advance the sub by some distance in meters.
virtual void strafeRel (const float relDist)
 Strafes the sub by some distance in meters.
virtual void dropMarker (const bool blocking=false)=0
 Drop a marker.
Visual processing functions

virtual Image< PixRGB< byte > > grabImage (const enum BeoSubCamera cam) const =0
 Grab a an image from one of the cameras.
virtual Image< float > getSaliencyMap (const enum BeoSubCamera cam) const
 Get saliency map from a given camera.
bool matchSIFT (const enum BeoSubCamera cam, const rutz::shared_ptr< VisualObject > &obj) const
 match a known object to a grabbed image
virtual bool recognizeSIFT (const enum BeoSubCamera cam, MappingData &data, Angle &myHeading) const
 Recognize an image from our camera against our image databases.
virtual bool affineSIFT (const enum BeoSubCamera cam, rutz::shared_ptr< VisualObject > goal)
virtual bool findShape (rutz::shared_ptr< ShapeModel > &shapeArg, const char *colorArg, const enum BeoSubCamera camArg) const
virtual bool centerColor (const char *colorArg, const enum BeoSubCamera camArg, float &thresholdMass)
virtual bool approachArea (std::string name, const enum BeoSubCamera cam, float stepdist)
virtual bool approachArea (MappingData goalArea, MappingData currentArea, float stepDist)
virtual bool Decode ()
virtual bool TaskGate ()
virtual bool TaskA ()
virtual bool TaskB ()
virtual bool TaskC ()
bool TaskScheduler (int TaskOrder)
bool LookForRedLight ()
bool CenterRedLight ()
bool ApproachRedLight ()
bool PushRedLight ()
virtual bool ApproachPipeLine ()
bool FollowPipeLine ()
int RecognizeBin ()
bool TestBin (nub::soft_ref< FrameIstream > gb, int testColor)
bool CenterBin ()
bool DropMarker ()
bool PassBin ()
Low-level access functions

double getTime () const
 Get time since started, in seconds.
Attitude getCurrentAttitude () const
 Gets the Current Attitude of the Sub.
Attitude getTargetAttitude () const
 Gets the Target Attitude of the Sub.
Angle getHeading () const
 Get current heading (yaw axis), in degrees, ]-180.0 .. 180.0].
Angle getPitch () const
 Get current pitch, in degrees, ]-180.0 .. 180.0].
Angle getRoll () const
 Get current roll, in degrees, ]-180.0 .. 180.0].
void getCompass (Angle &heading, Angle &pitch, Angle &roll) const
 Shorthand to get all 3 compass readings.
float getDepth () const
 Get current depth (units in meters).

Public Attributes

bool taskAdone
bool taskBdone
bool taskCdone
std::list< char > itsTasks
std::list< char >::iterator itsTasksIter
rutz::shared_ptr< VisualObjectitsVOtaskAdown
rutz::shared_ptr< VisualObjectitsVOtaskAfront
rutz::shared_ptr< VisualObjectitsVOtaskBdown
rutz::shared_ptr< VisualObjectitsVOtaskBfront
rutz::shared_ptr< VisualObjectitsVOtaskCdown
rutz::shared_ptr< VisualObjectitsVOtaskCfront
rutz::shared_ptr< VisualObjectitsVOtaskCup
rutz::shared_ptr< VisualObjectitsVOtaskGdown
rutz::shared_ptr< VisualObjectitsVOtaskGfront
rutz::shared_ptr< VisualObjectitsVOtaskGup
rutz::shared_ptr< VisualObjectitsVOtaskDfront
Location taskAposition
Location taskBposition
Location taskCposition
Location taskGposition

Protected Member Functions

virtual void start1 ()
 get started

Protected Attributes

OModelParam< std::stringitsFrontVODBfname
 file name of front object db
rutz::shared_ptr< VisualObjectDBitsFrontVODB
 front object db
OModelParam< std::stringitsDownVODBfname
 file name of down object db
rutz::shared_ptr< VisualObjectDBitsDownVODB
 down object db
OModelParam< std::stringitsUpVODBfname
 file name of up object db
rutz::shared_ptr< VisualObjectDBitsUpVODB
 up object db
Timer itsMasterClock
 our master clock, unit is useconds
int itsCkPt
 our checkpoint number
Attitude itsCurrentAttitude
 the current Attitude of the sub
Location itsGlobalPosition
Angle itsGlobalHeading
Attitude itsTargetAttitude
 target (desired) Attitude of the sub
nub::soft_ref< RawVisualCortexitsVisualCortex
 To compute saliency maps.
std::string itsFrontDBfname
 file name of front data db
rutz::shared_ptr< BeoSubDBitsFrontDB
 front data db
std::string itsDownDBfname
 file name of down data db
rutz::shared_ptr< BeoSubDBitsDownDB
 down data db
std::string itsUpDBfname
 file name of up data db
rutz::shared_ptr< BeoSubDBitsUpDB
 up data db
nub::soft_ref< BeoSubCannyitsShapeDetector
nub::soft_ref< BeoSubTaskDecoderitsTaskDecoder
nub::soft_ref< ColorTrackeritsColorTracker
nub::soft_ref< ColorTrackeritsColorTracker2
bool decoderIsRed
pthread_mutex_t itsLock
 lock to control access to our internal data

Detailed Description

Definition and access functions for the BeoSub base class.

BeoSub is an autonomous visually-guided submarine. This class implements the high-level functionality, relying on low-level drivers to handle motor activation, compass reading, etc. This is the base class. Some functions are purely virtual and need to be overloaded in various derived classes.

Definition at line 78 of file BeoSub.H.


Constructor & Destructor Documentation

BeoSub::BeoSub ( OptionManager mgr,
const std::string descrName = "BeoSub",
const std::string tagName = "BeoSub" 
)

Constructor.

Definition at line 51 of file BeoSub.C.

References ModelComponent::addSubComponent(), itsLock, and itsVisualCortex.

BeoSub::~BeoSub (  )  [virtual]

Destructor.

Definition at line 100 of file BeoSub.C.

References itsLock.


Member Function Documentation

virtual void BeoSub::advanceRel ( const float  relDist,
const bool  stop = true 
) [pure virtual]

Advance the sub by some distance in meters.

Negative distance is to the rear, positive to the front. Distance is in meters (approximate). Note: this blocks for some time...

Implemented in BeoSubOneBal, BeoSubSim, SeaBee, and BeoSubLeakDetector.

Referenced by CenterBin(), FollowPipeLine(), and strafeRel().

bool BeoSub::CenterBin (  ) 

!!need to check if overturned 180 degrees

Definition at line 2268 of file BeoSub.C.

References ModelComponent::addSubComponent(), advanceRel(), Image< T >::getHeight(), Image< T >::getWidth(), grabImage(), height, makeIEEE1394grabber(), ModelComponent::start(), and turnRel().

Referenced by TaskB().

void BeoSub::diveAbs ( const float  finalDepth,
const bool  blocking = false 
)

Makes the sub dive to a specific depth in meters.

Reimplemented in BeoSubSim.

Definition at line 194 of file BeoSub.C.

References Attitude::depth, itsCurrentAttitude, itsLock, itsTargetAttitude, and waitMove().

void BeoSub::diveRel ( const float  relDepth,
const bool  blocking = false 
)

Makes the sub dive to a specific depth relative to current.

Negative depth is up, positive is down. Distance is in meters.

Reimplemented in BeoSubSim.

Definition at line 204 of file BeoSub.C.

References Attitude::depth, itsLock, itsTargetAttitude, and waitMove().

void BeoSub::dropMarker ( const bool  blocking = false  )  [pure virtual]

Drop a marker.

Implemented in BeoSubOneBal, BeoSubSim, BeoSubTwoBal, SeaBee, and BeoSubLeakDetector.

Definition at line 268 of file BeoSubTwoBal.C.

bool BeoSub::FollowPipeLine (  ) 

!!need to check if overturned 180 degrees

Definition at line 1949 of file BeoSub.C.

References ModelComponent::addSubComponent(), advanceRel(), Image< T >::getHeight(), Image< T >::getWidth(), height, makeIEEE1394grabber(), ModelComponent::start(), and turnRel().

Referenced by TaskB().

void BeoSub::getCompass ( Angle heading,
Angle pitch,
Angle roll 
) const

Shorthand to get all 3 compass readings.

Definition at line 286 of file BeoSub.C.

References getCurrentAttitude(), and Attitude::roll.

Attitude BeoSub::getCurrentAttitude (  )  const

Gets the Current Attitude of the Sub.

Definition at line 256 of file BeoSub.C.

References itsCurrentAttitude, and itsLock.

Referenced by getCompass(), getDepth(), getHeading(), getPitch(), and getRoll().

float BeoSub::getDepth (  )  const

Get current depth (units in meters).

Definition at line 293 of file BeoSub.C.

References Attitude::depth, and getCurrentAttitude().

Referenced by BeoSubActionTurn::BeoSubActionTurn(), and BeoSubActionDive::getPosition().

Angle BeoSub::getHeading (  )  const

Get current heading (yaw axis), in degrees, ]-180.0 .. 180.0].

Definition at line 274 of file BeoSub.C.

References getCurrentAttitude().

Referenced by BeoSubActionDive::BeoSubActionDive(), and BeoSubActionTurn::getPosition().

Angle BeoSub::getPitch (  )  const

Get current pitch, in degrees, ]-180.0 .. 180.0].

Definition at line 278 of file BeoSub.C.

References getCurrentAttitude().

Angle BeoSub::getRoll (  )  const

Get current roll, in degrees, ]-180.0 .. 180.0].

Definition at line 282 of file BeoSub.C.

References getCurrentAttitude(), and Attitude::roll.

Image< float > BeoSub::getSaliencyMap ( const enum BeoSubCamera  cam  )  const [virtual]

Get saliency map from a given camera.

For ease of use, the output saliency map returned here is rescaled (with bilinear interpolation) to the same dims as the grabbed input image.

Definition at line 307 of file BeoSub.C.

References InputFrame::fromRgb(), Timer::getSimTime(), grabImage(), itsMasterClock, and itsVisualCortex.

Attitude BeoSub::getTargetAttitude (  )  const

Gets the Target Attitude of the Sub.

Definition at line 265 of file BeoSub.C.

References itsLock, and itsTargetAttitude.

double BeoSub::getTime (  )  const

Get time since started, in seconds.

Definition at line 252 of file BeoSub.C.

References Timer::getSecs(), and itsMasterClock.

virtual Image< PixRGB<byte> > BeoSub::grabImage ( const enum BeoSubCamera  cam  )  const [pure virtual]

Grab a an image from one of the cameras.

Implemented in BeoSubOneBal, BeoSubSim, SeaBee, and BeoSubLeakDetector.

Referenced by CenterBin(), getSaliencyMap(), matchSIFT(), and recognizeSIFT().

bool BeoSub::matchSIFT ( const enum BeoSubCamera  cam,
const rutz::shared_ptr< VisualObject > &  obj 
) const

match a known object to a grabbed image

Definition at line 387 of file BeoSub.C.

References VisualObjectMatch::checkSIFTaffine(), VisualObjectMatch::getScore(), grabImage(), and VisualObjectMatch::prune().

void BeoSub::pitchAbs ( const Angle  finalPitch,
const bool  blocking = false 
)

Pitch the sub to a given angle.

Definition at line 170 of file BeoSub.C.

References Angle::getVal(), itsCurrentAttitude, itsLock, itsTargetAttitude, and waitMove().

bool BeoSub::recognizeSIFT ( const enum BeoSubCamera  cam,
MappingData data,
Angle myHeading 
) const [virtual]

Recognize an image from our camera against our image databases.

Returns true if reliable recognition was achieved.

Definition at line 316 of file BeoSub.C.

References SIFTaffine::decompose(), grabImage(), itsDownDB, itsDownVODB, itsFrontDB, itsFrontVODB, itsUpDB, and itsUpVODB.

void BeoSub::start1 (  )  [protected, virtual]
void BeoSub::strafeRel ( const float  relDist  )  [virtual]

Strafes the sub by some distance in meters.

Negative distance is to the left, positive to the right. Distance is in meters (approximate). Note: this blocks for some time...

Reimplemented in BeoSubOneBal, and BeoSubSim.

Definition at line 214 of file BeoSub.C.

References advanceRel(), and turnRel().

bool BeoSub::targetReached ( const float  tol = 1.0F  )  const

Have we reached the latest set target?

A tol of 1.0F corresponds to +/- 10deg in heading and +/- 20cm in depth, these tolerances scaling linearly with tol. Pitch and roll are ignored, we just assume they will be stabilized by the PID controller and the sub will always remain level.

Definition at line 141 of file BeoSub.C.

References Attitude::depth, Angle::getVal(), itsCurrentAttitude, itsLock, and itsTargetAttitude.

Referenced by waitMove().

bool BeoSub::TaskB (  )  [virtual]

!!maybe need to change: looking for pipe and approaching pipe

Definition at line 1381 of file BeoSub.C.

References CenterBin(), FollowPipeLine(), and image.

void BeoSub::turnAbs ( const Angle  finalHeading,
const bool  blocking = false 
)

Turn the sub to the given heading.

Parameters:
blocking if true will block until completion or some timeout occurs

Reimplemented in BeoSubSim.

Definition at line 160 of file BeoSub.C.

References Angle::getVal(), itsCurrentAttitude, itsLock, itsTargetAttitude, and waitMove().

void BeoSub::turnRel ( const Angle  relHeading,
const bool  blocking = false 
)

Turns the sub to the given heading relative to our current heading.

Reimplemented in BeoSubSim.

Definition at line 180 of file BeoSub.C.

Referenced by CenterBin(), FollowPipeLine(), strafeRel(), and BeoSubOneBal::strafeRel().

void BeoSub::waitMove ( const double  timeout  ) 

Wait until a move is complete. Timeout is in seconds.

Definition at line 235 of file BeoSub.C.

References Timer::getSecs(), itsMasterClock, and targetReached().

Referenced by diveAbs(), diveRel(), pitchAbs(), and turnAbs().


Member Data Documentation

int BeoSub::itsCkPt [protected]

our checkpoint number

Definition at line 279 of file BeoSub.H.

down data db

Definition at line 295 of file BeoSub.H.

Referenced by recognizeSIFT(), and start1().

file name of down data db

Definition at line 294 of file BeoSub.H.

Referenced by start1().

down object db

Definition at line 274 of file BeoSub.H.

Referenced by recognizeSIFT(), and start1().

file name of down object db

Definition at line 273 of file BeoSub.H.

Referenced by start1().

front data db

Definition at line 293 of file BeoSub.H.

Referenced by recognizeSIFT(), and start1().

file name of front data db

Definition at line 292 of file BeoSub.H.

Referenced by start1().

front object db

Definition at line 272 of file BeoSub.H.

Referenced by recognizeSIFT(), and start1().

file name of front object db

Definition at line 271 of file BeoSub.H.

Referenced by start1().

pthread_mutex_t BeoSub::itsLock [protected]

up data db

Definition at line 297 of file BeoSub.H.

Referenced by recognizeSIFT(), and start1().

file name of up data db

Definition at line 296 of file BeoSub.H.

Referenced by start1().

up object db

Definition at line 276 of file BeoSub.H.

Referenced by recognizeSIFT(), and start1().

file name of up object db

Definition at line 275 of file BeoSub.H.

Referenced by start1().

To compute saliency maps.

Definition at line 290 of file BeoSub.H.

Referenced by BeoSub(), and getSaliencyMap().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:20:24 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3