I just stumbled on ODrive yesterday and I’m already totally floored by the demos. I cloned the repos right away and stared at the firmware code, looking specifically for the calibration of electrical phase with incremental encoders. From a fortunate misunderstanding, I tried to wrap my head around the inductance estimating routine
measure_phase_inductance, thinking that an inductance vs. shaft angle relationship was used to measure initial electrical phase. While I stumbled upon
calib_enc_offset a little later and realized inductance was instead used to tune the control gains, I’m still invested in understanding the inductance measurement here, as I’m trying an inductance-based calibration method in a DIY motor controller of my own. (I plan to use this in a bipedal robot where there are significant static loads at startup so I’m trying to avoid moving the motor much to extract the initial angle).
I come from an AVR background and will profess I’m not at all familiar with the STM32 and its peripheral interface, so I apologize if the code answers these questions amply already. I wanted to better understand the following:
- How is dI/dt estimated? My guess is the magnitude of steady-state current ripple from a voltage pulse train through one of the output phases. The timings of the current measurements on each end of the dI look like they’re right on transitions between forward and reverse voltages, with an effective inductor voltage that looks like the steady-state mean:
0.5f * (voltage_high - voltage_low).
- How reliable is this inductance estimate? In my tests of coil inductance vs. phase angle, the inductance varies around 20% peak-to-peak, so I’m hoping to discriminate in the uH regime. With a hefty number of samples (5000 by default!), what is the main contributor to imprecision if any?