Definition and access functions for the BeoSub. More...
#include <BeoSub/BeoSubSim.H>
Public Member Functions | |
void | updateCompass (const Angle heading, const Angle pitch, const Angle roll) |
Update compass - used by sensors. | |
void | updateDepth (const float depth) |
Update depth - used by sensors. | |
void | updatePosition (const float z, const float x) |
Update position. | |
float | getCurrentZ () |
float | getCurrentX () |
float | getRelDist () |
bool | isStrafing () |
void | setStrafing (const bool s=false) |
void | setUpGrabFlag (const bool s=false) |
bool | getUpGrabFlag () |
void | setDownGrabFlag (const bool s=false) |
bool | getDownGrabFlag () |
void | setFrontGrabFlag (const bool s=false) |
bool | getFrontGrabFlag () |
void | useDepthPID (const bool useit) |
Turn depth PID on/off. | |
void | useHeadingPID (const bool useit) |
Turn heading PID on/off. | |
void | usePitchPID (const bool useit) |
Turn pitch PID on/off. | |
Constructors and Destructors | |
BeoSubSim (OptionManager &mgr) | |
Constructor. | |
~BeoSubSim () | |
Destructor. | |
mid-level overloads | |
virtual void | advanceRel (const float relDist, const bool stop=true) |
Advance the sub by some distance in meters. | |
virtual void | strafeRel (const float relDist) |
Strafe the sub by some distance in meters. | |
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. | |
void | turnOpen (const Angle relHeading, const bool blocking=false) |
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. | |
Low-level access functions | |
void | thrust (const float leftval, const float rightval) |
Activate the thrusters. | |
void | getThrusters (float &leftval, float &rightval) const |
Get the current thruster settings. | |
void | setFrontBallast (const float val, const bool blocking=false) |
Set the front ballast. Value is between 0.0 (empty) and 1.0 (full). | |
void | setRearBallast (const float val, const bool blocking=false) |
Set the rear ballast. Value is between 0.0 (empty) and 1.0 (full). | |
void | setBallasts (const float f, const float r, const bool blocking=false) |
Set all ballasts. | |
float | getFrontBallast () const |
Get the front ballast. Value is between 0.0 (empty) and 1.0 (full). | |
float | getRearBallast () const |
Get the rear ballast. Value is between 0.0 (empty) and 1.0 (full). | |
void | getBallasts (float &f, float &r) const |
Get all ballasts. | |
virtual void | dropMarker (const bool blocking=false) |
Drop a marker. | |
virtual Image< PixRGB< byte > > | grabImage (const enum BeoSubCamera cam) const |
Grab a an image from one of the cameras. | |
Protected Member Functions | |
void | start1 () |
get started, before our subcomponents start | |
void | start2 () |
get started, after our subcomponents have started | |
Protected Attributes | |
NModelParam< int > | itsLeftThrusterServoNum |
servo num for left thruster | |
NModelParam< int > | itsRightThrusterServoNum |
servo num for right thruster | |
nub::soft_ref< HMR3300 > | itsHMR3300 |
compass for heading | |
nub::soft_ref< BeoChip > | itsBeo |
our beochip | |
nub::soft_ref< BeoSubBallast > | itsFballast |
nub::soft_ref< BeoSubBallast > | itsRballast |
our 2 ballasts | |
nub::soft_ref< BeoSubIMU > | itsIMU |
our IMU | |
nub::soft_ref< FrameIstream > | itsCameraFront |
nub::soft_ref< FrameIstream > | itsCameraDown |
nub::soft_ref< FrameIstream > | itsCameraUp |
our three cameras | |
float | itsThrustLeft |
float | itsThrustRight |
our current thruster settings | |
float | relDistance |
bool | isStrafe |
int | imageCounter |
float | itsCurrentZ |
float | itsCurrentX |
bool | upImageFlag |
bool | frontImageFlag |
bool | downImageFlag |
BeoSubSensor< float > | itsDepthSensor |
sensor cleaner for depth | |
BeoSubSensor< Angle > | itsHeadingSensor |
sensor cleaner for heading | |
BeoSubSensor< Angle > | itsPitchSensor |
sensor cleaner for pitch | |
PID< float > | itsDepthPID |
PID for depth stabilization. | |
PID< Angle > | itsHeadingPID |
PID for heading stabilization. | |
PID< Angle > | itsPitchPID |
PID for pitch stabilization. | |
bool | itsDepthPIDon |
bool | itsHeadingPIDon |
bool | itsPitchPIDon |
Friends | |
class | BeoSubListener |
class | HMRlistener |
Definition and access functions for the BeoSub.
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
Definition at line 55 of file BeoSubSim.H.
BeoSubSim::BeoSubSim | ( | OptionManager & | mgr | ) |
Constructor.
Class definition for BeoSubListener.
This is the listener class that is attached to each BeoChip in the ballast tube of the submarine. This class is just a pass-through to the function dispatchBeoChipEvent() of class BeoSubOneBal.
Definition at line 97 of file BeoSubSim.C.
BeoSubSim::~BeoSubSim | ( | ) |
Destructor.
Definition at line 126 of file BeoSubSim.C.
void BeoSubSim::advanceRel | ( | const float | relDist, | |
const bool | stop = true | |||
) | [virtual] |
Advance the sub by some distance in meters.
This is an overload of BeoSub::advanceRel() which ensures we turn off the heading PID during the advance
Implements BeoSub.
Definition at line 290 of file BeoSubSim.C.
References thrust().
void BeoSubSim::diveAbs | ( | const float | finalDepth, | |
const bool | blocking = false | |||
) |
Makes the sub dive to a specific depth in meters.
Reimplemented from BeoSub.
Definition at line 320 of file BeoSubSim.C.
References Attitude::depth, and BeoSub::itsTargetAttitude.
void BeoSubSim::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 from BeoSub.
Definition at line 324 of file BeoSubSim.C.
References Attitude::depth, BeoSub::itsCurrentAttitude, and BeoSub::itsTargetAttitude.
void BeoSubSim::dropMarker | ( | const bool | blocking = false |
) | [virtual] |
void BeoSubSim::getBallasts | ( | float & | f, | |
float & | r | |||
) | const |
Get all ballasts.
Definition at line 243 of file BeoSubSim.C.
float BeoSubSim::getFrontBallast | ( | ) | const |
Get the front ballast. Value is between 0.0 (empty) and 1.0 (full).
Definition at line 235 of file BeoSubSim.C.
float BeoSubSim::getRearBallast | ( | ) | const |
Get the rear ballast. Value is between 0.0 (empty) and 1.0 (full).
Definition at line 239 of file BeoSubSim.C.
void BeoSubSim::getThrusters | ( | float & | leftval, | |
float & | rightval | |||
) | const |
Get the current thruster settings.
Definition at line 218 of file BeoSubSim.C.
References itsThrustRight.
Image< PixRGB< byte > > BeoSubSim::grabImage | ( | const enum BeoSubCamera | cam | ) | const [virtual] |
Grab a an image from one of the cameras.
Implements BeoSub.
Definition at line 261 of file BeoSubSim.C.
References Raster::ReadRGB(), and sformat().
void BeoSubSim::setBallasts | ( | const float | f, | |
const float | r, | |||
const bool | blocking = false | |||
) |
void BeoSubSim::setFrontBallast | ( | const float | val, | |
const bool | blocking = false | |||
) |
Set the front ballast. Value is between 0.0 (empty) and 1.0 (full).
Definition at line 222 of file BeoSubSim.C.
void BeoSubSim::setRearBallast | ( | const float | val, | |
const bool | blocking = false | |||
) |
Set the rear ballast. Value is between 0.0 (empty) and 1.0 (full).
Definition at line 226 of file BeoSubSim.C.
void BeoSubSim::start1 | ( | ) | [protected, virtual] |
get started, before our subcomponents start
Reimplemented from BeoSub.
Definition at line 130 of file BeoSubSim.C.
void BeoSubSim::start2 | ( | ) | [protected, virtual] |
get started, after our subcomponents have started
Reimplemented from ModelComponent.
Definition at line 140 of file BeoSubSim.C.
References setBallasts().
void BeoSubSim::strafeRel | ( | const float | relDist | ) | [virtual] |
Strafe the sub by some distance in meters.
this is an overload of BeoSub::strafeRel() which ensures we turn the heading PID off during the strafe
Reimplemented from BeoSub.
Definition at line 298 of file BeoSubSim.C.
void BeoSubSim::thrust | ( | const float | leftval, | |
const float | rightval | |||
) |
Activate the thrusters.
Values should be between -1.0 (full reverse) and 1.0 (full forward), 0.0 being no motion
Definition at line 211 of file BeoSubSim.C.
References itsThrustRight.
Referenced by advanceRel().
void BeoSubSim::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 from BeoSub.
Definition at line 304 of file BeoSubSim.C.
References BeoSub::itsTargetAttitude.
void BeoSubSim::turnRel | ( | const Angle | relHeading, | |
const bool | blocking = false | |||
) |
Turns the sub to the given heading relative to our current heading.
Reimplemented from BeoSub.
Definition at line 308 of file BeoSubSim.C.
References BeoSub::itsCurrentAttitude, and BeoSub::itsTargetAttitude.
Update compass - used by sensors.
Definition at line 168 of file BeoSubSim.C.
References Timer::getSecs(), BeoSub::itsCurrentAttitude, BeoSub::itsLock, and BeoSub::itsMasterClock.
void BeoSubSim::updateDepth | ( | const float | depth | ) |
Update depth - used by sensors.
Definition at line 190 of file BeoSubSim.C.
References Attitude::depth, Timer::getSecs(), BeoSub::itsCurrentAttitude, itsDepthSensor, BeoSub::itsLock, BeoSub::itsMasterClock, BeoSubSensor< T >::newMeasurement(), and Attitude::pressureTime.
void BeoSubSim::updatePosition | ( | const float | z, | |
const float | x | |||
) |
Update position.
Definition at line 206 of file BeoSubSim.C.
void BeoSubSim::useDepthPID | ( | const bool | useit | ) |
Turn depth PID on/off.
Definition at line 329 of file BeoSubSim.C.
void BeoSubSim::useHeadingPID | ( | const bool | useit | ) |
Turn heading PID on/off.
Definition at line 333 of file BeoSubSim.C.
void BeoSubSim::usePitchPID | ( | const bool | useit | ) |
Turn pitch PID on/off.
Definition at line 337 of file BeoSubSim.C.
nub::soft_ref<BeoChip> BeoSubSim::itsBeo [protected] |
our beochip
Definition at line 165 of file BeoSubSim.H.
nub::soft_ref<FrameIstream> BeoSubSim::itsCameraUp [protected] |
our three cameras
Definition at line 168 of file BeoSubSim.H.
PID<float> BeoSubSim::itsDepthPID [protected] |
PID for depth stabilization.
Definition at line 180 of file BeoSubSim.H.
BeoSubSensor<float> BeoSubSim::itsDepthSensor [protected] |
PID<Angle> BeoSubSim::itsHeadingPID [protected] |
PID for heading stabilization.
Definition at line 181 of file BeoSubSim.H.
BeoSubSensor<Angle> BeoSubSim::itsHeadingSensor [protected] |
sensor cleaner for heading
Definition at line 178 of file BeoSubSim.H.
nub::soft_ref<HMR3300> BeoSubSim::itsHMR3300 [protected] |
compass for heading
Definition at line 164 of file BeoSubSim.H.
nub::soft_ref<BeoSubIMU> BeoSubSim::itsIMU [protected] |
our IMU
Definition at line 167 of file BeoSubSim.H.
NModelParam<int> BeoSubSim::itsLeftThrusterServoNum [protected] |
servo num for left thruster
Definition at line 161 of file BeoSubSim.H.
PID<Angle> BeoSubSim::itsPitchPID [protected] |
PID for pitch stabilization.
Definition at line 182 of file BeoSubSim.H.
BeoSubSensor<Angle> BeoSubSim::itsPitchSensor [protected] |
sensor cleaner for pitch
Definition at line 179 of file BeoSubSim.H.
nub::soft_ref<BeoSubBallast> BeoSubSim::itsRballast [protected] |
our 2 ballasts
Definition at line 166 of file BeoSubSim.H.
NModelParam<int> BeoSubSim::itsRightThrusterServoNum [protected] |
servo num for right thruster
Definition at line 162 of file BeoSubSim.H.
float BeoSubSim::itsThrustRight [protected] |
our current thruster settings
Definition at line 170 of file BeoSubSim.H.
Referenced by getThrusters(), and thrust().