NOT FINISHED YET!!! My first try to get a self built fully working Quadrocopter based on an mbed, a self built frame and some other more or less cheap parts.
Diff: Mixer/Mixer.cpp
- Revision:
- 29:8b7362a2ee14
- Parent:
- 28:ba6ca9f4def4
- Child:
- 30:021e13b62575
--- a/Mixer/Mixer.cpp Sat Dec 01 07:13:04 2012 +0000 +++ b/Mixer/Mixer.cpp Sat Dec 15 08:42:36 2012 +0000 @@ -6,23 +6,25 @@ Motor_speed[i]=0; } -void Mixer::compute(unsigned long dt, const float * angle, int Throttle, const float * controller_value) +void Mixer::compute(unsigned long dt, int Throttle, const float * controller_value) { // Calculate new motorspeeds for(int i=0; i<4; i++) Motor_speed[i] = Throttle; - Motor_speed[1] += +controller_value[0]; // Roll - Motor_speed[3] -= -controller_value[0]; + Motor_speed[1] -= controller_value[0]; // Roll + Motor_speed[3] += controller_value[0]; + + Motor_speed[0] -= controller_value[1]; // Pitch + Motor_speed[2] += controller_value[1]; - Motor_speed[0] += controller_value[1]; // Pitch - Motor_speed[2] -= controller_value[1]; - - Motor_speed[1] += controller_value[2]; // Yaw - Motor_speed[3] += controller_value[2]; - Motor_speed[0] -= controller_value[2]; - Motor_speed[2] -= controller_value[2]; + #if 0 + Motor_speed[1] -= controller_value[2]; // Yaw + Motor_speed[3] -= controller_value[2]; + Motor_speed[0] += controller_value[2]; + Motor_speed[2] += controller_value[2]; + #endif for(int i = 0; i < 4; i++) // make shure no motor stands still Motor_speed[i] = Motor_speed[i] > 50 ? Motor_speed[i] : 50;