feat: remove old roll correction

This commit is contained in:
Julien Oculi 2025-06-05 15:57:10 +02:00
parent 91da5f2793
commit 1831dfe0ab

View file

@ -1,8 +1,5 @@
#include "math.h"
// rollH atan((22.5 - 18.5) / 236) ~0.97°
// rollV ~1°
double degToRad(double deg) { return deg * M_PI / 180.0; }
double radToDeg(double rad) { return rad * 180.0 / M_PI; }
@ -16,11 +13,6 @@ void angleToStep(long &stepX, long &stepY, double angleX, double angleY) {
stepY = angleY / stepRatioY;
}
double rollCorrection(double x, double max, double width) {
double correction = max * (1.0 - cos((10.0 * x) / (width * M_PI))) / 2.0;
return x - correction;
}
void cartesianToPolar(long &stepX, long &stepY, double zeroX, double zeroY,
double x, double y, double z) {
// TODO remove magic numbers
@ -30,19 +22,12 @@ void cartesianToPolar(long &stepX, long &stepY, double zeroX, double zeroY,
x = -x; // natural axis direction
double dX = x + offsetX;
double dY = rollCorrection(y + offsetY, 0.2, 400.0);
double dY = y + offsetY;
double dZ = z + distance;
double roll = atan2(4.0, 236.0);
double rollY = dX * tan(roll);
double rollX = dY * tan(roll);
double dXr = dX + rollX;
double dYr = dY + rollY;
double rho = sqrt(pow(dXr, 2.0) + pow(dYr, 2.0) + pow(dZ, 2.0));
double angleY = M_PI / 2.0 - acos(dYr / rho);
double angleX = atan2(dXr, dZ);
double rho = sqrt(pow(dX, 2.0) + pow(dY, 2.0) + pow(dZ, 2.0));
double angleY = M_PI / 2.0 - acos(dY / rho);
double angleX = atan2(dX, dZ);
angleToStep(stepX, stepY, angleX, angleY);
}