ESE350 project, Spring 2016, University of Pennsylvania
Dependencies: Adafruit9-DOf Receiver mbed-rtos mbed
Diff: quadcopter.cpp
- Revision:
- 11:5c54826d23a7
- Parent:
- 10:e7d1801e966a
- Child:
- 12:422963993df5
diff -r e7d1801e966a -r 5c54826d23a7 quadcopter.cpp --- a/quadcopter.cpp Sat Apr 02 17:41:37 2016 +0000 +++ b/quadcopter.cpp Sat Apr 02 18:01:36 2016 +0000 @@ -43,6 +43,13 @@ if (dof_.magGetOrientation(SENSOR_AXIS_Z, &mag_event_, &orientation_)) { } + gyro_.getEvent(&gyro_event_); + + gyro_event_.gyro.x -= offsetAngRate_.x; + gyro_event_.gyro.y -= offsetAngRate_.y; + gyro_event_.gyro.z -= offsetAngRate_.z; + + // measured values (will come from IMU/parameter class/Input to function later) // angles state_.phi = orientation_.roll; @@ -90,4 +97,14 @@ -} \ No newline at end of file +} + +motors getPwm() +{ + motors motorPwm_; + motorPwm_.m1=0; + motorPwm_.m2=0.6+controlInput_.mx/100; + motorPwm_.m3=0; + motorPwm_.m4=0.6-controlInput_.mx/100; + return motorPwm; +}