Skip to content

Commit

Permalink
modified: webots/plugins/physics/ekf/ekf.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
simondlevy committed Nov 28, 2024
1 parent 64332a1 commit 93f0a90
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions webots/plugins/physics/ekf/ekf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ hf::state_t estimate_state(

_ekf.get_vehicle_state(quat_est, dxdy_est, z_est, dz_est);

hf::axis3_t euler_est = {};
hf::Utils::quat2euler(quat_est, euler_est);
// fprintf(_logfp, "%f,%f\n", -euler_est.y, _state.theta);

static hf::state_t _state;

// dx/dt, body frame
Expand All @@ -98,26 +102,22 @@ hf::state_t estimate_state(
_state.dz = dz_est;

// phi
_state.phi = hf::Utils::RAD2DEG * dynamics.x7;
_state.phi = euler_est.x;

// dphi/dt, directly from gyro
_state.dphi = gyro.x;

// theta
_state.theta = hf::Utils::RAD2DEG* dynamics.x9;
// theta (note negation)
_state.theta = -euler_est.y;

// dtheta/dt, directly from gyro
_state.dtheta = gyro.y;

// psi, directly from gyro
_state.psi = hf::Utils::RAD2DEG* dynamics.x11;
_state.psi = euler_est.z;

// dpsi/dt
_state.dpsi = gyro.z;

hf::axis3_t euler_est = {};
hf::Utils::quat2euler(quat_est, euler_est);
fprintf(_logfp, "%f,%f\n", euler_est.x, _state.phi);

return _state;
}

0 comments on commit 93f0a90

Please sign in to comment.