How does motor mixing work?
Posted: Sun Oct 14, 2012 8:18 am
for fun im working on my own quad X firmware and i need help understanding motor mixing/how to implement it. i have all the other main code sections done:
RX data in
IMU reading
IMU calibration
R/P/Y values calculated
R/P Kalman
PID on R/P/Y
EEPROM storage (stick values, IMU stuff (going to be))
I need to do:
motor mixing
arming
save IMU data to EEPROM?
various code tweaks, mods etc
i got all the stuff except the motor mixing covered for sure. ive looked at the MWC 1.3 code (http://code.google.com/p/multiwii/source/browse/tags/MultiWiiV1_3/MultiWiiV1_3.pde?spec=svn9&r=9) since i thought it would be the simplest, but im still a bit confused.
i found this:
which seems pretty simple and is the main mixing part. does this mean i can do as it says but with my throttle + pid values? but it seems this RCcommand function is changing the values, why? to implement rate/expo?
also, ive attached the code so far for reference if anyone is interested.
RX data in
IMU reading
IMU calibration
R/P/Y values calculated
R/P Kalman
PID on R/P/Y
EEPROM storage (stick values, IMU stuff (going to be))
I need to do:
motor mixing
arming
save IMU data to EEPROM?
various code tweaks, mods etc
i got all the stuff except the motor mixing covered for sure. ive looked at the MWC 1.3 code (http://code.google.com/p/multiwii/source/browse/tags/MultiWiiV1_3/MultiWiiV1_3.pde?spec=svn9&r=9) since i thought it would be the simplest, but im still a bit confused.
i found this:
Code: Select all
#ifdef QUADX
motor[FRONT_L] = 1500 + rcCommand[THROTTLE] + axisPID[ROLL] - axisPID[PITCH] - axisPID[YAW];
motor[FRONT_R] = 1500 + rcCommand[THROTTLE] - axisPID[ROLL] - axisPID[PITCH] + axisPID[YAW];
motor[REAR_L] = 1500 + rcCommand[THROTTLE] + axisPID[ROLL] + axisPID[PITCH] + axisPID[YAW];
motor[REAR_R] = 1500 + rcCommand[THROTTLE] - axisPID[ROLL] + axisPID[PITCH] - axisPID[YAW];
#endif
which seems pretty simple and is the main mixing part. does this mean i can do as it says but with my throttle + pid values? but it seems this RCcommand function is changing the values, why? to implement rate/expo?
also, ive attached the code so far for reference if anyone is interested.