added gy80 dcm
Dependencies: mbed DCM_AHRS_GY80 PID MMA8451Q
Fork of quadCommand by
Diff: quadCommand/quadCommand.cpp
- Revision:
- 9:9e0d0ba5b6b1
- Parent:
- 8:72791d8c36b7
- Child:
- 12:15d129d681e9
- Child:
- 16:84c7db5b4464
--- a/quadCommand/quadCommand.cpp Sun Jun 09 23:36:31 2013 +0000 +++ b/quadCommand/quadCommand.cpp Sun Jun 09 23:56:44 2013 +0000 @@ -22,6 +22,10 @@ rxYaw = 0; } +/******************************* run() ***********************************/ +/* */ +/*************************************************************************/ + void quadCommand::run() { while(1) @@ -31,23 +35,31 @@ } } +/***************************** rxInput() *********************************/ +/* */ +/*************************************************************************/ + void quadCommand::rxInput() { short * command = myCom->read(); if( command[0] == 1 ) // Throttle command. - rxThrottle = command[1]; + targetThrottle = command[1]; if( command[0] == 2 ) // Pitch command. - rxPitch = command[1]; + targetPitch = command[1]; if( command[0] == 3 ) // Roll command. - rxRoll = command[1]; + targetRoll = command[1]; if( command[0] == 4 ) // Yaw command. - rxYaw = command[1]; + targetYaw = command[1]; } +/*************************** updateMotors() ******************************/ +/* */ +/*************************************************************************/ + void quadCommand::updateMotors() { myMotors[ 0 ]->setSpeed( rxThrottle + rxPitch - rxRoll - rxYaw); // Motor 1 myMotors[ 1 ]->setSpeed( rxThrottle + rxPitch + rxRoll + rxYaw); // Motor 2