Definition and access functions for the BeoSub. More...
#include <BeoSub/BeoSubOneBal.H>
Public Member Functions | |
void | setRotVel (const Angle desired) |
void | setTransVel (const float desired) |
Constructors and Destructors | |
BeoSubOneBal (OptionManager &mgr) | |
Constructor. | |
~BeoSubOneBal () | |
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) |
Strafes the sub by some distance in meters. | |
virtual void | turnOpen (const Angle openHeading, const bool stop=true) |
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. | |
PID control | |
void | useDepthPID (const bool useit) |
Turn depth PID on/off. | |
void | setDepthPgain (float p) |
set depth PID pgain | |
void | setDepthIgain (float i) |
set depth PID igain | |
void | setDepthDgain (float d) |
set depth PID dgain | |
void | useHeadingPID (const bool useit) |
Turn heading PID on/off. | |
void | setHeadingPgain (float p) |
set heading PID pgain | |
void | setHeadingIgain (float i) |
set heading PID igain | |
void | setHeadingDgain (float d) |
set heading PID dgain | |
void | usePitchPID (const bool useit) |
Turn pitch PID on/off. | |
void | setPitchPgain (float p) |
set pitch PID pgain | |
void | setPitchIgain (float i) |
set pitch PID igain | |
void | setPitchDgain (float d) |
set pitch PID dgain | |
void | useRotVelPID (const bool useit) |
Turn pitch PID on/off. | |
void | setRotVelPgain (float p) |
set pitch PID pgain | |
void | setRotVelIgain (float i) |
set pitch PID igain | |
void | setRotVelDgain (float d) |
set pitch PID dgain | |
Miscellaneous | |
void | useKillSwitch (const bool useit) |
Use or ignore the kill switch. | |
bool | isKilled () |
void | killSwitch () |
Kill Switch Function. | |
For internal use by our listeners only -- do not call | |
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 | updateIMU (const float xa, const float ya, const float za, const Angle xv, const Angle yv, const Angle zv) |
Public Attributes | |
nub::soft_ref< BeoSubIMU > | itsIMU |
our IMU | |
Protected Member Functions | |
virtual void | start1 () |
get started, before our subcomponents start | |
virtual void | start2 () |
get started, after our subcomponents have started | |
virtual void | stop1 () |
This is called from within stop() before the subcomponents stop. | |
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< FrameIstream > | itsCameraFront |
nub::soft_ref< FrameIstream > | itsCameraDown |
nub::soft_ref< FrameIstream > | itsCameraUp |
our three cameras | |
float | itsThrustLeft |
float | itsThrustRight |
our current thruster settings | |
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. | |
PID< Angle > | itsRotVelPID |
PID for rotational velocity stabilization. | |
bool | itsDepthPIDon |
bool | itsHeadingPIDon |
bool | itsPitchPIDon |
bool | itsRotVelPIDon |
bool | itsKillSwitchUsed |
float | itsDiveSetting |
float | itsPitchSetting |
double | itsLastHeadingTime |
double | itsLastPitchTime |
double | itsLastDepthTime |
nub::soft_ref< ParPort > | lp0 |
Stepper | markerdropper |
int | killSwitchDebounceCounter |
Friends | |
class | BeoSubListener |
class | HMRlistener |
Definition and access functions for the BeoSub.
BeoSub is an autonomous visually-guided submarine. This class impoements the highl-evel functionality, relying on low-level drivers to handle motor activation, compass reading, etc
Definition at line 57 of file BeoSubOneBal.H.
BeoSubOneBal::BeoSubOneBal | ( | OptionManager & | mgr | ) |
Constructor.
Definition at line 136 of file BeoSubOneBal.C.
References ModelComponent::addSubComponent(), itsBeo, itsCameraUp, itsHMR3300, itsIMU, itsRballast, MC_RECURSE, and nub::soft_ref< T >::reset().
BeoSubOneBal::~BeoSubOneBal | ( | ) |
Destructor.
Definition at line 229 of file BeoSubOneBal.C.
void BeoSubOneBal::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 319 of file BeoSubOneBal.C.
References Angle::getRadians(), and useHeadingPID().
Referenced by strafeRel().
void BeoSubOneBal::dropMarker | ( | const bool | blocking = false |
) | [virtual] |
void BeoSubOneBal::getBallasts | ( | float & | f, | |
float & | r | |||
) | const |
Get all ballasts.
Definition at line 614 of file BeoSubOneBal.C.
References nub::soft_ref< T >::get(), and itsRballast.
float BeoSubOneBal::getFrontBallast | ( | ) | const |
Get the front ballast. Value is between 0.0 (empty) and 1.0 (full).
Definition at line 606 of file BeoSubOneBal.C.
References nub::soft_ref< T >::get().
float BeoSubOneBal::getRearBallast | ( | ) | const |
Get the rear ballast. Value is between 0.0 (empty) and 1.0 (full).
Definition at line 610 of file BeoSubOneBal.C.
References nub::soft_ref< T >::get(), and itsRballast.
void BeoSubOneBal::getThrusters | ( | float & | leftval, | |
float & | rightval | |||
) | const |
Get the current thruster settings.
Definition at line 572 of file BeoSubOneBal.C.
References itsThrustRight.
Image< PixRGB< byte > > BeoSubOneBal::grabImage | ( | const enum BeoSubCamera | cam | ) | const [virtual] |
Grab a an image from one of the cameras.
Implements BeoSub.
Definition at line 760 of file BeoSubOneBal.C.
References itsCameraUp.
void BeoSubOneBal::killSwitch | ( | ) |
Kill Switch Function.
This is called when the kill switch is activated
Definition at line 628 of file BeoSubOneBal.C.
References setBallasts(), useDepthPID(), useHeadingPID(), usePitchPID(), and useRotVelPID().
void BeoSubOneBal::setBallasts | ( | const float | f, | |
const float | r, | |||
const bool | blocking = false | |||
) |
Set all ballasts.
Definition at line 584 of file BeoSubOneBal.C.
References Timer::getSecs(), BeoSub::itsMasterClock, and itsRballast.
Referenced by killSwitch(), start2(), stop1(), updateCompass(), and updateDepth().
void BeoSubOneBal::setDepthDgain | ( | float | d | ) |
void BeoSubOneBal::setDepthIgain | ( | float | i | ) |
void BeoSubOneBal::setDepthPgain | ( | float | p | ) |
set depth PID pgain
Definition at line 802 of file BeoSubOneBal.C.
References itsDepthPID, and PID< T >::setPIDPgain().
void BeoSubOneBal::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 576 of file BeoSubOneBal.C.
void BeoSubOneBal::setHeadingDgain | ( | float | d | ) |
void BeoSubOneBal::setHeadingIgain | ( | float | i | ) |
void BeoSubOneBal::setHeadingPgain | ( | float | p | ) |
set heading PID pgain
Definition at line 814 of file BeoSubOneBal.C.
References itsHeadingPID, and PID< T >::setPIDPgain().
void BeoSubOneBal::setPitchDgain | ( | float | d | ) |
void BeoSubOneBal::setPitchIgain | ( | float | i | ) |
void BeoSubOneBal::setPitchPgain | ( | float | p | ) |
set pitch PID pgain
Definition at line 826 of file BeoSubOneBal.C.
References itsPitchPID, and PID< T >::setPIDPgain().
void BeoSubOneBal::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 580 of file BeoSubOneBal.C.
References itsRballast.
void BeoSubOneBal::setRotVelDgain | ( | float | d | ) |
void BeoSubOneBal::setRotVelIgain | ( | float | i | ) |
void BeoSubOneBal::setRotVelPgain | ( | float | p | ) |
set pitch PID pgain
Definition at line 838 of file BeoSubOneBal.C.
References itsRotVelPID, and PID< T >::setPIDPgain().
void BeoSubOneBal::start1 | ( | ) | [protected, virtual] |
get started, before our subcomponents start
Reimplemented from BeoSub.
Definition at line 233 of file BeoSubOneBal.C.
References itsCameraUp.
void BeoSubOneBal::start2 | ( | ) | [protected, virtual] |
get started, after our subcomponents have started
Reimplemented from ModelComponent.
Definition at line 268 of file BeoSubOneBal.C.
References itsBeo, and setBallasts().
void BeoSubOneBal::stop1 | ( | ) | [protected, virtual] |
This is called from within stop() before the subcomponents stop.
Reimplemented from ModelComponent.
Definition at line 304 of file BeoSubOneBal.C.
References setBallasts(), useDepthPID(), useHeadingPID(), usePitchPID(), and useRotVelPID().
void BeoSubOneBal::strafeRel | ( | const float | relDist | ) | [virtual] |
Strafes 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 391 of file BeoSubOneBal.C.
References advanceRel(), and BeoSub::turnRel().
void BeoSubOneBal::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 558 of file BeoSubOneBal.C.
References NModelParam< T >::getVal(), itsBeo, itsLeftThrusterServoNum, itsRightThrusterServoNum, and itsThrustRight.
Update compass - used by sensors.
Definition at line 446 of file BeoSubOneBal.C.
References Timer::getSecs(), BeoSubSensor< T >::getValue(), BeoSub::itsCurrentAttitude, itsHeadingPID, itsHeadingSensor, BeoSub::itsLock, BeoSub::itsMasterClock, itsPitchPID, itsPitchSensor, BeoSub::itsTargetAttitude, BeoSubSensor< T >::newMeasurement(), Attitude::roll, setBallasts(), and PID< T >::update().
Referenced by HMRlistener::newData().
void BeoSubOneBal::updateDepth | ( | const float | depth | ) |
Update depth - used by sensors.
Definition at line 514 of file BeoSubOneBal.C.
References Attitude::depth, Timer::getSecs(), BeoSubSensor< T >::getValue(), BeoSub::itsCurrentAttitude, itsDepthPID, itsDepthSensor, BeoSub::itsLock, BeoSub::itsMasterClock, BeoSub::itsTargetAttitude, BeoSubSensor< T >::newMeasurement(), Attitude::pressureTime, setBallasts(), and PID< T >::update().
void BeoSubOneBal::useDepthPID | ( | const bool | useit | ) |
Turn depth PID on/off.
Definition at line 770 of file BeoSubOneBal.C.
Referenced by killSwitch(), and stop1().
void BeoSubOneBal::useHeadingPID | ( | const bool | useit | ) |
Turn heading PID on/off.
Definition at line 774 of file BeoSubOneBal.C.
Referenced by advanceRel(), killSwitch(), and stop1().
void BeoSubOneBal::useKillSwitch | ( | const bool | useit | ) |
Use or ignore the kill switch.
Definition at line 785 of file BeoSubOneBal.C.
void BeoSubOneBal::usePitchPID | ( | const bool | useit | ) |
Turn pitch PID on/off.
Definition at line 778 of file BeoSubOneBal.C.
Referenced by killSwitch(), and stop1().
void BeoSubOneBal::useRotVelPID | ( | const bool | useit | ) |
Turn pitch PID on/off.
Definition at line 781 of file BeoSubOneBal.C.
Referenced by killSwitch(), and stop1().
nub::soft_ref<BeoChip> BeoSubOneBal::itsBeo [protected] |
our beochip
Definition at line 232 of file BeoSubOneBal.H.
Referenced by BeoSubOneBal(), start2(), and thrust().
nub::soft_ref<FrameIstream> BeoSubOneBal::itsCameraUp [protected] |
our three cameras
Definition at line 235 of file BeoSubOneBal.H.
Referenced by BeoSubOneBal(), grabImage(), and start1().
PID<float> BeoSubOneBal::itsDepthPID [protected] |
PID for depth stabilization.
Definition at line 242 of file BeoSubOneBal.H.
Referenced by setDepthDgain(), setDepthIgain(), setDepthPgain(), and updateDepth().
BeoSubSensor<float> BeoSubOneBal::itsDepthSensor [protected] |
sensor cleaner for depth
Definition at line 239 of file BeoSubOneBal.H.
Referenced by updateDepth().
PID<Angle> BeoSubOneBal::itsHeadingPID [protected] |
PID for heading stabilization.
Definition at line 243 of file BeoSubOneBal.H.
Referenced by setHeadingDgain(), setHeadingIgain(), setHeadingPgain(), and updateCompass().
BeoSubSensor<Angle> BeoSubOneBal::itsHeadingSensor [protected] |
sensor cleaner for heading
Definition at line 240 of file BeoSubOneBal.H.
Referenced by updateCompass().
nub::soft_ref<HMR3300> BeoSubOneBal::itsHMR3300 [protected] |
NModelParam<int> BeoSubOneBal::itsLeftThrusterServoNum [protected] |
PID<Angle> BeoSubOneBal::itsPitchPID [protected] |
PID for pitch stabilization.
Definition at line 244 of file BeoSubOneBal.H.
Referenced by setPitchDgain(), setPitchIgain(), setPitchPgain(), and updateCompass().
BeoSubSensor<Angle> BeoSubOneBal::itsPitchSensor [protected] |
sensor cleaner for pitch
Definition at line 241 of file BeoSubOneBal.H.
Referenced by updateCompass().
nub::soft_ref<BeoSubBallast> BeoSubOneBal::itsRballast [protected] |
our 2 ballasts
Definition at line 233 of file BeoSubOneBal.H.
Referenced by BeoSubOneBal(), getBallasts(), getRearBallast(), setBallasts(), and setRearBallast().
NModelParam<int> BeoSubOneBal::itsRightThrusterServoNum [protected] |
PID<Angle> BeoSubOneBal::itsRotVelPID [protected] |
PID for rotational velocity stabilization.
Definition at line 245 of file BeoSubOneBal.H.
Referenced by setRotVelDgain(), setRotVelIgain(), and setRotVelPgain().
float BeoSubOneBal::itsThrustRight [protected] |
our current thruster settings
Definition at line 237 of file BeoSubOneBal.H.
Referenced by getThrusters(), and thrust().