mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 05:23:34 +08:00
Added PerformanceModel for fixed wing (#22091)
* created a Performance Model for fixed wing vehicle - added compensation for maximum climbrate, minimum sinkrate, minimum airspeed and trim airspeed based on weight ratio and air density - added atmosphere lib to standard atmosphere calculations --------- Signed-off-by: RomanBapst <bapstroman@gmail.com> Co-authored-by: Thomas Stastny <thomas.stastny@auterion.com>
This commit is contained in:
co-authored by
Thomas Stastny
parent
70cd224236
commit
dd2322d622
@@ -38,7 +38,7 @@
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include "airspeed.hpp"
|
||||
#include <math.h>
|
||||
#include <lib/geo/geo.h> // For CONSTANTS_*
|
||||
#include <lib/atmosphere/atmosphere.h>
|
||||
|
||||
const char *const UavcanAirspeedBridge::NAME = "airspeed";
|
||||
|
||||
@@ -104,7 +104,7 @@ UavcanAirspeedBridge::ias_sub_cb(const
|
||||
report.timestamp = hrt_absolute_time();
|
||||
report.indicated_airspeed_m_s = msg.indicated_airspeed;
|
||||
report.true_airspeed_m_s = _last_tas_m_s;
|
||||
report.air_temperature_celsius = _last_outside_air_temp_k + CONSTANTS_ABSOLUTE_NULL_CELSIUS;
|
||||
report.air_temperature_celsius = _last_outside_air_temp_k + atmosphere::kAbsoluteNullCelsius;
|
||||
|
||||
publish(msg.getSrcNodeID().get(), &report);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
#include <uORB/PublicationMulti.hpp>
|
||||
#include <uORB/topics/sensor_baro.h>
|
||||
#include <lib/geo/geo.h> // For CONSTANTS_*
|
||||
#include <lib/atmosphere/atmosphere.h>
|
||||
|
||||
const char *const UavcanBarometerBridge::NAME = "baro";
|
||||
|
||||
@@ -78,10 +78,10 @@ void UavcanBarometerBridge::air_temperature_sub_cb(const
|
||||
|
||||
} else if (msg.static_temperature < 0) {
|
||||
// handle previous incorrect temperature conversion to Kelvin where 273 was subtracted instead of added (https://github.com/PX4/PX4-Autopilot/pull/19061)
|
||||
float temperature_c = msg.static_temperature - CONSTANTS_ABSOLUTE_NULL_CELSIUS;
|
||||
float temperature_c = msg.static_temperature - atmosphere::kAbsoluteNullCelsius;
|
||||
|
||||
if (temperature_c > -40.f && temperature_c < 120.f) {
|
||||
_last_temperature_kelvin = temperature_c - CONSTANTS_ABSOLUTE_NULL_CELSIUS;
|
||||
_last_temperature_kelvin = temperature_c - atmosphere::kAbsoluteNullCelsius;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ void UavcanBarometerBridge::air_pressure_sub_cb(const
|
||||
sensor_baro.pressure = msg.static_pressure;
|
||||
|
||||
if (PX4_ISFINITE(_last_temperature_kelvin) && (_last_temperature_kelvin >= 0.f)) {
|
||||
sensor_baro.temperature = _last_temperature_kelvin + CONSTANTS_ABSOLUTE_NULL_CELSIUS;
|
||||
sensor_baro.temperature = _last_temperature_kelvin + atmosphere::kAbsoluteNullCelsius;
|
||||
|
||||
} else {
|
||||
sensor_baro.temperature = NAN;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "battery.hpp"
|
||||
|
||||
#include <lib/geo/geo.h>
|
||||
#include <lib/atmosphere/atmosphere.h>
|
||||
#include <px4_defines.h>
|
||||
#include <px4_platform_common/log.h>
|
||||
|
||||
@@ -116,7 +116,7 @@ UavcanBatteryBridge::battery_sub_cb(const uavcan::ReceivedDataStructure<uavcan::
|
||||
|
||||
_battery_status[instance].remaining = msg.state_of_charge_pct / 100.0f; // between 0 and 1
|
||||
// _battery_status[instance].scale = msg.; // Power scaling factor, >= 1, or -1 if unknown
|
||||
_battery_status[instance].temperature = msg.temperature + CONSTANTS_ABSOLUTE_NULL_CELSIUS; // Kelvin to Celsius
|
||||
_battery_status[instance].temperature = msg.temperature + atmosphere::kAbsoluteNullCelsius; // Kelvin to Celsius
|
||||
// _battery_status[instance].cell_count = msg.;
|
||||
_battery_status[instance].connected = true;
|
||||
_battery_status[instance].source = msg.status_flags & uavcan::equipment::power::BatteryInfo::STATUS_FLAG_IN_USE;
|
||||
@@ -239,7 +239,7 @@ UavcanBatteryBridge::filterData(const uavcan::ReceivedDataStructure<uavcan::equi
|
||||
|
||||
/* Override data that is expected to arrive from UAVCAN msg*/
|
||||
_battery_status[instance] = _battery[instance]->getBatteryStatus();
|
||||
_battery_status[instance].temperature = msg.temperature + CONSTANTS_ABSOLUTE_NULL_CELSIUS; // Kelvin to Celsius
|
||||
_battery_status[instance].temperature = msg.temperature + atmosphere::kAbsoluteNullCelsius; // Kelvin to Celsius
|
||||
_battery_status[instance].serial_number = msg.model_instance_id;
|
||||
_battery_status[instance].id = msg.getSrcNodeID().get(); // overwrite zeroed index from _battery
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "differential_pressure.hpp"
|
||||
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <lib/geo/geo.h>
|
||||
#include <lib/atmosphere/atmosphere.h>
|
||||
#include <parameters/param.h>
|
||||
#include <systemlib/err.h>
|
||||
|
||||
@@ -71,7 +71,7 @@ void UavcanDifferentialPressureBridge::air_sub_cb(const
|
||||
_device_id.devid_s.address = msg.getSrcNodeID().get() & 0xFF;
|
||||
|
||||
float diff_press_pa = msg.differential_pressure;
|
||||
float temperature_c = msg.static_air_temperature + CONSTANTS_ABSOLUTE_NULL_CELSIUS;
|
||||
float temperature_c = msg.static_air_temperature + atmosphere::kAbsoluteNullCelsius;
|
||||
|
||||
differential_pressure_s report{};
|
||||
report.timestamp_sample = timestamp_sample;
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "hygrometer.hpp"
|
||||
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <lib/geo/geo.h>
|
||||
#include <lib/atmosphere/atmosphere.h>
|
||||
|
||||
const char *const UavcanHygrometerBridge::NAME = "hygrometer_sensor";
|
||||
|
||||
@@ -65,7 +65,7 @@ void UavcanHygrometerBridge::hygro_sub_cb(const uavcan::ReceivedDataStructure<dr
|
||||
sensor_hygrometer_s report{};
|
||||
report.timestamp_sample = timestamp_sample;
|
||||
report.device_id = 0; // TODO
|
||||
report.temperature = msg.temperature + CONSTANTS_ABSOLUTE_NULL_CELSIUS;
|
||||
report.temperature = msg.temperature + atmosphere::kAbsoluteNullCelsius;
|
||||
report.humidity = msg.humidity;
|
||||
report.timestamp = hrt_absolute_time();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user