Skip to content

Commit d35a895

Browse files
committed
7.1 mergeback
2 parents 8f74cf3 + 4c7980c commit d35a895

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2133
-837
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ make/local.mk
3636
launch.json
3737
.vscode/tasks.json
3838
.vscode/c_cpp_properties.json
39+
/cmake-build-debug/

.vscode/settings.json

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"chrono": "c",
44
"cmath": "c",
55
"ranges": "c",
6+
"navigation.h": "c",
7+
"rth_trackback.h": "c"
68
"platform.h": "c",
79
"timer.h": "c",
810
"bus.h": "c"

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ else()
5151
endif()
5252
endif()
5353

54-
project(INAV VERSION 7.1.0)
54+
project(INAV VERSION 8.0.0)
5555

5656
enable_language(ASM)
5757

cmake/arm-none-eabi-checks.cmake

+38-18
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,18 @@ include(gcc)
22
set(arm_none_eabi_triplet "arm-none-eabi")
33

44
# Keep version in sync with the distribution files below
5-
set(arm_none_eabi_gcc_version "10.3.1")
6-
set(arm_none_eabi_base_url "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10")
5+
set(arm_none_eabi_gcc_version "13.2.1")
6+
# This is the output directory "pretty" name and URI name prefix
7+
set(base_dir_name "arm-gnu-toolchain-13.2.rel1")
8+
# This is the name inside the archive, which is no longer evincible from URI, alas
9+
set(archive_base_dir_name "arm-gnu-toolchain-13.2.Rel1")
10+
set(arm_none_eabi_base_url "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/${base_dir_name}")
711
# suffix and checksum
8-
set(arm_none_eabi_win32 "win32.zip" 2bc8f0c4c4659f8259c8176223eeafc1)
9-
set(arm_none_eabi_linux_amd64 "x86_64-linux.tar.bz2" 2383e4eb4ea23f248d33adc70dc3227e)
10-
set(arm_none_eabi_linux_aarch64 "aarch64-linux.tar.bz2" 3fe3d8bb693bd0a6e4615b6569443d0d)
11-
set(arm_none_eabi_gcc_macos "mac.tar.bz2" 7f2a7b7b23797302a9d6182c6e482449)
12-
13-
function(arm_none_eabi_gcc_distname var)
14-
string(REPLACE "/" ";" url_parts ${arm_none_eabi_base_url})
15-
list(LENGTH url_parts n)
16-
math(EXPR last "${n} - 1")
17-
list(GET url_parts ${last} basename)
18-
set(${var} ${basename} PARENT_SCOPE)
19-
endfunction()
12+
set(arm_none_eabi_win32 "mingw-w64-i686-arm-none-eabi.zip" 7fd677088038cdf82f33f149e2e943ee)
13+
set(arm_none_eabi_linux_amd64 "x86_64-arm-none-eabi.tar.xz" 791754852f8c18ea04da7139f153a5b7)
14+
set(arm_none_eabi_linux_aarch64 "aarch64-arm-none-eabi.tar.xz" 5a08122e6d4caf97c6ccd1d29e62599c)
15+
set(arm_none_eabi_darwin_amd64 "darwin-x86_64-arm-none-eabi.tar.xz" 41d49840b0fc676d2ae35aab21a58693)
16+
set(arm_none_eabi_darwin_aarch64 "darwin-arm64-arm-none-eabi.tar.xz" 2c43e9d72206c1f81227b0a685df5ea6)
2017

2118
function(host_uname_machine var)
2219
# We need to call uname -m manually, since at the point
@@ -47,7 +44,14 @@ function(arm_none_eabi_gcc_install)
4744
message("-- no precompiled ${arm_none_eabi_triplet} toolchain for machine ${machine}")
4845
endif()
4946
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
50-
set(dist ${arm_none_eabi_gcc_macos})
47+
host_uname_machine(machine)
48+
if(machine STREQUAL "x86_64" OR machine STREQUAL "amd64")
49+
set(dist ${arm_none_eabi_darwin_amd64})
50+
elseif(machine STREQUAL "aarch64")
51+
set(dist ${arm_none_eabi_darwin_aarch64})
52+
else()
53+
message("-- no precompiled ${arm_none_eabi_triplet} toolchain for machine ${machine}")
54+
endif()
5155
endif()
5256

5357
if(dist STREQUAL "")
@@ -83,11 +87,27 @@ function(arm_none_eabi_gcc_install)
8387
if(NOT status EQUAL 0)
8488
message(FATAL_ERROR "error extracting ${basename}: ${status}")
8589
endif()
90+
string(REPLACE "." ";" url_parts ${dist_suffix})
91+
list(GET url_parts 0 host_dir_name)
92+
set(dir_name "${archive_base_dir_name}-${host_dir_name}")
93+
file(REMOVE_RECURSE "${TOOLS_DIR}/${base_dir_name}")
94+
file(RENAME "${TOOLS_DIR}/${dir_name}" "${TOOLS_DIR}/${base_dir_name}")
95+
# This is **somewhat ugly**
96+
# the newlib distributed by ARM generates suprious warnings from re-entrant POSIX functions
97+
# that INAV doesn't use. These "harmless" warnings can be surpressed by removing the
98+
# errant section from the only libnosys used by INAV ...
99+
# So look the other way ... while this is "fixed"
100+
execute_process(COMMAND arm-none-eabi-objcopy -w -R .gnu.warning.* "${TOOLS_DIR}/${base_dir_name}/arm-none-eabi/lib/thumb/v7e-m+fp/hard/libnosys.a"
101+
RESULT_VARIABLE status
102+
WORKING_DIRECTORY ${TOOLS_DIR}
103+
)
104+
if(NOT status EQUAL 0)
105+
message(FATAL_ERROR "error fixing libnosys.a: ${status}")
106+
endif()
86107
endfunction()
87108

88109
function(arm_none_eabi_gcc_add_path)
89-
arm_none_eabi_gcc_distname(dist_name)
90-
set(gcc_path "${TOOLS_DIR}/${dist_name}/bin")
110+
set(gcc_path "${TOOLS_DIR}/${base_dir_name}/bin")
91111
if(CMAKE_HOST_SYSTEM MATCHES ".*Windows.*")
92112
set(sep "\\;")
93113
else()
@@ -110,7 +130,7 @@ function(arm_none_eabi_gcc_check)
110130
message("-- found ${prog} ${version} at ${prog_path}")
111131
if(COMPILER_VERSION_CHECK AND NOT arm_none_eabi_gcc_version STREQUAL version)
112132
message("-- expecting ${prog} version ${arm_none_eabi_gcc_version}, but got version ${version} instead")
113-
arm_none_eabi_gcc_install()
133+
arm_none_eabi_gcc_install()
114134
return()
115135
endif()
116136
endfunction()

cmake/at32.cmake

+5-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ option(SEMIHOSTING "Enable semihosting")
99
message("-- DEBUG_HARDFAULTS: ${DEBUG_HARDFAULTS}, SEMIHOSTING: ${SEMIHOSTING}")
1010

1111
set(CMSIS_DIR "${MAIN_LIB_DIR}/lib/main/AT32F43x/Drivers/CMSIS")
12-
set(CMSIS_INCLUDE_DIR "${CMSIS_DIR}/cm4/core_support")
12+
set(CMSIS_INCLUDE_DIR "${CMSIS_DIR}/cm4/core_support")
1313
# DSP use common
1414
set(CMSIS_DSP_DIR "${MAIN_LIB_DIR}/main/CMSIS/DSP")
1515
set(CMSIS_DSP_INCLUDE_DIR "${CMSIS_DSP_DIR}/Include")
@@ -50,8 +50,8 @@ main_sources(AT32_ASYNCFATFS_SRC
5050
)
5151

5252
main_sources(AT32_MSC_SRC
53-
msc/at32_msc_diskio.c
54-
msc/emfat.c
53+
msc/at32_msc_diskio.c
54+
msc/emfat.c
5555
msc/emfat_file.c
5656
)
5757

@@ -92,6 +92,7 @@ set(AT32_LINK_OPTIONS
9292
-Wl,--cref
9393
-Wl,--no-wchar-size-warning
9494
-Wl,--print-memory-usage
95+
-Wl,--no-warn-rwx-segments
9596
)
9697
# Get target features
9798
macro(get_at32_target_features output_var dir target_name)
@@ -264,7 +265,7 @@ function(add_at32_executable)
264265
endif()
265266
endfunction()
266267

267-
# Main function of AT32
268+
# Main function of AT32
268269
function(target_at32)
269270
if(NOT arm-none-eabi STREQUAL TOOLCHAIN)
270271
return()

docs/ADSB.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# ADS-B
2+
3+
[Automatic Dependent Surveillance Broadcast](https://en.wikipedia.org/wiki/Automatic_Dependent_Surveillance%E2%80%93Broadcast)
4+
is an air traffic surveillance technology that enables aircraft to be accurately tracked by air traffic controllers and other pilots without the need for conventional radar.
5+
6+
## Current state
7+
8+
OSD can be configured to shows the closest aircraft.
9+
10+
## Hardware
11+
12+
All ADSB receivers which can send Mavlink [ADSB_VEHICLE](https://mavlink.io/en/messages/common.html#ADSB_VEHICLE) message are supported
13+
14+
* [PINGRX](https://uavionix.com/product/pingrx-pro/) (not tested)
15+
* [TT-SC1](https://www.aerobits.pl/product/aero/) (tested)
16+
17+

docs/Boards.md

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ These boards are well tested with INAV and are known to be of good quality and r
1212
| [Holybro Kakute H7](https://inavflight.com/shop/s/bg/1914066) | H7 | KAKUTEH7 | All | All | All | All | All | SERIAL, SD |
1313

1414
It's possible to find more supported and tested boards [here](https://github.com/iNavFlight/inav/wiki/Welcome-to-INAV,-useful-links-and-products)
15+
16+
There is also a [full list of all supported boards](https://github.com/iNavFlight/inav/wiki/Boards,-Targets-and-PWM-allocations).
17+
1518
### Boards documentation
1619

1720
See the [docs/boards](https://github.com/iNavFlight/inav/tree/master/docs/boards) folder for additional information regards to many targets in INAV, to example help in finding pinout and features. _Feel free to help improve the docs._

docs/ESC and servo outputs.md

+1-16
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,8 @@ While motors are usually ordered sequentially, here is no standard output layout
2828

2929
## Modifying output mapping
3030

31-
### Modifying all outputs at the same time
32-
33-
Since INAV 5, it has been possible to force *ALL* outputs to be `MOTORS` or `SERVOS`.
34-
35-
Traditional ESCs usually can be controlled via a servo output, but would require calibration.
36-
37-
This can be done with the `output_mode` CLI setting. Allowed values:
38-
39-
* `AUTO` assigns outputs according to the default mapping
40-
* `SERVOS` assigns all outputs to servos
41-
* `MOTORS` assigns all outputs to motors
42-
43-
### Modifying only some outputs
44-
4531
INAV 7 introduced extra functionality that let you force only some outputs to be either *MOTORS* or *SERVOS*, with some restrictions dictated by the hardware.
4632

47-
The mains restrictions is that outputs need to be associated with timers, which are usually shared between multiple outputs. Two outputs on the same timer need to have the same function.
33+
The main restrictions is that outputs are associated with timers, which can be shared between multiple outputs and two outputs on the same timer need to have the same function.
4834

4935
The easiest way to modify outputs, is to use the Mixer tab in the Configurator, as it will clearly show you which timer is used by all outputs, but you can also use `timer_output_mode` on the cli.
50-
This can be used in conjunction to the previous method, in that cass all outputs will follow `output_mode` and `timer_output_mode` overrides are applied after that.

docs/GPS_fix_estimation.md

+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# GPS Fix estimation (dead reconing, RTH without GPS) for fixed wing
2+
3+
Video demonstration
4+
5+
[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/wzvgRpXCS4U/0.jpg)](https://www.youtube.com/watch?v=wzvgRpXCS4U)
6+
7+
There is possibility to allow plane to estimate it's position when GPS fix is lost.
8+
The main purpose is RTH without GPS.
9+
It works for fixed wing only.
10+
11+
Plane should have the following sensors:
12+
- acceleromenter, gyroscope
13+
- barometer
14+
- GPS
15+
- magnethometer (optional, highly recommended)
16+
- pitot (optional)
17+
18+
By befault, all navigation modes are disabled when GPS fix is lost. If RC signal is lost also, plane will not be able to enable RTH. Plane will switch to LANDING instead. When flying above unreachable spaces, plane will be lost.
19+
20+
GPS fix estimation allows to recover plane using magnetometer and baromener only.
21+
22+
GPS Fix is also estimated on GPS Sensor timeouts (hardware failures).
23+
24+
Note, that GPS fix estimation is not a solution for navigation without GPS. Without GPS fix, position error accumulates quickly. But it is acceptable for RTH. This is not a solution for flying under spoofing also. GPS is the most trusted sensor in Inav. It's output is not validated.
25+
26+
# How it works ?
27+
28+
In normal situation, plane is receiving it's position from GPS sensor. This way it is able to hold course, RTH or navigate by waypoints.
29+
30+
Without GPS fix, plane has nose heading from magnetometer and height from barometer only.
31+
32+
To navigate without GPS fix, we make the following assumptions:
33+
- plane is flying in the direction where nose is pointing
34+
- (if pitot tube is not installed) plane is flying with constant airspeed, specified in settings
35+
36+
It is possible to roughly estimate position using theese assumptions. To increase accuracy, plane will use information about wind direction and speed, estimated before GPS fix was lost. To increase groundspeed estimation accuracy, plane will use pitot tube data(if available).
37+
38+
From estimated heading direction and speed, plane is able to **roughly** estimate it's position.
39+
40+
It is assumed, that plane will fly in roughly estimated direction to home position untill either GPS fix or RC signal is recovered.
41+
42+
*Plane has to acquire GPS fix and store home position before takeoff. Estimation completely without GPS fix will not work*.
43+
44+
# Estimation without magnethometer
45+
46+
Without magnethometer, navigation accuracy is very poor. The problem is heading drift.
47+
48+
The longer plane flies without magnethometer or GPS, the bigger is course estimation error.
49+
50+
After few minutes and few turns, "North" direction estimation can be completely broken.
51+
In general, accuracy is enough to perform RTH U-turn when both RC controls and GPS are lost, and roughtly keep RTH direction in areas with occasional GPS outages.
52+
53+
![image](https://github.com/RomanLut/inav/assets/11955117/3d5c5d10-f43a-45f9-a647-af3cca87c4da)
54+
55+
(purple line - estimated position, black line - real position).
56+
57+
It is recommened to use GPS fix estimation without magnethometer as last resort only. For example, if plane is flying above lake, landing means loss of plane. With GPS Fix estimation, plane will try to do RTH in very rought direction, instead of landing.
58+
59+
It is up to user to estimate the risk of fly-away.
60+
61+
62+
# Settings
63+
64+
GPS Fix estimation is enabled with CLI command:
65+
66+
```set inav_allow_gps_fix_estimation=ON```
67+
68+
Also you have to specify cruise airspeed of the plane.
69+
70+
To find out cruise airspeed, make a test flight. Enable ground speed display on OSD. Flight in CRUISE mode in two opposite directions. Take average speed.
71+
72+
Cruise airspeed is specified in cm/s.
73+
74+
To convert km/h to m/s, multiply by 27.77.
75+
76+
77+
Example: 100 km/h = 100 * 27.77 = 2777 cm/s
78+
79+
```set fw_reference_airspeed=2777```
80+
81+
*It is important, that plane fly with specified speed in CRUISE mode. If you have set option "Increase cruise speed with throttle" - do not use it without GPS Fix.*
82+
83+
*If pitot is available, pitot sensor data will be used instead of constant. It is not necessary to specify fw_reference_airspeed. However, it is still adviced to specify for the case of pitot failure.*
84+
85+
*Note related command: to continue mission without RC signal, see command ```set failsafe_mission_delay=-1```.*
86+
87+
**After entering CLI command, make sure that settings are saved:**
88+
89+
```save```
90+
91+
# Disabling GPS sensor from RC controller
92+
93+
![](Screenshots/programming_disable_gps_sensor_fix.png)
94+
95+
For testing purposes, it is possible to disable GPS sensor fix from RC controller in programming tab:
96+
97+
*GPS can be disabled only after: 1) initial GPS fix is acquired 2) in ARMED mode.*
98+
99+
# Allowing wp missions with GPS Fix estimation
100+
101+
```failsafe_gps_fix_estimation_delay```
102+
103+
Controls whether waypoint mission is allowed to proceed with gps fix estimation. Sets the time delay in seconds between gps fix lost event and RTH activation. Minimum delay is 7 seconds. If set to -1 the mission will continue until the end. With default setting(7), waypoint mission is aborted and switched to RTH with 7 seconds delay. RTH is done with GPS Fix estimation. RTH is trigerred regradless of failsafe procedure selected in configurator.
104+
105+
# Expected error (mag + baro)
106+
107+
Realistic expected error is up to 200m per 1km of flight path. In tests, 500m drift per 5km path was seen.
108+
109+
To dicrease drift:
110+
- fly one large circle with GPS available to get good wind estimation
111+
- use airspeed sensor. If airspeed sensor is not installed, fly in cruise mode without throttle override.
112+
- do smooth, large turns
113+
- make sure compass is pointing in nose direction precicely
114+
- calibrate compass correctly
115+
116+
This video shows real world test where GPS was disabled occasionally. Wind is 10km/h south-west:
117+
118+
119+
https://github.com/RomanLut/inav/assets/11955117/0599a3c3-df06-4d40-a32a-4d8f96140592
120+
121+
122+
Purple line shows estimated position. Black line shows real position. "EST ERR" sensor shows estimation error in metters. Estimation is running when satellite icon displays "ES". Estimated position snaps to real position when GPS fix is reaquired.
123+
124+
125+
# Is it possible to implement this for multirotor ?
126+
127+
There are some ideas, but there is no solution now. We can not make assumptions with multirotor which we can make with a fixed wing.
128+
129+
130+
# Links
131+
132+
INAV HITL https://github.com/RomanLut/INAV-X-Plane-HITL

docs/SITL/SITL.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ For this you need a FT232 module. With FT-Prog (https://ftdichip.com/utilities/)
7979
For SBUS, the command line arguments of the python script are:
8080
```python tcp_serial_redirect.py --parity E --stopbits 2 -c 127.0.0.1:[INAV-UART-PORT] COMXX 100000```
8181

82-
### Telemtry
82+
### Telemetry
8383

8484
LTM and MAVLink telemetry are supported, either as a discrete function or shared with MSP.
8585

Loading

0 commit comments

Comments
 (0)