Definition and access functions for the BeoSub base class. More...
#include <BeoSub/BeoSub.H>
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< VisualObject > | itsVOtaskAdown |
rutz::shared_ptr< VisualObject > | itsVOtaskAfront |
rutz::shared_ptr< VisualObject > | itsVOtaskBdown |
rutz::shared_ptr< VisualObject > | itsVOtaskBfront |
rutz::shared_ptr< VisualObject > | itsVOtaskCdown |
rutz::shared_ptr< VisualObject > | itsVOtaskCfront |
rutz::shared_ptr< VisualObject > | itsVOtaskCup |
rutz::shared_ptr< VisualObject > | itsVOtaskGdown |
rutz::shared_ptr< VisualObject > | itsVOtaskGfront |
rutz::shared_ptr< VisualObject > | itsVOtaskGup |
rutz::shared_ptr< VisualObject > | itsVOtaskDfront |
Location | taskAposition |
Location | taskBposition |
Location | taskCposition |
Location | taskGposition |
Protected Member Functions | |
virtual void | start1 () |
get started | |
Protected Attributes | |
OModelParam< std::string > | itsFrontVODBfname |
file name of front object db | |
rutz::shared_ptr< VisualObjectDB > | itsFrontVODB |
front object db | |
OModelParam< std::string > | itsDownVODBfname |
file name of down object db | |
rutz::shared_ptr< VisualObjectDB > | itsDownVODB |
down object db | |
OModelParam< std::string > | itsUpVODBfname |
file name of up object db | |
rutz::shared_ptr< VisualObjectDB > | itsUpVODB |
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< RawVisualCortex > | itsVisualCortex |
To compute saliency maps. | |
std::string | itsFrontDBfname |
file name of front data db | |
rutz::shared_ptr< BeoSubDB > | itsFrontDB |
front data db | |
std::string | itsDownDBfname |
file name of down data db | |
rutz::shared_ptr< BeoSubDB > | itsDownDB |
down data db | |
std::string | itsUpDBfname |
file name of up data db | |
rutz::shared_ptr< BeoSubDB > | itsUpDB |
up data db | |
nub::soft_ref< BeoSubCanny > | itsShapeDetector |
nub::soft_ref< BeoSubTaskDecoder > | itsTaskDecoder |
nub::soft_ref< ColorTracker > | itsColorTracker |
nub::soft_ref< ColorTracker > | itsColorTracker2 |
bool | decoderIsRed |
pthread_mutex_t | itsLock |
lock to control access to our internal data |
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.
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] |
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().
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] |
get started
Reimplemented from ModelComponent.
Reimplemented in BeoSubOneBal, BeoSubSim, BeoSubTwoBal, and SeaBee.
Definition at line 106 of file BeoSub.C.
References OModelParam< T >::getVal(), itsDownDB, itsDownDBfname, itsDownVODB, itsDownVODBfname, itsFrontDB, itsFrontDBfname, itsFrontVODB, itsFrontVODBfname, itsUpDB, itsUpDBfname, itsUpVODB, and itsUpVODBfname.
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.
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().
int BeoSub::itsCkPt [protected] |
Attitude BeoSub::itsCurrentAttitude [protected] |
the current Attitude of the sub
Definition at line 280 of file BeoSub.H.
Referenced by diveAbs(), BeoSubSim::diveRel(), getCurrentAttitude(), pitchAbs(), targetReached(), turnAbs(), BeoSubSim::turnRel(), BeoSubSim::updateCompass(), BeoSubOneBal::updateCompass(), BeoSubOneBal::updateDepth(), and BeoSubSim::updateDepth().
rutz::shared_ptr<BeoSubDB> BeoSub::itsDownDB [protected] |
std::string BeoSub::itsDownDBfname [protected] |
rutz::shared_ptr<VisualObjectDB> BeoSub::itsDownVODB [protected] |
down object db
Definition at line 274 of file BeoSub.H.
Referenced by recognizeSIFT(), and start1().
OModelParam<std::string> BeoSub::itsDownVODBfname [protected] |
rutz::shared_ptr<BeoSubDB> BeoSub::itsFrontDB [protected] |
std::string BeoSub::itsFrontDBfname [protected] |
rutz::shared_ptr<VisualObjectDB> BeoSub::itsFrontVODB [protected] |
front object db
Definition at line 272 of file BeoSub.H.
Referenced by recognizeSIFT(), and start1().
OModelParam<std::string> BeoSub::itsFrontVODBfname [protected] |
pthread_mutex_t BeoSub::itsLock [protected] |
lock to control access to our internal data
Definition at line 321 of file BeoSub.H.
Referenced by BeoSub(), diveAbs(), diveRel(), getCurrentAttitude(), getTargetAttitude(), pitchAbs(), targetReached(), turnAbs(), BeoSubSim::updateCompass(), BeoSubOneBal::updateCompass(), BeoSubOneBal::updateDepth(), BeoSubSim::updateDepth(), and ~BeoSub().
Timer BeoSub::itsMasterClock [protected] |
our master clock, unit is useconds
Definition at line 278 of file BeoSub.H.
Referenced by getSaliencyMap(), getTime(), BeoSubOneBal::setBallasts(), BeoSubSim::updateCompass(), BeoSubOneBal::updateCompass(), BeoSubOneBal::updateDepth(), BeoSubSim::updateDepth(), and waitMove().
Attitude BeoSub::itsTargetAttitude [protected] |
target (desired) Attitude of the sub
Definition at line 289 of file BeoSub.H.
Referenced by diveAbs(), BeoSubSim::diveAbs(), BeoSubSim::diveRel(), diveRel(), getTargetAttitude(), pitchAbs(), targetReached(), turnAbs(), BeoSubSim::turnAbs(), BeoSubSim::turnRel(), BeoSubOneBal::updateCompass(), and BeoSubOneBal::updateDepth().
rutz::shared_ptr<BeoSubDB> BeoSub::itsUpDB [protected] |
std::string BeoSub::itsUpDBfname [protected] |
rutz::shared_ptr<VisualObjectDB> BeoSub::itsUpVODB [protected] |
OModelParam<std::string> BeoSub::itsUpVODBfname [protected] |
nub::soft_ref<RawVisualCortex> BeoSub::itsVisualCortex [protected] |
To compute saliency maps.
Definition at line 290 of file BeoSub.H.
Referenced by BeoSub(), and getSaliencyMap().