Closed hsteinhaus closed 9 years ago
Its not that bad:
I get these coefficients:
p = 1.2129 -1.3072
So the measured value from PX4 ESC - 1.3072, then the result multiplied by 1.2002 should yield something close to Unilog.
PX4ESC doesn't measure average current, it's phase current. It converges with average current at 100% thrust.
I did this fit / fix:
transformed = (input + p(2)) * p(1);
if transformed < 0
transformed = 0;
end
And I get this output - blue is the Unilog data, red is the scaled ESC data.
@pavel-kirienko It seems to correlate more or less linearly though, so can we maybe offer the transformed (average) value as well?
I wouldn't expect the coefficients to stay the same for different loads.
Actually, we don't need instant current measurements anymore - it was necessary for earlier revisions of the firmware in order for the variable inductance rotor position detection method to work, which was employed for initial spin-up procedure. In the current implementation, there are only 2 uses for the current measurements:
Which means that we can simply replace the instant current measurements with average, by means of increasing C9 to 1uF. This will effectively drop the corner frequency of the RC filter to approx. 42 Hz, making the PWM synchronization effects negligible.
Can we also filter the value digitally or is this not observable at the current speeds?
ADC sampling is synchronized with PWM and always happens during PWM-on state, so no, we can't filter it digitally.
How fast is the PWM out happening? Any chance to ramp up ADC?
OK, if we added a parallel ADC sampling process that is not synchronized with PWM, then we probably would be able to get appropriate sampling rate to filter it digitally. However:
Despite the above, if we were forced to re-design the motor control having digital filtering as a requirement, I'm sure it would be possible.
PWM frequency is 20~50 KHz.
Let me update the schematics with larger C9.
The current measured and published by the PX4ESC seems to be affected by heavy offset and scale errors. I measured the current via SM Unilog and compared the results to the ones printed by "stat" on the serial console.
Unilog -> stat output 0.00A -> 0A 0.14A -> 1.58A 0.20A -> 1.61A 0.50A -> 1.64A 1.00A -> 2.17A 2.00A -> 3.07A 3.00A -> 3.86A 4.00A -> 4,75A 5.00A -> 5.52A 5.90A -> 6.12A
These results are not really in line with the numbers stated for common mode voltage offset and linearity errors stated in the datasheet of the current monitor circuit. Especially the heavy error in the 2..4A range is rather nasty, as a lot of copters hover in this region.