Corrected 45* error

This commit is contained in:
Ulysse Cura 2025-05-08 16:11:09 +02:00
parent d33c9eb4f3
commit 169f7c1103
2 changed files with 3 additions and 2 deletions

View File

@ -6,6 +6,7 @@
"stdlib.h": "c",
"stdint.h": "c",
"gyro.h": "c",
"motors.h": "c"
"motors.h": "c",
"motion_control.h": "c"
}
}

View File

@ -13,7 +13,7 @@ void i2c_update_motion_control(void)
// - we calculate the error of the targeted angle and the actual angle
// - then we calculate motors speed from targeted speed, the error and the offset
float actual_angle = robot.gyro_data.x_angle;
float actual_angle = robot.gyro_data.x_angle - 45; // Substracte 45* because robot is not aligned with it's moving base
float target_angle = (float)robot.motion_control_data.angle;
float error = target_angle - actual_angle;