added gy80 dcm
Dependencies: mbed DCM_AHRS_GY80 PID MMA8451Q
Fork of quadCommand by
Diff: quadCommand/quadCommand.cpp
- Revision:
- 8:72791d8c36b7
- Parent:
- 4:ce6ad16337c5
- Child:
- 9:9e0d0ba5b6b1
- Child:
- 15:92ecb025fbc5
diff -r 94f75781e2e7 -r 72791d8c36b7 quadCommand/quadCommand.cpp --- a/quadCommand/quadCommand.cpp Sun Jun 09 23:08:43 2013 +0000 +++ b/quadCommand/quadCommand.cpp Sun Jun 09 23:36:31 2013 +0000 @@ -4,6 +4,8 @@ #include "quadCommand.h" +const float quadCommand::MOTOR_UPDATE(20.0); + quadCommand::quadCommand() { myCom = new com( TXPIN, RXPIN ); // Setup com object. @@ -43,12 +45,14 @@ rxRoll = command[1]; if( command[0] == 4 ) // Yaw command. - rxYaw = command[1]; - - myMotors[ 0 ]->setSpeed( rxThrottle + rxPitch - rxRoll ); // Motor 1 - myMotors[ 1 ]->setSpeed( rxThrottle + rxPitch + rxRoll ); // Motor 2 - myMotors[ 2 ]->setSpeed( rxThrottle - rxPitch + rxRoll ); // Motor 3 - myMotors[ 3 ]->setSpeed( rxThrottle - rxPitch - rxRoll ); // Motor 4 + rxYaw = command[1]; +} + +void quadCommand::updateMotors() { + myMotors[ 0 ]->setSpeed( rxThrottle + rxPitch - rxRoll - rxYaw); // Motor 1 + myMotors[ 1 ]->setSpeed( rxThrottle + rxPitch + rxRoll + rxYaw); // Motor 2 + myMotors[ 2 ]->setSpeed( rxThrottle - rxPitch + rxRoll - rxYaw); // Motor 3 + myMotors[ 3 ]->setSpeed( rxThrottle - rxPitch - rxRoll + rxYaw); // Motor 4 delete[] command; } \ No newline at end of file