Saturday, 7 June 2014

[Daily Update] Week 7 - ESC Calibration Issue [Solved]

  • ESC manual has been studied extensively
  • ESC calibration is done properly and clearly
  • Throttle control related parameter has been studied extensively, from source code level

When Arducopter enters the ESC Calibration mode (long beep when start up, then turn on safety switch), it will directly feed pwm signal sent from TRANSMITTER to motor output. Typically the range will be 1100 ~ 1920 (tested using oscilloscope).

For the (blue) ESCs we are using, it shares (steals) the same manual as hobbyking ESCs, which the calibration is actually done in programming mode. Throttle calibration is the first option in the mode. Therefore, after entering Arducopter's Calibration mode, the ESC will short beeps for four times, indicating it is in the first option. Throttle must be immediately put to minimum, to set calibration. Confirm beeping sound will be heard when the calibration is recorded. Afterwards, power can be cut-off to end programming mode of ESCs.

Range of Arducopter motor pwm output 1100 (only presents when disarmed) ~1865.

Intersting fact: there is a threshold of the minimum pwm required to activate ESCs motor output. From the testing, it is 100 pwm units above the calibrated minimum transmitter pwm signal. For example, if the transmitter has minimum pwm of 1020, then the ESC won't activate motor until it receives pwm singal of 1120. This makes sense because, it is not meaningful to spin the motor at very low speed.



After the calibration,

  • Send nothing (safety switch off, disarmed) - regular warning beeps, with pause in between
  • Send Minimum PWM (safety switch on, disarmed) - no warning, ESCs knows controller is alive
  • Send Minimum PWM + 100 (armed, but 0 throttle) - spin slowly, specified MOT_SPIN_ARM (pwm unit, not percentage)
  • Send normal PWM, converted from RC input - normal flying, minimum throttle set in THR_MIN (in percentage)



file "config.h":
# define THR_MIN_DEFAULT       130             // minimum throttle sent to the motors when armed and pilot throttle above zero


Main loop 100hz - fast loop() -> set_servos_4(); -> motors.output(); -> update_max_throttle() + output_armed(); or output_disarmed();

  • output_disarmed();
    -> output_min();
    -> give RCx_MIN pwm to motors.
  • output_armed();
    ->  cap servo_out at _max_throttle (for slow_start)
    -> _rc_throttle->calc_pwm(); input is servo_out. pwm_out = rpm offset needed, radio_out = actual rpm needed
    -> if servo_out == 0 (throttle in dead zone), motor_out[] = radio_min + _spin_when_armed_ramped (by-pass, radio_out)
    -> if servo_out != 0 , use radio_out

  • ONE-TIME configuration: armed(bool arm) -> _flags.slow_start_low_end = true; >>>> update_max_throttle() -> ramp up minimum spin speed, step of 2.

TO BE TESTED : looks like _flags.slow_start only set to 1 on system startup, auto throttle mode -> change _max_throttle from 1000 to 0? -> ramp up, increment of 10 -> when _max_throttle >= _rc_throttle->servo_out, _max_throttle = 1000.

50 hz update rate update_throttle_mode() 
-> if control_in == 0, set_throttle_out(0, false); //btw control_in takes value of 0, or between THR_MIN and THR_MAX
-> otherwise pilot_throttle_scaled = get_pilot_desired_throttle(g.rc_3.control_in); // linearlise the curve, using THR_MID
-> set_throttle_out(pilot_throttle_scaled, false);
-> servo_out is set by set_throttle_out(,); // 0 , or between THR_MIN and THR_MAX