Skip to content

Commit

Permalink
fix 3d: apply model rotation before applying the vehicle attitude
Browse files Browse the repository at this point in the history
Otherwise roll/pitch is incorrect
  • Loading branch information
bkueng committed Jan 8, 2025
1 parent b779d55 commit 2060933
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/plot_app/templates/3d.html
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@

// Rotate the model to point east
var m = Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(heading_rotation_deg));
rotation_matrix = Cesium.Matrix3.multiply(rotation_matrix, m, new Cesium.Matrix3());
var q_heading_rotation = Cesium.Quaternion.fromRotationMatrix(m);

// rotation quaterion from ENU to ECEF
var q_enu_to_ecef = Cesium.Quaternion.fromRotationMatrix(rotation_matrix);

Expand All @@ -279,7 +280,8 @@
Cesium.Quaternion.multiply(tmp, q_ned_to_enu_inv, q);

var orientation = new Cesium.Quaternion();
Cesium.Quaternion.multiply(q_enu_to_ecef, q, orientation);
Cesium.Quaternion.multiply(q, q_heading_rotation, orientation);
Cesium.Quaternion.multiply(q_enu_to_ecef, orientation, orientation);
//orientationProperty.addSample(time_att, orientation); // this uses interpolation

// avoid using iterpolation (which causes problems)
Expand Down

0 comments on commit 2060933

Please sign in to comment.