Move retract value to hw config const

This commit is contained in:
fiona 2026-08-02 19:50:00 +00:00
parent 83a82542da
commit 7b2bf30394
2 changed files with 6 additions and 1 deletions

View file

@ -43,6 +43,11 @@ constexpr float CALIBRATION_RANGE = 83;
// velocity of the magnetic field during calibration (lower is more accurate) // velocity of the magnetic field during calibration (lower is more accurate)
constexpr float CALIBRATION_FIELD_VELOCITY = 20.0f; constexpr float CALIBRATION_FIELD_VELOCITY = 20.0f;
// angle to retract after homing before starting calibration run
// can be used if the encoder measurements at the beginning of the calibration
// run is non-linear
constexpr float CALIBRATION_RETRACT_ANGLE = 17.5f;
// size of the calibration lookup table // size of the calibration lookup table
constexpr int ENCODER_LUT_SIZE = 256; constexpr int ENCODER_LUT_SIZE = 256;

View file

@ -57,7 +57,7 @@ bool RobotJoint::calibrate(bool print_measurements) {
bool homing_ok = homing_controller.run_blocking(servo_controller, -HOMING_VELOCITY, bool homing_ok = homing_controller.run_blocking(servo_controller, -HOMING_VELOCITY,
360.0f*DEG_TO_RAD, HOMING_CURRENT, 360.0f*DEG_TO_RAD, HOMING_CURRENT,
ENCODER_ANGLE_TO_ROTOR_ANGLE, ENCODER_ANGLE_TO_ROTOR_ANGLE,
17.5f*DEG_TO_RAD); CALIBRATION_RETRACT_ANGLE*DEG_TO_RAD);
if(homing_ok == false) { if(homing_ok == false) {
LOG_ERROR("Joint-%i: Calibration failed due to unsuccessful homing sequence", joint_idx); LOG_ERROR("Joint-%i: Calibration failed due to unsuccessful homing sequence", joint_idx);
return false; return false;