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

Px4-xplane sitl airframe for Fixed Wing and Multicopter and VTOL #22493

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
dee3f52
added c172 and ehang4 SITL
alireza787b Dec 5, 2023
36741d8
setting params for ehang and cessna172
alireza787b Dec 6, 2023
3722882
Merge branch 'PX4:main' into px4xplane-sitl
alireza787b Dec 6, 2023
47f71a0
setting params name for ehang and cessna172
alireza787b Dec 6, 2023
8fa3224
Merge branch 'px4xplane-sitl' of https://github.com/alireza787b/PX4-A…
alireza787b Dec 6, 2023
f1c17aa
changes airspeed and roll perfomance params
alireza787b Dec 7, 2023
de5be47
Refactor X-Plane SITL targets into dedicated CMake file
alireza787b Dec 9, 2023
2d1332f
added jerk limitation to smooth the inputs in cessna 172
alireza787b Dec 10, 2023
68881fa
Merge branch 'PX4:main' into px4xplane-sitl
alireza787b Dec 15, 2023
58361eb
added Alia 250 and c172 and ehang4 name changed
alireza787b Dec 20, 2023
f27ee88
Merge branch 'PX4:main' into px4xplane-sitl
alireza787b Dec 20, 2023
8b4866d
Merge branch 'PX4:main' into px4xplane-sitl
alireza787b Dec 31, 2023
3625e75
updated performance specs for better flight
alireza787b Jan 7, 2024
971c5f7
Merge branch 'px4xplane-sitl' of https://github.com/alireza787b/PX4-A…
alireza787b Jan 7, 2024
997f530
improved Alia250 performance speeds
alireza787b Jan 9, 2024
28c5c83
Merge branch 'PX4:main' into px4xplane-sitl
alireza787b Jan 14, 2024
cb58fde
Merge branch 'PX4:main' into px4xplane-sitl
alireza787b Jan 21, 2024
2f9147f
Merge branch 'PX4:main' into px4xplane-sitl
alireza787b Feb 15, 2024
3bb67bd
Merge branch 'PX4:main' into px4xplane-sitl
alireza787b Mar 15, 2024
40f6fb7
Merge branch 'PX4:main' into px4xplane-sitl
alireza787b Apr 8, 2024
b84f974
added tb2
alireza787b Apr 14, 2024
8450e19
added 5002_xplane_tb2
alireza787b Apr 16, 2024
1addba8
Merge branch 'PX4:main' into px4xplane-sitl
alireza787b Apr 22, 2024
67b2151
Merge branch 'PX4:main' into px4xplane-sitl
alireza787b Jul 20, 2024
e109c12
fix duplicated empty line
alireza787b Jul 20, 2024
a0fd955
Merge branch 'main' into px4xplane-sitl
alireza787b Aug 11, 2024
281952d
Merge branch 'main' into px4xplane-sitl
alireza787b Aug 23, 2024
87dca6e
fixed missed params
alireza787b Aug 24, 2024
046be67
Merge branch 'px4xplane-sitl' of github.com:alireza787b/PX4-Autopilot…
alireza787b Aug 24, 2024
122b312
Update 5010_xplane_ehang184
alireza787b Aug 26, 2024
29998b9
Update 5010_xplane_ehang184
alireza787b Aug 26, 2024
c0da531
accel bias ekf2 and baro
alireza787b Aug 29, 2024
8b38dc6
merged
alireza787b Aug 29, 2024
cf28d94
accel bias rating
alireza787b Aug 29, 2024
6ea0cf9
not using baro for ekf2
alireza787b Sep 1, 2024
0414755
bias acceptance , ,..
alireza787b Sep 2, 2024
aa2087b
increased loter radii
alireza787b Sep 2, 2024
d1528ff
added new qtailsitter
alireza787b Oct 2, 2024
69172f1
Merge branch 'PX4:main' into px4xplane-sitl
alireza787b Oct 2, 2024
b356268
syntax
alireza787b Oct 2, 2024
a96a582
addedairframe
alireza787b Oct 2, 2024
3cbb375
wrong params
alireza787b Oct 2, 2024
0d34834
added filter bias for tailsitter
alireza787b Oct 19, 2024
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
144 changes: 144 additions & 0 deletions ROMFS/px4fmu_common/init.d-posix/airframes/5001_xplane_cessna172
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#!/bin/sh
#
# PX4 SITL Configuration Script for Cessna 172 Skyhawk in X-Plane
#
# This script configures PX4 SITL for a Cessna 172 Skyhawk, a standard fixed-wing plane.
# It's tailored for integration with X-Plane, a custom simulator, facilitating real-world scale simulation.
#
# Usage: Run with 'make px4_sitl xplane_cessna172'.
#
# @name: Cessna 172 Skyhawk
# Compatible Simulator: X-Plane
# @type Standard Plane
# @maintainer alireza787b <[email protected]>
# Date: Nov 2023
# @url https://github.com/alireza787b/px4xplane/
#
# ---- Start of Configuration ----

# Load default configuration for fixed-wing aircraft
. ${R}etc/init.d/rc.fw_defaults

param set-default EKF2_ABL_TAU 0.3
param set-default EKF2_ABL_LIM 2
param set-default EKF2_BARO_CTRL 1



# ---- Airframe Configuration Parameters ----
# These parameters define the physical configuration of the Cessna 172 Skyhawk airframe
param set-default CA_AIRFRAME 1
param set-default CA_ROTOR_COUNT 1

# ---- Control Surface Configuration ----
# Configuration of control surfaces for flight control and maneuvering
param set-default CA_SV_CS_COUNT 4
param set-default CA_SV_CS0_TYPE 1
param set-default CA_SV_CS0_TRQ_R -0.5
param set-default CA_SV_CS1_TYPE 2
param set-default CA_SV_CS1_TRQ_R 0.5
param set-default CA_SV_CS2_TYPE 3
param set-default CA_SV_CS2_TRQ_P 1.0
param set-default CA_SV_CS3_TYPE 4
param set-default CA_SV_CS3_TRQ_Y 1.0

# ---- Simulator Sensor Configuration ----
# Enabling simulated sensors for integration with X-Plane
param set-default SENS_EN_GPSSIM 1
param set-default SENS_EN_BAROSIM 1
param set-default SENS_EN_MAGSIM 1
param set-default SENS_EN_ARSPDSIM 1

# ---- PWM Output Configuration ----
# Assignments for PWM main outputs
param set-default PWM_MAIN_FUNC1 201
param set-default PWM_MAIN_FUNC2 202
param set-default PWM_MAIN_FUNC3 203
param set-default PWM_MAIN_FUNC4 101
param set-default PWM_MAIN_FUNC5 204
param set-default PWM_MAIN_FUNC6 204

# ---- Fixed-wing Specific Parameters ----
# Parameters specific to fixed-wing flight dynamics
param set-default FW_AIRSPD_MAX 75.0000
param set-default FW_AIRSPD_MIN 30.0000
param set-default FW_AIRSPD_STALL 25.0000
param set-default FW_AIRSPD_TRIM 45.0000
param set-default ASPD_FALLBACK_GW 1
param set-default FW_RR_FF 4.8000
param set-default FW_R_LIM 30.0000
param set-default LNDFW_VEL_XY_MAX 15.0000
param set-default FW_LND_FLALT 5.0000
param set-default RTL_LOITER_RAD 1000.0000
param set-default RTL_DESCEND_ALT 200.0000
param set-default FW_LND_FL_PMAX 35.0000

# ---- PWM Reversals ----
# Configuration for reversing the PWM signal
param set-default PWM_MAIN_REV 7

# ---- Logging Configuration ----
# Settings related to flight data logging
param set-default SDLOG_MODE 0

# ---- Circuit Breakers ----
# Disabling various system checks (use with caution)
param set-default CBRK_USB_CHK 197848 # Disable USB check
param set-default CBRK_SUPPLY_CHK 894281 # Disable real battery check
param set-default CBRK_IO_SAFETY 22027 # Disable safety switch check
param set-default CBRK_AIRSPD_CHK 1612128 # Disable airspeed sensor check

# ---- End of Configuration ----
#new

param set-default FW_TKO_AIRSPD 32.0000
param set-default FW_TKO_PITCH_MIN 20.0000
param set-default FW_T_CLMB_MAX 6.0000
param set-default FW_WING_HEIGHT 2.5000
param set-default FW_WING_SPAN 11.0000
param set-default MIS_DIST_1WP 5000.0000
param set-default MIS_TAKEOFF_ALT 100.0000
param set-default MIS_TKO_LAND_REQ 0
param set-default NAV_LOITER_RAD 1000.0000
param set-default RTL_MIN_DIST 50.0000
param set-default WEIGHT_BASE 1000.0000
param set-default WEIGHT_GROSS 1000.0000
param set-default CA_ROTOR0_PX 1.2000


param set-default CA_R0_SLEW 2.0000
param set-default EKF2_ABL_ACCLIM 35.0000
param set-default EKF2_MAG_DELAY 1.0000
param set-default FW_LND_ABORT 0
param set-default FW_PN_R_SLEW_MAX 50.0000
param set-default FW_PR_FF 3.4000
param set-default FW_PR_I 0.0450
param set-default FW_PR_P 0.3650
param set-default FW_P_LIM_MAX 20.0000
param set-default FW_P_LIM_MIN -15.0000
param set-default MPC_JERK_AUTO 1.0000
param set-default MPC_JERK_MAX 3.0000
param set-default FW_P_TC 0.4500
param set-default FW_RR_P 0.4700
param set-default FW_R_RMAX 10.0000
param set-default FW_R_TC 0.6000
param set-default FW_T_ALT_TC 10.0000
param set-default FW_T_I_GAIN_THR 0.0200
param set-default FW_T_RLL2THR 5.0000
param set-default FW_T_STE_R_TC 2.5000
param set-default FW_T_THR_DAMP 0.0000
param set-default LNDFW_AIRSPD_MAX 30.0000
param set-default MIS_YAW_ERR 30.0000
param set-default MIS_YAW_TMT 5.0000

param set-default NAV_ACC_RAD 300.0000
param set-default NAV_FW_ALT_RAD 50.0000
param set-default MPC_MAN_Y_MAX 20.0000
param set-default NAV_MIN_LTR_ALT -1.0000

param set-default EKF2_MAG_TYPE 0
param set-default FW_LND_AIRSPD 36.0000
param set-default FW_PR_D 0.3550
param set-default FW_RR_D 0.0850
param set-default FW_RR_I 0.1300
param set-default SYS_HAS_MAG 1
107 changes: 107 additions & 0 deletions ROMFS/px4fmu_common/init.d-posix/airframes/5002_xplane_tb2
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/bin/sh
#
# @name TB2 Fixed Wing Aircraft
# @type Plane A-Tail
# @class Plane
#
# @output Motor1 throttle
# @output Servo1 aileron right
# @output Servo2 aileron left
# @output Servo3 v-tail right
# @output Servo4 v-tail left
# @output Servo5 wheel
# @output Servo6 flaps right
# @output Servo7 flaps left
#
# @maintainer Alireza Ghaderi <[email protected]>
#

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

# --- Aircraft Configuration ---
param set-default CA_AIRFRAME 1
param set-default CA_ROTOR_COUNT 1
param set-default CA_SV_CS_COUNT 7


param set-default EKF2_ABL_TAU 0.3
param set-default EKF2_ABL_LIM 2
param set-default EKF2_BARO_CTRL 1


# --- Control Surface Configuration ---
param set-default CA_SV_CS0_TYPE 1 # Left aileron
param set-default CA_SV_CS0_TRQ_R -0.5
param set-default CA_SV_CS1_TYPE 2 # Right aileron
param set-default CA_SV_CS1_TRQ_R 0.5
param set-default CA_SV_CS2_TYPE 13 # Left V-tail
param set-default CA_SV_CS2_TRQ_P 0.5
param set-default CA_SV_CS2_TRQ_Y -0.5
param set-default CA_SV_CS3_TYPE 14 # Right V-tail
param set-default CA_SV_CS3_TRQ_P 0.5
param set-default CA_SV_CS3_TRQ_Y 0.5
param set-default CA_SV_CS4_TYPE 16 # Wheel
param set-default CA_SV_CS4_TRQ_Y 0
param set-default CA_SV_CS5_TYPE 9 # Left flap
param set-default CA_SV_CS6_TYPE 10 # Right flap

# --- PWM Configuration and Reversals ---
param set-default PWM_MAIN_FUNC1 201
param set-default PWM_MAIN_FUNC2 202
param set-default PWM_MAIN_FUNC3 203
param set-default PWM_MAIN_FUNC4 204
param set-default PWM_MAIN_FUNC5 101
param set-default PWM_MAIN_FUNC6 205
param set-default PWM_MAIN_FUNC7 206
param set-default PWM_MAIN_FUNC8 207
param set-default PWM_MAIN_REV 15 # PWM signal reversal configuration

# --- Flight Performance Parameters ---
param set-default FW_MAN_P_MAX 55
param set-default FW_MAN_R_MAX 55
param set-default FW_R_LIM 30
param set-default FW_WR_FF 0.2
param set-default FW_WR_I 0.2
param set-default FW_WR_IMAX 0.8
param set-default FW_WR_P 1
param set-default FW_W_RMAX 0

# --- Sensor Simulation ---
param set-default SENS_EN_GPSSIM 1
param set-default SENS_EN_BAROSIM 1
param set-default SENS_EN_MAGSIM 1
param set-default SENS_EN_ARSPDSIM 1

# --- Airspeed and Flight Mode Settings ---
param set-default FW_AIRSPD_MAX 80
param set-default FW_AIRSPD_MIN 30
param set-default FW_AIRSPD_STALL 25
param set-default FW_AIRSPD_TRIM 45
param set-default ASPD_FALLBACK_GW 1

# --- Landing and RTL Parameters ---
param set-default FW_LND_FLALT 5
param set-default RTL_LOITER_RAD 1000
param set-default FW_LND_FL_PMAX 35
param set-default FW_TKO_AIRSPD 32
param set-default FW_TKO_PITCH_MIN 20
param set-default FW_T_CLMB_MAX 6
param set-default FW_WING_HEIGHT 2.5
param set-default FW_WING_SPAN 11
param set-default MIS_DIST_1WP 5000
param set-default MIS_TAKEOFF_ALT 100
param set-default MIS_TKO_LAND_REQ 0
param set-default RTL_MIN_DIST 50

# --- Safety and Breakers ---
param set-default CBRK_USB_CHK 197848 # Disable USB check
param set-default CBRK_SUPPLY_CHK 894281 # Disable real battery check
param set-default CBRK_IO_SAFETY 22027 # Disable safety switch check

# --- Miscellaneous Settings ---
param set-default SDLOG_MODE 0
param set-default SYS_HAS_MAG 1
param set-default NAV_LOITER_RAD 1000
param set-default EKF2_MAG_TYPE 0

# --- End of Configuration ---
Loading
Loading