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:
- 28:ba6ca9f4def4
- Parent:
- 26:96a072233d7a
- Child:
- 29:8b7362a2ee14
--- a/Mixer/Mixer.cpp Wed Nov 28 12:29:02 2012 +0000 +++ b/Mixer/Mixer.cpp Sat Dec 01 07:13:04 2012 +0000 @@ -9,22 +9,20 @@ void Mixer::compute(unsigned long dt, const float * angle, int Throttle, const float * controller_value) { // Calculate new motorspeeds - // Pitch - Motor_speed[0] = Throttle +controller_value[1]; - Motor_speed[2] = Throttle -controller_value[1]; + + for(int i=0; i<4; i++) + Motor_speed[i] = Throttle; + + Motor_speed[1] += +controller_value[0]; // Roll + Motor_speed[3] -= -controller_value[0]; - #if 1 - // Roll - Motor_speed[1] = Throttle +controller_value[0]; - Motor_speed[3] = Throttle -controller_value[0]; - - /*// Yaw - Motor_speed[0] -= controller_value[2]; - Motor_speed[2] -= controller_value[2]; - - Motor_speed[1] += controller_value[2]; - Motor_speed[3] += controller_value[2];*/ - #endif + 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]; for(int i = 0; i < 4; i++) // make shure no motor stands still Motor_speed[i] = Motor_speed[i] > 50 ? Motor_speed[i] : 50;