ESE350 project, Spring 2016, University of Pennsylvania

Dependencies:   Adafruit9-DOf Receiver mbed-rtos mbed

Revision:
14:64b06476d943
Parent:
13:291ba30c7806
Child:
15:90e07946186f
--- a/quadcopter.h	Sat Apr 02 22:06:46 2016 +0000
+++ b/quadcopter.h	Thu Apr 07 02:07:33 2016 +0000
@@ -4,6 +4,8 @@
 #include "mbed.h"
 #include "Adafruit_9DOF.h"
 #include "Serial_base.h"
+#include "MRF24J40.h"
+
 
 // a few struct declarations. Can possibly eliminated using the vector class in STL
 struct state {
@@ -23,11 +25,11 @@
     double mz;
 };
 
-struct offset {
+typedef struct {
     double x;
     double y;
     double z;
-};
+} offset;
 
 struct motors {
     double m1;
@@ -37,14 +39,23 @@
 };
 
 
-class Quadcopter
-{
+class Quadcopter {
 private:
+    Serial *pc_; // use for printing
+    
+    // allow for remote communication
+    MRF24J40 *mrf_;
+    int rcIterations_;
+    int rcLength_;
+    Timer rcTimer_;
+    uint8_t rcChannel_;
+
     state state_;
     state desiredState_;
     controlInput controlInput_;
     //pwmOut * _pwmOut; // give address to constructor, than change this value
     motors motorPwm_;
+    PwmOut *motor1_;
     
     // declarations for IMU use
     Adafruit_9DOF dof_;
@@ -59,6 +70,7 @@
     offset offsetAttitude_; // used later to compensate default tilt of IMU
 
     Serial *pcPntr_; // used to access serial communication
+    
 
     double g_;  // gravity [m/s^2]
     double m_; // mass [kg]
@@ -76,19 +88,18 @@
     // desired force (will come from joystick)
     double F_des_; // desired thrust force (excluding weight compensation)
 
+public:
+    Quadcopter(Serial *pcPntr);  // constructor
 
-public:
-    Quadcopter(); // constructor
-    void setState(state *source, state *goal);
+    void setState(state *source, state *goal); // not sure if needed
     void controller();
     void readSensorValues();
-    void initAllSensors();
-    void setSerial(Serial *pcPntr) {
-        pcPntr_=pcPntr;
-    };
-    void print(char * myString); // overload in order to print numbers
+
+    void readRc();
+
     motors getPwm();
-
+    
+    //void readJoystick();
     // not implemented yet
     //void setGains();
     //void setPwm();