mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-15 17:23:33 +08:00
Fixed euler wrapping.
This commit is contained in:
@@ -61,8 +61,6 @@ public:
|
||||
psi_val = Type(atan2(-dcm(1,2), -dcm(0,2)));
|
||||
}
|
||||
|
||||
if (psi_val < 0) psi_val += 2*pi;
|
||||
|
||||
phi() = phi_val;
|
||||
theta() = theta_val;
|
||||
psi() = psi_val;
|
||||
|
||||
+2
-2
@@ -104,8 +104,8 @@ int main()
|
||||
roll_expected = 0;
|
||||
yaw_expected = yaw + roll;
|
||||
}
|
||||
if (yaw_expected < 0) yaw_expected += 360;
|
||||
if (yaw_expected > 360) yaw_expected -= 360;
|
||||
if (yaw_expected < -180) yaw_expected += 360;
|
||||
if (yaw_expected > 180) yaw_expected -= 360;
|
||||
|
||||
printf("roll:%d pitch:%d yaw:%d\n", roll, pitch, yaw);
|
||||
Euler<double> euler_expected(
|
||||
|
||||
Reference in New Issue
Block a user