Skip to content

Commit

Permalink
fix: round servo calibration result
Browse files Browse the repository at this point in the history
  • Loading branch information
nvsukhanov committed Mar 13, 2024
1 parent 0f028e8 commit dcd433f
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,15 +275,15 @@ export class HubServoCalibrationFacadeService {
const ccwDistanceFromStartPosition = startRelativePosition - ccwProbeResult;
const cwDistanceFromStartPosition = cwProbeResult - startRelativePosition;

const arcCenterPosition = Math.round((ccwProbeResult + cwProbeResult) / 2);
const rawServoRange = Math.round(Math.abs(ccwDistanceFromStartPosition + cwDistanceFromStartPosition));
const arcCenterPosition = (ccwProbeResult + cwProbeResult) / 2;
const rawServoRange = Math.abs(ccwDistanceFromStartPosition + cwDistanceFromStartPosition);
const servoRange = rawServoRange * Math.max(0, 1 - this.appConfig.servo.calibrationRangeResultReductionFactor);
const arcCenterAbsolutePosition = Math.round(transformRelativeDegToAbsoluteDeg(arcCenterPosition + encoderOffset));
const arcCenterAbsolutePosition = transformRelativeDegToAbsoluteDeg(arcCenterPosition + encoderOffset);

return {
servoRange,
arcCenterPosition,
arcCenterAbsolutePosition
servoRange: Math.round(servoRange),
arcCenterPosition: Math.round(arcCenterPosition),
arcCenterAbsolutePosition: Math.round(arcCenterAbsolutePosition)
};
}

Expand Down

0 comments on commit dcd433f

Please sign in to comment.