Skip to content

Commit

Permalink
fixed accelerometer simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Oct 5, 2023
1 parent 015acc0 commit 19e8a1a
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ void MultirotorModel::step(const double& dt) {
}

// fabricate what the onboard accelerometer would feel
imu_acceleration_ = state_.R.transpose() * (state_.v - state_.v_prev) / dt + Eigen::Vector3d(0, 0, params_.g);
imu_acceleration_ = state_.R.transpose() * (((state_.v - state_.v_prev) / dt) + Eigen::Vector3d(0, 0, params_.g));
state_.v_prev = state_.v;

// simulate the takeoff patch
Expand Down Expand Up @@ -341,6 +341,7 @@ void MultirotorModel::operator()(const MultirotorModel::InternalState& x, Multir
}

x_dot = cur_state.v;

v_dot = -Eigen::Vector3d(0, 0, params_.g) + thrust * R.col(2) / params_.mass + external_force_ / params_.mass - resistance * vnorm / params_.mass;

R_dot = R * omega_tensor;
Expand Down

0 comments on commit 19e8a1a

Please sign in to comment.