Skip to content

Commit

Permalink
Merged in offboard (pull request PX4#2)
Browse files Browse the repository at this point in the history
Custom glide mode + RTPS integration with Smart Loiter

Approved-by: Alexandre Borowczyk
  • Loading branch information
fse5947 committed Nov 24, 2022
2 parents 6823cbc + 40624eb commit 8ac4365
Show file tree
Hide file tree
Showing 23 changed files with 635 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
branch = master
[submodule "Tools/sitl_gazebo"]
path = Tools/sitl_gazebo
url = https://github.com/PX4/PX4-SITL_gazebo.git
url = [email protected]:notostechnologies/sitl_gazebo.git
branch = master
[submodule "src/drivers/gps/devices"]
path = src/drivers/gps/devices
Expand Down
2 changes: 1 addition & 1 deletion ROMFS/px4fmu_common/init.d-posix/airframes/1030_plane
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ param set-default FW_L1_PERIOD 12

param set-default FW_MAN_P_MAX 30

param set-default FW_PR_P 0.9
param set-default FW_PR_P 0.08
param set-default FW_PR_FF 0.2
param set-default FW_PSP_OFF 2
param set-default FW_P_LIM_MAX 32
Expand Down
18 changes: 10 additions & 8 deletions ROMFS/px4fmu_common/init.d/airframes/1000_rc_fw_easystar.hil
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ param set-default CA_SV_CS2_TRQ_Y 1.0
param set-default CA_SV_CS2_TYPE 4
param set-default CA_SV_CS3_TYPE 10

param set-default HIL_ACT_REV 2
param set-default HIL_ACT_FUNC1 201
param set-default HIL_ACT_FUNC2 202
param set-default HIL_ACT_FUNC3 203
param set-default HIL_ACT_FUNC4 101
param set-default HIL_ACT_FUNC5 204
param set-default HIL_ACT_FUNC6 400
param set-default HIL_ACT_FUNC1 0
param set-default HIL_ACT_FUNC2 0
param set-default HIL_ACT_FUNC3 201 # Rudder
param set-default HIL_ACT_FUNC4 101 # Throttle
param set-default HIL_ACT_FUNC5 202 # Flaps
param set-default HIL_ACT_FUNC6 203 # Left Aileron
param set-default HIL_ACT_FUNC7 204 # Right aileron
param set-default HIL_ACT_FUNC8 205 # elevator
param set-default HIL_ACT_FUNC9 206 # flaps

param set SYS_HITL 1

Expand All @@ -72,4 +74,4 @@ param set-default CBRK_SUPPLY_CHK 894281
param set-default COM_PREARM_MODE 0
param set-default CBRK_IO_SAFETY 22027

set MIXER AERT
set MIXER plane_hitl
148 changes: 148 additions & 0 deletions ROMFS/px4fmu_common/init.d/airframes/2201_magellan
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
#!/bin/sh
#
# @name Magellan
#
# @type Plane V-Tail
# @class Plane
#
# @output MAIN1 aileron right
# @output MAIN2 aileron left
# @output MAIN3 v-tail right
# @output MAIN4 v-tail left
# @output MAIN5 throttle
# @output MAIN6 flaps right
# @output MAIN7 flaps left
#
# @output AUX1 feed-through of RC AUX1 channel
# @output AUX2 feed-through of RC AUX2 channel
# @output AUX3 feed-through of RC AUX3 channel
#
# @maintainer Alexandre Borowczyk <[email protected]>
#

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

if [ $AUTOCNF = yes ]
then

# battery
param set BAT_SOURCE 0
param set BAT_CRIT_THR 0.175
param set BAT_EMERGEN_THR 0.10
param set BAT_LOW_THR 0.25

param set BAT_N_CELLS 3
param set BAT_CAPACITY 6000
#param set BAT_R_INTERNAL 0.06
param set BAT_V_CHARGED 4.00
param set BAT_V_EMPTY 3.65

# Airspeed
param set FW_AIRSPD_MIN 10
param set FW_AIRSPD_TRIM 15
param set FW_AIRSPD_MAX 20

param set FW_T_CLMB_MAX 3.5
param set FW_THR_IDLE 0
param set FW_THR_CRUISE 60
param set FW_MAN_P_MAX 55
param set FW_MAN_R_MAX 55
param set FW_R_LIM 55

param set FW_WR_FF 0.2
param set FW_WR_I 0.2
param set FW_WR_IMAX 0.8
param set FW_WR_P 1
param set FW_W_RMAX 0

#Radio
param set RC_MAP_PITCH 1
param set RC_MAP_ROLL 3
param set RC_MAP_THROTTLE 8
param set RC_MAP_YAW 2
param set RC_MAP_FLAPS 5
param set RC_MAP_ARM_SW 14
param set RC_MAP_FLTMODE 13
param set COM_ARM_SWISBTN 1
param set RC_MAP_AUX1 7
param set RC5_MIN 1500
param set RC5_TRIM 1750
param set RC7_MIN 1500
param set RC7_TRIM 1750

# Commander
param set COM_DISARM_LAND 0.0
param set COM_ARM_WO_GPS 0
param set COM_FLTMODE1 0
param set COM_FLTMODE2 8
param set COM_FLTMODE3 1
param set COM_FLTMODE4 3
param set COM_FLTMODE5 4
param set COM_FLTMODE6 5
#PWM
# param set PWM_MAIN_MAX1 1584
# param set PWM_MAIN_MAX2 1846
# param set PWM_MAIN_MAX3 1643
# param set PWM_MAIN_MAX4 1894
# param set PWM_MAIN_MAX5 2000
# param set PWM_MAIN_MAX6 1500
# param set PWM_MAIN_MAX7 1858


# param set PWM_MAIN_MIN1 1181
# param set PWM_MAIN_MIN2 1121
# param set PWM_MAIN_MIN3 1057
# param set PWM_MAIN_MIN4 1288
# param set PWM_MAIN_MIN5 1000
# param set PWM_MAIN_MIN6 1434
# param set PWM_MAIN_MIN7 1039


# param set PWM_MAIN_DIS1 1500
# param set PWM_MAIN_DIS2 1530
# param set PWM_MAIN_DIS3 1416
# param set PWM_MAIN_DIS4 1561
# param set PWM_MAIN_DIS5 900
# param set PWM_MAIN_DIS6 1500
# param set PWM_MAIN_DIS7 1500

# param set PWM_MAIN_FAIL1 1500
# param set PWM_MAIN_FAIL2 1530
# param set PWM_MAIN_FAIL3 1416
# param set PWM_MAIN_FAIL4 1561
# param set PWM_MAIN_FAIL5 900
# param set PWM_MAIN_FAIL6 1500
# param set PWM_MAIN_FAIL7 1500

# param set PWM_MAIN_REV1 1
# param set PWM_MAIN_REV2 0
# param set PWM_MAIN_REV3 1
# param set PWM_MAIN_REV4 1
# param set PWM_MAIN_REV6 1

# set disarmed value for the ESC
param set PWM_DISARMED 900

# Return Mode RC Loss
param set NAV_RCL_ACT 2
# Disabled Datalink Loss
param set NAV_DLL_ACT 0


# Set Logging
param set SDLOG_PROFILE 91

# UAVCAN
param set UAVCAN_ENABLE 2

param set FW_VARIO_POLAR_A -0.0127
param set FW_VARIO_POLAR_B 0.1105
param set FW_VARIO_POLAR_C -0.7274

fi


set MIXER AAVVTFF_magellan

# use PWM parameters for throttle channel
set PWM_OUT 5
2 changes: 1 addition & 1 deletion ROMFS/px4fmu_common/init.d/airframes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ px4_add_romfs_files(
2105_maja
2106_albatross
2200_mini_talon

2201_magellan
2507_cloudship

# [3000, 3999] Flying wing"
Expand Down
68 changes: 68 additions & 0 deletions ROMFS/px4fmu_common/mixers/AAVVTFF_magellan.main.mix
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
Aileron/v-tail/throttle/wheel/flaps mixer for PX4FMU
=======================================================

This file defines mixers suitable for controlling a fixed wing aircraft with
aileron, v-tail (rudder, elevator), throttle, and flaps
using PX4FMU.

The configuration assumes the following
Right Aileron- 0
Left Aileron- 1
Right tail- 2
Left tail- 3
throttle- 4
Right flaps- 5
Right flaps- 6

Control Group #0 (Flight Control)
0- roll (-1..1)
1- pitch (-1..1)
2- yaw (-1..1)
3- throttle (0..1)
4- flaps (-1..1)
5- spoilers (-1..1)
6- airbrakes (-1..1)
7- landing gear (-1..1)

Aileron mixer (roll + Airbrakes)
---------------------------------

This mixer assumes that the aileron servos are set up mechanically reversed.

M: 1
S: 0 0 10000 10000 -5200 -10000 10000

M: 1
S: 0 0 -7000 -3000 600 -10000 10000

V-tail mixers
-------------
Three scalers total (output, roll, pitch).

M: 2
S: 0 2 -7000 -7000 0 -10000 10000
S: 0 1 8000 8000 0 -10000 10000

M: 2
S: 0 2 -7000 -7000 0 -10000 10000
S: 0 1 -8000 -8000 0 -10000 10000

Motor speed mixer
-----------------
Two scalers total (output, thrust).

This mixer generates a full-range output (-1 to 1) from an input in the (0 - 1)
range. Inputs below zero are treated as zero.

M: 1
S: 0 3 0 20000 -10000 -10000 10000

Flaps mixer
------------
Flap servos are physically reversed.

M: 1
S: 0 4 10000 6000 0 -10000 10000

M: 1
S: 0 4 10000 6000 0 -10000 10000
2 changes: 2 additions & 0 deletions ROMFS/px4fmu_common/mixers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ px4_add_romfs_files(
AAERTWF.main.mix
AAVVTWFF.main.mix
AAVVTWFF_vtail.main.mix
AAVVTFF_magellan.main.mix
AERT.main.mix
AETRFG.main.mix
babyshark.main.mix
Expand Down Expand Up @@ -91,4 +92,5 @@ px4_add_romfs_files(
vtol_delta.aux.mix
vtol_tailsitter_duo.main.mix
vtol_tailsitter_duo_sat.main.mix
plane_hitl.main.mix
)
43 changes: 43 additions & 0 deletions ROMFS/px4fmu_common/mixers/plane_hitl.main.mix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Mixer for SITL plane
=========================================================

Z:

Z:

# mixer for the rudder
M: 1
O: 10000 10000 0 -10000 10000
S: 0 2 10000 10000 0 -10000 10000

# mixer for the pusher/puller throttle
# NOTE: for HITL the throttle needs to be on the 3rd position see:
# src/modules/mavlink/streams/HIL_ACTUATOR_CONTROLS.hpp::send() line 151
M: 1
O: 10000 10000 0 -10000 10000
S: 0 3 0 20000 -10000 -10000 10000

# mixer for the flaps
M: 1
O: 10000 10000 0 -10000 10000
S: 0 4 10000 10000 0 -10000 10000

# mixer for the left aileron
M: 1
O: 10000 10000 0 -10000 10000
S: 0 0 -10000 -10000 0 -10000 10000

# mixer for the right aileron
M: 1
O: 10000 10000 0 -10000 10000
S: 0 0 10000 10000 0 -10000 10000

# mixer for the elevator
M: 1
O: 10000 10000 0 -10000 10000
S: 0 1 10000 10000 0 -10000 10000

# mixer for the flaps
M: 1
O: 10000 10000 0 -10000 10000
S: 0 4 10000 10000 0 -10000 10000
Loading

0 comments on commit 8ac4365

Please sign in to comment.