BeeStem3.H
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef BeeStem3_H_DEFINED
00041 #define BeeStem3_H_DEFINED
00042
00043 #include "Component/ModelComponent.H"
00044 #include "Component/ModelParam.H"
00045 #include "Devices/Serial.H"
00046 #include "Util/Types.H"
00047 #include <string>
00048 #include <vector>
00049
00050 #define PID_DEPTH 0
00051 #define PID_HEADING 1
00052 #define PID_ENABLE 3
00053 #define PID_DISABLE 2
00054
00055 #define DESIRED_DEPTH 0
00056 #define DESIRED_HEADING 1
00057
00058 class Serial;
00059
00060 class BeeStem3 : public ModelComponent
00061 {
00062 public:
00063 const static int NUM_MOTOR_CONTROLLERS = 9;
00064 struct MotorControllerIDs
00065 {
00066 const static int FWD_RIGHT_THRUSTER = 3;
00067 const static int FWD_LEFT_THRUSTER = 1;
00068 const static int DEPTH_RIGHT_THRUSTER = 4;
00069 const static int DEPTH_LEFT_THRUSTER = 2;
00070 const static int STRAFE_FRONT_THRUSTER = 0;
00071 const static int STRAFE_BACK_THRUSTER = 5;
00072 const static int SHOOTER = 6;
00073 const static int DROPPER_STAGE1 = 7;
00074 const static int DROPPER_STAGE2 = 8;
00075 };
00076
00077 BeeStem3(OptionManager& mgr,
00078 const std::string& descrName = "BeeStem3 Driver",
00079 const std::string& tagName = "BeeStem3",
00080 const char *defdev = "/dev/ttyUSB0");
00081
00082
00083 ~BeeStem3();
00084
00085 bool getSensors(int &accelX, int &accelY, int &accelZ,
00086 int &compassHeading, int &compassPitch, int &compassRoll,
00087 int &internalPressure, int &externalPressure,
00088 int &desiredHeading, int &desiredDepth, int &desiredSpeed,
00089 int &headingK, int &headingP, int &headingD, int &headingI, int &headingOutput,
00090 int &depthK, int &depthP, int &depthD, int &depthI, int &depthOutput, char &killSwitch);
00091
00092
00093 bool setPID(int pidMode, float k, float p, float i, float d);
00094
00095
00096 bool setDesiredHeading(int16 heading);
00097 bool setDesiredDepth(int16 depth);
00098 bool setDesiredSpeed(char speed);
00099 void setThruster(int num, int val);
00100 void startCompassCalibration();
00101 void endCompassCalibration();
00102
00103 std::vector<int> mMotorControllerState;
00104
00105 protected:
00106 nub::soft_ref<Serial> itsPort;
00107 pthread_mutex_t itsSerialLock;
00108 };
00109
00110 #endif
00111
00112
00113
00114
00115
00116