Auterion / px4-jsbsim-bridge

JSBSim bridge for PX4 SITL/HITL simulations
BSD 3-Clause "New" or "Revised" License
26 stars 38 forks source link

Improve Airspeed Sensor Performance and Enable User Defined XML Configuration #30

Closed mvacanti closed 3 years ago

mvacanti commented 3 years ago

Proposal This proposal addresses two items associated with the airspeed sensor: 1)Improve Airspeed Sensor performance by using differential pressure directly from JSBSim rather than inferred 2)Enable user-defined JSBSim property mapping for airspeed sensor and define a new JSBSim airspeed sensor system file.

Description of Change 1: Simplify differential pressure calculation from inferring from ground speed from:

double diff_pressure = 0.005f * rho * vel_a * vel_a + diff_pressure_noise;

to:

std::string _jsb_diff_pressure = "aero/qbar-psf";
double SensorAirspeedPlugin::getDiffPressure() { return psfToMbar(_sim_ptr->GetPropertyValue(_jsb_diff_pressure)); }
double diff_pressure = getDiffPressure();

Before Change 1: NOTE: Noise / bias removed for comparison purposes and no wind conditions. Observe that the True Airspeed does not track GPS velocity (ground truth): before-fix

After Change 1 NOTE: Noise / bias removed for comparison purposes and no wind conditions. Observe that the True Airspeed does track GPS velocity (ground truth): after-fix

Description of Change 2: Enable user mapped JSBSim variables as inputs (as per previous) and add sensor airspeed system file as per previous. The system file includes a bias model related to sensor performance effects of angle of attack and side slip angle. The system files were not added to the Rascal or Malolo in order to prevent conflicts.

To Test: Modify rascal or malolo JSBSim file and add new system sensor file: <system file="px4_default_airspeed_sensor"/> Modify rascal or malolo config file and add <jsb_diff_pressure>px4/qbar-psf</jsb_diff_pressure> OR <jsb_diff_pressure>px4/biased-qbar-psf</jsb_diff_pressure> to observe effects with high alpha or beta.