Hi,
I have just built a quadcopter in an X configuration. I have been having majorproblems (stability, twitchy, uncontrollable ...) trying to get it to take offon its 1st flight. So I thought I would try tuning the PID using theconfigurator software. In doing so I thought I would have a look at the motoroutput graph in response to pitch, roll and yaw. (see attached screenshotdocument).
It seemed as though my quadcopter was operating as though programmed in +configuration, despite reprogramming it and double checking the definitionsettings. The front, right, left or rear motors would respond independently,not as pairs as I would expect for the X configuration.
I have attached a document showing the graph traces from the configurator and alittle more information about my set-up.
Any thoughts and comments would be much appreciated.
Regards,
Tom
You need to be a member of diydrones to add comments!
Replies
ArduCopter Quadcopter code (alpha_RC1)
Using roll as an example, and working backwards:
Other code was left out, but you can find these.
The right and left motor are controlled by control_roll. You can ignore the rest.
rightMotor = constrain(ch_throttle - control_roll + control_yaw, minThrottle, 2000);
leftMotor = constrain(ch_throttle + control_roll + control_yaw, minThrottle, 2000);
In acro mode:
control_roll is controlled by err_roll and the PID settings.
control_roll = Kp_RateRoll*err_roll + Kd_RateRoll*roll_D + Ki_RateRoll*roll_I;
err_roll is strictly roll in + and mixed roll/pitch in x. ch_roll is the stick input.
#ifdef FLIGHT_MODE_+
err_roll = ((ch_roll- roll_mid) * xmitFactor) - currentRollRate;
#endif
#ifdef FLIGHT_MODE_X // In X mode : mix on the input
err_roll = (((ch_roll- roll_mid)-(ch_pitch-pitch_mid)) * xmitFactor) - currentRollRate;
#endif
In stable mode:
The code is backwards from acro mode.
Strictly roll in the stable code section.
err_roll = command_rx_roll - ToDeg(roll);
control_roll = STABLE_MODE_KP_RATE_ROLL*err_roll;
Elsewhere in the code:
command_rx_roll is modified to be roll only in +, mixed roll/pitch in x.
#ifdef FLIGHT_MODE_+
command_rx_roll = (ch_roll-roll_mid) / STICK_TO_ANGLE_FACTOR;
#endif
#ifdef FLIGHT_MODE_X
// For X mode we make a mix in the input
float aux_roll = (ch_roll-roll_mid) / STICK_TO_ANGLE_FACTOR;
command_rx_roll = aux_roll - aux_pitch;
#endif
Where is your APM/IMU pointing? If you are using Alpha RC1 the the APM/IMU should always point to the front left arm even in X mode. If you are using the SVN trunk (not the ArducopterNG trunk) then the APM/IMU should point in the middle of the arms.
This is for the current Alpha version:
Cheers, Emile