/*
www.ArduCopter.com - www.DIYDrones.com
Copyright (c) 2010. All rights reserved.
An Open Source Arduino based multicopter.
File : Mixer.pde
Version : v1.0, Aug 27, 2010
Author(s): ArduCopter Team
Jose Julio, Jordi Muñoz,
Jani Hirvinen, Roberto Navoni,
Sandro Benigno, Chris Anderson
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
* ************************************************************** *
ChangeLog:
* ************************************************************** *
TODO:
* ************************************************************** */
#ifdef USEMIXER
#include
float MotorPitch[MAX_MOTORS];
float MotorRoll[MAX_MOTORS];
float MotorYaw[MAX_MOTORS];
float MotorGas[MAX_MOTORS];
float motorAxisCommandPitch[MAX_MOTORS];
float motorAxisCommandRoll[MAX_MOTORS];
float motorAxisCommandYaw[MAX_MOTORS];
//float motorAxisCommand[3]; // Command on Roll YAW PITCH Recived from IMU
#if FRAME_MODEL == QUAD
// This is an example of QuadX configuration for mixertable
void init_mixer_table()
{
// Example for Quad configuration
MotorGas[0] = 100;
MotorPitch[0] = -100;
MotorRoll[0] = 100;
MotorYaw[0] = 100;
MotorGas[1] = 100;
MotorPitch[1] = 100;
MotorRoll[1] = -100;
MotorYaw[1] = 100;
MotorGas[2] = 100;
MotorPitch[2] = -100;
MotorRoll[2] = -100;
MotorYaw[2] = -100;
MotorGas[3] = 100;
MotorPitch[3] = 100;
MotorRoll[3] = 100;
MotorYaw[3] = -100;
}
#elif FRAME_MODEL == HEXA
void init_mixer_table()
{
// Hexa configuration
MotorPitch[0] = -100;
MotorRoll[0] = 0;
MotorYaw[0] = 100;
MotorPitch[1] = -50;
MotorRoll[1] = -100;
MotorYaw[1] = -100;
MotorPitch[2] = +50;
MotorRoll[2] = -100;
MotorYaw[2] = 100;
MotorPitch[3] = +100;
MotorRoll[3] = 0;
MotorYaw[3] = -100;
MotorPitch[4] = +50;
MotorRoll[4] = 100;
MotorYaw[4] = 100;
MotorPitch[5] = -50;
MotorRoll[5] = 100;
MotorYaw[5] = -100;
}
#elif FRAME_MODEL == HEXARADIAL
void init_mixer_table()
{
// Example for Hexa configuration
MotorGas[0] = 100;
MotorPitch[0] = -100;
MotorRoll[0] = 0;
MotorYaw[0] = 100;
MotorGas[1] = 100;
MotorPitch[1] = -50;
MotorRoll[1] = -100;
MotorYaw[1] = -100;
MotorGas[2] = 100;
MotorPitch[2] = +50;
MotorRoll[2] = -100;
MotorYaw[2] = 100;
MotorGas[3] = 100;
MotorPitch[3] = +100;
MotorRoll[3] = 0;
MotorYaw[3] = -100;
MotorGas[4] = 100;
MotorPitch[4] = +50;
MotorRoll[4] = 100;
MotorYaw[4] = 100;
MotorGas[5] = 100;
MotorPitch[5] = -50;
MotorRoll[5] = 100;
MotorYaw[5] = -100;
}
#elif FRAME_MODEL == HEXACOAXIAL
void init_mixer_table()
{
// Example for Hexa configuration
MotorGas[0] = 95;
MotorPitch[0] = 100;
MotorRoll[0] = 0;
MotorYaw[0] = 100;
MotorGas[1] = 100;
MotorPitch[1] = 100;
MotorRoll[1] = 0;
MotorYaw[1] = -100;
MotorGas[2] = 95;
MotorPitch[2] = -50;
MotorRoll[2] = 100;
MotorYaw[2] = -100;
MotorGas[3] = 100;
MotorPitch[3] = -50;
MotorRoll[3] = 100;
MotorYaw[3] = 100;
MotorGas[4] = 95;
MotorPitch[4] = -50;
MotorRoll[4] = -100;
MotorYaw[4] = -100;
MotorGas[5] = 100;
MotorPitch[5] = -50;
MotorRoll[5] = -100;
MotorYaw[5] = 100;
}
#elif FRAME_MODEL == OCTO
void init_mixer_table()
{
// Octo configuration. Motors are numberd CW viewed from above starting at front = 1 (CW prop rotation)
// Motor rotation is CCW for odd numbered motors
MotorGas[0] = 100;
MotorPitch[0] = 100;
MotorRoll[0] = 0;
MotorYaw[0] = -100;
MotorGas[1] = 100;
MotorPitch[1] = 100;
MotorRoll[1] = -100;
MotorYaw[1] = 100;
MotorGas[2] = 100;
MotorPitch[2] = 0;
MotorRoll[2] = -100;
MotorYaw[2] = -100;
MotorGas[3] = 100;
MotorPitch[3] = -100;
MotorRoll[3] = -100;
MotorYaw[3] = 100;
MotorGas[4] = 100;
MotorPitch[4] = -100;
MotorRoll[4] = 0;
MotorYaw[4] = -100;
MotorGas[5] = 100;
MotorPitch[5] = -100;
MotorRoll[5] = 100;
MotorYaw[5] = 100;
MotorGas[6] = 100;
MotorPitch[6] = 0;
MotorRoll[6] = 100;
MotorYaw[6] = -100;
MotorGas[7] = 100;
MotorPitch[7] = 100;
MotorRoll[7] = 100;
MotorYaw[7] = 100;
}
#else
# error You need define your frame configuration on ArduUser.h
#endif
void motor_axis_correction()
{
int i;
for (i=0;i