mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 03:33:34 +08:00
double promotion warning fix or ignore per module
This commit is contained in:
committed by
Lorenz Meier
parent
11d348ec4f
commit
cf74166801
@@ -89,7 +89,7 @@ public:
|
||||
}
|
||||
matrix::Vector<Type, M> getStdDev()
|
||||
{
|
||||
return getVar().pow(0.5);
|
||||
return getVar().pow(0.5f);
|
||||
}
|
||||
private:
|
||||
// attributes
|
||||
|
||||
@@ -34,6 +34,7 @@ px4_add_module(
|
||||
MODULE lib__controllib__controllib_test
|
||||
MAIN controllib_test
|
||||
COMPILE_FLAGS
|
||||
-Wno-double-promotion # TODO: fix in Matrix library Vector::pow()
|
||||
SRCS
|
||||
controllib_test_main.cpp
|
||||
DEPENDS
|
||||
|
||||
@@ -75,7 +75,7 @@ protected:
|
||||
|
||||
work_s _work;
|
||||
bool _sensor_ok;
|
||||
uint32_t _measure_ticks;
|
||||
int _measure_ticks;
|
||||
bool _collect_phase;
|
||||
float _diff_pres_offset;
|
||||
|
||||
|
||||
+1
-1
Submodule src/lib/ecl updated: 1cba257bac...b26c2d62b8
@@ -41,6 +41,8 @@
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <px4_defines.h>
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
bool __EXPORT equal(float a, float b, float epsilon)
|
||||
@@ -106,7 +108,7 @@ void __EXPORT float2SigExp(
|
||||
// FIXME - This code makes no sense when exp is an int
|
||||
// FIXME - isnan and isinf not defined for QuRT
|
||||
#ifndef __PX4_QURT
|
||||
if (isnan(num) || isinf(num)) {
|
||||
if (!PX4_ISFINITE(num)) {
|
||||
sig = 0.0f;
|
||||
exp = -99;
|
||||
return;
|
||||
|
||||
@@ -1089,7 +1089,7 @@ param_export(int fd, bool only_unsaved)
|
||||
break;
|
||||
|
||||
case PARAM_TYPE_FLOAT: {
|
||||
const float f = s->val.f;
|
||||
const double f = (double)s->val.f;
|
||||
|
||||
debug("exporting: %s (%d) size: %d val: %.3f", name, s->param, size, (double)f);
|
||||
|
||||
|
||||
@@ -31,4 +31,4 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
px4_add_library(pid pid.c)
|
||||
px4_add_library(pid pid.cpp)
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
|
||||
#include "pid.h"
|
||||
#include <math.h>
|
||||
#include <px4_defines.h>
|
||||
|
||||
#define SIGMA 0.000001f
|
||||
|
||||
@@ -71,35 +72,35 @@ __EXPORT int pid_set_parameters(PID_t *pid, float kp, float ki, float kd, float
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (isfinite(kp)) {
|
||||
if (PX4_ISFINITE(kp)) {
|
||||
pid->kp = kp;
|
||||
|
||||
} else {
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
if (isfinite(ki)) {
|
||||
if (PX4_ISFINITE(ki)) {
|
||||
pid->ki = ki;
|
||||
|
||||
} else {
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
if (isfinite(kd)) {
|
||||
if (PX4_ISFINITE(kd)) {
|
||||
pid->kd = kd;
|
||||
|
||||
} else {
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
if (isfinite(integral_limit)) {
|
||||
if (PX4_ISFINITE(integral_limit)) {
|
||||
pid->integral_limit = integral_limit;
|
||||
|
||||
} else {
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
if (isfinite(output_limit)) {
|
||||
if (PX4_ISFINITE(output_limit)) {
|
||||
pid->output_limit = output_limit;
|
||||
|
||||
} else {
|
||||
@@ -111,7 +112,7 @@ __EXPORT int pid_set_parameters(PID_t *pid, float kp, float ki, float kd, float
|
||||
|
||||
__EXPORT float pid_calculate(PID_t *pid, float sp, float val, float val_dot, float dt)
|
||||
{
|
||||
if (!isfinite(sp) || !isfinite(val) || !isfinite(val_dot) || !isfinite(dt)) {
|
||||
if (!PX4_ISFINITE(sp) || !PX4_ISFINITE(val) || !PX4_ISFINITE(val_dot) || !PX4_ISFINITE(dt)) {
|
||||
return pid->last_output;
|
||||
}
|
||||
|
||||
@@ -136,7 +137,7 @@ __EXPORT float pid_calculate(PID_t *pid, float sp, float val, float val_dot, flo
|
||||
d = 0.0f;
|
||||
}
|
||||
|
||||
if (!isfinite(d)) {
|
||||
if (!PX4_ISFINITE(d)) {
|
||||
d = 0.0f;
|
||||
}
|
||||
|
||||
@@ -148,7 +149,7 @@ __EXPORT float pid_calculate(PID_t *pid, float sp, float val, float val_dot, flo
|
||||
i = pid->integral + (error * dt);
|
||||
|
||||
/* check for saturation */
|
||||
if (isfinite(i)) {
|
||||
if (PX4_ISFINITE(i)) {
|
||||
if ((pid->output_limit < SIGMA || (fabsf(output + (i * pid->ki)) <= pid->output_limit)) &&
|
||||
fabsf(i) <= pid->integral_limit) {
|
||||
/* not saturated, use new integral value */
|
||||
@@ -161,7 +162,7 @@ __EXPORT float pid_calculate(PID_t *pid, float sp, float val, float val_dot, flo
|
||||
}
|
||||
|
||||
/* limit output */
|
||||
if (isfinite(output)) {
|
||||
if (PX4_ISFINITE(output)) {
|
||||
if (pid->output_limit > SIGMA) {
|
||||
if (output > pid->output_limit) {
|
||||
output = pid->output_limit;
|
||||
@@ -31,4 +31,4 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
px4_add_library(pwm_limit pwm_limit.c)
|
||||
px4_add_library(pwm_limit pwm_limit.cpp)
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
#include "pwm_limit.h"
|
||||
|
||||
#include <px4_defines.h>
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
@@ -148,7 +149,7 @@ void pwm_limit_calc(const bool armed, const bool pre_armed, const unsigned num_c
|
||||
float control_value = output[i];
|
||||
|
||||
/* check for invalid / disabled channels */
|
||||
if (!isfinite(control_value)) {
|
||||
if (!PX4_ISFINITE(control_value)) {
|
||||
effective_pwm[i] = disarmed_pwm[i];
|
||||
continue;
|
||||
}
|
||||
@@ -198,7 +199,7 @@ void pwm_limit_calc(const bool armed, const bool pre_armed, const unsigned num_c
|
||||
float control_value = output[i];
|
||||
|
||||
/* check for invalid / disabled channels */
|
||||
if (!isfinite(control_value)) {
|
||||
if (!PX4_ISFINITE(control_value)) {
|
||||
effective_pwm[i] = disarmed_pwm[i];
|
||||
continue;
|
||||
}
|
||||
Reference in New Issue
Block a user