Control gain units

https://groups.google.com/group/uavdevboard/browse_frm/thread/df8be690c9a3d93f

Paul, I computed the net effect of the rudder gains in terms of the option parameters. The gains are expressed as transfer gains from either an angle in radians, or a rate in radians per second, to a command to the servos, measured in units of milliseconds. (You will have to figure out how much the rudder will deflect per millisecond of pulse width change.)

rudder_servo_pulsewidth_yawkp = 2.05 * YAWKP_RUDDER * sin ( yaw_angle) rudder_servo_pulsewidth_rollkp = 2.05 * ROLLKP_RUDDER * sin (roll_angle) rudder_servo_pulsewidth_yawkd = 0.7 * YAWKD_RUDDER * yaw_rate rudder_servo_pulsewidth_rollkd = 0.7 * ROLLKD_RUDDER * roll_rate

yaw_angle, roll_angle in radians yaw_rate, roll_rate in radians per second

XX_RUDDER in same units as in the options.h file

rudder_servo_pulsewidth_xx in milliseconds

william premerlani

Controls common to all multirotors
https://groups.google.com/group/uavdevboard-dev/browse_frm/thread/4e49f4c573dd2ec0

Congratulations on the quick success with your tricopter. I just took a look at your version of motorCtrl.c and your changes look clean, and should be easy to support as a configuration option. For generality, we just need to recognize that the controls (roll, pitch, yaw, throttle) are common to all multirotors, and translate them to multirotor specific outputs. I suppose we should decide between a switch statement in motorCtrl.c and a more object-oriented approach with the translation code encapsulated in a function.

Servo rates
I forgot to respond to your question about PWM rates for servos yesterday.

Right now, servoOut.c uses Timer3 to set the PWM rate for all OC channels to (ESC_HZ = 400) Hz. Your change only reduces the frequency at which the duty cycle is updated, so your servo is still receiving a 400Hz frame rate.

I think Timer2 is currently unused, so you should be able to set it for a lower rate and change line 158 from: OC4CONbits.OCTSEL = 1; // Select Timer 3 as output compare time base to OC4CONbits.OCTSEL = 0; // Select Timer 2 as output compare time base