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

improve support for VTOL and Fixed-wing in SITL #652

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# @class Plane
#

. /etc/init.d/rc.fw_defaults
. ${R}etc/init.d/rc.fw_defaults

PX4_SIMULATOR=${PX4_SIMULATOR:=gz}
PX4_GZ_WORLD=${PX4_GZ_WORLD:=default}
Expand All @@ -16,7 +16,7 @@ param set-default SIM_GZ_EN 1
param set-default SIM_GZ_RUN_GZSIM 0

param set-default SENS_EN_GPSSIM 1
param set-default SENS_BAROSIM 0
param set-default SENS_EN_BAROSIM 1
param set-default SENS_EN_MAGSIM 1
param set-default SENS_EN_ARSPDSIM 1

Expand All @@ -33,25 +33,28 @@ param set-default CA_SV_CS1_TRQ_R 0.5

# GZ SIM
param set-default SIM_GZ_EC_FUNC1 101
param set-default SIM_GZ_EC_MIN1 0
param set-default SIM_GZ_EC_MIN1 150
param set-default SIM_GZ_EC_MAX1 1000

param set-default SIM_GZ_SV_FUNC1 201
param set-default SIM_GZ_SV_FUNC2 202

# Airspeed parameters
param set-default ASPD_PRIMARY 1
# param set-default FW_AIRSPD_MAX 22.0
# param set-default FW_AIRSPD_MIN 14.0
# param set-default FW_AIRSPD_STALL 12.0
# param set-default FW_AIRSPD_TRIM 18.0
param set-default FW_AIRSPD_MAX 22.0
param set-default FW_AIRSPD_MIN 14.0
param set-default FW_AIRSPD_STALL 12.0
param set-default FW_AIRSPD_TRIM 18.0

# Maximum landing slope angle in deg
param set-default FW_LND_ANG 8

# RC loss failsafe to HOLD mode
param set-default COM_RC_IN_MODE 1

# Maximum manual roll angle
param set-default FW_MAN_R_MAX 60.0

# Fixed wing control
# Pitch rate
param set-default FW_PR_P 0.9
Expand All @@ -69,10 +72,10 @@ param set-default FW_RR_I 0.5
param set-default FW_YR_FF 0.5
param set-default FW_YR_P 0.6
param set-default FW_YR_I 0.5
# Throttle limit
# param set-default FW_THR_MAX 0.6
# param set-default FW_THR_MIN 0.05
# param set-default FW_THR_TRIM 0.25
#Throttle limit
param set-default FW_THR_MAX 0.6
param set-default FW_THR_MIN 0.05
param set-default FW_THR_TRIM 0.25
# Climb and sink rate
param set-default FW_T_CLMB_MAX 8
param set-default FW_T_SINK_MAX 2.7
Expand All @@ -82,14 +85,10 @@ param set-default FW_T_SINK_MIN 2.2
param set-default NAV_ACC_RAD 15
param set-default NAV_DLL_ACT 2

# Launch detection
param set-default FW_LAUN_DETCN_ON 1

# Misc
param set-default MIS_TAKEOFF_ALT 30.0
param set-default RTL_RETURN_ALT 30.0

# Disable internal magnetometer
param set CAL_MAG0_PRIO 0

# Catapult launch with acc threshold trigger
param set-default FW_LAUN_DETCN_ON 1
param set-default FW_THR_IDLE 0.1 # needs to be running before throw as that's how gazebo detects arming
param set-default FW_LAUN_AC_THLD 10
param set-default RTL_DESCEND_ALT 30.0
param set-default FW_LND_USETER 0
4 changes: 2 additions & 2 deletions packaging/entrypoint_sitl_gzsim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ case $PX4_VEHICLE_TYPE in
export PX4_GZ_MODEL=standard_vtol
;;
fw)
export PX4_SYS_AUTOSTART=4003
export PX4_GZ_MODEL=rc_cessna
export PX4_SYS_AUTOSTART=4440
export PX4_GZ_MODEL=skywalker_x8
;;
*)
echo "ERROR: unknown vehicle type: $PX4_VEHICLE_TYPE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void SensorAirspeedSim::Run()
// report.timestamp_sample = time;
differential_pressure.device_id = 1377548; // 1377548: DRV_DIFF_PRESS_DEVTYPE_SIM, BUS: 1, ADDR: 5, TYPE: SIMULATION
differential_pressure.differential_pressure_pa = (double)diff_pressure * 100.0; // hPa to Pa;
differential_pressure.temperature = temperature_local;
differential_pressure.temperature = temperature_local - TEMPERATURE_ZERO_C;
differential_pressure.timestamp = hrt_absolute_time();
_differential_pressure_pub.publish(differential_pressure);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
using namespace time_literals;

static constexpr float TEMPERATURE_MSL = 288.15; // temperature at MSL [K] (15 [C])
static constexpr float TEMPERATURE_ZERO_C = 273.15; // temperature at zero degree Celcius [K] (0 [C])
static constexpr float PRESSURE_MSL = 101325.0; // pressure at MSL [Pa]
static constexpr float LAPSE_RATE = 0.0065; // reduction in temperature with altitude for troposphere [K/m]
static constexpr float AIR_DENSITY_MSL = 1.225; // air density at MSL [kg/m^3]
Expand Down
Loading