ESE350 project, Spring 2016, University of Pennsylvania
Dependencies: Adafruit9-DOf Receiver mbed-rtos mbed
Diff: quadcopter.h
- Revision:
- 24:e220fbb70ded
- Parent:
- 22:92401a4fec13
- Child:
- 25:d44610851105
diff -r 04338a5ef404 -r e220fbb70ded quadcopter.h --- a/quadcopter.h Tue Apr 12 22:54:16 2016 +0000 +++ b/quadcopter.h Wed Apr 13 00:57:15 2016 +0000 @@ -26,9 +26,12 @@ }; typedef struct { - double x; - double y; - double z; + double gyro_x; + double gyro_y; + double gyro_z; + double roll; + double pitch; + double heading; } offset; struct motors { @@ -39,10 +42,11 @@ }; -class Quadcopter { +class Quadcopter +{ private: Serial *pc_; // use for printing - + // allow for remote communication MRF24J40 *mrf_; int rcIterations_; @@ -55,7 +59,7 @@ //pwmOut * _pwmOut; // give address to constructor, than change this value motors motorPwm_; PwmOut *motor1_; - + // declarations for IMU use Adafruit_9DOF dof_; Adafruit_LSM303_Accel_Unified accel_; @@ -65,17 +69,16 @@ sensors_event_t mag_event_; sensors_event_t gyro_event_; sensors_vec_t orientation_; - offset offsetAngRate_; - offset offsetAttitude_; // used later to compensate default tilt of IMU + offset* initial_offsets_; Serial *pcPntr_; // used to access serial communication - + double g_; // gravity [m/s^2] double m_; // mass [kg] double l_; // arm lenght [m] double gamma_; // relation between moment coefficient and force coefficient. - + // proportional attitude control gains double kp_f_; // gain converting radio input to thrust. double kp_phi_; @@ -100,14 +103,19 @@ void readRc(); motors getPwm(); - state getState(); + state getState(); + Adafruit_LSM303_Accel_Unified getAccel(); + Adafruit_LSM303_Mag_Unified getMag(); + Adafruit_L3GD20_Unified getGyro(); + Adafruit_9DOF getIMU(); + offset* getOffset(); float thrust; float yaw; float pitch; float roll; long long id; - + //void readJoystick(); // not implemented yet //void setGains();