Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] ekf2 allow initializing without baro or mag depending on configuration #16216

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/lib/battery/battery.cpp
Expand Up @@ -129,11 +129,9 @@ void Battery::updateBatteryStatus(const hrt_abstime &timestamp, float voltage_v,
_throttle_filter.reset(throttle_normalized);
}

_voltage_filter_v.update(voltage_v);
_current_filter_a.update(current_a);
_throttle_filter.update(throttle_normalized);
sumDischarged(timestamp, current_a);
estimateRemaining(_voltage_filter_v.getState(), _current_filter_a.getState(), _throttle_filter.getState());
estimateRemaining(_voltage_filter_v.update(voltage_v),
_current_filter_a.update(current_a),
_throttle_filter.update(throttle_normalized));
computeScale();

if (_battery_initialized) {
Expand Down
Expand Up @@ -354,8 +354,7 @@ void FlightTaskManualAltitude::_updateSetpoints()
Vector2f sp(_sticks.getPosition().slice<2, 1>(0, 0));

_man_input_filter.setParameters(_deltatime, _param_mc_man_tilt_tau.get());
_man_input_filter.update(sp);
sp = _man_input_filter.getState();
sp = _man_input_filter.update(sp);
_rotateIntoHeadingFrame(sp);

if (sp.length() > 1.0f) {
Expand Down
7 changes: 3 additions & 4 deletions src/modules/mc_att_control/mc_att_control_main.cpp
Expand Up @@ -146,10 +146,9 @@ MulticopterAttitudeControl::generate_attitude_setpoint(const Quatf &q, float dt,
*/
_man_x_input_filter.setParameters(dt, _param_mc_man_tilt_tau.get());
_man_y_input_filter.setParameters(dt, _param_mc_man_tilt_tau.get());
_man_x_input_filter.update(_manual_control_setpoint.x * _man_tilt_max);
_man_y_input_filter.update(_manual_control_setpoint.y * _man_tilt_max);
const float x = _man_x_input_filter.getState();
const float y = _man_y_input_filter.getState();

const float x = _man_x_input_filter.update(_manual_control_setpoint.x * _man_tilt_max);
const float y = _man_y_input_filter.update(_manual_control_setpoint.y * _man_tilt_max);

// we want to fly towards the direction of (x, y), so we use a perpendicular axis angle vector in the XY-plane
Vector2f v = Vector2f(y, -x);
Expand Down