ESE350 project, Spring 2016, University of Pennsylvania
Dependencies: Adafruit9-DOf Receiver mbed-rtos mbed
Diff: quadcopter.cpp
- Revision:
- 15:90e07946186f
- Parent:
- 14:64b06476d943
- Child:
- 16:2be2aab63198
diff -r 64b06476d943 -r 90e07946186f quadcopter.cpp --- a/quadcopter.cpp Thu Apr 07 02:07:33 2016 +0000 +++ b/quadcopter.cpp Thu Apr 07 21:14:27 2016 +0000 @@ -6,7 +6,7 @@ //#include "mbed.h" // constructor -Quadcopter::Quadcopter(Serial *pcPntr) +Quadcopter::Quadcopter(Serial *pcPntr, MRF24J40 *mrfPntr) { pc_= pcPntr; // enable printing // initSensors(accel_, mag_, gyro_, offsetAngRate_); // IMU @@ -35,10 +35,9 @@ // initSensors(accel_, mag_, gyro_, offsetAngRate_); // IMU // prepare for communication with remote control - MRF24J40 mrf_var(p11, p12, p13, p14, p21); - mrf_ = &mrf_var; // RF tranceiver to link with handheld. + mrf_ = mrfPntr; // RF tranceiver to link with handheld. rcIterations_ = 100; - rcLength_ = 50; + rcLength_ = 250; rcChannel_ = 3; } @@ -113,7 +112,6 @@ void Quadcopter::readRc() { - //write to class variables additional thrust double F_des_, desired state: phi, theta, psi. // RF tranceiver to link with handheld. @@ -148,7 +146,7 @@ for (int i = 0; i < rcIterations_; i++) { receive = rf_receive_rssi(*mrf_, rxBuffer, rssi, rcLength_ + 1); if (receive > 0) { - pc_->printf("%s \r\n", rxBuffer); + pc_->printf("RX: %s \r\n", rxBuffer); result = sscanf(rxBuffer, "%f,%f,%f,%f", &thrust, &yaw, &pitch, &roll); if (result != 4) { pc_->printf("Parse failure\r\n");