File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 11# Unreleased Features
22Please add a note of your changes below this heading if you make a Pull Request.
33
4+ ### Changed
5+ Fixed the encoder offset calibration to work correctly when calib_scan_distance is not a multiple of 4pi
6+
47# Releases
58## [ 0.5.1] - 2020-09-27
69### Added
Original file line number Diff line number Diff line change @@ -202,10 +202,13 @@ bool Encoder::run_offset_calibration() {
202202 else
203203 return false ;
204204
205- // go to motor zero phase for start_lock_duration to get ready to scan
205+ // go to start position of forward scan for start_lock_duration to get ready to scan
206206 int i = 0 ;
207207 axis_->run_control_loop ([&](){
208- if (!axis_->motor_ .enqueue_voltage_timings (voltage_magnitude, 0 .0f ))
208+ float phase = wrap_pm_pi (0 - config_.calib_scan_distance / 2 .0f );
209+ float v_alpha = voltage_magnitude * our_arm_cos_f32 (phase);
210+ float v_beta = voltage_magnitude * our_arm_sin_f32 (phase);
211+ if (!axis_->motor_ .enqueue_voltage_timings (v_alpha, v_beta))
209212 return false ; // error set inside enqueue_voltage_timings
210213 axis_->motor_ .log_timing (TIMING_LOG_ENC_CALIB);
211214 return ++i < start_lock_duration * current_meas_hz;
You can’t perform that action at this time.
0 commit comments