mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 13:23:34 +08:00
mathlib: get rid of now duplicate sign() function
Instead use the one that was copied to the matrix library in https://github.com/PX4/Matrix/pull/116/
This commit is contained in:
@@ -39,6 +39,8 @@
|
||||
|
||||
#include "zero_order_hover_thrust_ekf.hpp"
|
||||
|
||||
using matrix::sign;
|
||||
|
||||
void ZeroOrderHoverThrustEkf::predict(const float dt)
|
||||
{
|
||||
// State is constant
|
||||
@@ -69,7 +71,7 @@ void ZeroOrderHoverThrustEkf::fuseAccZ(const float acc_z, const float thrust, st
|
||||
bumpStateVariance();
|
||||
}
|
||||
|
||||
const float signed_innov_test_ratio = math::sign(innov) * innov_test_ratio;
|
||||
const float signed_innov_test_ratio = sign(innov) * innov_test_ratio;
|
||||
updateLpf(residual, signed_innov_test_ratio);
|
||||
updateMeasurementNoise(residual, H);
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ void PositionControl::_velocityControl(const float dt)
|
||||
_vel_int += vel_error.emult(_gain_vel_i) * dt;
|
||||
|
||||
// limit thrust integral
|
||||
_vel_int(2) = math::min(fabsf(_vel_int(2)), _lim_thr_max) * math::sign(_vel_int(2));
|
||||
_vel_int(2) = math::min(fabsf(_vel_int(2)), _lim_thr_max) * sign(_vel_int(2));
|
||||
}
|
||||
|
||||
bool PositionControl::_updateSuccessful()
|
||||
|
||||
@@ -47,9 +47,7 @@
|
||||
|
||||
#define ACTUATOR_PUBLISH_PERIOD_MS 4
|
||||
|
||||
using matrix::Eulerf;
|
||||
using matrix::Quatf;
|
||||
using matrix::Vector3f;
|
||||
using namespace matrix;
|
||||
|
||||
/**
|
||||
* L1 control app start / stop handling function
|
||||
@@ -261,7 +259,7 @@ RoverPositionControl::control_position(const matrix::Vector2f ¤t_position,
|
||||
|
||||
float desired_r = ground_speed_2d.norm_squared() / math::abs_t(_gnd_control.nav_lateral_acceleration_demand());
|
||||
float desired_theta = (0.5f * M_PI_F) - atan2f(desired_r, _param_wheel_base.get());
|
||||
float control_effort = (desired_theta / _param_max_turn_angle.get()) * math::sign(
|
||||
float control_effort = (desired_theta / _param_max_turn_angle.get()) * sign(
|
||||
_gnd_control.nav_lateral_acceleration_demand());
|
||||
control_effort = math::constrain(control_effort, -1.0f, 1.0f);
|
||||
_act_controls.control[actuator_controls_s::INDEX_YAW] = control_effort;
|
||||
|
||||
Reference in New Issue
Block a user