Corrected 45* error
This commit is contained in:
parent
d33c9eb4f3
commit
169f7c1103
|
@ -6,6 +6,7 @@
|
||||||
"stdlib.h": "c",
|
"stdlib.h": "c",
|
||||||
"stdint.h": "c",
|
"stdint.h": "c",
|
||||||
"gyro.h": "c",
|
"gyro.h": "c",
|
||||||
"motors.h": "c"
|
"motors.h": "c",
|
||||||
|
"motion_control.h": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,7 +13,7 @@ void i2c_update_motion_control(void)
|
||||||
// - we calculate the error of the targeted angle and the actual angle
|
// - 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
|
// - 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 target_angle = (float)robot.motion_control_data.angle;
|
||||||
|
|
||||||
float error = target_angle - actual_angle;
|
float error = target_angle - actual_angle;
|
||||||
|
|
Loading…
Reference in New Issue