Skip to content

Commit

Permalink
Revert "Fixed the encoder offset calibration to work correctly when c…
Browse files Browse the repository at this point in the history
…alib_scan_distance is not a multiple of 4pi"

This reverts commit b52cd87.

Reverted fix - see `bug_fixes` branch instead
  • Loading branch information
PAJohnson committed Apr 13, 2021
1 parent b52cd87 commit 411494c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
3 changes: 0 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Unreleased Features
Please add a note of your changes below this heading if you make a Pull Request.

### Changed
Fixed the encoder offset calibration to work correctly when calib_scan_distance is not a multiple of 4pi

# Releases
## [0.5.1] - 2020-09-27
### Added
Expand Down
7 changes: 2 additions & 5 deletions Firmware/MotorControl/encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,10 @@ bool Encoder::run_offset_calibration() {
else
return false;

// go to start position of forward scan for start_lock_duration to get ready to scan
// go to motor zero phase for start_lock_duration to get ready to scan
int i = 0;
axis_->run_control_loop([&](){
float phase = wrap_pm_pi(0 - config_.calib_scan_distance / 2.0f);
float v_alpha = voltage_magnitude * our_arm_cos_f32(phase);
float v_beta = voltage_magnitude * our_arm_sin_f32(phase);
if (!axis_->motor_.enqueue_voltage_timings(v_alpha, v_beta))
if (!axis_->motor_.enqueue_voltage_timings(voltage_magnitude, 0.0f))
return false; // error set inside enqueue_voltage_timings
axis_->motor_.log_timing(TIMING_LOG_ENC_CALIB);
return ++i < start_lock_duration * current_meas_hz;
Expand Down

0 comments on commit 411494c

Please sign in to comment.