mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-18 15:51:29 +08:00
Compare commits
311 Commits
pr-ark_gps
...
pr-output_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d7f6ea09c | ||
|
|
d259386987 | ||
|
|
14c4257a59 | ||
|
|
b71c6fb6ea | ||
|
|
adb22f1407 | ||
|
|
0c97b0f4b0 | ||
|
|
5ca22df55c | ||
|
|
a3515a2474 | ||
|
|
6bd1145006 | ||
|
|
1df52df27d | ||
|
|
97423136d1 | ||
|
|
c5101c70b3 | ||
|
|
df46ad7774 | ||
|
|
d1b8a2e8d5 | ||
|
|
ae3aee3402 | ||
|
|
1d07697a9e | ||
|
|
1c25d65a1e | ||
|
|
4c0b6dbe86 | ||
|
|
d8d2213cab | ||
|
|
9184a8f4ef | ||
|
|
3ceb932b7c | ||
|
|
938be68c69 | ||
|
|
b0df7c7ccb | ||
|
|
789b3880cf | ||
|
|
0d8ba587ca | ||
|
|
178ea132b6 | ||
|
|
fe7988672f | ||
|
|
aaefc36cad | ||
|
|
6c9af2e0ec | ||
|
|
6b4fca1b9d | ||
|
|
d85aaf4dfd | ||
|
|
82c422b818 | ||
|
|
8bb20db7da | ||
|
|
7b4712cb29 | ||
|
|
d014d76ca7 | ||
|
|
5a2efc1cb2 | ||
|
|
c853acc2ff | ||
|
|
d1e8bdbd16 | ||
|
|
dc7f9165d1 | ||
|
|
3de6fee07f | ||
|
|
96a81c22e3 | ||
|
|
439d6c61e0 | ||
|
|
14b8afe972 | ||
|
|
591845bb41 | ||
|
|
be05b3e8d7 | ||
|
|
efb325d25d | ||
|
|
53076b9863 | ||
|
|
11cca72ef1 | ||
|
|
6f295d91d1 | ||
|
|
14785eeb47 | ||
|
|
4b920a6628 | ||
|
|
e47aba8bc9 | ||
|
|
72a811a4b3 | ||
|
|
80dd7e4806 | ||
|
|
f69636feef | ||
|
|
3b041ef8d4 | ||
|
|
9d465615d1 | ||
|
|
c2345ac5b3 | ||
|
|
33a3e568bb | ||
|
|
afe110cca1 | ||
|
|
e627fe01dc | ||
|
|
42ce9eb692 | ||
|
|
36f0c0f0bf | ||
|
|
120e7fea8b | ||
|
|
f00d97d974 | ||
|
|
59abab8379 | ||
|
|
a9213e3862 | ||
|
|
befbc19a4a | ||
|
|
c84185af96 | ||
|
|
9ce090f2da | ||
|
|
7c45093908 | ||
|
|
bea00f62c9 | ||
|
|
3a7f2f8bce | ||
|
|
de9074558b | ||
|
|
09d30568ab | ||
|
|
f53edfa440 | ||
|
|
c27181a154 | ||
|
|
87683aa790 | ||
|
|
8f4ce28e84 | ||
|
|
5b4031356e | ||
|
|
9409646a89 | ||
|
|
e9810e7be6 | ||
|
|
dd9c1c02d1 | ||
|
|
a6b2bcd166 | ||
|
|
a40120c332 | ||
|
|
86e5561a64 | ||
|
|
524fa73ad3 | ||
|
|
dde7bbb4f6 | ||
|
|
fe4d319ba9 | ||
|
|
c7e780cb6d | ||
|
|
184993daa3 | ||
|
|
a857df88e4 | ||
|
|
ab486de430 | ||
|
|
549c6b565c | ||
|
|
66544d080a | ||
|
|
8a68a66203 | ||
|
|
1e06ed2ed5 | ||
|
|
a73409c015 | ||
|
|
ef20708a98 | ||
|
|
2363c03bfe | ||
|
|
f01400de81 | ||
|
|
5af6cf1889 | ||
|
|
dfbd5c88b1 | ||
|
|
da8692c682 | ||
|
|
2734c44533 | ||
|
|
6a34b63b60 | ||
|
|
5e1f0b73ce | ||
|
|
3ac7ed6afa | ||
|
|
a92e7a8796 | ||
|
|
7afa011741 | ||
|
|
93cae5f9d7 | ||
|
|
8271faedeb | ||
|
|
6e31638817 | ||
|
|
a99a7d2abd | ||
|
|
eae939d86c | ||
|
|
8a899170bf | ||
|
|
7833d2a879 | ||
|
|
19964d56ed | ||
|
|
fbc95ff4bd | ||
|
|
895ddee16a | ||
|
|
742d237ae3 | ||
|
|
1c8f31f339 | ||
|
|
6cc38776c8 | ||
|
|
86fbeb8a20 | ||
|
|
e280a6c6e6 | ||
|
|
ade68aa563 | ||
|
|
f2aabe968e | ||
|
|
2865bbb8ab | ||
|
|
3c194d552a | ||
|
|
a41f24a2e2 | ||
|
|
b178c943a6 | ||
|
|
c0f26c8fbd | ||
|
|
563bfbf6e7 | ||
|
|
fd709e05b0 | ||
|
|
f3eacb4844 | ||
|
|
f8f4ea2fee | ||
|
|
56bfe41f10 | ||
|
|
19f08b46b0 | ||
|
|
a9c4e5a33f | ||
|
|
c497a25bea | ||
|
|
7c1d41aeb8 | ||
|
|
976cd67f71 | ||
|
|
9387de8282 | ||
|
|
eefc6a0027 | ||
|
|
1cf38e9d76 | ||
|
|
0dbd7b9176 | ||
|
|
ab867b963c | ||
|
|
f3e85219a3 | ||
|
|
85c75aedd1 | ||
|
|
e568b4a1d7 | ||
|
|
6320ca64a9 | ||
|
|
0f3378e194 | ||
|
|
1c3a1183c8 | ||
|
|
5f8ecd6b40 | ||
|
|
dd2322d622 | ||
|
|
70cd224236 | ||
|
|
c7672fc68c | ||
|
|
f2482d7157 | ||
|
|
a501262a6b | ||
|
|
1b99e7df81 | ||
|
|
8f02184669 | ||
|
|
9bed8f48c7 | ||
|
|
fd4d635035 | ||
|
|
58d6d03da3 | ||
|
|
3433a4cbc9 | ||
|
|
35e13a908e | ||
|
|
42d70808e9 | ||
|
|
83c461ebb8 | ||
|
|
ae89c30a18 | ||
|
|
047a5a7abf | ||
|
|
ead16d0e6c | ||
|
|
78987f6016 | ||
|
|
2110eae25d | ||
|
|
62027b0965 | ||
|
|
3b2d766573 | ||
|
|
e90e8ae0ea | ||
|
|
e3f8d53718 | ||
|
|
d2915743cb | ||
|
|
68354dc760 | ||
|
|
f0bc7d287d | ||
|
|
51cda9edb0 | ||
|
|
35b9205b25 | ||
|
|
fa1a858537 | ||
|
|
222b95233a | ||
|
|
0d53bd945e | ||
|
|
f513c40d62 | ||
|
|
2f91102808 | ||
|
|
d609e41413 | ||
|
|
d12a7dd11d | ||
|
|
36fbd18bdc | ||
|
|
fb7e973dfd | ||
|
|
22acb08406 | ||
|
|
0dcecf0666 | ||
|
|
a72f2517ea | ||
|
|
bb900264e0 | ||
|
|
b46e1d744b | ||
|
|
889b6a1a78 | ||
|
|
fbbccf6997 | ||
|
|
58d2badf9f | ||
|
|
4555c4e5cc | ||
|
|
efa12ad224 | ||
|
|
96e05481b4 | ||
|
|
50d9d05c10 | ||
|
|
00568985c0 | ||
|
|
32127ca789 | ||
|
|
6800a448b0 | ||
|
|
9d455d5f1f | ||
|
|
1a48f311ea | ||
|
|
c2b4f051f9 | ||
|
|
84577ce2c2 | ||
|
|
44d1003f8e | ||
|
|
f29c5742be | ||
|
|
833cd79e67 | ||
|
|
1592aedc11 | ||
|
|
10a2e7e44f | ||
|
|
4485c7aa11 | ||
|
|
19b681ca1f | ||
|
|
1463f9dec8 | ||
|
|
fc5b868138 | ||
|
|
5efcde7412 | ||
|
|
29714a0fba | ||
|
|
041e5069cb | ||
|
|
0d36d54fbe | ||
|
|
a4b04c3982 | ||
|
|
cf03b99ab4 | ||
|
|
0a271b1982 | ||
|
|
ec20f92558 | ||
|
|
72c6db6b23 | ||
|
|
457d261278 | ||
|
|
1ad5a9de08 | ||
|
|
142e44c418 | ||
|
|
3acc29410a | ||
|
|
55fd0bde85 | ||
|
|
77baa7c24a | ||
|
|
a47b684fd7 | ||
|
|
8741a9784d | ||
|
|
a6fcf7b48c | ||
|
|
4dda99c80b | ||
|
|
de0910c767 | ||
|
|
94d4dc85f8 | ||
|
|
3d16383bb4 | ||
|
|
c53e0c4799 | ||
|
|
fd009c8be3 | ||
|
|
c054bc2370 | ||
|
|
ae888b73d0 | ||
|
|
54d26e084a | ||
|
|
a29b07fa73 | ||
|
|
39fbfd8e0c | ||
|
|
22ee90b7d7 | ||
|
|
7394a20a58 | ||
|
|
428e7d7754 | ||
|
|
fd0a311f3c | ||
|
|
51e1a80556 | ||
|
|
a989e5338c | ||
|
|
d6dbf38a1b | ||
|
|
1089079a32 | ||
|
|
e3473a0f90 | ||
|
|
8edd7ce2c1 | ||
|
|
e5e66370e7 | ||
|
|
0d6c2c8ce9 | ||
|
|
d7f388e590 | ||
|
|
fee6d250f3 | ||
|
|
2e850371c5 | ||
|
|
e4e2e6374a | ||
|
|
654e885003 | ||
|
|
24f59dd465 | ||
|
|
a4d05085a7 | ||
|
|
c1214c847f | ||
|
|
698c57c5f8 | ||
|
|
e2cbf5be94 | ||
|
|
26fd4c852c | ||
|
|
794d0d177b | ||
|
|
6a849163db | ||
|
|
d882ae05c1 | ||
|
|
db765e6cbd | ||
|
|
c6287a8a89 | ||
|
|
d3d5b582fc | ||
|
|
53655b1e3c | ||
|
|
b8b150b213 | ||
|
|
01e9418310 | ||
|
|
a0491bfb9a | ||
|
|
1a2a02b7ae | ||
|
|
479c1524b1 | ||
|
|
85aeedd986 | ||
|
|
285e0ca519 | ||
|
|
12bde36dbe | ||
|
|
12b291b82f | ||
|
|
2ef807eaa0 | ||
|
|
eed2870fd8 | ||
|
|
f68f88b97c | ||
|
|
63b5c790b7 | ||
|
|
ecb78ca207 | ||
|
|
f120ebcdc0 | ||
|
|
3ad2c641da | ||
|
|
e31e170438 | ||
|
|
68bc90bab5 | ||
|
|
96ee73f295 | ||
|
|
71b9e31005 | ||
|
|
27f9b1b65a | ||
|
|
e79737a38d | ||
|
|
7ac50a20b0 | ||
|
|
019d232911 | ||
|
|
5137ca1ccc | ||
|
|
408c30de13 | ||
|
|
bdaf0acfca | ||
|
|
fefdad83bf | ||
|
|
da34e5e2c8 | ||
|
|
7d0a8aa638 | ||
|
|
3d238b0275 | ||
|
|
6eae9fb371 | ||
|
|
988705831d |
@ -88,7 +88,6 @@ pipeline {
|
||||
"nxp_fmuk66-e_socketcan",
|
||||
"nxp_fmuk66-v3_default",
|
||||
"nxp_fmuk66-v3_socketcan",
|
||||
"nxp_fmurt1062-v1_default",
|
||||
"nxp_mr-canhubk3_default",
|
||||
"nxp_ucans32k146_canbootloader",
|
||||
"nxp_ucans32k146_default",
|
||||
@ -111,6 +110,8 @@ pipeline {
|
||||
"px4_fmu-v6c_default",
|
||||
"px4_fmu-v6u_default",
|
||||
"px4_fmu-v6x_default",
|
||||
"px4_fmu-v6xrt_bootloader",
|
||||
"px4_fmu-v6xrt_default",
|
||||
"px4_io-v2_default",
|
||||
"raspberrypi_pico_default",
|
||||
"sky-drones_smartap-airlink_default",
|
||||
|
||||
5
.github/workflows/compile_macos.yml
vendored
5
.github/workflows/compile_macos.yml
vendored
@ -18,6 +18,11 @@ jobs:
|
||||
px4_sitl
|
||||
]
|
||||
steps:
|
||||
- name: install Python 3.10
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.10"
|
||||
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
token: ${{secrets.ACCESS_TOKEN}}
|
||||
|
||||
2
.github/workflows/compile_nuttx.yml
vendored
2
.github/workflows/compile_nuttx.yml
vendored
@ -57,7 +57,6 @@ jobs:
|
||||
mro_x21-777,
|
||||
nxp_fmuk66-e,
|
||||
nxp_fmuk66-v3,
|
||||
nxp_fmurt1062-v1,
|
||||
nxp_mr-canhubk3,
|
||||
nxp_ucans32k146,
|
||||
omnibus_f4sd,
|
||||
@ -70,6 +69,7 @@ jobs:
|
||||
px4_fmu-v6c,
|
||||
px4_fmu-v6u,
|
||||
px4_fmu-v6x,
|
||||
px4_fmu-v6xrt,
|
||||
raspberrypi_pico,
|
||||
sky-drones_smartap-airlink,
|
||||
spracing_h7extreme,
|
||||
|
||||
2
.github/workflows/metadata.yml
vendored
2
.github/workflows/metadata.yml
vendored
@ -128,4 +128,6 @@ jobs:
|
||||
run: |
|
||||
git clone https://github.com/PX4/px4_msgs.git
|
||||
rm px4_msgs/msg/*.msg
|
||||
rm px4_msgs/srv/*.srv
|
||||
cp msg/*.msg px4_msgs/msg/
|
||||
cp srv/*.srv px4_msgs/srv/
|
||||
|
||||
32
.github/workflows/nuttx_env_config.yml
vendored
Normal file
32
.github/workflows/nuttx_env_config.yml
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
name: Nuttx Target with extra env config
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container: px4io/px4-dev-nuttx-focal:2022-08-12
|
||||
strategy:
|
||||
matrix:
|
||||
config: [
|
||||
px4_fmu-v5,
|
||||
]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
token: ${{secrets.ACCESS_TOKEN}}
|
||||
|
||||
- name: make ${{matrix.config}}
|
||||
env:
|
||||
PX4_EXTRA_NUTTX_CONFIG: "CONFIG_NSH_LOGIN_PASSWORD=\"test\";CONFIG_NSH_CONSOLE_LOGIN=y"
|
||||
run: |
|
||||
echo "PX4_EXTRA_NUTTX_CONFIG: $PX4_EXTRA_NUTTX_CONFIG"
|
||||
make ${{matrix.config}} nuttx_context
|
||||
# Check that the config option is set
|
||||
grep CONFIG_NSH_LOGIN_PASSWORD build/${{matrix.config}}_default/NuttX/nuttx/.config
|
||||
14
.gitmodules
vendored
14
.gitmodules
vendored
@ -62,3 +62,17 @@
|
||||
path = src/modules/uxrce_dds_client/Micro-XRCE-DDS-Client
|
||||
url = https://github.com/PX4/Micro-XRCE-DDS-Client.git
|
||||
branch = px4
|
||||
[submodule "src/lib/cdrstream/cyclonedds"]
|
||||
path = src/lib/cdrstream/cyclonedds
|
||||
url = https://github.com/px4/cyclonedds
|
||||
[submodule "src/lib/cdrstream/rosidl"]
|
||||
path = src/lib/cdrstream/rosidl
|
||||
url = https://github.com/px4/rosidl
|
||||
[submodule "src/modules/zenoh/zenoh-pico"]
|
||||
path = src/modules/zenoh/zenoh-pico
|
||||
url = https://github.com/px4/zenoh-pico
|
||||
branch = pr-zubf-werror-fix
|
||||
[submodule "src/lib/heatshrink/heatshrink"]
|
||||
path = src/lib/heatshrink/heatshrink
|
||||
url = https://github.com/PX4/heatshrink.git
|
||||
branch = px4
|
||||
|
||||
15
.vscode/cmake-variants.yaml
vendored
15
.vscode/cmake-variants.yaml
vendored
@ -81,6 +81,16 @@ CONFIG:
|
||||
buildType: MinSizeRel
|
||||
settings:
|
||||
CONFIG: px4_fmu-v6x_bootloader
|
||||
px4_fmu-v6xrt_default:
|
||||
short: px4_fmu-v6xrt
|
||||
buildType: MinSizeRel
|
||||
settings:
|
||||
CONFIG: px4_fmu-v6xrt_default
|
||||
px4_fmu-v6xrt_bootloader:
|
||||
short: px4_fmu-v6xrt_bootloader
|
||||
buildType: MinSizeRel
|
||||
settings:
|
||||
CONFIG: px4_fmu-v6xrt_bootloader
|
||||
airmind_mindpx-v2_default:
|
||||
short: airmind_mindpx-v2
|
||||
buildType: MinSizeRel
|
||||
@ -181,6 +191,11 @@ CONFIG:
|
||||
buildType: MinSizeRel
|
||||
settings:
|
||||
CONFIG: cubepilot_cubeorange_test
|
||||
cubepilot_cubeorangeplus_test:
|
||||
short: cubepilot_cubeorangeplus
|
||||
buildType: MinSizeRel
|
||||
settings:
|
||||
CONFIG: cubepilot_cubeorangeplus_test
|
||||
emlid_navio2_default:
|
||||
short: emlid_navio2
|
||||
buildType: MinSizeRel
|
||||
|
||||
3
Jenkinsfile
vendored
3
Jenkinsfile
vendored
@ -105,6 +105,7 @@ pipeline {
|
||||
./emsdk activate latest;
|
||||
cd ..;
|
||||
. ./_emscripten_sdk/emsdk_env.sh;
|
||||
git fetch --all --tags;
|
||||
make failsafe_web;
|
||||
cd build/px4_sitl_default_failsafe_web;
|
||||
mkdir -p failsafe_sim;
|
||||
@ -230,7 +231,9 @@ pipeline {
|
||||
sh("git clone https://${GIT_USER}:${GIT_PASS}@github.com/PX4/px4_msgs.git")
|
||||
// 'main' branch
|
||||
sh('rm -f px4_msgs/msg/*.msg')
|
||||
sh('rm -f px4_msgs/srv/*.srv')
|
||||
sh('cp msg/*.msg px4_msgs/msg/')
|
||||
sh('cp srv/*.srv px4_msgs/srv/')
|
||||
sh('cd px4_msgs; git status; git add .; git commit -a -m "Update message definitions `date`" || true')
|
||||
sh('cd px4_msgs; git push origin main || true')
|
||||
sh('rm -rf px4_msgs')
|
||||
|
||||
2
Kconfig
2
Kconfig
@ -205,3 +205,5 @@ menu "platforms"
|
||||
depends on PLATFORM_QURT || PLATFORM_POSIX
|
||||
source "platforms/common/Kconfig"
|
||||
endmenu
|
||||
|
||||
source "src/lib/*/Kconfig"
|
||||
|
||||
3
Makefile
3
Makefile
@ -266,7 +266,6 @@ px4fmu_firmware: \
|
||||
|
||||
misc_qgc_extra_firmware: \
|
||||
check_nxp_fmuk66-v3_default \
|
||||
check_nxp_fmurt1062-v1_default \
|
||||
check_mro_x21_default \
|
||||
check_bitcraze_crazyflie_default \
|
||||
check_bitcraze_crazyflie21_default \
|
||||
@ -484,7 +483,9 @@ validate_module_configs:
|
||||
@find "$(SRC_DIR)"/src/modules "$(SRC_DIR)"/src/drivers "$(SRC_DIR)"/src/lib -name *.yaml -type f \
|
||||
-not -path "$(SRC_DIR)/src/lib/mixer_module/*" \
|
||||
-not -path "$(SRC_DIR)/src/modules/uxrce_dds_client/dds_topics.yaml" \
|
||||
-not -path "$(SRC_DIR)/src/modules/zenoh/zenoh-pico/*" \
|
||||
-not -path "$(SRC_DIR)/src/lib/events/libevents/*" \
|
||||
-not -path "$(SRC_DIR)/src/lib/cdrstream/*" \
|
||||
-not -path "$(SRC_DIR)/src/lib/crypto/libtommath/*" -print0 | \
|
||||
xargs -0 "$(SRC_DIR)"/Tools/validate_yaml.py --schema-file "$(SRC_DIR)"/validation/module_schema.yaml
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ These boards are maintained to be compatible with PX4-Autopilot by the Manufactu
|
||||
|
||||
### Community supported
|
||||
|
||||
These boards don't fully comply industry standards, and thus is solely maintained by the PX4 publc community members.
|
||||
These boards don't fully comply industry standards, and thus is solely maintained by the PX4 public community members.
|
||||
|
||||
### Experimental
|
||||
|
||||
|
||||
@ -67,9 +67,6 @@ then
|
||||
fi
|
||||
unset BOARD_RC_DEFAULTS
|
||||
|
||||
# start uavcannode as early as possible to pet the watchdog
|
||||
uavcannode start
|
||||
|
||||
#
|
||||
# Start system state indicator.
|
||||
#
|
||||
@ -117,4 +114,5 @@ param set-default SENS_MAG_RATE 100
|
||||
|
||||
sensors start
|
||||
|
||||
uavcannode start
|
||||
unset R
|
||||
|
||||
@ -47,6 +47,8 @@ param set-default PWM_MAIN_FUNC6 201
|
||||
param set-default PWM_MAIN_FUNC7 202
|
||||
param set-default PWM_MAIN_FUNC8 203
|
||||
|
||||
param set-default FW_AIRSPD_MAX 25
|
||||
param set-default FW_THR_ASPD_MAX 0.4
|
||||
param set-default NPFG_PERIOD 12
|
||||
param set-default FW_PR_FF 0.2
|
||||
param set-default FW_PR_P 0.9
|
||||
@ -62,19 +64,18 @@ param set-default FW_T_SINK_MAX 2.7
|
||||
param set-default FW_T_SINK_MIN 2.2
|
||||
|
||||
param set-default MC_AIRMODE 1
|
||||
param set-default MC_ROLL_P 4
|
||||
param set-default MC_ROLLRATE_P 0.3
|
||||
param set-default MC_YAW_P 1.6
|
||||
param set-default MC_YAWRATE_P 0.3
|
||||
|
||||
|
||||
param set-default MIS_TAKEOFF_ALT 10
|
||||
|
||||
param set-default MPC_XY_P 0.8
|
||||
param set-default MPC_XY_VEL_P_ACC 3
|
||||
param set-default MPC_XY_VEL_I_ACC 4
|
||||
param set-default MPC_XY_VEL_D_ACC 0.1
|
||||
|
||||
param set-default NAV_ACC_RAD 5
|
||||
|
||||
param set-default VT_FWD_THRUST_EN 4
|
||||
param set-default VT_FWD_THRUST_SC 1
|
||||
param set-default VT_F_TRANS_THR 0.75
|
||||
param set-default VT_TYPE 2
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ 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 FW_L1_PERIOD 12
|
||||
param set-default NPFG_PERIOD 12
|
||||
param set-default FW_PR_FF 0.2
|
||||
param set-default FW_PR_P 0.9
|
||||
param set-default FW_PSP_OFF 2
|
||||
|
||||
@ -52,12 +52,8 @@ param set-default MAV_1_MODE 9
|
||||
# param set-default SER_TEL1_BAUD 921600 Not found
|
||||
|
||||
# Vehicle attitude PID tuning
|
||||
param set-default MC_ACRO_EXPO 0
|
||||
param set-default MC_ACRO_EXPO_Y 0
|
||||
param set-default MC_ACRO_P_MAX 200
|
||||
param set-default MC_ACRO_R_MAX 200
|
||||
param set-default MC_ACRO_SUPEXPO 0
|
||||
param set-default MC_ACRO_SUPEXPOY 0
|
||||
param set-default MC_ACRO_Y_MAX 150
|
||||
param set-default MC_PITCHRATE_D 0.0015
|
||||
param set-default MC_ROLLRATE_D 0.0015
|
||||
|
||||
@ -0,0 +1,82 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# @name Advanced Plane SITL
|
||||
#
|
||||
|
||||
. ${R}etc/init.d/rc.fw_defaults
|
||||
|
||||
PX4_SIMULATOR=${PX4_SIMULATOR:=gz}
|
||||
PX4_GZ_WORLD=${PX4_GZ_WORLD:=default}
|
||||
PX4_SIM_MODEL=${PX4_SIM_MODEL:=advanced_plane}
|
||||
|
||||
param set-default SIM_GZ_EN 1
|
||||
|
||||
param set-default SENS_EN_GPSSIM 1
|
||||
param set-default SENS_EN_MAGSIM 1
|
||||
param set-default SENS_EN_ARSPDSIM 1
|
||||
|
||||
param set-default FW_LND_ANG 8
|
||||
param set-default NPFG_PERIOD 12
|
||||
|
||||
param set-default FW_MAN_P_MAX 30
|
||||
param set-default FW_PR_P 0.9
|
||||
param set-default FW_PR_FF 0.5
|
||||
param set-default FW_PR_I 0.5
|
||||
|
||||
param set-default FW_PSP_OFF 2
|
||||
param set-default FW_P_LIM_MAX 32
|
||||
param set-default FW_P_LIM_MIN -15
|
||||
|
||||
param set-default FW_RR_FF 0.5
|
||||
param set-default FW_RR_P 0.3
|
||||
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
|
||||
|
||||
param set-default FW_SPOILERS_LND 0.4
|
||||
|
||||
param set-default FW_THR_MIN 0.05
|
||||
param set-default FW_THR_TRIM 0.25
|
||||
|
||||
param set-default FW_T_CLMB_MAX 8
|
||||
param set-default FW_T_SINK_MAX 2.7
|
||||
param set-default FW_T_SINK_MIN 2.2
|
||||
|
||||
param set-default FW_W_EN 1
|
||||
|
||||
param set-default MIS_TAKEOFF_ALT 30
|
||||
|
||||
param set-default NAV_ACC_RAD 15
|
||||
param set-default NAV_DLL_ACT 2
|
||||
|
||||
param set-default RWTO_TKOFF 1
|
||||
|
||||
param set-default CA_AIRFRAME 1
|
||||
|
||||
param set-default CA_ROTOR_COUNT 1
|
||||
param set-default CA_ROTOR0_PX 0.3
|
||||
|
||||
param set-default CA_SV_CS_COUNT 6
|
||||
param set-default CA_SV_CS0_TRQ_R -0.5
|
||||
param set-default CA_SV_CS0_TYPE 1
|
||||
param set-default CA_SV_CS1_TRQ_R 0.5
|
||||
param set-default CA_SV_CS1_TYPE 2
|
||||
param set-default CA_SV_CS2_TRQ_P 1.0
|
||||
param set-default CA_SV_CS2_TYPE 3
|
||||
param set-default CA_SV_CS3_TRQ_Y 1.0
|
||||
param set-default CA_SV_CS3_TYPE 4
|
||||
param set-default CA_SV_CS4_TYPE 9
|
||||
param set-default CA_SV_CS5_TYPE 10
|
||||
|
||||
param set-default SIM_GZ_EC_FUNC1 101
|
||||
param set-default SIM_GZ_EC_MIN1 10
|
||||
param set-default SIM_GZ_EC_MAX1 1600
|
||||
|
||||
param set-default SIM_GZ_SV_FUNC1 201
|
||||
param set-default SIM_GZ_SV_FUNC2 202
|
||||
param set-default SIM_GZ_SV_FUNC3 203
|
||||
param set-default SIM_GZ_SV_FUNC4 204
|
||||
param set-default SIM_GZ_SV_FUNC5 205
|
||||
param set-default SIM_GZ_SV_FUNC6 206
|
||||
@ -79,6 +79,7 @@ px4_add_romfs_files(
|
||||
4004_gz_standard_vtol
|
||||
4005_gz_x500_vision
|
||||
4006_gz_px4vision
|
||||
4008_gz_advanced_plane
|
||||
|
||||
6011_gazebo-classic_typhoon_h480
|
||||
6011_gazebo-classic_typhoon_h480.post
|
||||
|
||||
@ -36,7 +36,7 @@ if [ "$PX4_SIMULATOR" = "sihsim" ] || [ "$(param show -q SYS_AUTOSTART)" -eq "0"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
elif [ "$PX4_SIMULATOR" = "gz" ] || [ "$(param show -q SIM_GZ_EN)" -eq "1" ]; then
|
||||
elif [ "$PX4_SIMULATOR" = "gz" ] || [ "$(param show -q SIM_GZ_EN)" = "1" ]; then
|
||||
|
||||
# set local coordinate frame reference
|
||||
if [ -n "${PX4_HOME_LAT}" ]; then
|
||||
@ -92,7 +92,7 @@ elif [ "$PX4_SIMULATOR" = "gz" ] || [ "$(param show -q SIM_GZ_EN)" -eq "1" ]; th
|
||||
fi
|
||||
|
||||
# start gz_bridge
|
||||
if [ -n "${PX4_GZ_MODEL}" ] && [ -z "${PX4_GZ_MODEL_NAME}" ]; then
|
||||
if [ -n "${PX4_SIM_MODEL#*gz_}" ] && [ -z "${PX4_GZ_MODEL_NAME}" ]; then
|
||||
# model specified, gz_bridge will spawn model
|
||||
|
||||
if [ -n "${PX4_GZ_MODEL_POSE}" ]; then
|
||||
@ -106,7 +106,7 @@ elif [ "$PX4_SIMULATOR" = "gz" ] || [ "$(param show -q SIM_GZ_EN)" -eq "1" ]; th
|
||||
fi
|
||||
|
||||
# start gz bridge with pose arg.
|
||||
if gz_bridge start -p "${model_pose}" -m "${PX4_GZ_MODEL}" -w "${PX4_GZ_WORLD}" -i "${px4_instance}"; then
|
||||
if gz_bridge start -p "${model_pose}" -m "${PX4_SIM_MODEL#*gz_}" -w "${PX4_GZ_WORLD}" -i "${px4_instance}"; then
|
||||
if param compare -s SENS_EN_BAROSIM 1
|
||||
then
|
||||
sensor_baro_sim start
|
||||
@ -129,7 +129,7 @@ elif [ "$PX4_SIMULATOR" = "gz" ] || [ "$(param show -q SIM_GZ_EN)" -eq "1" ]; th
|
||||
exit 1
|
||||
fi
|
||||
|
||||
elif [ -n "${PX4_GZ_MODEL_NAME}" ] && [ -z "${PX4_GZ_MODEL}" ]; then
|
||||
elif [ -n "${PX4_GZ_MODEL_NAME}" ]; then
|
||||
# model name specificed, gz_bridge will attach to existing model
|
||||
|
||||
if gz_bridge start -n "${PX4_GZ_MODEL_NAME}" -w "${PX4_GZ_WORLD}"; then
|
||||
@ -155,35 +155,8 @@ elif [ "$PX4_SIMULATOR" = "gz" ] || [ "$(param show -q SIM_GZ_EN)" -eq "1" ]; th
|
||||
exit 1
|
||||
fi
|
||||
|
||||
elif [ -n "${PX4_SIM_MODEL}" ] && [ -z "${PX4_GZ_MODEL_NAME}" ] && [ -z "${PX4_GZ_MODEL}" ]; then
|
||||
|
||||
echo "WARN [init] PX4_GZ_MODEL_NAME or PX4_GZ_MODEL not set using PX4_SIM_MODEL."
|
||||
|
||||
if gz_bridge start -m "${PX4_SIM_MODEL#*gz_}" -w "${PX4_GZ_WORLD}" -i "${px4_instance}"; then
|
||||
if param compare -s SENS_EN_BAROSIM 1
|
||||
then
|
||||
sensor_baro_sim start
|
||||
fi
|
||||
if param compare -s SENS_EN_GPSSIM 1
|
||||
then
|
||||
sensor_gps_sim start
|
||||
fi
|
||||
if param compare -s SENS_EN_MAGSIM 1
|
||||
then
|
||||
sensor_mag_sim start
|
||||
fi
|
||||
if param compare -s SENS_EN_ARSPDSIM 1
|
||||
then
|
||||
sensor_airspeed_sim start
|
||||
fi
|
||||
|
||||
else
|
||||
echo "ERROR [init] gz_bridge failed to start"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
else
|
||||
echo "ERROR [init] failed to pass only PX4_GZ_MODEL_NAME or PX4_GZ_MODEL"
|
||||
echo "ERROR [init] failed to pass only PX4_GZ_MODEL_NAME or PX4_SIM_MODEL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@ -45,12 +45,8 @@ param set-default MAV_1_MODE 9
|
||||
param set-default SER_TEL1_BAUD 921600
|
||||
|
||||
# Vehicle attitude PID tuning
|
||||
param set-default MC_ACRO_EXPO 0
|
||||
param set-default MC_ACRO_EXPO_Y 0
|
||||
param set-default MC_ACRO_P_MAX 200
|
||||
param set-default MC_ACRO_R_MAX 200
|
||||
param set-default MC_ACRO_SUPEXPO 0
|
||||
param set-default MC_ACRO_SUPEXPOY 0
|
||||
param set-default MC_ACRO_Y_MAX 150
|
||||
param set-default MC_PITCHRATE_D 0.0015
|
||||
param set-default MC_ROLLRATE_D 0.0015
|
||||
|
||||
@ -45,12 +45,8 @@ param set-default MAV_1_MODE 9
|
||||
param set-default SER_TEL1_BAUD 921600
|
||||
|
||||
# Vehicle attitude PID tuning
|
||||
param set-default MC_ACRO_EXPO 0
|
||||
param set-default MC_ACRO_EXPO_Y 0
|
||||
param set-default MC_ACRO_P_MAX 200
|
||||
param set-default MC_ACRO_R_MAX 200
|
||||
param set-default MC_ACRO_SUPEXPO 0
|
||||
param set-default MC_ACRO_SUPEXPOY 0
|
||||
param set-default MC_ACRO_Y_MAX 150
|
||||
param set-default MC_PITCHRATE_D 0.0015
|
||||
param set-default MC_ROLLRATE_D 0.0015
|
||||
|
||||
@ -1,65 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# @name Reaper 500 Quad
|
||||
#
|
||||
# @type Quadrotor H
|
||||
# @class Copter
|
||||
#
|
||||
# @maintainer Blankered
|
||||
#
|
||||
# @board px4_fmu-v2 exclude
|
||||
# @board bitcraze_crazyflie exclude
|
||||
#
|
||||
|
||||
. ${R}etc/init.d/rc.mc_defaults
|
||||
|
||||
param set-default MC_ROLLRATE_P 0.14
|
||||
param set-default MC_ROLLRATE_I 0.1
|
||||
param set-default MC_ROLLRATE_D 0.004
|
||||
param set-default MC_PITCH_P 6
|
||||
param set-default MC_PITCHRATE_P 0.14
|
||||
param set-default MC_PITCHRATE_I 0.09
|
||||
param set-default MC_PITCHRATE_D 0.004
|
||||
param set-default MC_YAW_P 4
|
||||
|
||||
param set-default NAV_ACC_RAD 2
|
||||
|
||||
param set-default RTL_RETURN_ALT 30
|
||||
param set-default RTL_DESCEND_ALT 10
|
||||
|
||||
param set-default CA_ROTOR_COUNT 4
|
||||
param set-default CA_ROTOR0_PX 0.15
|
||||
param set-default CA_ROTOR0_PY 0.15
|
||||
param set-default CA_ROTOR0_KM -0.05
|
||||
param set-default CA_ROTOR1_PX -0.15
|
||||
param set-default CA_ROTOR1_PY -0.15
|
||||
param set-default CA_ROTOR1_KM -0.05
|
||||
param set-default CA_ROTOR2_PX 0.15
|
||||
param set-default CA_ROTOR2_PY -0.15
|
||||
param set-default CA_ROTOR2_KM 0.05
|
||||
param set-default CA_ROTOR3_PX -0.15
|
||||
param set-default CA_ROTOR3_PY 0.15
|
||||
param set-default CA_ROTOR3_KM 0.05
|
||||
|
||||
param set-default PWM_MAIN_FUNC1 101
|
||||
param set-default PWM_MAIN_FUNC2 102
|
||||
param set-default PWM_MAIN_FUNC3 103
|
||||
param set-default PWM_MAIN_FUNC4 104
|
||||
param set-default PWM_MAIN_MIN1 1100
|
||||
param set-default PWM_MAIN_MIN2 1100
|
||||
param set-default PWM_MAIN_MIN3 1100
|
||||
param set-default PWM_MAIN_MIN4 1100
|
||||
param set-default PWM_MAIN_MAX1 1900
|
||||
param set-default PWM_MAIN_MAX2 1900
|
||||
param set-default PWM_MAIN_MAX3 1900
|
||||
param set-default PWM_MAIN_MAX4 1900
|
||||
|
||||
param set-default PWM_MAIN_TIM0 50
|
||||
param set-default PWM_MAIN_TIM1 50
|
||||
param set-default PWM_MAIN_TIM2 50
|
||||
|
||||
param set-default PWM_AUX_TIM0 50
|
||||
param set-default PWM_AUX_TIM1 50
|
||||
param set-default PWM_AUX_TIM2 50
|
||||
|
||||
|
||||
@ -1,91 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# @name Crazyflie 2
|
||||
#
|
||||
# @type Quadrotor x
|
||||
# @class Copter
|
||||
#
|
||||
# @maintainer Dennis Shtatov <densht@gmail.com>
|
||||
#
|
||||
# @board px4_fmu-v2 exclude
|
||||
# @board px4_fmu-v3 exclude
|
||||
# @board px4_fmu-v4 exclude
|
||||
# @board px4_fmu-v4pro exclude
|
||||
# @board px4_fmu-v5 exclude
|
||||
# @board px4_fmu-v5x exclude
|
||||
# @board diatone_mamba-f405-mk2 exclude
|
||||
#
|
||||
. ${R}etc/init.d/rc.mc_defaults
|
||||
|
||||
param set-default BAT1_N_CELLS 1
|
||||
param set-default BAT1_CAPACITY 240
|
||||
param set-default BAT1_SOURCE 1
|
||||
|
||||
param set-default CBRK_SUPPLY_CHK 894281
|
||||
param set-default COM_RC_IN_MODE 1
|
||||
|
||||
param set-default EKF2_ABL_LIM 2
|
||||
param set-default EKF2_HGT_REF 2
|
||||
param set-default EKF2_RNG_CTRL 2
|
||||
param set-default EKF2_MAG_TYPE 1
|
||||
param set-default EKF2_OF_CTRL 1
|
||||
param set-default EKF2_OF_DELAY 10
|
||||
|
||||
param set-default IMU_GYRO_CUTOFF 100
|
||||
param set-default IMU_ACCEL_CUTOFF 30
|
||||
|
||||
param set-default MC_AIRMODE 1
|
||||
param set-default IMU_DGYRO_CUTOFF 70
|
||||
param set-default MC_PITCHRATE_D 0.002
|
||||
param set-default MC_PITCHRATE_P 0.07
|
||||
param set-default MC_ROLLRATE_D 0.002
|
||||
param set-default MC_ROLLRATE_P 0.07
|
||||
param set-default MC_YAW_P 3
|
||||
|
||||
param set-default MPC_THR_HOVER 0.7
|
||||
param set-default MPC_Z_P 1.5
|
||||
param set-default MPC_Z_VEL_P_ACC 8
|
||||
param set-default MPC_Z_VEL_I_ACC 6
|
||||
param set-default MPC_HOLD_MAX_XY 0.1
|
||||
param set-default MPC_MAX_FLOW_HGT 3
|
||||
|
||||
param set-default NAV_RCL_ACT 3
|
||||
|
||||
param set-default CA_ROTOR_COUNT 4
|
||||
param set-default CA_ROTOR0_PX 0.03
|
||||
param set-default CA_ROTOR0_PY 0.03
|
||||
param set-default CA_ROTOR1_PX -0.03
|
||||
param set-default CA_ROTOR1_PY 0.03
|
||||
param set-default CA_ROTOR1_KM -0.05
|
||||
param set-default CA_ROTOR2_PX -0.03
|
||||
param set-default CA_ROTOR2_PY -0.03
|
||||
param set-default CA_ROTOR3_PX 0.03
|
||||
param set-default CA_ROTOR3_PY -0.03
|
||||
param set-default CA_ROTOR3_KM -0.05
|
||||
|
||||
# Run the motors at 328.125 kHz (recommended)
|
||||
param set-default PWM_MAIN_TIM0 3921
|
||||
param set-default PWM_MAIN_TIM1 3921
|
||||
|
||||
param set-default PWM_MAIN_FUNC1 101
|
||||
param set-default PWM_MAIN_FUNC2 102
|
||||
param set-default PWM_MAIN_FUNC3 103
|
||||
param set-default PWM_MAIN_FUNC4 104
|
||||
param set-default PWM_MAIN_DIS0 0
|
||||
param set-default PWM_MAIN_DIS1 0
|
||||
param set-default PWM_MAIN_DIS2 0
|
||||
param set-default PWM_MAIN_DIS3 0
|
||||
param set-default PWM_MAIN_MIN0 0
|
||||
param set-default PWM_MAIN_MIN1 0
|
||||
param set-default PWM_MAIN_MIN2 0
|
||||
param set-default PWM_MAIN_MIN3 0
|
||||
param set-default PWM_MAIN_MAX0 255
|
||||
param set-default PWM_MAIN_MAX1 255
|
||||
param set-default PWM_MAIN_MAX2 255
|
||||
param set-default PWM_MAIN_MAX3 255
|
||||
|
||||
|
||||
param set-default SENS_FLOW_MINRNG 0.05
|
||||
|
||||
syslink start
|
||||
mavlink start -d /dev/bridge0 -b 57600 -m osd -r 40000
|
||||
@ -13,6 +13,8 @@
|
||||
|
||||
. ${R}etc/init.d/rc.rover_defaults
|
||||
|
||||
|
||||
|
||||
param set-default BAT1_N_CELLS 4
|
||||
|
||||
param set-default EKF2_GBIAS_INIT 0.01
|
||||
@ -52,10 +54,9 @@ param set-default GND_MAX_ANG 3.1415
|
||||
# Set geometry & output configration
|
||||
param set-default CA_AIRFRAME 6
|
||||
param set-default CA_R_REV 3
|
||||
param set-default PWM_MAIN_FUNC1 101
|
||||
param set-default PWM_MAIN_FUNC2 102
|
||||
param set-default PWM_MAIN_DIS1 1500
|
||||
param set-default PWM_MAIN_DIS2 1500
|
||||
param set-default PWM_MAIN_TIM0 50
|
||||
param set-default PWM_MAIN_TIM1 50
|
||||
|
||||
|
||||
param set-default RBCLW_ADDRESS 128
|
||||
param set-default RBCLW_FUNC1 101
|
||||
param set-default RBCLW_FUNC2 102
|
||||
param set-default RBCLW_REV 1
|
||||
|
||||
@ -58,7 +58,6 @@ px4_add_romfs_files(
|
||||
4017_nxp_hovergames
|
||||
4019_x500_v2
|
||||
4020_holybro_px4vision_v1_5
|
||||
4040_reaper
|
||||
4041_beta75x
|
||||
4050_generic_250
|
||||
4052_holybro_qav250
|
||||
@ -67,7 +66,6 @@ px4_add_romfs_files(
|
||||
4071_ifo
|
||||
4073_ifo-s
|
||||
4500_clover4
|
||||
4900_crazyflie
|
||||
4901_crazyflie21
|
||||
|
||||
# [5000, 5999] Quadrotor +"
|
||||
|
||||
@ -17,7 +17,7 @@ param set-default COM_POS_FS_DELAY 5
|
||||
|
||||
# there is a 2.5 factor applied on the _FS thresholds if for invalidation
|
||||
param set-default COM_POS_FS_EPH 50
|
||||
param set-default COM_VEL_FS_EVH 5
|
||||
param set-default COM_VEL_FS_EVH 3
|
||||
|
||||
param set-default COM_POS_LOW_EPH 50
|
||||
|
||||
|
||||
@ -170,7 +170,7 @@ else
|
||||
param select-backup $PARAM_BACKUP_FILE
|
||||
fi
|
||||
|
||||
if ver hwcmp PX4_FMU_V5X PX4_FMU_V6X ARK_FMU_V6X
|
||||
if ver hwcmp PX4_FMU_V5X PX4_FMU_V6X ARK_FMU_V6X PX4_FMU_V6XRT
|
||||
then
|
||||
netman update -i eth0
|
||||
fi
|
||||
@ -274,12 +274,9 @@ else
|
||||
. $FCONFIG
|
||||
fi
|
||||
|
||||
#
|
||||
# Start IO for PWM output or RC input if enabled
|
||||
#
|
||||
if param compare -s SYS_USE_IO 1
|
||||
if px4io supported
|
||||
then
|
||||
# Check if PX4IO present and update firmware if needed.
|
||||
# Check if PX4IO present and update firmware if needed.
|
||||
if [ -f $IOFW ]
|
||||
then
|
||||
if ! px4io checkcrc ${IOFW}
|
||||
@ -301,12 +298,12 @@ else
|
||||
tune_control stop
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! px4io start
|
||||
then
|
||||
echo "PX4IO start failed"
|
||||
set STARTUP_TUNE 2 # tune 2 = ERROR_TUNE
|
||||
if ! px4io start
|
||||
then
|
||||
echo "PX4IO start failed"
|
||||
set STARTUP_TUNE 2 # tune 2 = ERROR_TUNE
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -537,6 +534,10 @@ else
|
||||
cyphal start
|
||||
fi
|
||||
fi
|
||||
if param greater -s ZENOH_ENABLE 0
|
||||
then
|
||||
zenoh start
|
||||
fi
|
||||
|
||||
#
|
||||
# End of autostart.
|
||||
|
||||
25
SECURITY.md
Normal file
25
SECURITY.md
Normal file
@ -0,0 +1,25 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
The following is a list of versions the development team is currently supporting.
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 1.4.x | :white_check_mark: |
|
||||
| 1.3.3 | :white_check_mark: |
|
||||
| < 1.3 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
We currently only receive security vulnerability reports through GitHub.
|
||||
|
||||
To begin a report, please go to the top-level repository, for example, PX4/PX4-Autopilot,
|
||||
and click on the Security tab. If you are on mobile, click the ... dropdown menu, and then click Security.
|
||||
|
||||
Click Report a Vulnerability to open the advisory form. Fill in the advisory details form.
|
||||
Make sure your title is descriptive, and the development team can find all of the relevant details needed
|
||||
to verify on the description box. We recommend you add as much data as possible. We welcome logs,
|
||||
screenshots, photos, and videos, anything that can help us verify and identify the issues being reported.
|
||||
|
||||
At the bottom of the form, click Submit report. The maintainer team will be notified and will get back to you ASAP.
|
||||
@ -25,5 +25,9 @@ exec find boards msg src platforms test \
|
||||
-path src/lib/crypto/monocypher -prune -o \
|
||||
-path src/lib/crypto/libtomcrypt -prune -o \
|
||||
-path src/lib/crypto/libtommath -prune -o \
|
||||
-path src/lib/heatshrink/heatshrink -prune -o \
|
||||
-path src/modules/uxrce_dds_client/Micro-XRCE-DDS-Client -prune -o \
|
||||
-path src/lib/cdrstream/cyclonedds -prune -o \
|
||||
-path src/lib/cdrstream/rosidl -prune -o \
|
||||
-path src/modules/zenoh/zenoh-pico -prune -o \
|
||||
-type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) | grep $PATTERN
|
||||
|
||||
@ -43,6 +43,11 @@ def create_pdf_report(ulog: ULog, multi_instance: int, output_plot_filename: str
|
||||
except:
|
||||
raise PreconditionError('could not find estimator_states instance', multi_instance)
|
||||
|
||||
try:
|
||||
estimator_sensor_bias = ulog.get_dataset('estimator_sensor_bias', multi_instance).data
|
||||
except:
|
||||
raise PreconditionError('could not find estimator_sensor_bias instance', multi_instance)
|
||||
|
||||
try:
|
||||
estimator_innovations = ulog.get_dataset('estimator_innovations', multi_instance).data
|
||||
estimator_innovation_variances = ulog.get_dataset('estimator_innovation_variances', multi_instance).data
|
||||
@ -299,21 +304,21 @@ def create_pdf_report(ulog: ULog, multi_instance: int, output_plot_filename: str
|
||||
data_plot.save()
|
||||
data_plot.close()
|
||||
|
||||
# Plot the delta angle bias estimates
|
||||
# Plot the gyro bias estimates
|
||||
data_plot = CheckFlagsPlot(
|
||||
1e-6 * estimator_states['timestamp'], estimator_states,
|
||||
[['states[10]'], ['states[11]'], ['states[12]']],
|
||||
x_label='time (sec)', y_labels=['X (rad)', 'Y (rad)', 'Z (rad)'],
|
||||
plot_title='Delta Angle Bias Estimates', annotate=False, pdf_handle=pdf_pages)
|
||||
1e-6 * estimator_sensor_bias['timestamp'], estimator_sensor_bias,
|
||||
[['gyro_bias[0]'], ['gyro_bias[1]'], ['gyro_bias[2]']],
|
||||
x_label='time (sec)', y_labels=['X (rad/s)', 'Y (rad/s)', 'Z (rad/s)'],
|
||||
plot_title='Gyro Bias Estimates', annotate=False, pdf_handle=pdf_pages)
|
||||
data_plot.save()
|
||||
data_plot.close()
|
||||
|
||||
# Plot the delta velocity bias estimates
|
||||
# Plot the accel bias estimates
|
||||
data_plot = CheckFlagsPlot(
|
||||
1e-6 * estimator_states['timestamp'], estimator_states,
|
||||
[['states[13]'], ['states[14]'], ['states[15]']],
|
||||
x_label='time (sec)', y_labels=['X (m/s)', 'Y (m/s)', 'Z (m/s)'],
|
||||
plot_title='Delta Velocity Bias Estimates', annotate=False, pdf_handle=pdf_pages)
|
||||
1e-6 * estimator_sensor_bias['timestamp'], estimator_sensor_bias,
|
||||
[['accel_bias[0]'], ['accel_bias[1]'], ['accel_bias[2]']],
|
||||
x_label='time (sec)', y_labels=['X (m/s^2)', 'Y (m/s^2)', 'Z (m/s^2)'],
|
||||
plot_title='Accel Bias Estimates', annotate=False, pdf_handle=pdf_pages)
|
||||
data_plot.save()
|
||||
data_plot.close()
|
||||
|
||||
|
||||
@ -302,12 +302,6 @@ When set to -1 (default), the value depends on the function (see {:}).
|
||||
for key, label, param_suffix, description in standard_params_array:
|
||||
if key in standard_params:
|
||||
|
||||
# values must be in range of an uint16_t
|
||||
if standard_params[key]['min'] < 0:
|
||||
raise Exception('minimum value for {:} expected >= 0 (got {:})'.format(key, standard_params[key]['min']))
|
||||
if standard_params[key]['max'] >= 1<<16:
|
||||
raise Exception('maximum value for {:} expected <= {:} (got {:})'.format(key, 1<<16, standard_params[key]['max']))
|
||||
|
||||
if key == 'failsafe':
|
||||
standard_params[key]['default'] = -1
|
||||
standard_params[key]['min'] = -1
|
||||
@ -317,7 +311,7 @@ When set to -1 (default), the value depends on the function (see {:}).
|
||||
'short': channel_label+' ${i} '+label+' Value',
|
||||
'long': description
|
||||
},
|
||||
'type': 'int32',
|
||||
'type': 'float',
|
||||
'instance_start': instance_start,
|
||||
'instance_start_label': instance_start_label,
|
||||
'num_instances': num_channels,
|
||||
|
||||
235
Tools/msg/px_generate_uorb_compressed_fields.py
Executable file
235
Tools/msg/px_generate_uorb_compressed_fields.py
Executable file
@ -0,0 +1,235 @@
|
||||
#!/usr/bin/env python3
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) 2023 PX4 Pro Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
"""
|
||||
Generates cpp source + header files with compressed uorb topic fields from json files
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import struct
|
||||
from operator import itemgetter
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../src/lib/heatshrink'))
|
||||
import heatshrink_encode
|
||||
|
||||
|
||||
def parse_json_files(json_files: [str]) -> dict:
|
||||
"""Read list of json files into a dict"""
|
||||
definitions = {}
|
||||
for json_file in json_files:
|
||||
with open(json_file, encoding='utf-8') as file_handle:
|
||||
definition = json.load(file_handle)
|
||||
assert definition['name'] not in definitions
|
||||
definitions[definition['name']] = definition
|
||||
definitions[definition['name']]['completed'] = False
|
||||
|
||||
return definitions
|
||||
|
||||
|
||||
def get_ordered_list_by_dependency(name: str, definitions: dict) -> [str]:
|
||||
"""Iterate dependency graph and create an ordered list"""
|
||||
if definitions[name]['completed']:
|
||||
return []
|
||||
ret = []
|
||||
# Get nested types first (DFS)
|
||||
for dependency in definitions[name]['dependencies']:
|
||||
ret.extend(get_ordered_list_by_dependency(dependency, definitions))
|
||||
|
||||
ret.append(name)
|
||||
definitions[name]['completed'] = True
|
||||
return ret
|
||||
|
||||
|
||||
def get_field_definitions(names: [str], definitions: dict) -> (bytes, [str]):
|
||||
"""Get byte array with all definitions"""
|
||||
ret = bytes()
|
||||
formats_list = []
|
||||
|
||||
for name in names:
|
||||
# Format as '<# orb_ids><orb_id0...><# orb_ids dependencies<orb_id_dependency0...><fields><null>'
|
||||
assert len(definitions[name]['orb_ids']) < 255
|
||||
assert len(definitions[name]['dependencies']) < 255
|
||||
ret += struct.pack('<B', len(definitions[name]['orb_ids']))
|
||||
for orb_id in definitions[name]['orb_ids']:
|
||||
assert orb_id < (1 << 16)
|
||||
ret += struct.pack('<H', orb_id)
|
||||
# Dependencies
|
||||
ret += struct.pack('<B', len(definitions[name]['dependencies']))
|
||||
for dependent_message_name in definitions[name]['dependencies']:
|
||||
# Get ORB ID by looking up the name in all definitions
|
||||
dependent_orb_id_list = [definitions[k]['main_orb_id'] for k in definitions if
|
||||
definitions[k]['name'] == dependent_message_name]
|
||||
assert len(dependent_orb_id_list) == 1
|
||||
orb_id = dependent_orb_id_list[0]
|
||||
assert (1 << 16) > orb_id >= 0
|
||||
ret += struct.pack('<H', orb_id)
|
||||
|
||||
ret += bytes(definitions[name]['fields'], 'latin1')
|
||||
ret += b'\0'
|
||||
|
||||
formats_list.append(definitions[name]['fields'])
|
||||
|
||||
return ret, formats_list
|
||||
|
||||
|
||||
def write_fields_to_cpp_file(file_name: str, compressed_fields: bytes):
|
||||
fields_str = ', '.join(str(c) for c in compressed_fields)
|
||||
with open(file_name, 'w') as file_handle:
|
||||
file_handle.write('''
|
||||
// Auto-generated from px4_generate_uorb_compressed_fields.py
|
||||
#include <uORB/topics/uORBMessageFieldsGenerated.hpp>
|
||||
|
||||
namespace uORB {
|
||||
|
||||
static const uint8_t compressed_fields[] = {
|
||||
{FIELDS}
|
||||
};
|
||||
|
||||
const uint8_t* orb_compressed_message_formats()
|
||||
{
|
||||
return compressed_fields;
|
||||
}
|
||||
unsigned orb_compressed_message_formats_size()
|
||||
{
|
||||
return sizeof(compressed_fields) / sizeof(compressed_fields[0]);
|
||||
}
|
||||
|
||||
} // namespace uORB
|
||||
'''.replace('{FIELDS}', fields_str))
|
||||
|
||||
|
||||
def c_encode(s, encoding='ascii'):
|
||||
result = ''
|
||||
for c in s:
|
||||
if not (32 <= ord(c) < 127) or c in ('\\', '"'):
|
||||
result += '\\%03o' % ord(c)
|
||||
else:
|
||||
result += c
|
||||
return '"' + result + '"'
|
||||
|
||||
|
||||
def write_fields_to_hpp_file(file_name: str, definitions: dict, window_length: int, lookahead_length: int,
|
||||
format_list: [str]):
|
||||
max_tokenized_field_length, max_tokenized_field_length_msg = max(
|
||||
((len(definitions[k]['fields']), k) for k in definitions), key=itemgetter(0))
|
||||
max_untokenized_field_length = max(definitions[k]['fields_total_length'] for k in definitions)
|
||||
max_num_orb_ids = max(len(definitions[k]['orb_ids']) for k in definitions)
|
||||
max_num_orb_id_dependencies = max(len(definitions[k]['dependencies']) for k in definitions)
|
||||
|
||||
with open(file_name, 'w') as file_handle:
|
||||
file_handle.write('''
|
||||
// Auto-generated from px4_generate_uorb_compressed_fields.py
|
||||
#include <cstdint>
|
||||
|
||||
namespace uORB {
|
||||
|
||||
/**
|
||||
* Get compressed string of all uorb message format definitions
|
||||
*/
|
||||
const uint8_t* orb_compressed_message_formats();
|
||||
|
||||
/**
|
||||
* Get length of compressed message format definitions
|
||||
*/
|
||||
unsigned orb_compressed_message_formats_size();
|
||||
|
||||
static constexpr unsigned orb_tokenized_fields_max_length = {MAX_TOKENIZED_FIELD_LENGTH}; // {MAX_TOKENIZED_FIELD_LENGTH_MSG}
|
||||
static constexpr unsigned orb_untokenized_fields_max_length = {MAX_UNTOKENIZED_FIELD_LENGTH};
|
||||
static constexpr unsigned orb_compressed_max_num_orb_ids = {MAX_NUM_ORB_IDS};
|
||||
static constexpr unsigned orb_compressed_max_num_orb_id_dependencies = {MAX_NUM_ORB_ID_DEPENDENCIES};
|
||||
|
||||
static constexpr unsigned orb_compressed_heatshrink_window_length = {WINDOW_LENGTH};
|
||||
static constexpr unsigned orb_compressed_heatshrink_lookahead_length = {LOOKAHEAD_LENGTH};
|
||||
|
||||
#define ORB_DECOMPRESSED_MESSAGE_FIELDS {{DECOMPRESSED_MESSAGE_FIELDS}}
|
||||
|
||||
} // namespace uORB
|
||||
'''
|
||||
.replace('{MAX_TOKENIZED_FIELD_LENGTH}', str(max_tokenized_field_length))
|
||||
.replace('{MAX_TOKENIZED_FIELD_LENGTH_MSG}', max_tokenized_field_length_msg)
|
||||
.replace('{MAX_UNTOKENIZED_FIELD_LENGTH}', str(max_untokenized_field_length))
|
||||
.replace('{MAX_NUM_ORB_IDS}', str(max_num_orb_ids))
|
||||
.replace('{MAX_NUM_ORB_ID_DEPENDENCIES}', str(max_num_orb_id_dependencies))
|
||||
.replace('{WINDOW_LENGTH}', str(window_length))
|
||||
.replace('{LOOKAHEAD_LENGTH}', str(lookahead_length))
|
||||
.replace('{DECOMPRESSED_MESSAGE_FIELDS}', ','.join(c_encode(x) for x in format_list))
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='Generate compressed uorb topic fields')
|
||||
parser.add_argument('-f', dest='file',
|
||||
help="json input files",
|
||||
nargs="+")
|
||||
parser.add_argument('--source-output-file', dest='output_cpp',
|
||||
help='cpp output file to generate')
|
||||
parser.add_argument('--header-output-file', dest='output_hpp',
|
||||
help='hpp output file to generate')
|
||||
parser.add_argument('-v', '--verbose',
|
||||
action='store_true',
|
||||
help="verbose output")
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.file is not None:
|
||||
definitions = parse_json_files(args.file)
|
||||
|
||||
# Get array of all field definitions
|
||||
names = []
|
||||
for definition in definitions:
|
||||
names.extend(get_ordered_list_by_dependency(definitions[definition]['name'], definitions))
|
||||
names.reverse() # Dependent definitions must be after
|
||||
assert len(names) == len(definitions)
|
||||
for definition in definitions: # sanity check
|
||||
assert definitions[definition]['completed']
|
||||
field_definitions, format_list = get_field_definitions(names, definitions)
|
||||
|
||||
# Compress
|
||||
window_size = 8 # Larger value = better compression; memory requirement (for decompression): 2 ^ window_size
|
||||
lookahead = 4
|
||||
compressed_field_definitions = heatshrink_encode.encode(field_definitions, window_size, lookahead)
|
||||
|
||||
if args.verbose:
|
||||
print(
|
||||
f'Field definitions: size: {len(field_definitions)}, reduction from compression: {len(field_definitions) - len(compressed_field_definitions)}')
|
||||
|
||||
# Write cpp & hpp file
|
||||
write_fields_to_cpp_file(args.output_cpp, compressed_field_definitions)
|
||||
write_fields_to_hpp_file(args.output_hpp, definitions, window_size, lookahead, format_list)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@ -70,9 +70,8 @@ __license__ = "BSD"
|
||||
__email__ = "thomasgubler@gmail.com"
|
||||
|
||||
|
||||
TEMPLATE_FILE = ['msg.h.em', 'msg.cpp.em']
|
||||
TOPICS_LIST_TEMPLATE_FILE = ['uORBTopics.hpp.em', 'uORBTopics.cpp.em']
|
||||
OUTPUT_FILE_EXT = ['.h', '.cpp']
|
||||
TEMPLATE_FILE = ['msg.h.em', 'msg.cpp.em', 'uorb_idl_header.h.em', 'msg.json.em']
|
||||
TOPICS_LIST_TEMPLATE_FILE = ['uORBTopics.hpp.em', 'uORBTopics.cpp.em', None, None]
|
||||
INCL_DEFAULT = ['std_msgs:./msg/std_msgs']
|
||||
PACKAGE = 'px4'
|
||||
TOPICS_TOKEN = '# TOPICS '
|
||||
@ -105,7 +104,7 @@ def get_topics(filename):
|
||||
return result
|
||||
|
||||
|
||||
def generate_output_from_file(format_idx, filename, outputdir, package, templatedir, includepath):
|
||||
def generate_output_from_file(format_idx, filename, outputdir, package, templatedir, includepath, all_topics):
|
||||
"""
|
||||
Converts a single .msg file to an uorb header/source file
|
||||
"""
|
||||
@ -150,10 +149,12 @@ def generate_output_from_file(format_idx, filename, outputdir, package, template
|
||||
em_globals = {
|
||||
"name_snake_case": full_type_name_snake,
|
||||
"file_name_in": filename,
|
||||
"file_base_name": file_base_name,
|
||||
"search_path": search_path,
|
||||
"msg_context": msg_context,
|
||||
"spec": spec,
|
||||
"topics": topics,
|
||||
"all_topics": all_topics,
|
||||
}
|
||||
|
||||
# Make sure output directory exists:
|
||||
@ -161,7 +162,11 @@ def generate_output_from_file(format_idx, filename, outputdir, package, template
|
||||
os.makedirs(outputdir)
|
||||
|
||||
template_file = os.path.join(templatedir, TEMPLATE_FILE[format_idx])
|
||||
output_file = os.path.join(outputdir, full_type_name_snake + OUTPUT_FILE_EXT[format_idx])
|
||||
extension = os.path.splitext(os.path.splitext(TEMPLATE_FILE[format_idx])[0])[1]
|
||||
if format_idx == 2:
|
||||
output_file = os.path.join(outputdir, file_base_name + extension)
|
||||
else:
|
||||
output_file = os.path.join(outputdir, full_type_name_snake + extension)
|
||||
|
||||
return generate_by_template(output_file, template_file, em_globals)
|
||||
|
||||
@ -191,17 +196,13 @@ def generate_by_template(output_file, template_file, em_globals):
|
||||
return True
|
||||
|
||||
|
||||
def generate_topics_list_file_from_files(files, outputdir, template_filename, templatedir):
|
||||
def generate_topics_list_file_from_files(files, outputdir, template_filename, templatedir, all_topics):
|
||||
# generate cpp file with topics list
|
||||
filenames = []
|
||||
for filename in [os.path.basename(p) for p in files if os.path.basename(p).endswith(".msg")]:
|
||||
filenames.append(re.sub(r'(?<!^)(?=[A-Z])', '_', filename).lower())
|
||||
|
||||
topics = []
|
||||
for msg_filename in files:
|
||||
topics.extend(get_topics(msg_filename))
|
||||
|
||||
tl_globals = {"msgs": filenames, "topics": topics}
|
||||
tl_globals = {"msgs": filenames, "all_topics": all_topics}
|
||||
tl_template_file = os.path.join(templatedir, template_filename)
|
||||
tl_out_file = os.path.join(outputdir, template_filename.replace(".em", ""))
|
||||
|
||||
@ -217,8 +218,10 @@ if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='Convert msg files to uorb headers/sources')
|
||||
parser.add_argument('--headers', help='Generate header files', action='store_true')
|
||||
parser.add_argument('--sources', help='Generate source files', action='store_true')
|
||||
parser.add_argument('--uorb-idl-header', help='Generate uORB compatible idl header', action='store_true')
|
||||
parser.add_argument('--json', help='Generate json files', action='store_true')
|
||||
parser.add_argument('-f', dest='file',
|
||||
help="files to convert (use only without -d)",
|
||||
help="files to convert",
|
||||
nargs="+")
|
||||
parser.add_argument('-i', dest="include_paths",
|
||||
help='Additional Include Paths', nargs="*",
|
||||
@ -241,13 +244,22 @@ if __name__ == "__main__":
|
||||
generate_idx = 0
|
||||
elif args.sources:
|
||||
generate_idx = 1
|
||||
elif args.uorb_idl_header:
|
||||
generate_idx = 2
|
||||
elif args.json:
|
||||
generate_idx = 3
|
||||
else:
|
||||
print('Error: either --headers or --sources must be specified')
|
||||
print('Error: either --headers, --sources or --json must be specified')
|
||||
exit(-1)
|
||||
if args.file is not None:
|
||||
all_topics = []
|
||||
for msg_filename in args.file:
|
||||
all_topics.extend(get_topics(msg_filename))
|
||||
all_topics.sort()
|
||||
|
||||
for f in args.file:
|
||||
generate_output_from_file(generate_idx, f, args.outputdir, args.package, args.templatedir, INCL_DEFAULT)
|
||||
generate_output_from_file(generate_idx, f, args.outputdir, args.package, args.templatedir, INCL_DEFAULT, all_topics)
|
||||
|
||||
# Generate topics list header and source file
|
||||
if os.path.isfile(os.path.join(args.templatedir, TOPICS_LIST_TEMPLATE_FILE[generate_idx])):
|
||||
generate_topics_list_file_from_files(args.file, args.outputdir, TOPICS_LIST_TEMPLATE_FILE[generate_idx], args.templatedir)
|
||||
if TOPICS_LIST_TEMPLATE_FILE[generate_idx] is not None and os.path.isfile(os.path.join(args.templatedir, TOPICS_LIST_TEMPLATE_FILE[generate_idx])):
|
||||
generate_topics_list_file_from_files(args.file, args.outputdir, TOPICS_LIST_TEMPLATE_FILE[generate_idx], args.templatedir, all_topics)
|
||||
|
||||
@ -171,6 +171,61 @@ def get_children_fields(base_type, search_path):
|
||||
return spec_temp.parsed_fields()
|
||||
|
||||
|
||||
def get_message_fields_str_for_message_hash(msg_fields, search_path):
|
||||
"""
|
||||
Get all fields (including for nested types) in the form of:
|
||||
'''
|
||||
uint64 timestamp
|
||||
uint8 esc_count
|
||||
uint8 esc_online_flags
|
||||
EscReport[8] esc
|
||||
uint64 timestamp
|
||||
uint32 esc_errorcount
|
||||
int32 esc_rpm
|
||||
float32 esc_voltage
|
||||
uint16 failures
|
||||
int8 esc_power
|
||||
'''
|
||||
"""
|
||||
all_fields_str = ''
|
||||
for field in msg_fields:
|
||||
if field.is_header:
|
||||
continue
|
||||
|
||||
type_name = field.type
|
||||
# detect embedded types
|
||||
sl_pos = type_name.find('/')
|
||||
if sl_pos >= 0:
|
||||
type_name = type_name[sl_pos + 1:]
|
||||
|
||||
all_fields_str += type_name + ' ' + field.name + '\n'
|
||||
|
||||
if sl_pos >= 0: # nested type, add all nested fields
|
||||
children_fields = get_children_fields(field.base_type, search_path)
|
||||
all_fields_str += get_message_fields_str_for_message_hash(children_fields, search_path)
|
||||
|
||||
return all_fields_str
|
||||
|
||||
|
||||
def hash_32_fnv1a(data: str):
|
||||
hash_val = 0x811c9dc5
|
||||
prime = 0x1000193
|
||||
for i in range(len(data)):
|
||||
value = ord(data[i])
|
||||
hash_val = hash_val ^ value
|
||||
hash_val *= prime
|
||||
hash_val &= 0xffffffff
|
||||
return hash_val
|
||||
|
||||
|
||||
def get_message_hash(msg_fields, search_path):
|
||||
"""
|
||||
Get a 32 bit message hash over all fields
|
||||
"""
|
||||
all_fields_str = get_message_fields_str_for_message_hash(msg_fields, search_path)
|
||||
return hash_32_fnv1a(all_fields_str)
|
||||
|
||||
|
||||
def add_padding_bytes(fields, search_path):
|
||||
"""
|
||||
Add padding fields before the embedded types, at the end and calculate the
|
||||
|
||||
65
Tools/msg/templates/cdrstream/uorb_idl_header.h.em
Normal file
65
Tools/msg/templates/cdrstream/uorb_idl_header.h.em
Normal file
@ -0,0 +1,65 @@
|
||||
@{
|
||||
import genmsg.msgs
|
||||
import re
|
||||
|
||||
from px_generate_uorb_topic_helper import * # this is in Tools/
|
||||
|
||||
uorb_struct = '%s_s'%name_snake_case
|
||||
uorb_struct_upper = name_snake_case.upper()
|
||||
}@
|
||||
|
||||
/****************************************************************
|
||||
|
||||
PX4 Cyclone DDS IDL to C Translator compatible idl struct
|
||||
Source: @file_name_in
|
||||
Compatible with Cyclone DDS: V0.11.0
|
||||
|
||||
*****************************************************************/
|
||||
#ifndef DDSC_IDL_UORB_@(uorb_struct_upper)_H
|
||||
#define DDSC_IDL_UORB_@(uorb_struct_upper)_H
|
||||
|
||||
#include "dds/ddsc/dds_public_impl.h"
|
||||
#include "dds/cdr/dds_cdrstream.h"
|
||||
#include <uORB/topics/@(name_snake_case).h>
|
||||
|
||||
@##############################
|
||||
@# Includes for dependencies
|
||||
@##############################
|
||||
@{
|
||||
for field in spec.parsed_fields():
|
||||
if (not field.is_builtin):
|
||||
if (not field.is_header):
|
||||
(package, name) = genmsg.names.package_resource_name(field.base_type)
|
||||
package = package or spec.package # convert '' to package
|
||||
|
||||
print('#include "%s.h"'%(name))
|
||||
name = re.sub(r'(?<!^)(?=[A-Z])', '_', name).lower()
|
||||
print('#include <uORB/topics/%s.h>'%(name))
|
||||
}@
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@{
|
||||
for field in spec.parsed_fields():
|
||||
if (not field.is_builtin):
|
||||
if (not field.is_header):
|
||||
(package, name) = genmsg.names.package_resource_name(field.base_type)
|
||||
package = package or spec.package # convert '' to package
|
||||
|
||||
print('typedef px4_msg_%s px4_msg_px4__msg__%s;' % (name,name))
|
||||
}@
|
||||
|
||||
|
||||
|
||||
typedef struct @uorb_struct px4_msg_@(file_base_name);
|
||||
|
||||
extern const struct dds_cdrstream_desc px4_msg_@(file_base_name)_cdrstream_desc;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DDSC_IDL_UORB_@(uorb_struct_upper)_H */
|
||||
@ -124,7 +124,7 @@ static inline constexpr int ucdr_topic_size_@(topic)()
|
||||
return @(struct_size);
|
||||
}
|
||||
|
||||
bool ucdr_serialize_@(topic)(const void* data, ucdrBuffer& buf, int64_t time_offset = 0)
|
||||
static inline bool ucdr_serialize_@(topic)(const void* data, ucdrBuffer& buf, int64_t time_offset = 0)
|
||||
{
|
||||
const @(uorb_struct)& topic = *static_cast<const @(uorb_struct)*>(data);
|
||||
@{
|
||||
@ -153,7 +153,7 @@ for field_type, field_name, field_size, padding in fields:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ucdr_deserialize_@(topic)(ucdrBuffer& buf, @(uorb_struct)& topic, int64_t time_offset = 0)
|
||||
static inline bool ucdr_deserialize_@(topic)(ucdrBuffer& buf, @(uorb_struct)& topic, int64_t time_offset = 0)
|
||||
{
|
||||
@{
|
||||
for field_type, field_name, field_size, padding in fields:
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
@# - spec (msggen.MsgSpec) Parsed specification of the .msg file
|
||||
@# - search_path (dict) search paths for genmsg
|
||||
@# - topics (List of String) topic names
|
||||
@# - all_topics (List of String) all generated topic names (sorted)
|
||||
@###############################################
|
||||
/****************************************************************************
|
||||
*
|
||||
@ -57,9 +58,9 @@ from px_generate_uorb_topic_helper import * # this is in Tools/
|
||||
|
||||
uorb_struct = '%s_s'%name_snake_case
|
||||
|
||||
message_hash = get_message_hash(spec.parsed_fields(), search_path)
|
||||
sorted_fields = sorted(spec.parsed_fields(), key=sizeof_field_type, reverse=True)
|
||||
struct_size, padding_end_size = add_padding_bytes(sorted_fields, search_path)
|
||||
topic_fields = ["%s %s" % (convert_type(field.type, True), field.name) for field in sorted_fields]
|
||||
}@
|
||||
|
||||
#include <inttypes.h>
|
||||
@ -72,12 +73,9 @@ topic_fields = ["%s %s" % (convert_type(field.type, True), field.name) for field
|
||||
#include <lib/matrix/matrix/math.hpp>
|
||||
#include <lib/mathlib/mathlib.h>
|
||||
|
||||
@# join all msg files in one line e.g: "float[3] position;float[3] velocity;bool armed"
|
||||
@# This is used for the logger
|
||||
constexpr char __orb_@(name_snake_case)_fields[] = "@( ";".join(topic_fields) );";
|
||||
|
||||
@[for topic in topics]@
|
||||
ORB_DEFINE(@topic, struct @uorb_struct, @(struct_size-padding_end_size), __orb_@(name_snake_case)_fields, static_cast<orb_id_size_t>(ORB_ID::@topic));
|
||||
static_assert(static_cast<orb_id_size_t>(ORB_ID::@topic) == @(all_topics.index(topic)), "ORB_ID index mismatch");
|
||||
ORB_DEFINE(@topic, struct @uorb_struct, @(struct_size-padding_end_size), @(message_hash)u, static_cast<orb_id_size_t>(ORB_ID::@topic));
|
||||
@[end for]
|
||||
|
||||
void print_message(const orb_metadata *meta, const @uorb_struct& message)
|
||||
|
||||
50
Tools/msg/templates/uorb/msg.json.em
Normal file
50
Tools/msg/templates/uorb/msg.json.em
Normal file
@ -0,0 +1,50 @@
|
||||
@###############################################
|
||||
@#
|
||||
@# PX4 ROS compatible message source code
|
||||
@# generation for C++
|
||||
@#
|
||||
@# EmPy template for generating <msg>.h files
|
||||
@# Based on the original template for ROS
|
||||
@#
|
||||
@###############################################
|
||||
@# Start of Template
|
||||
@#
|
||||
@# Context:
|
||||
@# - file_name_in (String) Source file
|
||||
@# - spec (msggen.MsgSpec) Parsed specification of the .msg file
|
||||
@# - search_path (dict) search paths for genmsg
|
||||
@# - topics (List of String) topic names
|
||||
@# - all_topics (List of String) all generated topic names (sorted)
|
||||
@###############################################
|
||||
|
||||
@{
|
||||
import genmsg.msgs
|
||||
import json
|
||||
|
||||
from px_generate_uorb_topic_helper import * # this is in Tools/
|
||||
|
||||
uorb_struct = '%s_s'%name_snake_case
|
||||
|
||||
sorted_fields = sorted(spec.parsed_fields(), key=sizeof_field_type, reverse=True)
|
||||
struct_size, padding_end_size = add_padding_bytes(sorted_fields, search_path)
|
||||
topic_fields = ["%s %s" % (convert_type(field.type, True), field.name) for field in sorted_fields]
|
||||
|
||||
dependencies = []
|
||||
for field in spec.parsed_fields():
|
||||
if not field.is_header:
|
||||
type_name = field.type
|
||||
# detect embedded types
|
||||
sl_pos = type_name.find('/')
|
||||
if sl_pos >= 0: # nested type
|
||||
dependencies.append(field.base_type)
|
||||
}@
|
||||
|
||||
{
|
||||
@# join all msg files in one line e.g: "float[3] position;float[3] velocity;bool armed;"
|
||||
"fields": @( json.dumps(bytearray(";".join(topic_fields)+";", 'utf-8').decode('unicode_escape')) ),
|
||||
"fields_total_length": @(sum([len(convert_type(field.type))+1+len(field.name)+1 for field in sorted_fields])),
|
||||
"orb_ids": @( json.dumps([ all_topics.index(topic) for topic in topics]) ),
|
||||
"main_orb_id": @( all_topics.index(name_snake_case) if name_snake_case in all_topics else -1 ),
|
||||
"dependencies": @( json.dumps(list(set(dependencies))) ),
|
||||
"name": "@( spec.full_name )"
|
||||
}
|
||||
@ -8,7 +8,7 @@
|
||||
@#
|
||||
@# Context:
|
||||
@# - msgs (List) list of all msg files
|
||||
@# - multi_topics (List) list of all multi-topic names
|
||||
@# - all_topics (List) list of all topic names (sorted)
|
||||
@###############################################
|
||||
/****************************************************************************
|
||||
*
|
||||
@ -50,9 +50,7 @@ msg_names = list(set([mn.replace(".msg", "") for mn in msgs])) # set() filters d
|
||||
msg_names.sort()
|
||||
msgs_count = len(msg_names)
|
||||
|
||||
topic_names = list(set(topics)) # set() filters duplicates
|
||||
topic_names.sort()
|
||||
topics_count = len(topics)
|
||||
topics_count = len(all_topics)
|
||||
|
||||
}@
|
||||
@[for msg_name in msg_names]@
|
||||
@ -60,8 +58,8 @@ topics_count = len(topics)
|
||||
@[end for]
|
||||
|
||||
const constexpr struct orb_metadata *const uorb_topics_list[ORB_TOPICS_COUNT] = {
|
||||
@[for idx, topic_name in enumerate(topic_names, 1)]@
|
||||
ORB_ID(@(topic_name))@[if idx != topic_names], @[end if]
|
||||
@[for idx, topic_name in enumerate(all_topics, 1)]@
|
||||
ORB_ID(@(topic_name))@[if idx != all_topics], @[end if]
|
||||
@[end for]
|
||||
};
|
||||
|
||||
|
||||
@ -7,7 +7,8 @@
|
||||
@# Start of Template
|
||||
@#
|
||||
@# Context:
|
||||
@# - topics (List) list of all topic names
|
||||
@# - msgs (List) list of all msg files
|
||||
@# - all_topics (List) list of all topic names (sorted)
|
||||
@###############################################
|
||||
/****************************************************************************
|
||||
*
|
||||
@ -43,9 +44,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
@{
|
||||
topics_count = len(topics)
|
||||
topic_names_all = list(set(topics)) # set() filters duplicates
|
||||
topic_names_all.sort()
|
||||
topics_count = len(all_topics)
|
||||
}@
|
||||
|
||||
#pragma once
|
||||
@ -63,7 +62,7 @@ static constexpr size_t orb_topics_count() { return ORB_TOPICS_COUNT; }
|
||||
extern const struct orb_metadata *const *orb_get_topics() __EXPORT;
|
||||
|
||||
enum class ORB_ID : orb_id_size_t {
|
||||
@[for idx, topic_name in enumerate(topic_names_all)]@
|
||||
@[for idx, topic_name in enumerate(all_topics)]@
|
||||
@(topic_name) = @(idx),
|
||||
@[end for]
|
||||
INVALID
|
||||
|
||||
@ -250,6 +250,22 @@ class SourceParser(object):
|
||||
event.group = "arming_check"
|
||||
event.prepend_arguments([('navigation_mode_group_t', 'modes'),
|
||||
('uint8_t', 'health_component_index')])
|
||||
elif call in ['reporter.healthFailureExt', 'reporter.armingCheckFailureExt']: # from ROS2
|
||||
assert len(args_split) == num_args + 3, \
|
||||
"Unexpected Number of arguments for: {:}, {:}".format(args_split, num_args)
|
||||
m = self.re_event_id.search(args_split[0])
|
||||
if m:
|
||||
_, event_name = m.group(1, 2)
|
||||
else:
|
||||
raise Exception("Could not extract event ID from {:}".format(args_split[0]))
|
||||
event.name = event_name
|
||||
event.message = args_split[2][1:-1]
|
||||
if 'health' in call:
|
||||
event.group = "health"
|
||||
else:
|
||||
event.group = "arming_check"
|
||||
event.prepend_arguments([('navigation_mode_group_t', 'modes'),
|
||||
('uint8_t', 'health_component_index')])
|
||||
else:
|
||||
raise Exception("unknown event method call: {}, args: {}".format(call, args))
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
## Bash script to setup PX4 development environment on Arch Linux.
|
||||
## Tested on Manjaro 20.2.1.
|
||||
## Tested on Arch 2023-03-01
|
||||
##
|
||||
## Installs:
|
||||
## - Common dependencies and tools for nuttx, jMAVSim
|
||||
@ -50,6 +50,7 @@ sudo pacman -Sy --noconfirm --needed \
|
||||
cmake \
|
||||
cppcheck \
|
||||
doxygen \
|
||||
fuse2 \
|
||||
gdb \
|
||||
git \
|
||||
gnutls \
|
||||
@ -66,7 +67,7 @@ sudo pacman -Sy --noconfirm --needed \
|
||||
|
||||
# Python dependencies
|
||||
echo "Installing PX4 Python3 dependencies"
|
||||
pip install --user -r ${DIR}/requirements.txt
|
||||
pip install --break-system-packages -r ${DIR}/${REQUIREMENTS_FILE}
|
||||
|
||||
# NuttX toolchain (arm-none-eabi-gcc)
|
||||
if [[ $INSTALL_NUTTX == "true" ]]; then
|
||||
@ -74,45 +75,17 @@ if [[ $INSTALL_NUTTX == "true" ]]; then
|
||||
echo "Installing NuttX dependencies"
|
||||
|
||||
sudo pacman -S --noconfirm --needed \
|
||||
gperf \
|
||||
vim \
|
||||
arm-none-eabi-gcc \
|
||||
arm-none-eabi-newlib \
|
||||
;
|
||||
|
||||
if [ ! -z "$USER" ]; then
|
||||
# add user to dialout group (serial port access)
|
||||
sudo usermod -aG uucp $USER
|
||||
sudo echo usermod -aG uucp $USER
|
||||
fi
|
||||
|
||||
# remove modem manager (interferes with PX4 serial port usage)
|
||||
sudo pacman -R modemmanager --noconfirm
|
||||
|
||||
# arm-none-eabi-gcc
|
||||
NUTTX_GCC_VERSION="10-2020-q4-major"
|
||||
NUTTX_GCC_VERSION_SHORT="10-2020q4"
|
||||
|
||||
source $HOME/.profile # load changed path for the case the script is reran before relogin
|
||||
if [ $(which arm-none-eabi-gcc) ]; then
|
||||
GCC_VER_STR=$(arm-none-eabi-gcc --version)
|
||||
GCC_FOUND_VER=$(echo $GCC_VER_STR | grep -c "${NUTTX_GCC_VERSION}")
|
||||
fi
|
||||
|
||||
if [[ "$GCC_FOUND_VER" == "1" ]]; then
|
||||
echo "arm-none-eabi-gcc-${NUTTX_GCC_VERSION} found, skipping installation"
|
||||
|
||||
else
|
||||
echo "Installing arm-none-eabi-gcc-${NUTTX_GCC_VERSION}";
|
||||
wget -O /tmp/gcc-arm-none-eabi-${NUTTX_GCC_VERSION}-linux.tar.bz2 https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/${NUTTX_GCC_VERSION_SHORT}/gcc-arm-none-eabi-${NUTTX_GCC_VERSION}-x86_64-linux.tar.bz2 && \
|
||||
sudo tar -jxf /tmp/gcc-arm-none-eabi-${NUTTX_GCC_VERSION}-linux.tar.bz2 -C /opt/;
|
||||
|
||||
# add arm-none-eabi-gcc to user's PATH
|
||||
exportline="export PATH=/opt/gcc-arm-none-eabi-${NUTTX_GCC_VERSION}/bin:\$PATH"
|
||||
|
||||
if grep -Fxq "$exportline" $HOME/.profile; then
|
||||
echo "${NUTTX_GCC_VERSION} path already set.";
|
||||
else
|
||||
echo $exportline >> $HOME/.profile;
|
||||
fi
|
||||
fi
|
||||
# don't run modem manager (interferes with PX4 serial port usage)
|
||||
sudo systemctl disable --now ModemManager
|
||||
fi
|
||||
|
||||
# Simulation tools
|
||||
@ -122,8 +95,7 @@ if [[ $INSTALL_SIM == "true" ]]; then
|
||||
|
||||
# java (jmavsim)
|
||||
sudo pacman -S --noconfirm --needed \
|
||||
ant \
|
||||
jdk-openjdk \
|
||||
ant
|
||||
;
|
||||
|
||||
# Gazebo setup
|
||||
@ -161,5 +133,5 @@ fi
|
||||
|
||||
if [[ $INSTALL_NUTTX == "true" ]]; then
|
||||
echo
|
||||
echo "Reboot or logout, login computer before attempting to build NuttX targets"
|
||||
echo "Reboot or logout, login computer before attempting to flash NuttX targets"
|
||||
fi
|
||||
|
||||
@ -2,7 +2,7 @@ argcomplete
|
||||
argparse>=1.2
|
||||
cerberus
|
||||
coverage
|
||||
empy>=3.3
|
||||
empy==3.3.4
|
||||
future
|
||||
jinja2>=2.8
|
||||
jsonschema
|
||||
|
||||
@ -155,7 +155,7 @@ if [[ $INSTALL_NUTTX == "true" ]]; then
|
||||
|
||||
if [ -n "$USER" ]; then
|
||||
# add user to dialout group (serial port access)
|
||||
sudo usermod -a -G dialout $USER
|
||||
sudo usermod -aG dialout $USER
|
||||
fi
|
||||
|
||||
# arm-none-eabi-gcc
|
||||
@ -165,7 +165,7 @@ if [[ $INSTALL_NUTTX == "true" ]]; then
|
||||
source $HOME/.profile # load changed path for the case the script is reran before relogin
|
||||
if [ $(which arm-none-eabi-gcc) ]; then
|
||||
GCC_VER_STR=$(arm-none-eabi-gcc --version)
|
||||
GCC_FOUND_VER=$(echo $GCC_VER_STR | grep -c "${NUTTX_GCC_VERSION}")
|
||||
GCC_FOUND_VER=$(echo $GCC_VER_STR | grep -c "${NUTTX_GCC_VERSION}" || true)
|
||||
fi
|
||||
|
||||
if [[ "$GCC_FOUND_VER" == "1" ]]; then
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 20ded0757b4f2cb362833538716caf1e938b162a
|
||||
Subproject commit 33ac87a37676fb597de110e926bbf0a080169ffe
|
||||
14
Tools/simulation/gz/models/advanced_plane/model.config
Normal file
14
Tools/simulation/gz/models/advanced_plane/model.config
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
<model>
|
||||
<name>Advanced Plane</name>
|
||||
<version>1.0</version>
|
||||
<sdf version='1.5'>model.sdf</sdf>
|
||||
|
||||
<author>
|
||||
<name>Karthik Srivatsan</name>
|
||||
</author>
|
||||
|
||||
<description>
|
||||
This is a model of a standard plane, which uses the advanced liftdrag plugin.
|
||||
</description>
|
||||
</model>
|
||||
578
Tools/simulation/gz/models/advanced_plane/model.sdf
Normal file
578
Tools/simulation/gz/models/advanced_plane/model.sdf
Normal file
@ -0,0 +1,578 @@
|
||||
<?xml version="1.0"?>
|
||||
<sdf version='1.5'>
|
||||
<model name='plane'>
|
||||
<pose>0 0 0.246 0 0 0</pose>
|
||||
<link name='base_link'>
|
||||
<pose>0 0 0 0 0 0</pose>
|
||||
<inertial>
|
||||
<pose>0 0 0 0 0 0</pose>
|
||||
<mass>1</mass>
|
||||
<inertia>
|
||||
<ixx>0.197563</ixx>
|
||||
<ixy>0</ixy>
|
||||
<ixz>0</ixz>
|
||||
<iyy>0.1458929</iyy>
|
||||
<iyz>0</iyz>
|
||||
<izz>0.1477</izz>
|
||||
</inertia>
|
||||
</inertial>
|
||||
<collision name='base_link_collision'>
|
||||
<pose>0 0 -0.07 0 0 0</pose>
|
||||
<geometry>
|
||||
<box>
|
||||
<size>0.47 0.47 0.11</size>
|
||||
</box>
|
||||
</geometry>
|
||||
<surface>
|
||||
<contact>
|
||||
<ode>
|
||||
<max_vel>10</max_vel>
|
||||
<min_depth>0.01</min_depth>
|
||||
</ode>
|
||||
</contact>
|
||||
<friction>
|
||||
<ode/>
|
||||
</friction>
|
||||
</surface>
|
||||
</collision>
|
||||
<visual name='base_link_visual'>
|
||||
<pose>0.07 0 -0.08 0 0 0</pose>
|
||||
<geometry>
|
||||
<mesh>
|
||||
<scale>0.1 0.1 0.1</scale>
|
||||
<uri>https://fuel.gazebosim.org/1.0/PX4/models/Advanced%20Plane/tip/files/meshes/body.dae</uri>
|
||||
</mesh>
|
||||
</geometry>
|
||||
<material>
|
||||
<ambient>.175 .175 .175 1.0</ambient>
|
||||
<diffuse>.175 .175 .175 1.0</diffuse>
|
||||
</material>
|
||||
</visual>
|
||||
<gravity>1</gravity>
|
||||
<velocity_decay/>
|
||||
<self_collide>0</self_collide>
|
||||
<sensor name="imu_sensor" type="imu">
|
||||
<always_on>1</always_on>
|
||||
<update_rate>250</update_rate>
|
||||
</sensor>
|
||||
<sensor name="air_pressure_sensor" type="air_pressure">
|
||||
<always_on>1</always_on>
|
||||
<update_rate>50</update_rate>
|
||||
<air_pressure>
|
||||
<pressure>
|
||||
<noise type="gaussian">
|
||||
<mean>0</mean>
|
||||
<stddev>0.01</stddev>
|
||||
</noise>
|
||||
</pressure>
|
||||
</air_pressure>
|
||||
</sensor>
|
||||
</link>
|
||||
<link name='rotor_puller'>
|
||||
<pose>0.3 0 0.0 0 1.57 0</pose>
|
||||
<inertial>
|
||||
<pose>0 0 0 0 0 0</pose>
|
||||
<mass>0.005</mass>
|
||||
<inertia>
|
||||
<ixx>9.75e-07</ixx>
|
||||
<ixy>0</ixy>
|
||||
<ixz>0</ixz>
|
||||
<iyy>0.000166704</iyy>
|
||||
<iyz>0</iyz>
|
||||
<izz>0.000167604</izz>
|
||||
</inertia>
|
||||
</inertial>
|
||||
<collision name='rotor_puller_collision'>
|
||||
<pose>0.0 0 0.0 0 0 0</pose>
|
||||
<geometry>
|
||||
<cylinder>
|
||||
<length>0.005</length>
|
||||
<radius>0.1</radius>
|
||||
</cylinder>
|
||||
</geometry>
|
||||
<surface>
|
||||
<contact>
|
||||
<ode/>
|
||||
</contact>
|
||||
<friction>
|
||||
<ode/>
|
||||
</friction>
|
||||
</surface>
|
||||
</collision>
|
||||
<visual name='rotor_puller_visual'>
|
||||
<pose>0 0 -0.09 0 0 0</pose>
|
||||
<geometry>
|
||||
<mesh>
|
||||
<scale>1 1 1</scale>
|
||||
<uri>https://fuel.gazebosim.org/1.0/PX4/models/Advanced%20Plane/tip/files/meshes/iris_prop_ccw.dae</uri>
|
||||
</mesh>
|
||||
</geometry>
|
||||
<material>
|
||||
<ambient>.175 .175 .175 1.0</ambient>
|
||||
<diffuse>.175 .175 .175 1.0</diffuse>
|
||||
</material>
|
||||
</visual>
|
||||
<gravity>1</gravity>
|
||||
<velocity_decay/>
|
||||
<self_collide>0</self_collide>
|
||||
</link>
|
||||
<joint name='rotor_puller_joint' type='revolute'>
|
||||
<child>rotor_puller</child>
|
||||
<parent>base_link</parent>
|
||||
<axis>
|
||||
<xyz>1 0 0</xyz>
|
||||
<limit>
|
||||
<lower>-1e+16</lower>
|
||||
<upper>1e+16</upper>
|
||||
</limit>
|
||||
<dynamics>
|
||||
<spring_reference>0</spring_reference>
|
||||
<spring_stiffness>0</spring_stiffness>
|
||||
</dynamics>
|
||||
<use_parent_model_frame>1</use_parent_model_frame>
|
||||
</axis>
|
||||
</joint>
|
||||
|
||||
<link name="left_elevon">
|
||||
<inertial>
|
||||
<mass>0.00000001</mass>
|
||||
<inertia>
|
||||
<ixx>0.000001</ixx>
|
||||
<ixy>0.0</ixy>
|
||||
<iyy>0.000001</iyy>
|
||||
<ixz>0.0</ixz>
|
||||
<iyz>0.0</iyz>
|
||||
<izz>0.000001</izz>
|
||||
</inertia>
|
||||
<pose>0 0.3 0 0.00 0 0.0</pose>
|
||||
</inertial>
|
||||
<visual name='left_elevon_visual'>
|
||||
<pose>0.07 0.0 -0.08 0.00 0 0.0</pose>
|
||||
<geometry>
|
||||
<mesh>
|
||||
<scale>0.1 0.1 0.1</scale>
|
||||
<uri>https://fuel.gazebosim.org/1.0/PX4/models/Advanced%20Plane/tip/files/meshes/left_aileron.dae</uri>
|
||||
</mesh>
|
||||
</geometry>
|
||||
<material>
|
||||
<ambient>1 0 0 1.0</ambient>
|
||||
<diffuse>1 0 0 1.0</diffuse>
|
||||
</material>
|
||||
</visual>
|
||||
</link>
|
||||
<link name="right_elevon">
|
||||
<inertial>
|
||||
<mass>0.00000001</mass>
|
||||
<inertia>
|
||||
<ixx>0.000001</ixx>
|
||||
<ixy>0.0</ixy>
|
||||
<iyy>0.000001</iyy>
|
||||
<ixz>0.0</ixz>
|
||||
<iyz>0.0</iyz>
|
||||
<izz>0.000001</izz>
|
||||
</inertia>
|
||||
<pose>0 -0.3 0 0.00 0 0.0</pose>
|
||||
</inertial>
|
||||
<visual name='right_elevon_visual'>
|
||||
<pose>0.07 0.0 -0.08 0.00 0 0.0</pose>
|
||||
<geometry>
|
||||
<mesh>
|
||||
<scale>0.1 0.1 0.1</scale>
|
||||
<uri>https://fuel.gazebosim.org/1.0/PX4/models/Advanced%20Plane/tip/files/meshes/right_aileron.dae</uri>
|
||||
</mesh>
|
||||
</geometry>
|
||||
<material>
|
||||
<ambient>1 0 0 1.0</ambient>
|
||||
<diffuse>1 0 0 1.0</diffuse>
|
||||
</material>
|
||||
</visual>
|
||||
</link>
|
||||
<link name="left_flap">
|
||||
<inertial>
|
||||
<mass>0.00000001</mass>
|
||||
<inertia>
|
||||
<ixx>0.000001</ixx>
|
||||
<ixy>0.0</ixy>
|
||||
<iyy>0.000001</iyy>
|
||||
<ixz>0.0</ixz>
|
||||
<iyz>0.0</iyz>
|
||||
<izz>0.000001</izz>
|
||||
</inertia>
|
||||
<pose>0 0.15 0 0.00 0 0.0</pose>
|
||||
</inertial>
|
||||
<visual name='left_flap_visual'>
|
||||
<pose>0.07 0.0 -0.08 0.00 0 0.0</pose>
|
||||
<geometry>
|
||||
<mesh>
|
||||
<scale>0.1 0.1 0.1</scale>
|
||||
<uri>https://fuel.gazebosim.org/1.0/PX4/models/Advanced%20Plane/tip/files/meshes/left_flap.dae</uri>
|
||||
</mesh>
|
||||
</geometry>
|
||||
<material>
|
||||
<ambient>1 0 0 1.0</ambient>
|
||||
<diffuse>1 0 0 1.0</diffuse>
|
||||
</material>
|
||||
</visual>
|
||||
</link>
|
||||
<link name="right_flap">
|
||||
<inertial>
|
||||
<mass>0.00000001</mass>
|
||||
<inertia>
|
||||
<ixx>0.000001</ixx>
|
||||
<ixy>0.0</ixy>
|
||||
<iyy>0.000001</iyy>
|
||||
<ixz>0.0</ixz>
|
||||
<iyz>0.0</iyz>
|
||||
<izz>0.000001</izz>
|
||||
</inertia>
|
||||
<pose>0 -0.15 0 0.00 0 0.0</pose>
|
||||
</inertial>
|
||||
<visual name='right_flap_visual'>
|
||||
<pose>0.07 0.0 -0.08 0.00 0 0.0</pose>
|
||||
<geometry>
|
||||
<mesh>
|
||||
<scale>0.1 0.1 0.1</scale>
|
||||
<uri>https://fuel.gazebosim.org/1.0/PX4/models/Advanced%20Plane/tip/files/meshes/right_flap.dae</uri>
|
||||
</mesh>
|
||||
</geometry>
|
||||
<material>
|
||||
<ambient>1 0 0 1.0</ambient>
|
||||
<diffuse>1 0 0 1.0</diffuse>
|
||||
</material>
|
||||
</visual>
|
||||
</link>
|
||||
<link name="elevator">
|
||||
<inertial>
|
||||
<mass>0.00000001</mass>
|
||||
<inertia>
|
||||
<ixx>0.000001</ixx>
|
||||
<ixy>0.0</ixy>
|
||||
<iyy>0.000001</iyy>
|
||||
<ixz>0.0</ixz>
|
||||
<iyz>0.0</iyz>
|
||||
<izz>0.000001</izz>
|
||||
</inertia>
|
||||
<pose> -0.5 0 0 0.00 0 0.0</pose>
|
||||
</inertial>
|
||||
<visual name='elevator_visual'>
|
||||
<pose>0.07 0.0 -0.08 0.00 0 0.0</pose>
|
||||
<geometry>
|
||||
<mesh>
|
||||
<scale>0.1 0.1 0.1</scale>
|
||||
<uri>https://fuel.gazebosim.org/1.0/PX4/models/Advanced%20Plane/tip/files/meshes/elevators.dae</uri>
|
||||
</mesh>
|
||||
</geometry>
|
||||
<material>
|
||||
<ambient>1 0 0 1.0</ambient>
|
||||
<diffuse>1 0 0 1.0</diffuse>
|
||||
</material>
|
||||
</visual>
|
||||
</link>
|
||||
<link name="rudder">
|
||||
<inertial>
|
||||
<mass>0.00000001</mass>
|
||||
<inertia>
|
||||
<ixx>0.000001</ixx>
|
||||
<ixy>0.0</ixy>
|
||||
<iyy>0.000001</iyy>
|
||||
<ixz>0.0</ixz>
|
||||
<iyz>0.0</iyz>
|
||||
<izz>0.000001</izz>
|
||||
</inertia>
|
||||
<pose>-0.5 0 0.05 0 0 0 </pose>
|
||||
</inertial>
|
||||
<visual name='rudder_visual'>
|
||||
<pose>0.07 0.0 -0.08 0.00 0 0.0</pose>
|
||||
<geometry>
|
||||
<mesh>
|
||||
<scale>0.1 0.1 0.1</scale>
|
||||
<uri>https://fuel.gazebosim.org/1.0/PX4/models/Advanced%20Plane/tip/files/meshes/rudder.dae</uri>
|
||||
</mesh>
|
||||
</geometry>
|
||||
<material>
|
||||
<ambient>1 0 0 1.0</ambient>
|
||||
<diffuse>1 0 0 1.0</diffuse>
|
||||
</material>
|
||||
</visual>
|
||||
</link>
|
||||
<joint name='servo_0' type='revolute'>
|
||||
<parent>base_link</parent>
|
||||
<child>left_elevon</child>
|
||||
<pose>-0.07 0.4 0.08 0.00 0 0.0</pose>
|
||||
<axis>
|
||||
<xyz>0 1 0</xyz>
|
||||
<limit>
|
||||
<!-- -30/+30 deg. -->
|
||||
<lower>-0.53</lower>
|
||||
<upper>0.53</upper>
|
||||
</limit>
|
||||
<dynamics>
|
||||
<damping>1.000</damping>
|
||||
</dynamics>
|
||||
</axis>
|
||||
<physics>
|
||||
<ode>
|
||||
<implicit_spring_damper>1</implicit_spring_damper>
|
||||
</ode>
|
||||
</physics>
|
||||
</joint>
|
||||
<plugin
|
||||
filename="gz-sim-joint-position-controller-system" name="gz::sim::systems::JointPositionController">
|
||||
<joint_name>servo_0</joint_name>
|
||||
<sub_topic>servo_0</sub_topic>
|
||||
<p_gain>10</p_gain>
|
||||
<i_gain>0</i_gain>
|
||||
<d_gain>0</d_gain>
|
||||
</plugin>
|
||||
<joint name='servo_1' type='revolute'>
|
||||
<parent>base_link</parent>
|
||||
<child>right_elevon</child>
|
||||
<pose>-0.07 -0.4 0.08 0.00 0 0.0</pose>
|
||||
<axis>
|
||||
<xyz>0 1 0</xyz>
|
||||
<limit>
|
||||
<!-- -30/+30 deg. -->
|
||||
<lower>-0.53</lower>
|
||||
<upper>0.53</upper>
|
||||
</limit>
|
||||
<dynamics>
|
||||
<damping>1.000</damping>
|
||||
</dynamics>
|
||||
</axis>
|
||||
<physics>
|
||||
<ode>
|
||||
<implicit_spring_damper>1</implicit_spring_damper>
|
||||
</ode>
|
||||
</physics>
|
||||
</joint>
|
||||
<plugin
|
||||
filename="gz-sim-joint-position-controller-system" name="gz::sim::systems::JointPositionController">
|
||||
<joint_name>servo_1</joint_name>
|
||||
<sub_topic>servo_1</sub_topic>
|
||||
<p_gain>10</p_gain>
|
||||
<i_gain>0</i_gain>
|
||||
<d_gain>0</d_gain>
|
||||
</plugin>
|
||||
<joint name='servo_4' type='revolute'>
|
||||
<parent>base_link</parent>
|
||||
<child>left_flap</child>
|
||||
<pose>-0.07 0.2 0.08 0.00 0 0.0</pose>
|
||||
<axis>
|
||||
<xyz>0 1 0</xyz>
|
||||
<limit>
|
||||
<!-- -30/+30 deg. -->
|
||||
<lower>-0.53</lower>
|
||||
<upper>0.53</upper>
|
||||
</limit>
|
||||
<dynamics>
|
||||
<damping>1.000</damping>
|
||||
</dynamics>
|
||||
</axis>
|
||||
<physics>
|
||||
<ode>
|
||||
<implicit_spring_damper>1</implicit_spring_damper>
|
||||
</ode>
|
||||
</physics>
|
||||
</joint>
|
||||
<plugin
|
||||
filename="gz-sim-joint-position-controller-system" name="gz::sim::systems::JointPositionController">
|
||||
<joint_name>servo_4</joint_name>
|
||||
<sub_topic>servo_4</sub_topic>
|
||||
<p_gain>10</p_gain>
|
||||
<i_gain>0</i_gain>
|
||||
<d_gain>0</d_gain>
|
||||
</plugin>
|
||||
<joint name='servo_5' type='revolute'>
|
||||
<parent>base_link</parent>
|
||||
<child>right_flap</child>
|
||||
<pose>-0.07 -0.2 0.08 0.00 0 0.0</pose>
|
||||
<axis>
|
||||
<xyz>0 1 0</xyz>
|
||||
<limit>
|
||||
<!-- -30/+30 deg. -->
|
||||
<lower>-0.53</lower>
|
||||
<upper>0.53</upper>
|
||||
</limit>
|
||||
<dynamics>
|
||||
<damping>1.000</damping>
|
||||
</dynamics>
|
||||
</axis>
|
||||
<physics>
|
||||
<ode>
|
||||
<implicit_spring_damper>1</implicit_spring_damper>
|
||||
</ode>
|
||||
</physics>
|
||||
</joint>
|
||||
<plugin
|
||||
filename="gz-sim-joint-position-controller-system" name="gz::sim::systems::JointPositionController">
|
||||
<joint_name>servo_5</joint_name>
|
||||
<sub_topic>servo_5</sub_topic>
|
||||
<p_gain>10</p_gain>
|
||||
<i_gain>0</i_gain>
|
||||
<d_gain>0</d_gain>
|
||||
</plugin>
|
||||
<joint name='servo_2' type='revolute'>
|
||||
<parent>base_link</parent>
|
||||
<child>elevator</child>
|
||||
<pose> -0.5 0 0 0 0 0</pose>
|
||||
<axis>
|
||||
<xyz>0 1 0</xyz>
|
||||
<limit>
|
||||
<!-- -30/+30 deg. -->
|
||||
<lower>-0.53</lower>
|
||||
<upper>0.53</upper>
|
||||
</limit>
|
||||
<dynamics>
|
||||
<damping>1.000</damping>
|
||||
</dynamics>
|
||||
</axis>
|
||||
<physics>
|
||||
<ode>
|
||||
<implicit_spring_damper>1</implicit_spring_damper>
|
||||
</ode>
|
||||
</physics>
|
||||
</joint>
|
||||
<plugin
|
||||
filename="gz-sim-joint-position-controller-system" name="gz::sim::systems::JointPositionController">
|
||||
<joint_name>servo_2</joint_name>
|
||||
<sub_topic>servo_2</sub_topic>
|
||||
<p_gain>10</p_gain>
|
||||
<i_gain>0</i_gain>
|
||||
<d_gain>0</d_gain>
|
||||
</plugin>
|
||||
<joint name='servo_3' type='revolute'>
|
||||
<parent>base_link</parent>
|
||||
<child>rudder</child>
|
||||
<pose>-0.5 0 0.05 0.00 0 0.0</pose>
|
||||
<axis>
|
||||
<xyz>0 0 1</xyz>
|
||||
<limit>
|
||||
<!-- -30/+30 deg. -->
|
||||
<lower>-0.53</lower>
|
||||
<upper>0.53</upper>
|
||||
</limit>
|
||||
<dynamics>
|
||||
<damping>1.000</damping>
|
||||
</dynamics>
|
||||
</axis>
|
||||
<physics>
|
||||
<ode>
|
||||
<implicit_spring_damper>1</implicit_spring_damper>
|
||||
</ode>
|
||||
</physics>
|
||||
</joint>
|
||||
<plugin
|
||||
filename="gz-sim-joint-position-controller-system" name="gz::sim::systems::JointPositionController">
|
||||
<joint_name>servo_3</joint_name>
|
||||
<sub_topic>servo_3</sub_topic>
|
||||
<p_gain>10</p_gain>
|
||||
<i_gain>0</i_gain>
|
||||
<d_gain>0</d_gain>
|
||||
</plugin>
|
||||
|
||||
<plugin filename="gz-sim-advanced-lift-drag-system" name="gz::sim::systems::AdvancedLiftDrag">
|
||||
<a0>0.0</a0>
|
||||
<CL0>0.15188</CL0>
|
||||
<AR>6.5</AR>
|
||||
<eff>0.97</eff>
|
||||
<CLa>5.015</CLa>
|
||||
<CD0>0.029</CD0>
|
||||
<Cem0>0.075</Cem0>
|
||||
<Cema>-0.463966</Cema>
|
||||
<CYb>-0.258244</CYb>
|
||||
<Cellb>-0.039250</Cellb>
|
||||
<Cenb>0.100826</Cenb>
|
||||
<CDp>0.0</CDp>
|
||||
<CYp>0.065861</CYp>
|
||||
<CLp>0.0</CLp>
|
||||
<Cellp>-0.487407</Cellp>
|
||||
<Cemp>0.0</Cemp>
|
||||
<Cenp>-0.040416</Cenp>
|
||||
<CDq>0.055166</CDq>
|
||||
<CYq>0.0</CYq>
|
||||
<CLq>7.971792</CLq>
|
||||
<Cellq>0.0</Cellq>
|
||||
<Cemq>-12.140140</Cemq>
|
||||
<Cenq>0.0</Cenq>
|
||||
<CDr>0.0</CDr>
|
||||
<CYr>0.230299</CYr>
|
||||
<CLr>0.0</CLr>
|
||||
<Cellr>0.078165</Cellr>
|
||||
<Cemr>0.0</Cemr>
|
||||
<Cenr>-0.089947</Cenr>
|
||||
<alpha_stall>0.3391428111</alpha_stall>
|
||||
<CLa_stall>-3.85</CLa_stall>
|
||||
<CDa_stall>-0.9233984055</CDa_stall>
|
||||
<Cema_stall>0</Cema_stall>
|
||||
<cp>-0.12 0.0 0.0</cp>
|
||||
<area>0.34</area>
|
||||
<mac>0.22</mac>
|
||||
<air_density>1.2041</air_density>
|
||||
<forward>1 0 0</forward>
|
||||
<upward>0 0 1</upward>
|
||||
<link_name>base_link</link_name>
|
||||
<num_ctrl_surfaces>4</num_ctrl_surfaces>
|
||||
<control_surface>
|
||||
<name>servo_0</name>
|
||||
<index>0</index>
|
||||
<direction>1</direction>
|
||||
<CD_ctrl>-0.000059</CD_ctrl>
|
||||
<CY_ctrl>0.000171</CY_ctrl>
|
||||
<CL_ctrl>-0.011940</CL_ctrl>
|
||||
<Cell_ctrl>-0.003331</Cell_ctrl>
|
||||
<Cem_ctrl>0.001498</Cem_ctrl>
|
||||
<Cen_ctrl>-0.000057</Cen_ctrl>
|
||||
</control_surface>
|
||||
<control_surface>
|
||||
<name>servo_1</name>
|
||||
<direction>1</direction>
|
||||
<index>1</index>
|
||||
<CD_ctrl>-0.000059</CD_ctrl>
|
||||
<CY_ctrl>-0.000171</CY_ctrl>
|
||||
<CL_ctrl>-0.011940</CL_ctrl>
|
||||
<Cell_ctrl>0.003331</Cell_ctrl>
|
||||
<Cem_ctrl>0.001498</Cem_ctrl>
|
||||
<Cen_ctrl>0.000057</Cen_ctrl>
|
||||
</control_surface>
|
||||
<control_surface>
|
||||
<name>servo_2</name>
|
||||
<direction>-1</direction>
|
||||
<index>2</index>
|
||||
<CD_ctrl>0.000274</CD_ctrl>
|
||||
<CY_ctrl>0</CY_ctrl>
|
||||
<CL_ctrl>0.010696</CL_ctrl>
|
||||
<Cell_ctrl>0.0</Cell_ctrl>
|
||||
<Cem_ctrl>-0.025798</Cem_ctrl>
|
||||
<Cen_ctrl>0.0</Cen_ctrl>
|
||||
</control_surface>
|
||||
<control_surface>
|
||||
<name>servo_3</name>
|
||||
<direction>1</direction>
|
||||
<index>3</index>
|
||||
<CD_ctrl>0.0</CD_ctrl>
|
||||
<CY_ctrl>-0.003913</CY_ctrl>
|
||||
<CL_ctrl>0.0</CL_ctrl>
|
||||
<Cell_ctrl>-0.000257</Cell_ctrl>
|
||||
<Cem_ctrl>0.0</Cem_ctrl>
|
||||
<Cen_ctrl>0.001613</Cen_ctrl>
|
||||
</control_surface>
|
||||
</plugin>
|
||||
<plugin filename="gz-sim-multicopter-motor-model-system" name="gz::sim::systems::MulticopterMotorModel">
|
||||
<jointName>rotor_puller_joint</jointName>
|
||||
<linkName>rotor_puller</linkName>
|
||||
<turningDirection>cw</turningDirection>
|
||||
<timeConstantUp>0.0125</timeConstantUp>
|
||||
<timeConstantDown>0.025</timeConstantDown>
|
||||
<maxRotVelocity>3500</maxRotVelocity>
|
||||
<motorConstant>8.54858e-06</motorConstant>
|
||||
<momentConstant>0.01</momentConstant>
|
||||
<commandSubTopic>command/motor_speed</commandSubTopic>
|
||||
<motorNumber>0</motorNumber>
|
||||
<rotorDragCoefficient>8.06428e-05</rotorDragCoefficient>
|
||||
<rollingMomentCoefficient>1e-06</rollingMomentCoefficient>
|
||||
<rotorVelocitySlowdownSim>10</rotorVelocitySlowdownSim>
|
||||
<motorType>velocity</motorType>
|
||||
|
||||
</plugin>
|
||||
</model>
|
||||
</sdf>
|
||||
@ -2,7 +2,7 @@
|
||||
<sdf version='1.9'>
|
||||
<include>
|
||||
<name>omnicopter</name>
|
||||
<pose>0 0 0 0 0 0</pose>
|
||||
<pose>0 0 0.2 0 0 0</pose>
|
||||
<uri>https://fuel.gazebosim.org/1.0/PX4/models/Omnicopter</uri>
|
||||
</include>
|
||||
</sdf>
|
||||
|
||||
@ -806,7 +806,7 @@
|
||||
<plugin filename="gz-sim-multicopter-motor-model-system" name="gz::sim::systems::MulticopterMotorModel">
|
||||
<jointName>rotor_puller_joint</jointName>
|
||||
<linkName>rotor_puller</linkName>
|
||||
<turningDirection>cw</turningDirection>
|
||||
<turningDirection>ccw</turningDirection>
|
||||
<timeConstantUp>0.0125</timeConstantUp>
|
||||
<timeConstantDown>0.025</timeConstantDown>
|
||||
<maxRotVelocity>1000</maxRotVelocity>
|
||||
|
||||
149
Tools/simulation/gz/tools/avl_automation/README.md
Executable file
149
Tools/simulation/gz/tools/avl_automation/README.md
Executable file
@ -0,0 +1,149 @@
|
||||
## Purpose
|
||||
|
||||
The idea of this tool is to automate the writing of the Advanced Lift Drag plugin by automatizing the coefficient generation and requiring minimal user calculations.
|
||||
|
||||
## Setup
|
||||
|
||||
In order to run this tool, it is necessary to follow these steps:
|
||||
|
||||
1. Download AVL 3.36 from <https://web.mit.edu/drela/Public/web/avl/>. The file for AVL version 3.36 can be found about halfway down the page.
|
||||
2. After downloading, extract AVL and move it to the home directory using:
|
||||
|
||||
```shell
|
||||
sudo tar -xf avl3.36.tgz
|
||||
mv ./Avl /home/
|
||||
```
|
||||
|
||||
Follow the README.md found in Avl to finish the setup process for AVL (requires to set up plotlib and eispack libraries). I recommend using the gfortran compile option. This might require you to install gfortran. This can be done by running:
|
||||
|
||||
```shell
|
||||
sudo apt update
|
||||
sudo apt install gfortran
|
||||
```
|
||||
|
||||
When running the Makefile for AVL, you might encounter an Error 1 message stating that there is a directory missing. This does not prevent AVL from working for our purposes. Once the process described in the AVL README is completed, AVL is ready to be used. No further set up is required on the side of the AVL or the tool.
|
||||
If you want to move the location of the AVL directory, this can simply be done by passing the `--avl_path` flag to the `input_avl.py` file, using the desired directory location for the flag (don't forget to place a "/" behind the last part of the path). Running this will automatically also adjust the paths where necessary.
|
||||
|
||||
## Run
|
||||
|
||||
To run the tool all that is needed is to modify the `input.yml` to the plane that you desire and then run `python input_avl.py <your_custom_yaml_file>.yml` Note that you require to have the yaml and argparse packages in your python environment to run this. An example template has been provided in the form of the `input.yml` that implements a standard plane with two ailerons, an elevator and a rudder. This example template can be run using: `python input_avl.py --yaml_file input.yml`.
|
||||
Once the script has been executed, the generated .avl, .sdf and a plot of the proposed control surfaces can be found in <your-planes-name> directory. The sdf file is the generated Advanced Lift Drag Plugin that can be copied and pasted straight into a model.sdf file, which can then be run in Gazebo.
|
||||
|
||||
## Functionality
|
||||
|
||||
The tool first asks the user for a range of vehicle specific parameters that are needed in order to specify the geometry and physical properties of the plane. The user has the choice to define a completely custom model, or alternatively select a predefined model template (such as a Cessna or a VTOL), which has a known number of control surfaces, and then provide only some physical properties, without having to define the entire model themselves. The input_avl.py file takes the provided parameter and creates an .avl file from this that can be read by AVL (the program). This happens in the process.sh file. The necessary output generated by AVL will be saved in two files: custom_vehicle_body_axis_derivatives.txt and custom_vehicle_stability_derivatives.txt. These two files contain the parameters that are required in order to populate the Advanced Lift Drag Plugin. Finally, avl_out_parse.py reads the generated .txt files and accordingly assigns parameters to the correct element in sdf. Once this is done, it is only a question of copy and pasting the generated Advanced Lift Drag plugin (found as <custom_plane>.sdf into the desired model.sdf file. )
|
||||
|
||||
|
||||
## Usability
|
||||
|
||||
The current implementation provides a minimal working example. More accurate measurements can be made by adjusting the chosen number of vortices along span and chord according to desired preferences. A good starting point for this can be found here: <https://www.redalyc.org/pdf/6735/673571173005.pdf>. Furthermore, one can also more accurately model a vehicle by using a larger number of sections. In the current .yml file, only a left and right edge are defined for each surface yielding exactly one section, but the code supports expanding this to any number of desired sections.
|
||||
|
||||
## IMPORTANT POINTS TO NOTE
|
||||
|
||||
- A control surface in AVL is always defined from left to right. This means you need to first provide the left edge of a surface and then the right edge. If you do this the opposite way around, a surface will essentially be defined upside down.
|
||||
- The tool is designed to only support at most two control surfaces of any type on any one vehicle. Having more surfaces than that can lead to faulty behavior.
|
||||
- Another important point is that these scripts make use of the match, case syntax, which was only introduced in Python in version 3.10.
|
||||
- The primary reference resource for AVL can be found at <https://web.mit.edu/drela/Public/web/avl/AVL_User_Primer.pdf>. This document was written by the creators of AVL and contains all the variables that could be required in defining the control surfaces.
|
||||
- AVL cannot predict stall values. As such these need to be calculated/estimated another way. In the current implementation, default stall values have been taken from PX4's Advanced Plane. These should naturally be changed for new/different models.
|
||||
|
||||
## Parameter Assignment
|
||||
|
||||
Below is a comprehensive list on how the parameters are assigned at output and what files in AVL they are taken from. I am by no means an AVL expert, so please verify that these are actually the correct parameters required by the Advanced Lift Drag Plugin. For an explanation of what the parameters do, please see take a look at the Advanced Lift Drag Plugin.
|
||||
|
||||
(name-in-AVL) -> (name-in-plugin)
|
||||
|
||||
From the stability derivatives log file, the following advanced lift drag plugin parameters are taken:
|
||||
|
||||
Alpha -> alpha The angle of attack
|
||||
|
||||
Cmtot -> Cem0 Pitching moment coefficient at zero angle of attack
|
||||
|
||||
CLtot -> CL0 Lift Coefficient at zero angle of attack
|
||||
|
||||
CDtot -> CD0 Drag coefficient at zero angle of attack
|
||||
|
||||
CLa -> CLa dCL/da (slope of CL-alpha curve)
|
||||
|
||||
CYa -> CYa dCy/da (sideforce slope wrt alpha)
|
||||
|
||||
Cla -> Cella dCl/da (roll moment slope wrt alpha)
|
||||
|
||||
Cma -> Cema dCm/da (pitching moment slope wrt alpha - before stall)
|
||||
|
||||
Cna -> Cena dCn/da (yaw moment slope wrt alpha)
|
||||
|
||||
CLb -> CLb dCL/dbeta (lift coefficient slope wrt beta)
|
||||
|
||||
CYb -> CYb dCY/dbeta (side force slope wrt beta)
|
||||
|
||||
Clb -> Cellb dCl/dbeta (roll moment slope wrt beta)
|
||||
|
||||
Cmb -> Cemb dCm/dbeta (pitching moment slope wrt beta)
|
||||
|
||||
Cnb -> Cenb dCn/dbeta (yaw moment slope wrt beta)
|
||||
|
||||
|
||||
From the body axis derivatives log file, the following advanced lift drag plugin parameters are taken:
|
||||
|
||||
e -> eff Wing efficiency (Oswald efficiency factor for a 3D wing)
|
||||
|
||||
CXp -> CDp dCD/dp (drag coefficient slope wrt roll rate)
|
||||
|
||||
CYp -> CYp dCY/dp (sideforce slope wrt roll rate)
|
||||
|
||||
CZp -> CLp dCL/dp (lift coefficient slope wrt roll rate)
|
||||
|
||||
Clp -> Cellp dCl/dp (roll moment slope wrt roll rate)
|
||||
|
||||
Cmp -> Cemp dCm/dp (pitching moment slope wrt roll rate)
|
||||
|
||||
Cmp -> Cenp dCn/dp (yaw moment slope wrt roll rate)
|
||||
|
||||
CXq -> CDq dCD/dq (drag coefficient slope wrt pitching rate)
|
||||
|
||||
CYq -> CYq dCY/dq (side force slope wrt pitching rate)
|
||||
|
||||
CZq -> CLq dCL/dq (lift coefficient slope wrt pitching rate)
|
||||
|
||||
Clq -> Cellq dCl/dq (roll moment slope wrt pitching rate)
|
||||
|
||||
Cmq -> Cemq dCm/dq (pitching moment slope wrt pitching rate)
|
||||
|
||||
Cnq -> Cenq dCn/dq (yaw moment slope wrt pitching rate)
|
||||
|
||||
CXr -> CDr dCD/dr (drag coefficient slope wrt yaw rate)
|
||||
|
||||
CYr -> CYr dCY/dr (side force slope wrt yaw rate)
|
||||
|
||||
CZr -> CLr dCL/dr (lift coefficient slope wrt yaw rate)
|
||||
|
||||
Clr -> Cellr dCl/dr (roll moment slope wrt yaw rate)
|
||||
|
||||
Cmr -> Cemr dCm/dr (pitching moment slope wrt yaw rate)
|
||||
|
||||
Cnr -> Cenr dCn/dr (yaw moment slope wrt yaw rate)
|
||||
|
||||
|
||||
Furthermore, every control surface also has six own parameters, which are also derived from this log file. {i} below ranges from 1 to the number of unique control surface types in the model.
|
||||
|
||||
CXd{i} -> CD_ctrl Effect of the control surface's deflection on drag
|
||||
|
||||
CYd{i} -> CY_ctrl Effect of the control surface's deflection on side force
|
||||
|
||||
CZd{i} -> CL_ctrl Effect of the control surface's deflection on lift
|
||||
|
||||
Cld{i} -> Cell_ctrl Effect of the control surface's deflection on roll moment
|
||||
|
||||
Cmd{i} -> Cem_ctrl Effect of the control surface's deflection on pitching moment
|
||||
|
||||
Cnd{i} -> Cen_ctrl Effect of the control surface's deflection on yaw moment
|
||||
|
||||
|
||||
## Future Work
|
||||
|
||||
The tool, while self-contained, could be expanded into multiple directions.
|
||||
|
||||
1. Currently hinge positions and gains are set at default levels, and these could, if desired be further customized for more control.
|
||||
2. More vehicles could be added to provide default templates that require less input. At the moment, only "custom" works completely.
|
||||
3. Fuselage modelling could be included to further improve the accuracy of calculated coefficients.
|
||||
4. At the moment only NACA airfoils are provided as a way to generate cambered surfaces. An alternative to this would be to use custom airfoil files.
|
||||
342
Tools/simulation/gz/tools/avl_automation/avl_out_parse.py
Executable file
342
Tools/simulation/gz/tools/avl_automation/avl_out_parse.py
Executable file
@ -0,0 +1,342 @@
|
||||
#!/usr/bin/env
|
||||
|
||||
import argparse
|
||||
import shutil
|
||||
import fileinput
|
||||
import subprocess
|
||||
import os
|
||||
from typing import TextIO
|
||||
|
||||
|
||||
"""
|
||||
Get the desired coefficient from the AVL output files by looking through the file line by line and picking it out when encountered.
|
||||
|
||||
Args:
|
||||
file (TextIO): The file from which the desired coefficient should be read.
|
||||
token (str): The coefficient which to look for.
|
||||
|
||||
Return:
|
||||
value (str): The value associated with the desired coefficient.
|
||||
|
||||
"""
|
||||
def get_coef(file: TextIO,token: str) -> str:
|
||||
|
||||
linesplit = []
|
||||
for line in file:
|
||||
if f' {token} ' in line:
|
||||
linesplit = line.split()
|
||||
break
|
||||
|
||||
index = 0
|
||||
for i,v in enumerate(linesplit):
|
||||
if v == token:
|
||||
index = i
|
||||
value = linesplit[index+2]
|
||||
return value
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Write all gathered, model-wide coefficients to the sdf file.
|
||||
|
||||
Args:
|
||||
file (TextIO): The file to which the desired coefficient should be written.
|
||||
token_str (str): The coefficients for which the associated value should be written.
|
||||
token (str): The value which should be placed in the avl.
|
||||
|
||||
Return:
|
||||
None.
|
||||
|
||||
"""
|
||||
def write_coef(file: TextIO, token_str: str, token: str):
|
||||
old_line = f'<{token_str}></{token_str}>'
|
||||
new_line = f'<{token_str}>{token}</{token_str}>'
|
||||
with fileinput.FileInput(file, inplace=True) as output_file:
|
||||
for line in output_file:
|
||||
print(line.replace(old_line, new_line), end='')
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Write all gathered, control surface specific parameters to the sdf file.
|
||||
|
||||
Args:
|
||||
file (TextIO): The file to which the desired coefficients should be written.
|
||||
ctrl_surface_vec (list): A vector that contains all 6 necessary coefficient values for the control surface in question.
|
||||
index (str): The model-wide index number of the control surface in question.
|
||||
direction (str): The direction in which the control surface can be actuated.
|
||||
|
||||
Return:
|
||||
None.
|
||||
"""
|
||||
def ctrl_surface_coef(file: TextIO,ctrl_surface_vec: list,index: str, direction: str):
|
||||
|
||||
extracted_text = ''
|
||||
with open("./templates/control_surface.sdf",'r') as open_file:
|
||||
for line in open_file:
|
||||
extracted_text += line
|
||||
open_file.close()
|
||||
|
||||
# Insert necessary coefficient values, index and direction in correct sdf location.
|
||||
extracted_text = extracted_text.replace("<name></name>",f'<name>servo_{index}</name>')
|
||||
extracted_text = extracted_text.replace("<index></index>",f'<index>{index}</index>')
|
||||
extracted_text = extracted_text.replace("<direction></direction>",f'<directon>{direction}</direction>')
|
||||
extracted_text = extracted_text.replace("<CD_ctrl></CD_ctrl>",f'<CD_ctrl>{ctrl_surface_vec[0]}</CD_ctrl>')
|
||||
extracted_text = extracted_text.replace("<CY_ctrl></CY_ctrl>",f'<CY_ctrl>{ctrl_surface_vec[1]}</CY_ctrl>')
|
||||
extracted_text = extracted_text.replace("<CL_ctrl></CL_ctrl>",f'<CL_ctrl>{ctrl_surface_vec[2]}</CL_ctrl>')
|
||||
extracted_text = extracted_text.replace("<Cell_ctrl></Cell_ctrl>",f'<Cell_ctrl>{ctrl_surface_vec[3]}</Cell_ctrl>')
|
||||
extracted_text = extracted_text.replace("<Cem_ctrl></Cem_ctrl>",f'<Cem_ctrl>{ctrl_surface_vec[4]}</Cem_ctrl>')
|
||||
extracted_text = extracted_text.replace("<Cen_ctrl></Cen_ctrl>",f'<Cen_ctrl>{ctrl_surface_vec[5]}</Cen_ctrl>')
|
||||
|
||||
|
||||
# Create model specific template
|
||||
with open(file,'a') as plugin_file:
|
||||
plugin_file.write(extracted_text + "\n")
|
||||
plugin_file.close()
|
||||
|
||||
"""
|
||||
Read out the necessary log files to gather the desired parameters and write them to the sdf plugin file.
|
||||
Arguments provided here are passed in the input_avl.py file.
|
||||
|
||||
Args:
|
||||
file_name (TextIO): The file to which the desired coefficients should be written.
|
||||
vehicle_type (str): The type of vehicle in use.
|
||||
AR (str): The calculated aspect ratio.
|
||||
mac (str): The calculated mean aerodynamic chord.
|
||||
ref_pt_x (str): The x coordinate of the reference point, at which forces and moments are applied.
|
||||
ref_pt_y (str): The y coordinate of the reference point, at which forces and moments are applied.
|
||||
ref_pt_z (str): The z coordinate of the reference point, at which forces and moments are applied.
|
||||
num_ctrl_surfaces (str): The number of control surfaces that the model uses.
|
||||
area (str): The wing surface area.
|
||||
ctrl_surface_order (list): A list containing the types of control surfaces, in theorder in which
|
||||
they have been defined in the .avl file.
|
||||
avl_path (str): A string containing the directory where the AVL directory should be moved to.
|
||||
|
||||
Return:
|
||||
None.
|
||||
"""
|
||||
|
||||
def main(file_name: TextIO, vehicle_type: str, AR: str, mac: str, ref_pt_x: str, ref_pt_y: str, ref_pt_z: str, num_ctrl_surfaces: str, area: str, ctrl_surface_order: list, avl_path:str):
|
||||
|
||||
# Set current path for user
|
||||
curr_path = subprocess.run(['pwd'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
||||
|
||||
if curr_path.returncode == 0:
|
||||
# Save the output in a variable
|
||||
savedir = curr_path.stdout.strip()
|
||||
else:
|
||||
raise LookupError("Invalid path to directory. Check both the avl_automation directory and the Avl directory are positioned correctly.")
|
||||
|
||||
# Set the file directory path from where the AVL output logs can be read.
|
||||
filedir = f'{avl_path}Avl/runs/'
|
||||
|
||||
# Read out all necessary parameters from the stability and body axis derivatives files.
|
||||
with open(f'{filedir}custom_vehicle_stability_derivatives.txt','r+') as stability_file:
|
||||
original_position = stability_file.tell()
|
||||
|
||||
# As plane is modelled at 0 degree AoA, the total coefficients should(?) correspond to the
|
||||
# 0 degree coefficients required by the plugin.
|
||||
alpha = get_coef(stability_file,"Alpha")
|
||||
Cem0 = get_coef(stability_file,"Cmtot")
|
||||
CL0 = get_coef(stability_file,"CLtot")
|
||||
CD0 = get_coef(stability_file,"CDtot")
|
||||
|
||||
CLa = get_coef(stability_file,"CLa")
|
||||
CYa = get_coef(stability_file,"CYa")
|
||||
Cella = get_coef(stability_file,"Cla")
|
||||
Cema = get_coef(stability_file,"Cma")
|
||||
Cena = get_coef(stability_file,"Cna")
|
||||
|
||||
stability_file.seek(original_position)
|
||||
|
||||
CLb = get_coef(stability_file,"CLb")
|
||||
CYb = get_coef(stability_file,"CYb")
|
||||
Cellb = get_coef(stability_file,"Clb")
|
||||
Cemb = get_coef(stability_file,"Cmb")
|
||||
Cenb = get_coef(stability_file,"Cnb")
|
||||
stability_file.close()
|
||||
|
||||
with open(f'{filedir}custom_vehicle_body_axis_derivatives.txt') as bodyax_file:
|
||||
original_position = bodyax_file.tell()
|
||||
|
||||
eff = get_coef(bodyax_file,"e")
|
||||
|
||||
bodyax_file.seek(original_position)
|
||||
|
||||
CDp = get_coef(bodyax_file,"CXp")
|
||||
CYp = get_coef(bodyax_file,"CYp")
|
||||
CLp = get_coef(bodyax_file,"CZp")
|
||||
Cellp = get_coef(bodyax_file,"Clp")
|
||||
Cemp = get_coef(bodyax_file,"Cmp")
|
||||
Cenp = get_coef(bodyax_file,"Cnp")
|
||||
|
||||
bodyax_file.seek(original_position)
|
||||
|
||||
CDq = get_coef(bodyax_file,"CXq")
|
||||
CYq = get_coef(bodyax_file,"CYq")
|
||||
CLq = get_coef(bodyax_file,"CZq")
|
||||
Cellq = get_coef(bodyax_file,"Clq")
|
||||
Cemq = get_coef(bodyax_file,"Cmq")
|
||||
Cenq = get_coef(bodyax_file,"Cnq")
|
||||
|
||||
bodyax_file.seek(original_position)
|
||||
|
||||
CDr = get_coef(bodyax_file,"CXr")
|
||||
CYr = get_coef(bodyax_file,"CYr")
|
||||
CLr = get_coef(bodyax_file,"CZr")
|
||||
Cellr = get_coef(bodyax_file,"Clr")
|
||||
Cemr = get_coef(bodyax_file,"Cmr")
|
||||
Cenr = get_coef(bodyax_file,"Cnr")
|
||||
bodyax_file.close()
|
||||
|
||||
plane_type = vehicle_type
|
||||
ctrl_surface_mat = []
|
||||
|
||||
# Maybe in the future you want more types of set aircraft. Thus us a case differentiator.
|
||||
match plane_type:
|
||||
|
||||
case "custom":
|
||||
ctrl_surface_vec = []
|
||||
with open(f'{filedir}custom_vehicle_body_axis_derivatives.txt') as bodyax_file:
|
||||
original_position = bodyax_file.tell()
|
||||
for i in range(1,(len(set(ctrl_surface_order)))+1):
|
||||
ctrl_surface_vec = []
|
||||
ctrl_surface_vec.append(get_coef(bodyax_file,f'CXd{i}'))
|
||||
ctrl_surface_vec.append(get_coef(bodyax_file,f'CYd{i}'))
|
||||
ctrl_surface_vec.append(get_coef(bodyax_file,f'CZd{i}'))
|
||||
ctrl_surface_vec.append(get_coef(bodyax_file,f'Cld{i}'))
|
||||
ctrl_surface_vec.append(get_coef(bodyax_file,f'Cmd{i}'))
|
||||
ctrl_surface_vec.append(get_coef(bodyax_file,f'Cnd{i}'))
|
||||
bodyax_file.seek(original_position)
|
||||
ctrl_surface_mat.append(ctrl_surface_vec)
|
||||
|
||||
|
||||
# SPECIFY STALL PARAMETERS BASED ON AIRCRAFT TYPE (IF PROVIDED)
|
||||
if not os.path.exists(f'{savedir}/{file_name}'):
|
||||
os.makedirs(f'{savedir}/{file_name}')
|
||||
file_name = f'{savedir}/{file_name}/{file_name}.sdf'
|
||||
shutil.copy(f'{savedir}/templates/advanced_lift_drag_template.sdf',file_name)
|
||||
|
||||
# Get argument coefficients taken directly from the input file.
|
||||
write_coef(file_name,"a0",alpha)
|
||||
write_coef(file_name,"CL0",CL0)
|
||||
write_coef(file_name,"CD0",CD0)
|
||||
write_coef(file_name,"Cem0",Cem0)
|
||||
write_coef(file_name,"AR",AR)
|
||||
write_coef(file_name,"area",area)
|
||||
write_coef(file_name,"mac",mac)
|
||||
write_coef(file_name,"air_density",1.2041) # TODO: Provide custom air density option
|
||||
write_coef(file_name,"forward","1 0 0")
|
||||
write_coef(file_name,"upward","0 0 1")
|
||||
write_coef(file_name,"link_name","base_link")
|
||||
write_coef(file_name,"cp",f'{ref_pt_x} {ref_pt_y} {ref_pt_z}')
|
||||
write_coef(file_name,"num_ctrl_surfaces",num_ctrl_surfaces)
|
||||
|
||||
write_coef(file_name,"CLa",CLa)
|
||||
write_coef(file_name,"CYa",CYa)
|
||||
write_coef(file_name,"Cella",Cella)
|
||||
write_coef(file_name,"Cema",Cema)
|
||||
write_coef(file_name,"Cena",Cena)
|
||||
write_coef(file_name,"CLb",CLb)
|
||||
write_coef(file_name,"CYb",CYb)
|
||||
write_coef(file_name,"Cellb",Cellb)
|
||||
write_coef(file_name,"Cemb",Cemb)
|
||||
write_coef(file_name,"Cenb",Cenb)
|
||||
|
||||
write_coef(file_name,"CDp",CDp)
|
||||
write_coef(file_name,"CYp",CYp)
|
||||
write_coef(file_name,"CLp",CLp)
|
||||
write_coef(file_name,"Cellp",Cellp)
|
||||
write_coef(file_name,"Cemp",Cemp)
|
||||
write_coef(file_name,"Cenp",Cenp)
|
||||
write_coef(file_name,"CDq",CDq)
|
||||
write_coef(file_name,"CYq",CYq)
|
||||
write_coef(file_name,"CLq",CLq)
|
||||
write_coef(file_name,"Cellq",Cellq)
|
||||
write_coef(file_name,"Cemq",Cemq)
|
||||
write_coef(file_name,"Cenq",Cenq)
|
||||
write_coef(file_name,"CDr",CDr)
|
||||
write_coef(file_name,"CYr",CYr)
|
||||
write_coef(file_name,"CLr",CLr)
|
||||
write_coef(file_name,"Cellr",Cellr)
|
||||
write_coef(file_name,"Cemr",Cemr)
|
||||
write_coef(file_name,"Cenr",Cenr)
|
||||
|
||||
write_coef(file_name,"eff",eff)
|
||||
|
||||
# TODO: Improve this for custom stall values
|
||||
# Note: Currently these stall values are simply taken from advanced_plane presets.
|
||||
|
||||
write_coef(file_name,"alpha_stall","0.3391428111")
|
||||
write_coef(file_name,"CLa_stall","-3.85")
|
||||
write_coef(file_name,"CDa_stall","-0.9233984055")
|
||||
write_coef(file_name,"Cema_stall","0")
|
||||
|
||||
# Check whether a particular type of control surface has been seen before. If it has,
|
||||
# then the current control surface is the (right) counterpart.
|
||||
|
||||
# ASSUMPTION: There is the assumption that an vehicle will only ever have two of any
|
||||
# particular type of control surface. (left and right). If this is not the case, the negation
|
||||
# below will likely not work correctly.
|
||||
type_seen = list()
|
||||
|
||||
# Dictionary containing the directions that each type of control surface can move.
|
||||
ctrl_direction = {"aileron": 1,"elevator": -1,"rudder": 1}
|
||||
|
||||
# More set types in the future?
|
||||
match plane_type:
|
||||
|
||||
case "custom":
|
||||
for i, ctrl_surface in enumerate(ctrl_surface_order):
|
||||
|
||||
# Check whether a particular type of control surface has been seen before. If it has,
|
||||
# then the current control surface is the (right) counterpart. Depending on the exact
|
||||
# nature of the encountered type you then need to negate the correct parameters.
|
||||
if ctrl_surface in type_seen:
|
||||
# Work out what the corresponding index for the first encounter of the ctrl surface is.
|
||||
seen_index = type_seen.index(ctrl_surface)
|
||||
|
||||
if ctrl_surface == 'aileron':
|
||||
#Change for right wing aileron by flipping sign
|
||||
ctrl_surface_mat[seen_index][3] = -float(ctrl_surface_mat[0][3])
|
||||
ctrl_surface_mat[seen_index][5] = -float(ctrl_surface_mat[0][5])
|
||||
|
||||
# Split Elevators are assumed to never run differentially. Feel free to add a
|
||||
# condition if your plane does require differential elevator action.
|
||||
|
||||
else:
|
||||
# If a ctrl surface has not been encountered add it to the type_seen list and
|
||||
# set the index to the length of the list - 1 as this corresponds to the newest
|
||||
# unseen element in ctrl_surface_mat .
|
||||
type_seen.append(ctrl_surface)
|
||||
seen_index = len(type_seen) - 1
|
||||
|
||||
ctrl_surface_coef(file_name,ctrl_surface_mat[seen_index],i,ctrl_direction[ctrl_surface])
|
||||
|
||||
|
||||
# close the sdf file with plugin
|
||||
with open(file_name,'a') as plugin_file:
|
||||
plugin_file.write("</plugin>")
|
||||
plugin_file.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_argument("file_name", help="The file to which the desired coefficients should be written.")
|
||||
parser.add_argument("vehicle_type", help="The type of vehicle in use.")
|
||||
parser.add_argument("AR", help="The calculated aspect ratio.")
|
||||
parser.add_argument("mac", help="The calculated mean aerodynamic chord.")
|
||||
parser.add_argument("ref_pt_x", help="The x coordinate of the reference point, at which forces and moments are applied.")
|
||||
parser.add_argument("ref_pt_y", help="The y coordinate of the reference point, at which forces and moments are applied.")
|
||||
parser.add_argument("ref_pt_z", help="The z coordinate of the reference point, at which forces and moments are applied.")
|
||||
parser.add_argument("num_ctrl_surfaces", help="The number of control surfaces that the model uses.")
|
||||
parser.add_argument("area", help= "The wing surface area.")
|
||||
parser.add_argument("ctrl_surface_order", help=" A list containing the types of control surfaces, in theorder in which \
|
||||
they have been defined in the .avl file.")
|
||||
parser.add_argument("avl_path",help="A string containing the directory where the AVL directory should be moved to.")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
main(args.file_name,args.vehicle_type,args.AR,args.mac,args.ref_pt_x,args.ref_pt_y,
|
||||
args.ref_pt_z,args.num_ctrl_surfaces,args.area,args.ctrl_surface_order,args.avl_path)
|
||||
10
Tools/simulation/gz/tools/avl_automation/avl_steps.txt
Executable file
10
Tools/simulation/gz/tools/avl_automation/avl_steps.txt
Executable file
@ -0,0 +1,10 @@
|
||||
oper
|
||||
x
|
||||
n custom_plane
|
||||
st custom_vehicle_stability_derivatives.txt
|
||||
sb custom_vehicle_body_axis_derivatives.txt
|
||||
g
|
||||
h
|
||||
|
||||
|
||||
quit
|
||||
142
Tools/simulation/gz/tools/avl_automation/input.yml
Executable file
142
Tools/simulation/gz/tools/avl_automation/input.yml
Executable file
@ -0,0 +1,142 @@
|
||||
# Enter a name for your vehicle
|
||||
vehicle_name: plane_example_2
|
||||
|
||||
# Enter the type of airframe you would like to use:
|
||||
frame_type: custom
|
||||
|
||||
# First define some model-wide parameters for custom models:
|
||||
reference_area: 12
|
||||
wing_span: 15
|
||||
# Provide a reference point at which the forces and moments generated will act.
|
||||
reference_point:
|
||||
X: 0
|
||||
Y: 0
|
||||
Z: 0
|
||||
|
||||
#Provide information on each of the Control Surfaces
|
||||
num_ctrl_surfaces: 4
|
||||
control_surfaces:
|
||||
- name: right_wing
|
||||
type: aileron
|
||||
nchord: 1
|
||||
cspace: 1
|
||||
nspan: 16
|
||||
sspace: -2
|
||||
angle: 4
|
||||
translation:
|
||||
X: 0
|
||||
Y: 0
|
||||
Z: 0
|
||||
naca: 2412
|
||||
sections:
|
||||
- name: section_1
|
||||
position:
|
||||
X: -0.25
|
||||
Y: 0
|
||||
Z: 0
|
||||
chord: 1
|
||||
ainc: 0
|
||||
nspan: 8
|
||||
sspace: 1
|
||||
- name: section_2
|
||||
position:
|
||||
X: -0.175
|
||||
Y: 5
|
||||
Z: 0.5
|
||||
chord: 0.7
|
||||
ainc: 0
|
||||
nspan: 0
|
||||
sspace: 0
|
||||
|
||||
|
||||
- name: left_wing
|
||||
type: aileron
|
||||
nchord: 1
|
||||
cspace: 1
|
||||
nspan: 16
|
||||
sspace: -2
|
||||
angle: 4
|
||||
translation:
|
||||
X: 0
|
||||
Y: 0
|
||||
Z: 0
|
||||
naca: 2412
|
||||
sections:
|
||||
- name: section_1
|
||||
position:
|
||||
X: -0.175
|
||||
Y: -5
|
||||
Z: 0.5
|
||||
chord: 0.7
|
||||
ainc: 0
|
||||
nspan: 0
|
||||
sspace: 0
|
||||
- name: section_2
|
||||
position:
|
||||
X: -0.25
|
||||
Y: 0
|
||||
Z: 0
|
||||
chord: 1
|
||||
ainc: 0
|
||||
nspan: 8
|
||||
sspace: 1
|
||||
|
||||
- name: elevator
|
||||
type: elevator
|
||||
nchord: 1
|
||||
cspace: 1
|
||||
nspan: 7
|
||||
sspace: -2
|
||||
translation:
|
||||
X: 6
|
||||
Y: 0
|
||||
Z: 0.5
|
||||
sections:
|
||||
- name: section_1
|
||||
position:
|
||||
X: -0.1
|
||||
Y: 0
|
||||
Z: 0
|
||||
chord: 0.4
|
||||
ainc: 0
|
||||
nspan: 7
|
||||
sspace: -1.25
|
||||
- name: section_2
|
||||
position:
|
||||
X: -0.075
|
||||
Y: 2
|
||||
Z: 0
|
||||
chord: 0.3
|
||||
ainc: 0
|
||||
nspan: 0
|
||||
sspace: 0
|
||||
|
||||
- name: fin
|
||||
type: rudder
|
||||
nchord: 1
|
||||
cspace: 1
|
||||
nspan: 10
|
||||
sspace: 1
|
||||
translation:
|
||||
X: 6
|
||||
Y: 0
|
||||
Z: 0.5
|
||||
sections:
|
||||
- name: section_1
|
||||
position:
|
||||
X: -0.1
|
||||
Y: 0
|
||||
Z: 0
|
||||
chord: 0.4
|
||||
ainc: 0
|
||||
nspan: 7
|
||||
sspace: -1.25
|
||||
- name: section_2
|
||||
position:
|
||||
X: -0.075
|
||||
Y: 0
|
||||
Z: 1
|
||||
chord: 0.3
|
||||
ainc: 0
|
||||
nspan: 0
|
||||
sspace: 0
|
||||
314
Tools/simulation/gz/tools/avl_automation/input_avl.py
Executable file
314
Tools/simulation/gz/tools/avl_automation/input_avl.py
Executable file
@ -0,0 +1,314 @@
|
||||
#!/usr/bin/env
|
||||
|
||||
import argparse
|
||||
import avl_out_parse
|
||||
import os
|
||||
import yaml
|
||||
import subprocess
|
||||
import shutil
|
||||
|
||||
"""
|
||||
Write individual airfoil section definitions to the .avl file.
|
||||
Sections are defined through a 3D point in space and assigned properties such as chord, angle of incidence etc.
|
||||
AVL then links them up to the other sections of a particular surface. You can define any number of sections for
|
||||
a particular surface, but there always have to be at least two (a left and right edge).
|
||||
|
||||
Args:
|
||||
plane_name (str): The name of the vehicle.
|
||||
x (str): The x coordinate of the section.
|
||||
y (str): The y coordinate of the section.
|
||||
z (str): The z coordinate of the section.
|
||||
chord (str): Chord in this section of the surface. Trailing edge is at x + chord, y, z.
|
||||
ainc (str): Angle of incidence for this section. Taken as a rotation (RH rule) about the surface's
|
||||
spanwise axis projected onto the Y-Z plane.
|
||||
nspan (str): Number of spanwise vortices in until the next section.
|
||||
sspan (str): Controls the spanwise spacing of the vortices.
|
||||
naca_number (str): The chosen NACA number that will define the cambered properties of this section
|
||||
of the surface. For help picking an airfoil go to: http://airfoiltools.com/airfoil/naca4digit.
|
||||
ctrl_surface_type: The selected type of control surface. This should be consistent along the entirety of
|
||||
the surface. (Question: Flap and Aileron along the same airfoil?)
|
||||
|
||||
Return:
|
||||
None.
|
||||
|
||||
"""
|
||||
def write_section(plane_name: str,x: str,y: str,z: str,chord: str,ainc: str,nspan: str,sspace: str,naca_number: str,ctrl_surf_type: str):
|
||||
|
||||
with open(f'{plane_name}.avl','a') as avl_file:
|
||||
avl_file.write("SECTION \n")
|
||||
avl_file.write("!Xle Yle Zle Chord Ainc Nspanwise Sspace \n")
|
||||
avl_file.write(f'{x} {y} {z} {chord} {ainc} {nspan} {sspace} \n')
|
||||
if naca_number != "0000":
|
||||
avl_file.write("NACA \n")
|
||||
avl_file.write(f'{naca_number} \n')
|
||||
avl_file.close()
|
||||
|
||||
match ctrl_surf_type:
|
||||
case 'aileron':
|
||||
#TODO provide custom options for gain and hinge positions
|
||||
with open(f'{plane_name}.avl','a') as avl_file:
|
||||
avl_file.write("CONTROL \n")
|
||||
avl_file.write("aileron 1.0 0.0 0.0 0.0 0.0 -1 \n")
|
||||
avl_file.close()
|
||||
|
||||
case 'elevator':
|
||||
with open(f'{plane_name}.avl','a') as avl_file:
|
||||
avl_file.write("CONTROL \n")
|
||||
avl_file.write("elevator 1.0 0.0 0.0 0.0 0.0 1 \n")
|
||||
avl_file.close()
|
||||
|
||||
case 'rudder':
|
||||
with open(f'{plane_name}.avl','a') as avl_file:
|
||||
avl_file.write("CONTROL \n")
|
||||
avl_file.write("rudder 1.0 0.0 0.0 0.0 0.0 1 \n")
|
||||
avl_file.close()
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Read the provided yaml file and generate the corresponding .avl file that can be read into AVL.
|
||||
Also calls AVL and the avl_out_parse.py file that generates the sdf plugin.
|
||||
|
||||
Args:
|
||||
yaml_file: Path to the input yaml file
|
||||
avl_path: Set the avl_path to provide a desired directory for where Avl should be located.
|
||||
|
||||
Return:
|
||||
None
|
||||
|
||||
"""
|
||||
def main():
|
||||
user = os.environ.get('USER')
|
||||
# This will find Avl on a users machine.
|
||||
for root, dirs, _ in os.walk(f'/home/{user}/'):
|
||||
if "Avl" in dirs:
|
||||
target_directory_path = os.path.join(root, "Avl")
|
||||
break
|
||||
parent_directory_path = os.path.dirname(target_directory_path)
|
||||
filedir = f'{parent_directory_path}/'
|
||||
print(filedir)
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--yaml_file", help="Path to input yaml file.")
|
||||
parser.add_argument("--avl_path", default=filedir, help="Provide an absolute AVL path. If this argument is passed, AVL will be moved there and the files will adjust their paths accordingly.")
|
||||
inputs = parser.parse_args()
|
||||
|
||||
|
||||
# If the user passes the avl_path argument then move Avl to that location:
|
||||
if inputs.avl_path != filedir:
|
||||
|
||||
#Check if the directory is already there
|
||||
if os.path.exists(f'{inputs.avl_path}/Avl') and os.path.isdir(f'{inputs.avl_path}/Avl'):
|
||||
print("Avl is already at desired location")
|
||||
else:
|
||||
shutil.move(f'{filedir}Avl',inputs.avl_path)
|
||||
|
||||
# Adjust paths to AVL in process.sh
|
||||
print("Adjusting paths")
|
||||
with open("./process.sh", "r") as file:
|
||||
all_lines = file.readlines()
|
||||
file.close()
|
||||
|
||||
it = 0
|
||||
for line in all_lines:
|
||||
if "cp $DIR_PATH/$CUSTOM_MODEL.avl" in line:
|
||||
new_line = f'cp $DIR_PATH/$CUSTOM_MODEL.avl {inputs.avl_path}Avl/runs\n'
|
||||
all_lines[it] = new_line
|
||||
|
||||
if "/Avl/runs/plot.ps $DIR_PATH/" in line:
|
||||
new_line =f'mv {inputs.avl_path}Avl/runs/plot.ps $DIR_PATH/\n'
|
||||
all_lines[it] = new_line
|
||||
|
||||
if "cd" in line and "/Avl/runs" in line:
|
||||
new_line = f'cd {inputs.avl_path}Avl/runs\n'
|
||||
all_lines[it] = new_line
|
||||
it += 1
|
||||
|
||||
with open("./process.sh", "w") as file:
|
||||
file.writelines(all_lines)
|
||||
file.close()
|
||||
|
||||
|
||||
with open(inputs.yaml_file,'r') as yaml_file:
|
||||
yaml_data = yaml.safe_load(yaml_file)
|
||||
|
||||
airframes = ['cessna','standard_vtol','custom']
|
||||
plane_name = yaml_data['vehicle_name']
|
||||
frame_type = yaml_data['frame_type']
|
||||
if not frame_type in airframes:
|
||||
raise ValueError("\nThis is not a valid airframe, please choose a valid airframe. \n")
|
||||
|
||||
# Parameters that need to be provided:
|
||||
# General
|
||||
# - Reference Area (Sref)
|
||||
# - Wing span (Bref) (wing span squared / area = aspect ratio which is a required parameter for the sdf file)
|
||||
# - Reference point (X,Y,Zref) point at which moments and forces are calculated
|
||||
#Control Surface specific
|
||||
# - type (select from options; aileron,elevator,rudder)
|
||||
# - nchord
|
||||
# - cspace
|
||||
# - nspanwise
|
||||
# - sspace
|
||||
# - x,y,z 1. (section)
|
||||
# - chord 1. (section)
|
||||
# - ainc 1. (section)
|
||||
# - Nspan 1. (optional for section)
|
||||
# - sspace 1. (optional for section)
|
||||
# - x,y,z 2. (section)
|
||||
# - chord 2. (section)
|
||||
# - ainc 2. (section)
|
||||
# - Nspan 2. (optional for section)
|
||||
# - sspace 2. (optional for section)
|
||||
|
||||
# TODO: Find out if elevons are defined
|
||||
ctrl_surface_types = ['aileron','elevator','rudder']
|
||||
# - Reference Chord (Cref) (= area/wing span)
|
||||
delineation = '!***************************************'
|
||||
sec_demark = '#--------------------------------------------------'
|
||||
num_ctrl_surfaces = 0
|
||||
ctrl_surface_order = []
|
||||
area = 0
|
||||
span = 0
|
||||
|
||||
ref_pt_x = None
|
||||
ref_pt_y = None
|
||||
ref_pt_z = None
|
||||
|
||||
# Future work: Provide some pre-worked frames for a Cessna and standard VTOL if there is a need for it
|
||||
match frame_type:
|
||||
|
||||
case "custom":
|
||||
|
||||
# These parameters are consistent across all models.
|
||||
# At the moment we do not use any symmetry axis for mirroring.
|
||||
with open(f'{plane_name}.avl','w') as avl_file:
|
||||
avl_file.write(f'{delineation} \n')
|
||||
avl_file.write(f'!{plane_name} input dataset \n')
|
||||
avl_file.write(f'{delineation} \n')
|
||||
avl_file.write(f'{plane_name} \n')
|
||||
avl_file.write('!Mach \n0.0 \n')
|
||||
avl_file.write('!IYsym IZsym Zsym \n')
|
||||
avl_file.write('0 0 0 \n')
|
||||
avl_file.close()
|
||||
|
||||
# First define some model-specific parameters for custom models
|
||||
area = yaml_data["reference_area"]
|
||||
span = yaml_data["wing_span"]
|
||||
ref_pt_x = yaml_data["reference_point"]["X"]
|
||||
ref_pt_y = yaml_data["reference_point"]["Y"]
|
||||
ref_pt_z = yaml_data["reference_point"]["Z"]
|
||||
|
||||
if(span != 0 and area != 0):
|
||||
ref_chord = float(area)/float(span)
|
||||
else:
|
||||
raise ValueError("Invalid reference chord value. Check area and wing span values.")
|
||||
|
||||
# Write the gathered model-wide parameters into the .avl file
|
||||
with open(f'{plane_name}.avl','a') as avl_file:
|
||||
avl_file.write('!Sref Cref Bref \n')
|
||||
avl_file.write(f'{area} {str(ref_chord)} {span} \n')
|
||||
avl_file.write('!Xref Yref Zref \n')
|
||||
avl_file.write(f'{ref_pt_x} {ref_pt_y} {ref_pt_z} \n')
|
||||
avl_file.close()
|
||||
|
||||
num_ctrl_surfaces = yaml_data["num_ctrl_surfaces"]
|
||||
for i, control_surface in enumerate(yaml_data["control_surfaces"]):
|
||||
|
||||
# Wings always need to be defined from left to right
|
||||
ctrl_surf_name = control_surface['name']
|
||||
ctrl_surf_type = control_surface['type']
|
||||
if ctrl_surf_type not in ctrl_surface_types:
|
||||
raise ValueError(f'The selected type is invalid. Available types are: {ctrl_surface_types}')
|
||||
|
||||
# The order of control surfaces becomes important in the output parsing
|
||||
# to correctly assign derivatives to particular surfaces.
|
||||
ctrl_surface_order.append(ctrl_surf_type)
|
||||
|
||||
nchord = control_surface["nchord"]
|
||||
cspace = control_surface["cspace"]
|
||||
nspanwise = control_surface["nspan"]
|
||||
sspace = control_surface["sspace"]
|
||||
|
||||
# TODO: Add more control surface types that also require Angles.
|
||||
if ctrl_surf_type.lower() == 'aileron':
|
||||
angle = control_surface["angle"]
|
||||
|
||||
#Translation of control surface, will move the whole surface to specified position
|
||||
tx = control_surface["translation"]["X"]
|
||||
ty = control_surface["translation"]["Y"]
|
||||
tz = control_surface["translation"]["Z"]
|
||||
|
||||
# Write common part of this surface to .avl file
|
||||
with open(f'{plane_name}.avl','a') as avl_file:
|
||||
avl_file.write(sec_demark)
|
||||
avl_file.write("\nSURFACE \n")
|
||||
avl_file.write(f'{ctrl_surf_name} \n')
|
||||
avl_file.write("!Nchordwise Cspace Nspanwise Sspace \n")
|
||||
avl_file.write(f'{nchord} {cspace} {nspanwise} {sspace} \n')
|
||||
|
||||
# If we have a elevator, we can duplicate the defined control surface along the y-axis of the model
|
||||
# as both sides are generally modelled and controlled as one in simulation. Adjust for split elevators if desired.
|
||||
if ctrl_surf_type.lower() == 'elevator':
|
||||
avl_file.write("\nYDUPLICATE\n")
|
||||
avl_file.write("0.0\n\n")
|
||||
|
||||
# Elevators and Rudders do not require an angle of incidence.
|
||||
if ctrl_surf_type.lower() == 'aileron':
|
||||
avl_file.write("ANGLE \n")
|
||||
avl_file.write(f'{angle} \n')
|
||||
|
||||
# Translate the surface to a particular position in space.
|
||||
avl_file.write("TRANSLATE \n")
|
||||
avl_file.write(f'{tx} {ty} {tz} \n')
|
||||
avl_file.close()
|
||||
|
||||
|
||||
# Define NACA airfoil shape.
|
||||
# For help picking an airfoil go to: http://airfoiltools.com/airfoil/naca4digit
|
||||
# NOTE: AVL can only use 4-digit NACA codes.
|
||||
if ctrl_surf_type.lower() == "aileron":
|
||||
naca_number = control_surface["naca"]
|
||||
else:
|
||||
# Provide a default NACA number for unused airfoils
|
||||
naca_number = '0000'
|
||||
|
||||
# Iterating over each defined section for the control surface. There need to be at least
|
||||
# two in order to define a left and right edge, but there is no upper limit.
|
||||
# CRITICAL: ALWAYS DEFINE YOUR SECTION FROM LEFT TO RIGHT
|
||||
for j, section in enumerate(control_surface["sections"]):
|
||||
|
||||
print(f'Defining {j}. section of {i+1}. control surface \n')
|
||||
y = section["position"]["Y"]
|
||||
z = section["position"]["Z"]
|
||||
x = section["position"]["X"]
|
||||
chord = section["chord"]
|
||||
ainc = section["ainc"]
|
||||
nspan = section["nspan"]
|
||||
write_section(plane_name,x,y,z,chord,ainc,nspan,sspace,naca_number,ctrl_surf_type)
|
||||
|
||||
print(f'\nPARAMETER DEFINITION FOR {i+1}. CONTROL SURFACE COMPLETED \n')
|
||||
|
||||
|
||||
# Calculation of Aspect Ratio (AR) and Mean Aerodynamic Chord (mac)
|
||||
AR = str((float(span)*float(span))/float(area))
|
||||
mac = str((2/3)*(float(area)/float(span)))
|
||||
|
||||
# Call shell script that will pass the generated .avl file to AVL
|
||||
os.system(f'./process.sh {plane_name}')
|
||||
|
||||
# Call main function of avl parse script to parse the generated AVL files.
|
||||
avl_out_parse.main(plane_name,frame_type,AR,mac,ref_pt_x,ref_pt_y,ref_pt_z,num_ctrl_surfaces,area,ctrl_surface_order,inputs.avl_path)
|
||||
|
||||
# Finally move all generated files to a new directory and show the generated geometry image:
|
||||
result = subprocess.run(['pwd'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
||||
|
||||
if result.returncode == 0:
|
||||
# Save the output in a variable
|
||||
current_path = result.stdout.strip()
|
||||
|
||||
# Run image plot from avl_automation directory.
|
||||
os.system(f'mv ./{plane_name}.* ./{plane_name}' )
|
||||
os.system(f'evince {current_path}/{plane_name}/{plane_name}.ps')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
27
Tools/simulation/gz/tools/avl_automation/process.sh
Executable file
27
Tools/simulation/gz/tools/avl_automation/process.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
CUSTOM_MODEL=$1
|
||||
DIR_PATH=$(pwd)
|
||||
|
||||
cp $DIR_PATH/$CUSTOM_MODEL.avl /home/$USER/Avl/runs/
|
||||
cd
|
||||
cd /home/$USER/Avl/runs
|
||||
|
||||
old_stability_derivatives="custom_vehicle_stability_derivatives.txt"
|
||||
old_body_ax_derivatives="custom_vehicle_body_axis_derivatives.txt"
|
||||
|
||||
if [ -e "$old_stability_derivatives" ]; then
|
||||
# Delete old stability derivative file
|
||||
rm "$old_stability_derivatives"
|
||||
fi
|
||||
if [ -e "$old_body_ax_derivatives" ]; then
|
||||
# Delete old body_axis derivative file
|
||||
rm "$old_body_ax_derivatives"
|
||||
fi
|
||||
|
||||
#avl_steps.txt can be used to run commands on the AVL commandline.
|
||||
../bin/avl $CUSTOM_MODEL.avl < $DIR_PATH/avl_steps.txt
|
||||
echo "\n"
|
||||
|
||||
#After completion move the plot to avl_automation directory
|
||||
mv /home/$USER/Avl/runs/plot.ps $DIR_PATH/
|
||||
mv $DIR_PATH/plot.ps $DIR_PATH/$CUSTOM_MODEL.ps
|
||||
@ -0,0 +1,43 @@
|
||||
<plugin filename="gz-sim-advanced-lift-drag-system" name="gz::sim::systems::AdvancedLiftDrag">
|
||||
<a0></a0>
|
||||
<CL0></CL0>
|
||||
<AR></AR>
|
||||
<eff></eff>
|
||||
<CLa></CLa>
|
||||
<CD0></CD0>
|
||||
<Cem0></Cem0>
|
||||
<Cema></Cema>
|
||||
<CYb></CYb>
|
||||
<Cellb></Cellb>
|
||||
<Cenb></Cenb>
|
||||
<CDp></CDp>
|
||||
<CYp></CYp>
|
||||
<CLp></CLp>
|
||||
<Cellp></Cellp>
|
||||
<Cemp></Cemp>
|
||||
<Cenp></Cenp>
|
||||
<CDq></CDq>
|
||||
<CYq></CYq>
|
||||
<CLq></CLq>
|
||||
<Cellq></Cellq>
|
||||
<Cemq></Cemq>
|
||||
<Cenq></Cenq>
|
||||
<CDr></CDr>
|
||||
<CYr></CYr>
|
||||
<CLr></CLr>
|
||||
<Cellr></Cellr>
|
||||
<Cemr></Cemr>
|
||||
<Cenr></Cenr>
|
||||
<alpha_stall></alpha_stall>
|
||||
<CLa_stall></CLa_stall>
|
||||
<CDa_stall></CDa_stall>
|
||||
<Cema_stall></Cema_stall>
|
||||
<cp></cp>
|
||||
<area></area>
|
||||
<mac></mac>
|
||||
<air_density></air_density>
|
||||
<forward></forward>
|
||||
<upward></upward>
|
||||
<link_name></link_name>
|
||||
<num_ctrl_surfaces></num_ctrl_surfaces>
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
<control_surface>
|
||||
<name></name>
|
||||
<index></index>
|
||||
<direction></direction>
|
||||
<CD_ctrl></CD_ctrl>
|
||||
<CY_ctrl></CY_ctrl>
|
||||
<CL_ctrl></CL_ctrl>
|
||||
<Cell_ctrl></Cell_ctrl>
|
||||
<Cem_ctrl></Cem_ctrl>
|
||||
<Cen_ctrl></Cen_ctrl>
|
||||
</control_surface>
|
||||
151
Tools/simulation/gz/worlds/windy.sdf
Normal file
151
Tools/simulation/gz/worlds/windy.sdf
Normal file
@ -0,0 +1,151 @@
|
||||
<sdf version='1.9'>
|
||||
<world name='windy'>
|
||||
<physics type="ode">
|
||||
<max_step_size>0.004</max_step_size>
|
||||
<real_time_factor>1.0</real_time_factor>
|
||||
<real_time_update_rate>250</real_time_update_rate>
|
||||
</physics>
|
||||
<plugin name='gz::sim::systems::Physics' filename='gz-sim-physics-system'/>
|
||||
<plugin name='gz::sim::systems::UserCommands' filename='gz-sim-user-commands-system'/>
|
||||
<plugin name='gz::sim::systems::SceneBroadcaster' filename='gz-sim-scene-broadcaster-system'/>
|
||||
<plugin name='gz::sim::systems::Contact' filename='gz-sim-contact-system'/>
|
||||
<plugin name='gz::sim::systems::Imu' filename='gz-sim-imu-system'/>
|
||||
<plugin name='gz::sim::systems::AirPressure' filename='gz-sim-air-pressure-system'/>
|
||||
<plugin name='gz::sim::systems::ApplyLinkWrench' filename='gz-sim-apply-link-wrench-system'/>
|
||||
<plugin name='gz::sim::systems::Sensors' filename='gz-sim-sensors-system'>
|
||||
<render_engine>ogre2</render_engine>
|
||||
</plugin>
|
||||
<gui fullscreen='false'>
|
||||
<plugin name='3D View' filename='GzScene3D'>
|
||||
<gz-gui>
|
||||
<title>3D View</title>
|
||||
<property type='bool' key='showTitleBar'>0</property>
|
||||
<property type='string' key='state'>docked</property>
|
||||
</gz-gui>
|
||||
<engine>ogre2</engine>
|
||||
<scene>scene</scene>
|
||||
<ambient_light>0.5984631152222222 0.5984631152222222 0.5984631152222222</ambient_light>
|
||||
<background_color>0.8984631152222222 0.8984631152222222 0.8984631152222222</background_color>
|
||||
<camera_pose>-6 0 6 0 0.5 0</camera_pose>
|
||||
</plugin>
|
||||
<plugin name='World control' filename='WorldControl'>
|
||||
<gz-gui>
|
||||
<title>World control</title>
|
||||
<property type='bool' key='showTitleBar'>0</property>
|
||||
<property type='bool' key='resizable'>0</property>
|
||||
<property type='double' key='height'>72</property>
|
||||
<property type='double' key='width'>121</property>
|
||||
<property type='double' key='z'>1</property>
|
||||
<property type='string' key='state'>floating</property>
|
||||
<anchors target='3D View'>
|
||||
<line own='left' target='left'/>
|
||||
<line own='bottom' target='bottom'/>
|
||||
</anchors>
|
||||
</gz-gui>
|
||||
<play_pause>1</play_pause>
|
||||
<step>1</step>
|
||||
<start_paused>1</start_paused>
|
||||
</plugin>
|
||||
<plugin name='World stats' filename='WorldStats'>
|
||||
<gz-gui>
|
||||
<title>World stats</title>
|
||||
<property type='bool' key='showTitleBar'>0</property>
|
||||
<property type='bool' key='resizable'>0</property>
|
||||
<property type='double' key='height'>110</property>
|
||||
<property type='double' key='width'>290</property>
|
||||
<property type='double' key='z'>1</property>
|
||||
<property type='string' key='state'>floating</property>
|
||||
<anchors target='3D View'>
|
||||
<line own='right' target='right'/>
|
||||
<line own='bottom' target='bottom'/>
|
||||
</anchors>
|
||||
</gz-gui>
|
||||
<sim_time>1</sim_time>
|
||||
<real_time>1</real_time>
|
||||
<real_time_factor>1</real_time_factor>
|
||||
<iterations>1</iterations>
|
||||
</plugin>
|
||||
<plugin name='Entity tree' filename='EntityTree'/>
|
||||
</gui>
|
||||
<gravity>0 0 -9.8</gravity>
|
||||
<magnetic_field>6e-06 2.3e-05 -4.2e-05</magnetic_field>
|
||||
<atmosphere type='adiabatic'/>
|
||||
<scene>
|
||||
<grid>false</grid>
|
||||
<ambient>0.4 0.4 0.4 1</ambient>
|
||||
<background>0.7 0.7 0.7 1</background>
|
||||
<shadows>true</shadows>
|
||||
</scene>
|
||||
<model name='ground_plane'>
|
||||
<static>true</static>
|
||||
<link name='link'>
|
||||
<collision name='collision'>
|
||||
<geometry>
|
||||
<plane>
|
||||
<normal>0 0 1</normal>
|
||||
<size>1 1</size>
|
||||
</plane>
|
||||
</geometry>
|
||||
<surface>
|
||||
<friction>
|
||||
<ode/>
|
||||
</friction>
|
||||
<bounce/>
|
||||
<contact/>
|
||||
</surface>
|
||||
</collision>
|
||||
<visual name='visual'>
|
||||
<geometry>
|
||||
<plane>
|
||||
<normal>0 0 1</normal>
|
||||
<size>100 100</size>
|
||||
</plane>
|
||||
</geometry>
|
||||
<material>
|
||||
<ambient>0.8 0.8 0.8 1</ambient>
|
||||
<diffuse>0.8 0.8 0.8 1</diffuse>
|
||||
<specular>0.8 0.8 0.8 1</specular>
|
||||
</material>
|
||||
</visual>
|
||||
<pose>0 0 0 0 -0 0</pose>
|
||||
<inertial>
|
||||
<pose>0 0 0 0 -0 0</pose>
|
||||
<mass>1</mass>
|
||||
<inertia>
|
||||
<ixx>1</ixx>
|
||||
<ixy>0</ixy>
|
||||
<ixz>0</ixz>
|
||||
<iyy>1</iyy>
|
||||
<iyz>0</iyz>
|
||||
<izz>1</izz>
|
||||
</inertia>
|
||||
</inertial>
|
||||
<enable_wind>true</enable_wind>
|
||||
</link>
|
||||
<pose>0 0 0 0 -0 0</pose>
|
||||
<self_collide>false</self_collide>
|
||||
</model>
|
||||
<light name='sunUTC' type='directional'>
|
||||
<pose>0 0 500 0 -0 0</pose>
|
||||
<cast_shadows>true</cast_shadows>
|
||||
<intensity>1</intensity>
|
||||
<direction>0.001 0.625 -0.78</direction>
|
||||
<diffuse>0.904 0.904 0.904 1</diffuse>
|
||||
<specular>0.271 0.271 0.271 1</specular>
|
||||
<attenuation>
|
||||
<range>2000</range>
|
||||
<linear>0</linear>
|
||||
<constant>1</constant>
|
||||
<quadratic>0</quadratic>
|
||||
</attenuation>
|
||||
<spot>
|
||||
<inner_angle>0</inner_angle>
|
||||
<outer_angle>0</outer_angle>
|
||||
<falloff>0</falloff>
|
||||
</spot>
|
||||
</light>
|
||||
<wind>
|
||||
<linear_velocity>10 10 10</linear_velocity>
|
||||
</wind>
|
||||
</world>
|
||||
</sdf>
|
||||
175
Tools/zenoh/px_generate_zenoh_topic_files.py
Executable file
175
Tools/zenoh/px_generate_zenoh_topic_files.py
Executable file
@ -0,0 +1,175 @@
|
||||
#!/usr/bin/env python3
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) 2013-2022 PX4 Pro Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
"""
|
||||
px_generate_zenoh_topic_files.py
|
||||
Generates c/cpp header/source files for use with zenoh
|
||||
message files
|
||||
"""
|
||||
|
||||
import os
|
||||
import argparse
|
||||
import re
|
||||
import sys
|
||||
|
||||
try:
|
||||
import em
|
||||
except ImportError as e:
|
||||
print("Failed to import em: " + str(e))
|
||||
print("")
|
||||
print("You may need to install it using:")
|
||||
print(" pip3 install --user empy")
|
||||
print("")
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
import genmsg.template_tools
|
||||
except ImportError as e:
|
||||
print("Failed to import genmsg: " + str(e))
|
||||
print("")
|
||||
print("You may need to install it using:")
|
||||
print(" pip3 install --user pyros-genmsg")
|
||||
print("")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
__author__ = "Sergey Belash, Thomas Gubler, Beat Kueng"
|
||||
__copyright__ = "Copyright (C) 2013-2022 PX4 Development Team."
|
||||
__license__ = "BSD"
|
||||
__email__ = "thomasgubler@gmail.com"
|
||||
|
||||
ZENOH_TEMPLATE_FILE = ['Kconfig.topics.em', 'uorb_pubsub_factory.hpp.em']
|
||||
TOPICS_TOKEN = '# TOPICS '
|
||||
|
||||
|
||||
def get_topics(filename):
|
||||
"""
|
||||
Get TOPICS names from a "# TOPICS" line
|
||||
"""
|
||||
ofile = open(filename, 'r')
|
||||
text = ofile.read()
|
||||
result = []
|
||||
for each_line in text.split('\n'):
|
||||
if each_line.startswith(TOPICS_TOKEN):
|
||||
topic_names_str = each_line.strip()
|
||||
topic_names_str = topic_names_str.replace(TOPICS_TOKEN, "")
|
||||
topic_names_list = topic_names_str.split(" ")
|
||||
for topic in topic_names_list:
|
||||
# topic name PascalCase (file name) to snake_case (topic name)
|
||||
topic_name = re.sub(r'(?<!^)(?=[A-Z])', '_', topic).lower()
|
||||
result.append(topic_name)
|
||||
ofile.close()
|
||||
|
||||
if len(result) == 0:
|
||||
# topic name PascalCase (file name) to snake_case (topic name)
|
||||
file_base_name = os.path.basename(filename).replace(".msg", "")
|
||||
topic_name = re.sub(r'(?<!^)(?=[A-Z])', '_', file_base_name).lower()
|
||||
result.append(topic_name)
|
||||
|
||||
return result
|
||||
|
||||
def generate_by_template(output_file, template_file, em_globals):
|
||||
"""
|
||||
Invokes empy intepreter to geneate output_file by the
|
||||
given template_file and predefined em_globals dict
|
||||
"""
|
||||
# check if folder exists:
|
||||
folder_name = os.path.dirname(output_file)
|
||||
if not os.path.exists(folder_name):
|
||||
os.makedirs(folder_name)
|
||||
|
||||
ofile = open(output_file, 'w')
|
||||
# todo, reuse interpreter
|
||||
interpreter = em.Interpreter(output=ofile, globals=em_globals, options={
|
||||
em.RAW_OPT: True, em.BUFFERED_OPT: True})
|
||||
try:
|
||||
interpreter.file(open(template_file))
|
||||
except OSError as e:
|
||||
ofile.close()
|
||||
os.remove(output_file)
|
||||
raise
|
||||
interpreter.shutdown()
|
||||
ofile.close()
|
||||
return True
|
||||
|
||||
|
||||
def generate_topics_list_file_from_files(files, outputdir, template_filename, templatedir):
|
||||
# generate cpp file with topics list
|
||||
filenames = []
|
||||
for filename in [os.path.basename(p) for p in files if os.path.basename(p).endswith(".msg")]:
|
||||
filenames.append(re.sub(r'(?<!^)(?=[A-Z])', '_', filename).lower())
|
||||
|
||||
datatypes = []
|
||||
for filename in [os.path.basename(p) for p in files if os.path.basename(p).endswith(".msg")]:
|
||||
datatypes.append(re.sub(r'(?<!^)(?=[A-Z])', '_', filename).lower().replace(".msg",""))
|
||||
|
||||
full_base_names = []
|
||||
for filename in [os.path.basename(p) for p in files if os.path.basename(p).endswith(".msg")]:
|
||||
full_base_names.append(filename.replace(".msg",""))
|
||||
|
||||
topics = []
|
||||
for msg_filename in files:
|
||||
topics.extend(get_topics(msg_filename))
|
||||
|
||||
tl_globals = {"msgs": filenames, "topics": topics, "datatypes": datatypes, "full_base_names": full_base_names}
|
||||
tl_template_file = os.path.join(templatedir, template_filename)
|
||||
tl_out_file = os.path.join(outputdir, template_filename.replace(".em", ""))
|
||||
|
||||
generate_by_template(tl_out_file, tl_template_file, tl_globals)
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='Convert msg files to uorb headers/sources')
|
||||
parser.add_argument('--zenoh-config', help='Generate Zenoh Kconfig file', action='store_true')
|
||||
parser.add_argument('--zenoh-pub-sub', help='Generate Zenoh Pubsub factory', action='store_true')
|
||||
parser.add_argument('-f', dest='file',
|
||||
help="files to convert (use only without -d)",
|
||||
nargs="+")
|
||||
parser.add_argument('-e', dest='templatedir',
|
||||
help='directory with template files',)
|
||||
parser.add_argument('-o', dest='outputdir',
|
||||
help='output directory for header files')
|
||||
parser.add_argument('-p', dest='prefix', default='',
|
||||
help='string added as prefix to the output file '
|
||||
' name when converting directories')
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.zenoh_config:
|
||||
generate_topics_list_file_from_files(args.file, args.outputdir, ZENOH_TEMPLATE_FILE[0], args.templatedir)
|
||||
exit(0)
|
||||
elif args.zenoh_pub_sub:
|
||||
generate_topics_list_file_from_files(args.file, args.outputdir, ZENOH_TEMPLATE_FILE[1], args.templatedir)
|
||||
exit(0)
|
||||
else:
|
||||
print('Error: either --headers or --sources must be specified')
|
||||
exit(-1)
|
||||
25
Tools/zenoh/templates/zenoh/Kconfig.topics.em
Normal file
25
Tools/zenoh/templates/zenoh/Kconfig.topics.em
Normal file
@ -0,0 +1,25 @@
|
||||
@{
|
||||
topics_count = len(topics)
|
||||
topic_names_all = list(set(topics)) # set() filters duplicates
|
||||
topic_names_all.sort()
|
||||
|
||||
datatypes = list(set(datatypes)) # set() filters duplicates
|
||||
datatypes.sort()
|
||||
}@
|
||||
|
||||
menu "Zenoh publishers/subscribers"
|
||||
depends on MODULES_ZENOH
|
||||
@[for idx, topic_name in enumerate(datatypes)]@
|
||||
config ZENOH_PUBSUB_@(topic_name.upper())
|
||||
bool "@(topic_name)"
|
||||
default n
|
||||
|
||||
@[end for]
|
||||
|
||||
config ZENOH_PUBSUB_ALL_SELECTION
|
||||
bool
|
||||
default y if ZENOH_PUBSUB_ALL
|
||||
@[for idx, topic_name in enumerate(datatypes)]@
|
||||
select ZENOH_PUBSUB_@(topic_name.upper())
|
||||
@[end for]
|
||||
endmenu
|
||||
154
Tools/zenoh/templates/zenoh/uorb_pubsub_factory.hpp.em
Normal file
154
Tools/zenoh/templates/zenoh/uorb_pubsub_factory.hpp.em
Normal file
@ -0,0 +1,154 @@
|
||||
@###############################################
|
||||
@#
|
||||
@# EmPy template for generating u.hpp file
|
||||
@# for logging purposes
|
||||
@#
|
||||
@###############################################
|
||||
@# Start of Template
|
||||
@#
|
||||
@# Context:
|
||||
@# - topics (List) list of all topic names
|
||||
@###############################################
|
||||
@{
|
||||
|
||||
topic_dict = dict(zip(datatypes, full_base_names))
|
||||
|
||||
topics_count = len(topics)
|
||||
topic_names_all = list(set(topics)) # set() filters duplicates
|
||||
topic_names_all.sort()
|
||||
|
||||
datatypes = list(set(datatypes)) # set() filters duplicates
|
||||
datatypes.sort()
|
||||
|
||||
full_base_names = list(set(full_base_names)) # set() filters duplicates
|
||||
full_base_names.sort()
|
||||
|
||||
|
||||
}@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2023 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* uorb_pubsub_factory.hpp
|
||||
*
|
||||
* Defines generic, templatized uORB over Zenoh / ROS2
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <publishers/uorb_publisher.hpp>
|
||||
#include <uORB/topics/uORBTopics.hpp>
|
||||
@[for idx, topic_name in enumerate(full_base_names)]@
|
||||
#include <px4/msg/@(topic_name).h>
|
||||
@[end for]
|
||||
|
||||
@[for idx, topic_name in enumerate(datatypes)]@
|
||||
@{
|
||||
type_topic_count = len([e for e in topic_names_all if e.startswith(topic_name)])
|
||||
}@
|
||||
#ifdef CONFIG_ZENOH_PUBSUB_@(topic_name.upper())
|
||||
# define CONFIG_ZENOH_PUBSUB_@(topic_name.upper())_COUNT @(type_topic_count)
|
||||
#else
|
||||
# define CONFIG_ZENOH_PUBSUB_@(topic_name.upper())_COUNT 0
|
||||
#endif
|
||||
@[end for]
|
||||
|
||||
#define ZENOH_PUBSUB_COUNT \
|
||||
@[for idx, topic_name in enumerate(datatypes)]@
|
||||
CONFIG_ZENOH_PUBSUB_@(topic_name.upper())_COUNT + \
|
||||
@[end for] 0
|
||||
|
||||
typedef struct {
|
||||
const uint32_t *ops;
|
||||
const orb_metadata* orb_meta;
|
||||
} UorbPubSubTopicBinder;
|
||||
|
||||
const UorbPubSubTopicBinder _topics[ZENOH_PUBSUB_COUNT] {
|
||||
@{
|
||||
uorb_id_idx = 0
|
||||
}@
|
||||
@[for idx, topic_name in enumerate(datatypes)]@
|
||||
#ifdef CONFIG_ZENOH_PUBSUB_@(topic_name.upper())
|
||||
@{
|
||||
topic_names = [e for e in topic_names_all if e.startswith(topic_name)]
|
||||
}@
|
||||
@[for topic_name_inst in topic_names]@
|
||||
{
|
||||
px4_msg_@(topic_dict[topic_name])_cdrstream_desc.ops.ops,
|
||||
ORB_ID(@(topic_name_inst))
|
||||
},
|
||||
@{
|
||||
uorb_id_idx += 1
|
||||
}@
|
||||
@[end for]#endif
|
||||
@[end for]
|
||||
};
|
||||
|
||||
uORB_Zenoh_Publisher* genPublisher(const orb_metadata *meta) {
|
||||
for (auto &pub : _topics) {
|
||||
if(pub.orb_meta->o_id == meta->o_id) {
|
||||
return new uORB_Zenoh_Publisher(meta, pub.ops);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
uORB_Zenoh_Publisher* genPublisher(const char *name) {
|
||||
for (auto &pub : _topics) {
|
||||
if(strcmp(pub.orb_meta->o_name, name) == 0) {
|
||||
return new uORB_Zenoh_Publisher(pub.orb_meta, pub.ops);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Zenoh_Subscriber* genSubscriber(const orb_metadata *meta) {
|
||||
for (auto &sub : _topics) {
|
||||
if(sub.orb_meta->o_id == meta->o_id) {
|
||||
return new uORB_Zenoh_Subscriber(meta, sub.ops);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Zenoh_Subscriber* genSubscriber(const char *name) {
|
||||
for (auto &sub : _topics) {
|
||||
if(strcmp(sub.orb_meta->o_name, name) == 0) {
|
||||
return new uORB_Zenoh_Subscriber(sub.orb_meta, sub.ops);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -16,8 +16,8 @@ CONFIG_DRIVERS_GPS=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM20948=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_MPU6000=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_MPU6500=y
|
||||
CONFIG_DRIVERS_IMU_L3GD20=y
|
||||
CONFIG_DRIVERS_IMU_LSM303D=y
|
||||
CONFIG_DRIVERS_IMU_ST_L3GD20=y
|
||||
CONFIG_DRIVERS_IMU_ST_LSM303D=y
|
||||
CONFIG_DRIVERS_IRLOCK=y
|
||||
CONFIG_COMMON_LIGHT=y
|
||||
CONFIG_COMMON_MAGNETOMETER=y
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
param set-default IMU_GYRO_RATEMAX 1000
|
||||
param set-default SENS_IMU_CLPNOTI 0
|
||||
|
||||
# Internal SPI
|
||||
if ! paw3902 -s start -Y 180
|
||||
|
||||
@ -27,7 +27,6 @@
|
||||
# CONFIG_NSH_DISABLE_LOOPS is not set
|
||||
# CONFIG_NSH_DISABLE_LS is not set
|
||||
# CONFIG_NSH_DISABLE_MKDIR is not set
|
||||
# CONFIG_NSH_DISABLE_MKFATFS is not set
|
||||
# CONFIG_NSH_DISABLE_MOUNT is not set
|
||||
# CONFIG_NSH_DISABLE_MV is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
@ -66,17 +65,8 @@ CONFIG_DEBUG_HARDFAULT_ALERT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DEBUG_TCBINFO=y
|
||||
CONFIG_DEFAULT_SMALL=y
|
||||
CONFIG_DEV_FIFO_SIZE=0
|
||||
CONFIG_DEV_PIPE_MAXSIZE=1024
|
||||
CONFIG_DEV_PIPE_SIZE=70
|
||||
CONFIG_FDCLONE_STDIO=y
|
||||
CONFIG_FS_BINFS=y
|
||||
CONFIG_FS_CROMFS=y
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_FS_FATTIME=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_PROCFS_INCLUDE_PROGMEM=y
|
||||
CONFIG_FS_PROCFS_REGISTER=y
|
||||
CONFIG_FS_ROMFS=y
|
||||
CONFIG_GRAN=y
|
||||
CONFIG_GRAN_INTR=y
|
||||
@ -88,14 +78,9 @@ CONFIG_INIT_STACKSIZE=2624
|
||||
CONFIG_LIBC_FLOATINGPOINT=y
|
||||
CONFIG_LIBC_LONG_LONG=y
|
||||
CONFIG_LIBC_MAX_EXITFUNS=1
|
||||
CONFIG_LIBC_STRERROR=y
|
||||
CONFIG_MEMSET_64BIT=y
|
||||
CONFIG_MEMSET_OPTSPEED=y
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_MTD=y
|
||||
CONFIG_MTD_BYTE_WRITE=y
|
||||
CONFIG_MTD_PARTITION=y
|
||||
CONFIG_MTD_RAMTRON=y
|
||||
CONFIG_NAME_MAX=40
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_ARGCAT=y
|
||||
@ -108,31 +93,20 @@ CONFIG_NSH_NESTDEPTH=8
|
||||
CONFIG_NSH_QUOTE=y
|
||||
CONFIG_NSH_ROMFSETC=y
|
||||
CONFIG_NSH_ROMFSSECTSIZE=128
|
||||
CONFIG_NSH_STRERROR=y
|
||||
CONFIG_NSH_VARS=y
|
||||
CONFIG_PIPES=y
|
||||
CONFIG_PREALLOC_TIMERS=50
|
||||
CONFIG_PRIORITY_INHERITANCE=y
|
||||
CONFIG_PTHREAD_MUTEX_ROBUST=y
|
||||
CONFIG_PTHREAD_STACK_MIN=512
|
||||
CONFIG_RAMTRON_EMULATE_PAGE_SHIFT=5
|
||||
CONFIG_RAMTRON_EMULATE_SECTOR_SHIFT=5
|
||||
CONFIG_RAMTRON_SETSPEED=y
|
||||
CONFIG_RAM_SIZE=262144
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RTC_DATETIME=y
|
||||
CONFIG_SCHED_HPWORK=y
|
||||
CONFIG_SCHED_HPWORKPRIORITY=254
|
||||
CONFIG_SCHED_HPWORKSTACKSIZE=3000
|
||||
CONFIG_SCHED_INSTRUMENTATION=y
|
||||
CONFIG_SCHED_INSTRUMENTATION_EXTERNAL=y
|
||||
CONFIG_SCHED_INSTRUMENTATION_SWITCH=y
|
||||
CONFIG_SCHED_LPWORK=y
|
||||
CONFIG_SCHED_LPWORKPRIORITY=50
|
||||
CONFIG_SCHED_LPWORKSTACKSIZE=1632
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SEM_PREALLOCHOLDERS=32
|
||||
CONFIG_SERIAL_TERMIOS=y
|
||||
CONFIG_SIG_DEFAULT=y
|
||||
CONFIG_SIG_SIGALRM_ACTION=y
|
||||
@ -151,11 +125,6 @@ CONFIG_STM32_FLASH_PREFETCH=y
|
||||
CONFIG_STM32_FLOWCONTROL_BROKEN=y
|
||||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_RTC=y
|
||||
CONFIG_STM32_RTC_HSECLOCK=y
|
||||
CONFIG_STM32_RTC_MAGIC=0xfacefeee
|
||||
CONFIG_STM32_RTC_MAGIC_REG=1
|
||||
CONFIG_STM32_RTC_MAGIC_TIME_SET=0xfacefeef
|
||||
CONFIG_STM32_SERIALBRK_BSDCOMPAT=y
|
||||
CONFIG_STM32_SERIAL_DISABLE_REORDERING=y
|
||||
CONFIG_STM32_SPI1=y
|
||||
|
||||
@ -156,8 +156,7 @@ __EXPORT int board_app_initialize(uintptr_t arg)
|
||||
led_on(LED_BLUE);
|
||||
|
||||
/* Configure the HW based on the manifest */
|
||||
|
||||
px4_platform_configure();
|
||||
//px4_platform_configure();
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
|
||||
param set-default CBRK_IO_SAFETY 0
|
||||
param set-default MBE_ENABLE 1
|
||||
param set-default SENS_IMU_CLPNOTI 0
|
||||
|
||||
safety_button start
|
||||
tone_alarm start
|
||||
|
||||
@ -27,7 +27,6 @@
|
||||
# CONFIG_NSH_DISABLE_LOOPS is not set
|
||||
# CONFIG_NSH_DISABLE_LS is not set
|
||||
# CONFIG_NSH_DISABLE_MKDIR is not set
|
||||
# CONFIG_NSH_DISABLE_MKFATFS is not set
|
||||
# CONFIG_NSH_DISABLE_MOUNT is not set
|
||||
# CONFIG_NSH_DISABLE_MV is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
@ -66,17 +65,8 @@ CONFIG_DEBUG_HARDFAULT_ALERT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DEBUG_TCBINFO=y
|
||||
CONFIG_DEFAULT_SMALL=y
|
||||
CONFIG_DEV_FIFO_SIZE=0
|
||||
CONFIG_DEV_PIPE_MAXSIZE=1024
|
||||
CONFIG_DEV_PIPE_SIZE=70
|
||||
CONFIG_FDCLONE_STDIO=y
|
||||
CONFIG_FS_BINFS=y
|
||||
CONFIG_FS_CROMFS=y
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_FS_FATTIME=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_PROCFS_INCLUDE_PROGMEM=y
|
||||
CONFIG_FS_PROCFS_REGISTER=y
|
||||
CONFIG_FS_ROMFS=y
|
||||
CONFIG_GRAN=y
|
||||
CONFIG_GRAN_INTR=y
|
||||
@ -90,14 +80,9 @@ CONFIG_INIT_STACKSIZE=2624
|
||||
CONFIG_LIBC_FLOATINGPOINT=y
|
||||
CONFIG_LIBC_LONG_LONG=y
|
||||
CONFIG_LIBC_MAX_EXITFUNS=1
|
||||
CONFIG_LIBC_STRERROR=y
|
||||
CONFIG_MEMSET_64BIT=y
|
||||
CONFIG_MEMSET_OPTSPEED=y
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_MTD=y
|
||||
CONFIG_MTD_BYTE_WRITE=y
|
||||
CONFIG_MTD_PARTITION=y
|
||||
CONFIG_MTD_RAMTRON=y
|
||||
CONFIG_NAME_MAX=40
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_ARGCAT=y
|
||||
@ -110,37 +95,25 @@ CONFIG_NSH_NESTDEPTH=8
|
||||
CONFIG_NSH_QUOTE=y
|
||||
CONFIG_NSH_ROMFSETC=y
|
||||
CONFIG_NSH_ROMFSSECTSIZE=128
|
||||
CONFIG_NSH_STRERROR=y
|
||||
CONFIG_NSH_VARS=y
|
||||
CONFIG_PIPES=y
|
||||
CONFIG_PREALLOC_TIMERS=50
|
||||
CONFIG_PRIORITY_INHERITANCE=y
|
||||
CONFIG_PTHREAD_MUTEX_ROBUST=y
|
||||
CONFIG_PTHREAD_STACK_MIN=512
|
||||
CONFIG_RAMTRON_EMULATE_PAGE_SHIFT=5
|
||||
CONFIG_RAMTRON_EMULATE_SECTOR_SHIFT=5
|
||||
CONFIG_RAMTRON_SETSPEED=y
|
||||
CONFIG_RAM_SIZE=262144
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RTC_DATETIME=y
|
||||
CONFIG_SCHED_HPWORK=y
|
||||
CONFIG_SCHED_HPWORKPRIORITY=249
|
||||
CONFIG_SCHED_HPWORKSTACKSIZE=1280
|
||||
CONFIG_SCHED_INSTRUMENTATION=y
|
||||
CONFIG_SCHED_INSTRUMENTATION_EXTERNAL=y
|
||||
CONFIG_SCHED_INSTRUMENTATION_SWITCH=y
|
||||
CONFIG_SCHED_LPWORK=y
|
||||
CONFIG_SCHED_LPWORKPRIORITY=50
|
||||
CONFIG_SCHED_LPWORKSTACKSIZE=1632
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SEM_PREALLOCHOLDERS=32
|
||||
CONFIG_SERIAL_TERMIOS=y
|
||||
CONFIG_SIG_DEFAULT=y
|
||||
CONFIG_SIG_SIGALRM_ACTION=y
|
||||
CONFIG_SIG_SIGUSR1_ACTION=y
|
||||
CONFIG_SIG_SIGUSR2_ACTION=y
|
||||
CONFIG_SIG_SIGWORK=4
|
||||
CONFIG_STACK_COLORATION=y
|
||||
CONFIG_START_DAY=30
|
||||
CONFIG_START_MONTH=11
|
||||
@ -155,11 +128,6 @@ CONFIG_STM32_I2C1=y
|
||||
CONFIG_STM32_I2C2=y
|
||||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_RTC=y
|
||||
CONFIG_STM32_RTC_HSECLOCK=y
|
||||
CONFIG_STM32_RTC_MAGIC=0xfacefeee
|
||||
CONFIG_STM32_RTC_MAGIC_REG=1
|
||||
CONFIG_STM32_RTC_MAGIC_TIME_SET=0xfacefeef
|
||||
CONFIG_STM32_SERIALBRK_BSDCOMPAT=y
|
||||
CONFIG_STM32_SERIAL_DISABLE_REORDERING=y
|
||||
CONFIG_STM32_SPI1=y
|
||||
|
||||
@ -156,8 +156,7 @@ __EXPORT int board_app_initialize(uintptr_t arg)
|
||||
#endif // FLASH_BASED_PARAMS
|
||||
|
||||
/* Configure the HW based on the manifest */
|
||||
|
||||
px4_platform_configure();
|
||||
//px4_platform_configure();
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -21,21 +21,15 @@ CONFIG_UAVCANNODE_RTK_DATA=y
|
||||
CONFIG_UAVCANNODE_SAFETY_BUTTON=y
|
||||
CONFIG_UAVCANNODE_STATIC_PRESSURE=y
|
||||
CONFIG_UAVCANNODE_STATIC_TEMPERATURE=y
|
||||
CONFIG_MODULES_EKF2=y
|
||||
# CONFIG_EKF2_AUXVEL is not set
|
||||
# CONFIG_EKF2_EXTERNAL_VISION is not set
|
||||
# CONFIG_EKF2_GNSS_YAW is not set
|
||||
# CONFIG_EKF2_GRAVITY_FUSION is not set
|
||||
# CONFIG_EKF2_RANGE_FINDER is not set
|
||||
# CONFIG_EKF2_WIND is not set
|
||||
CONFIG_MODULES_GYRO_CALIBRATION=y
|
||||
CONFIG_MODULES_MAG_BIAS_ESTIMATOR=y
|
||||
CONFIG_MODULES_SENSORS=y
|
||||
# CONFIG_SENSORS_VEHICLE_AIRSPEED is not set
|
||||
# CONFIG_SENSORS_VEHICLE_ANGULAR_VELOCITY is not set
|
||||
# CONFIG_SENSORS_VEHICLE_ACCELERATION is not set
|
||||
# CONFIG_SENSORS_VEHICLE_OPTICAL_FLOW is not set
|
||||
CONFIG_SYSTEMCMDS_I2CDETECT=y
|
||||
# CONFIG_SENSORS_VEHICLE_AIR_DATA is not set
|
||||
# CONFIG_SENSORS_VEHICLE_GPS_POSITION is not set
|
||||
CONFIG_SYSTEMCMDS_PARAM=y
|
||||
CONFIG_SYSTEMCMDS_PERF=y
|
||||
CONFIG_SYSTEMCMDS_REBOOT=y
|
||||
CONFIG_SYSTEMCMDS_SYSTEM_TIME=y
|
||||
CONFIG_SYSTEMCMDS_TOP=y
|
||||
CONFIG_SYSTEMCMDS_TOPIC_LISTENER=y
|
||||
|
||||
@ -7,6 +7,7 @@ param set-default CBRK_IO_SAFETY 0
|
||||
param set-default CANNODE_SUB_MBD 1
|
||||
param set-default CANNODE_SUB_RTCM 1
|
||||
param set-default MBE_ENABLE 1
|
||||
param set-default SENS_IMU_CLPNOTI 0
|
||||
|
||||
safety_button start
|
||||
tone_alarm start
|
||||
|
||||
@ -102,6 +102,9 @@ CONFIG_PTHREAD_STACK_MIN=512
|
||||
CONFIG_RAM_SIZE=262144
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_SCHED_HPWORK=y
|
||||
CONFIG_SCHED_HPWORKPRIORITY=249
|
||||
CONFIG_SCHED_HPWORKSTACKSIZE=1280
|
||||
CONFIG_SCHED_INSTRUMENTATION=y
|
||||
CONFIG_SCHED_INSTRUMENTATION_EXTERNAL=y
|
||||
CONFIG_SCHED_INSTRUMENTATION_SWITCH=y
|
||||
@ -111,6 +114,7 @@ CONFIG_SIG_DEFAULT=y
|
||||
CONFIG_SIG_SIGALRM_ACTION=y
|
||||
CONFIG_SIG_SIGUSR1_ACTION=y
|
||||
CONFIG_SIG_SIGUSR2_ACTION=y
|
||||
CONFIG_SIG_SIGWORK=4
|
||||
CONFIG_STACK_COLORATION=y
|
||||
CONFIG_START_DAY=30
|
||||
CONFIG_START_MONTH=11
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
# board specific defaults
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
param set-default SENS_IMU_CLPNOTI 0
|
||||
|
||||
pwm_out start
|
||||
|
||||
dshot start
|
||||
|
||||
@ -27,7 +27,6 @@
|
||||
# CONFIG_NSH_DISABLE_LOOPS is not set
|
||||
# CONFIG_NSH_DISABLE_LS is not set
|
||||
# CONFIG_NSH_DISABLE_MKDIR is not set
|
||||
# CONFIG_NSH_DISABLE_MKFATFS is not set
|
||||
# CONFIG_NSH_DISABLE_MOUNT is not set
|
||||
# CONFIG_NSH_DISABLE_MV is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
@ -66,17 +65,8 @@ CONFIG_DEBUG_HARDFAULT_ALERT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DEBUG_TCBINFO=y
|
||||
CONFIG_DEFAULT_SMALL=y
|
||||
CONFIG_DEV_FIFO_SIZE=0
|
||||
CONFIG_DEV_PIPE_MAXSIZE=1024
|
||||
CONFIG_DEV_PIPE_SIZE=70
|
||||
CONFIG_FDCLONE_STDIO=y
|
||||
CONFIG_FS_BINFS=y
|
||||
CONFIG_FS_CROMFS=y
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_FS_FATTIME=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_PROCFS_INCLUDE_PROGMEM=y
|
||||
CONFIG_FS_PROCFS_REGISTER=y
|
||||
CONFIG_FS_ROMFS=y
|
||||
CONFIG_GRAN=y
|
||||
CONFIG_GRAN_INTR=y
|
||||
@ -90,14 +80,9 @@ CONFIG_INIT_STACKSIZE=2624
|
||||
CONFIG_LIBC_FLOATINGPOINT=y
|
||||
CONFIG_LIBC_LONG_LONG=y
|
||||
CONFIG_LIBC_MAX_EXITFUNS=1
|
||||
CONFIG_LIBC_STRERROR=y
|
||||
CONFIG_MEMSET_64BIT=y
|
||||
CONFIG_MEMSET_OPTSPEED=y
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_MTD=y
|
||||
CONFIG_MTD_BYTE_WRITE=y
|
||||
CONFIG_MTD_PARTITION=y
|
||||
CONFIG_MTD_RAMTRON=y
|
||||
CONFIG_NAME_MAX=40
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_ARGCAT=y
|
||||
@ -110,31 +95,20 @@ CONFIG_NSH_NESTDEPTH=8
|
||||
CONFIG_NSH_QUOTE=y
|
||||
CONFIG_NSH_ROMFSETC=y
|
||||
CONFIG_NSH_ROMFSSECTSIZE=128
|
||||
CONFIG_NSH_STRERROR=y
|
||||
CONFIG_NSH_VARS=y
|
||||
CONFIG_PIPES=y
|
||||
CONFIG_PREALLOC_TIMERS=50
|
||||
CONFIG_PRIORITY_INHERITANCE=y
|
||||
CONFIG_PTHREAD_MUTEX_ROBUST=y
|
||||
CONFIG_PTHREAD_STACK_MIN=512
|
||||
CONFIG_RAMTRON_EMULATE_PAGE_SHIFT=5
|
||||
CONFIG_RAMTRON_EMULATE_SECTOR_SHIFT=5
|
||||
CONFIG_RAMTRON_SETSPEED=y
|
||||
CONFIG_RAM_SIZE=262144
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RTC_DATETIME=y
|
||||
CONFIG_SCHED_HPWORK=y
|
||||
CONFIG_SCHED_HPWORKPRIORITY=254
|
||||
CONFIG_SCHED_HPWORKSTACKSIZE=3000
|
||||
CONFIG_SCHED_INSTRUMENTATION=y
|
||||
CONFIG_SCHED_INSTRUMENTATION_EXTERNAL=y
|
||||
CONFIG_SCHED_INSTRUMENTATION_SWITCH=y
|
||||
CONFIG_SCHED_LPWORK=y
|
||||
CONFIG_SCHED_LPWORKPRIORITY=50
|
||||
CONFIG_SCHED_LPWORKSTACKSIZE=1632
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SEM_PREALLOCHOLDERS=32
|
||||
CONFIG_SERIAL_TERMIOS=y
|
||||
CONFIG_SIG_DEFAULT=y
|
||||
CONFIG_SIG_SIGALRM_ACTION=y
|
||||
@ -155,11 +129,6 @@ CONFIG_STM32_FLOWCONTROL_BROKEN=y
|
||||
CONFIG_STM32_I2C1=y
|
||||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_RTC=y
|
||||
CONFIG_STM32_RTC_HSECLOCK=y
|
||||
CONFIG_STM32_RTC_MAGIC=0xfacefeee
|
||||
CONFIG_STM32_RTC_MAGIC_REG=1
|
||||
CONFIG_STM32_RTC_MAGIC_TIME_SET=0xfacefeef
|
||||
CONFIG_STM32_SERIALBRK_BSDCOMPAT=y
|
||||
CONFIG_STM32_SERIAL_DISABLE_REORDERING=y
|
||||
CONFIG_STM32_SPI1=y
|
||||
|
||||
@ -180,8 +180,7 @@ __EXPORT int board_app_initialize(uintptr_t arg)
|
||||
#endif // FLASH_BASED_PARAMS
|
||||
|
||||
/* Configure the HW based on the manifest */
|
||||
|
||||
px4_platform_configure();
|
||||
//px4_platform_configure();
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -32,11 +32,4 @@ then
|
||||
param set-default SENS_TEMP_ID 3014666
|
||||
fi
|
||||
|
||||
if ver hwtypecmp ARKV6X001000 ARKV6X001001 ARKV6X001002 ARKV6X001003 ARKV6X001004 ARKV6X001005 ARKV6X001006 ARKV6X001007
|
||||
then
|
||||
param set-default SYS_USE_IO 0
|
||||
else
|
||||
param set-default SYS_USE_IO 1
|
||||
fi
|
||||
|
||||
safety_button start
|
||||
|
||||
@ -30,7 +30,7 @@ then
|
||||
|
||||
if [ $HAVE_PM3 = yes ]
|
||||
then
|
||||
ina226 -X -b 3 -t 2 -k start
|
||||
ina226 -X -b 3 -t 3 -k start
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -46,7 +46,7 @@ then
|
||||
|
||||
if [ $HAVE_PM3 = yes ]
|
||||
then
|
||||
ina228 -X -b 3 -t 2 -k start
|
||||
ina228 -X -b 3 -t 3 -k start
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -62,7 +62,7 @@ then
|
||||
|
||||
if [ $HAVE_PM3 = yes ]
|
||||
then
|
||||
ina238 -X -b 3 -t 2 -k start
|
||||
ina238 -X -b 3 -t 3 -k start
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -81,13 +81,16 @@ fi
|
||||
if ver hwtypecmp ARKV6X000001 ARKV6X001001 ARKV6X002001 ARKV6X003001 ARKV6X004001 ARKV6X005001 ARKV6X006001 ARKV6X007001
|
||||
then
|
||||
# Internal SPI bus IIM42653 with SPIX measured frequency of 32.051kHz
|
||||
iim42653 -R 3 -s -b 1 -C 32051 start
|
||||
#iim42653 -R 3 -s -b 1 -C 32051 start
|
||||
iim42653 -R 3 -s -b 1 start
|
||||
|
||||
# Internal SPI bus IIM42653 with SPIX measured frequency of 32.051kHz
|
||||
iim42653 -R 9 -s -b 2 -C 32051 start
|
||||
#iim42653 -R 9 -s -b 2 -C 32051 start
|
||||
iim42653 -R 9 -s -b 2 start
|
||||
|
||||
# Internal SPI bus IIM42653 with SPIX measured frequency of 32.051kHz
|
||||
iim42653 -R 6 -s -b 3 -C 32051 start
|
||||
#iim42653 -R 6 -s -b 3 -C 32051 start
|
||||
iim42653 -R 6 -s -b 3 start
|
||||
fi
|
||||
|
||||
# Internal magnetometer on I2C
|
||||
|
||||
@ -247,7 +247,6 @@
|
||||
/* PWM
|
||||
*/
|
||||
#define DIRECT_PWM_OUTPUT_CHANNELS 8
|
||||
#define BOARD_PWM_FREQ 1024000
|
||||
|
||||
#define GPIO_FMU_CH1 /* PI0 */ (GPIO_INPUT|GPIO_PULLDOWN|GPIO_PORTI|GPIO_PIN0)
|
||||
#define GPIO_FMU_CH2 /* PH12 */ (GPIO_INPUT|GPIO_PULLDOWN|GPIO_PORTH|GPIO_PIN12)
|
||||
|
||||
@ -82,9 +82,7 @@
|
||||
#define rDMAR(_tmr) REG(_tmr, STM32_GTIM_DMAR_OFFSET)
|
||||
#define rBDTR(_tmr) REG(_tmr, STM32_ATIM_BDTR_OFFSET)
|
||||
|
||||
#if !defined(BOARD_PWM_FREQ)
|
||||
#define BOARD_PWM_FREQ 1000000
|
||||
#endif
|
||||
#define BOARD_SPIX_SYNC_PWM_FREQ 1024000
|
||||
|
||||
unsigned
|
||||
spix_sync_timer_get_period(unsigned timer)
|
||||
@ -129,11 +127,11 @@ static void spix_sync_timer_init_timer(unsigned timer, unsigned rate)
|
||||
* Otherwise, other frequencies are attainable by adjusting .clock_freq accordingly.
|
||||
*/
|
||||
|
||||
rPSC(timer) = (spix_sync_timers[timer].clock_freq / BOARD_PWM_FREQ) - 1;
|
||||
rPSC(timer) = (spix_sync_timers[timer].clock_freq / BOARD_SPIX_SYNC_PWM_FREQ) - 1;
|
||||
|
||||
/* configure the timer to update at the desired rate */
|
||||
|
||||
rARR(timer) = (BOARD_PWM_FREQ / rate) - 1;
|
||||
rARR(timer) = (BOARD_SPIX_SYNC_PWM_FREQ / rate) - 1;
|
||||
|
||||
/* generate an update event; reloads the counter and all registers */
|
||||
rEGR(timer) = GTIM_EGR_UG;
|
||||
|
||||
@ -15,8 +15,8 @@ CONFIG_DRIVERS_CAMERA_TRIGGER=y
|
||||
CONFIG_COMMON_DIFFERENTIAL_PRESSURE=y
|
||||
CONFIG_COMMON_DISTANCE_SENSOR=y
|
||||
CONFIG_DRIVERS_GPS=y
|
||||
CONFIG_DRIVERS_IMU_ADIS16477=y
|
||||
CONFIG_DRIVERS_IMU_ADIS16497=y
|
||||
CONFIG_DRIVERS_IMU_ANALOG_DEVICES_ADIS16477=y
|
||||
CONFIG_DRIVERS_IMU_ANALOG_DEVICES_ADIS16497=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM20948=y
|
||||
CONFIG_DRIVERS_IRLOCK=y
|
||||
CONFIG_COMMON_LIGHT=y
|
||||
|
||||
@ -14,6 +14,4 @@ param set-default SENS_EN_THERMAL 0
|
||||
|
||||
param set-default -s SENS_TEMP_ID 2621474
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
set IOFW "/etc/extras/cubepilot_io-v2_default.bin"
|
||||
|
||||
@ -14,6 +14,4 @@ param set-default SENS_EN_THERMAL 0
|
||||
|
||||
param set-default -s SENS_TEMP_ID 2621474
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
set IOFW "/etc/extras/cubepilot_io-v2_default.bin"
|
||||
|
||||
@ -13,6 +13,4 @@ param set-default BAT2_A_PER_V 17
|
||||
# Disable IMU thermal control
|
||||
param set-default SENS_EN_THERMAL 0
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
set IOFW "/etc/extras/cubepilot_io-v2_default.bin"
|
||||
|
||||
@ -11,5 +11,3 @@ param set-default BAT2_A_PER_V 36.367515152
|
||||
|
||||
# Enable IMU thermal control
|
||||
param set-default SENS_EN_THERMAL 1
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
@ -14,7 +14,7 @@ CONFIG_COMMON_DISTANCE_SENSOR=y
|
||||
CONFIG_DRIVERS_DSHOT=y
|
||||
CONFIG_DRIVERS_GPS=y
|
||||
CONFIG_DRIVERS_IMU_BOSCH_BMI270=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM20689=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM42688P=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_MPU6000=y
|
||||
CONFIG_COMMON_LIGHT=y
|
||||
CONFIG_COMMON_MAGNETOMETER=y
|
||||
|
||||
@ -8,7 +8,7 @@ board_adc start
|
||||
# but there might also be an MPU6000
|
||||
if ! mpu6000 -R 6 -s start
|
||||
then
|
||||
icm20689 -R 6 -s start
|
||||
icm42688p -R 6 -s start
|
||||
fi
|
||||
|
||||
bmp280 -X start
|
||||
|
||||
@ -14,7 +14,7 @@ CONFIG_COMMON_DISTANCE_SENSOR=y
|
||||
CONFIG_DRIVERS_DSHOT=y
|
||||
CONFIG_DRIVERS_GPS=y
|
||||
CONFIG_DRIVERS_IMU_BOSCH_BMI270=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_MPU6000=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM42688P=y
|
||||
CONFIG_COMMON_LIGHT=y
|
||||
CONFIG_COMMON_MAGNETOMETER=y
|
||||
CONFIG_COMMON_OPTICAL_FLOW=y
|
||||
|
||||
@ -4,6 +4,9 @@
|
||||
#------------------------------------------------------------------------------
|
||||
board_adc start
|
||||
|
||||
bmi270 -R 6 -s start
|
||||
if ! bmi270 -s -q start
|
||||
then
|
||||
icm42688p -R 0 -s start
|
||||
fi
|
||||
|
||||
bmp280 -X start
|
||||
|
||||
@ -14,7 +14,7 @@ CONFIG_COMMON_DISTANCE_SENSOR=y
|
||||
CONFIG_DRIVERS_DSHOT=y
|
||||
CONFIG_DRIVERS_GPS=y
|
||||
CONFIG_DRIVERS_IMU_BOSCH_BMI270=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM20689=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM42688P=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_MPU6000=y
|
||||
CONFIG_COMMON_LIGHT=y
|
||||
CONFIG_COMMON_MAGNETOMETER=y
|
||||
|
||||
@ -4,6 +4,9 @@
|
||||
#------------------------------------------------------------------------------
|
||||
board_adc start
|
||||
|
||||
bmi270 -s start
|
||||
if ! bmi270 -s -q start
|
||||
then
|
||||
icm42688p -R 0 -s start
|
||||
fi
|
||||
|
||||
bmp280 -X start
|
||||
|
||||
@ -9,7 +9,5 @@ param set-default BAT2_V_DIV 18.1
|
||||
param set-default BAT1_A_PER_V 36.367515152
|
||||
param set-default BAT2_A_PER_V 36.367515152
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
rgbled_pwm start
|
||||
safety_button start
|
||||
|
||||
@ -5,5 +5,3 @@
|
||||
|
||||
param set-default BAT1_V_DIV 10.177939394
|
||||
param set-default BAT1_A_PER_V 15.391030303
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
@ -5,5 +5,3 @@
|
||||
|
||||
param set-default BAT1_V_DIV 10.177939394
|
||||
param set-default BAT1_A_PER_V 15.391030303
|
||||
|
||||
param set-default SYS_USE_IO 1
|
||||
|
||||
@ -15,9 +15,9 @@ CONFIG_COMMON_DIFFERENTIAL_PRESSURE=y
|
||||
CONFIG_COMMON_DISTANCE_SENSOR=y
|
||||
CONFIG_DRIVERS_DISTANCE_SENSOR_SRF05=y
|
||||
CONFIG_DRIVERS_GPS=y
|
||||
CONFIG_DRIVERS_IMU_FXAS21002C=y
|
||||
CONFIG_DRIVERS_IMU_FXOS8701CQ=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM20948=y
|
||||
CONFIG_DRIVERS_IMU_NXP_FXAS21002C=y
|
||||
CONFIG_DRIVERS_IMU_NXP_FXOS8701CQ=y
|
||||
CONFIG_DRIVERS_IRLOCK=y
|
||||
CONFIG_DRIVERS_LIGHTS_RGBLED=y
|
||||
CONFIG_DRIVERS_LIGHTS_RGBLED_NCP5623C=y
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# board specific defaults
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
param set-default BAT1_V_DIV 10.1097
|
||||
param set-default BAT1_A_PER_V 15.391030303
|
||||
|
||||
rgbled_pwm start
|
||||
safety_button start
|
||||
@ -1,34 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# PX4 FMUv5 specific board sensors init
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# UART mapping on NXP FMURT1062:
|
||||
#
|
||||
# LPUART7 /dev/ttyS0 CONSOLE
|
||||
# LPUART2 /dev/ttyS1 GPS
|
||||
# LPUART3 /dev/ttyS2 TELEM2 (GPIO flow control)
|
||||
# LPUART4 /dev/ttyS3 TELEM1 (UART flow control)
|
||||
# LPUART5 /dev/ttyS4 TELEM4 GPS2
|
||||
# LPUART6 /dev/ttyS5 TELEM3 (RC_INPUT)
|
||||
# LPUART8 /dev/ttyS6 PX4IO
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
board_adc start
|
||||
|
||||
# Internal SPI bus ICM-20602
|
||||
icm20602 -R 2 -s start
|
||||
|
||||
# Internal SPI bus ICM-20689
|
||||
icm20689 -R 2 -s start
|
||||
|
||||
# Internal SPI bus BMI055 accel/gyro
|
||||
bmi055 -A -R 2 -s start
|
||||
bmi055 -G -R 2 -s start
|
||||
|
||||
# internal compass
|
||||
ist8310 -I -R 10 start
|
||||
|
||||
# Baro on internal SPI
|
||||
ms5611 -s start
|
||||
@ -1,400 +0,0 @@
|
||||
/************************************************************************************
|
||||
* nuttx-configs/nxp_fmurt1062-v1/include/board.h
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __NUTTX_CONFIG_NXP_FMURT1062_V1_INCLUDE_BOARD_H
|
||||
#define __NUTTX_CONFIG_NXP_FMURT1062_V1_INCLUDE_BOARD_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Clocking *************************************************************************/
|
||||
|
||||
/* Set VDD_SOC to 1.3V */
|
||||
|
||||
#define IMXRT_VDD_SOC (0x14)
|
||||
|
||||
/* Set Arm PLL (PLL1) to fOut = (24Mhz * ARM_PLL_DIV_SELECT/2) / ARM_PODF_DIVISOR
|
||||
* 576Mhz = (24Mhz * ARM_PLL_DIV_SELECT/2) / ARM_PODF_DIVISOR
|
||||
* ARM_PLL_DIV_SELECT = 96
|
||||
* ARM_PODF_DIVISOR = 2
|
||||
* 576Mhz = (24Mhz * 96/2) / 2
|
||||
*
|
||||
* AHB_CLOCK_ROOT = PLL1fOut / IMXRT_AHB_PODF_DIVIDER
|
||||
* 1Hz to 600 Mhz = 576Mhz / IMXRT_ARM_CLOCK_DIVIDER
|
||||
* IMXRT_ARM_CLOCK_DIVIDER = 1
|
||||
* 576Mhz = 576Mhz / 1
|
||||
*
|
||||
* PRE_PERIPH_CLK_SEL = PRE_PERIPH_CLK_SEL_PLL1
|
||||
* PERIPH_CLK_SEL = 1 (0 select PERIPH_CLK2_PODF, 1 select PRE_PERIPH_CLK_SEL_PLL1)
|
||||
* PERIPH_CLK = 576Mhz
|
||||
*
|
||||
* IPG_CLOCK_ROOT = AHB_CLOCK_ROOT / IMXRT_IPG_PODF_DIVIDER
|
||||
* IMXRT_IPG_PODF_DIVIDER = 4
|
||||
* 144Mhz = 576Mhz / 4
|
||||
*
|
||||
* PRECLK_CLOCK_ROOT = IPG_CLOCK_ROOT / IMXRT_PERCLK_PODF_DIVIDER
|
||||
* IMXRT_PERCLK_PODF_DIVIDER = 1
|
||||
* 16Mhz = 144Mhz / 9
|
||||
*
|
||||
* SEMC_CLK_ROOT = 576Mhz / IMXRT_SEMC_PODF_DIVIDER (labeled AIX_PODF in 18.2)
|
||||
* IMXRT_SEMC_PODF_DIVIDER = 8
|
||||
* 72Mhz = 576Mhz / 8
|
||||
*
|
||||
* Set Sys PLL (PLL2) to fOut = (24Mhz * (20+(2*(DIV_SELECT)))
|
||||
* 528Mhz = (24Mhz * (20+(2*(1)))
|
||||
*
|
||||
* Set USB1 PLL (PLL3) to fOut = (24Mhz * 20)
|
||||
* 480Mhz = (24Mhz * 20)
|
||||
*
|
||||
* Set LPSPI PLL3 PFD0 to fOut = (480Mhz / 12 * 18)
|
||||
* 720Mhz = (480Mhz / 12 * 18)
|
||||
* 90Mhz = (720Mhz / LSPI_PODF_DIVIDER)
|
||||
*
|
||||
* Set LPI2C PLL3 / 8 to fOut = (480Mhz / 8)
|
||||
* 60Mhz = (480Mhz / 8)
|
||||
* 12Mhz = (60Mhz / LSPI_PODF_DIVIDER)
|
||||
*
|
||||
* Set USDHC1 PLL2 PFD2 to fOut = (528Mhz / 24 * 18)
|
||||
* 396Mhz = (528Mhz / 24 * 18)
|
||||
* 198Mhz = (396Mhz / IMXRT_USDHC1_PODF_DIVIDER)
|
||||
*/
|
||||
|
||||
#define BOARD_XTAL_FREQUENCY 24000000
|
||||
#define IMXRT_PRE_PERIPH_CLK_SEL CCM_CBCMR_PRE_PERIPH_CLK_SEL_PLL1
|
||||
#define IMXRT_PERIPH_CLK_SEL CCM_CBCDR_PERIPH_CLK_SEL_PRE_PERIPH
|
||||
#define IMXRT_ARM_PLL_DIV_SELECT 96
|
||||
#define IMXRT_ARM_PODF_DIVIDER 2
|
||||
#define IMXRT_AHB_PODF_DIVIDER 1
|
||||
#define IMXRT_IPG_PODF_DIVIDER 4
|
||||
#define IMXRT_PERCLK_CLK_SEL CCM_CSCMR1_PERCLK_CLK_SEL_IPG_CLK_ROOT
|
||||
#define IMXRT_PERCLK_PODF_DIVIDER 9
|
||||
#define IMXRT_SEMC_PODF_DIVIDER 8
|
||||
|
||||
#define IMXRT_LPSPI_CLK_SELECT CCM_CBCMR_LPSPI_CLK_SEL_PLL3_PFD0
|
||||
#define IMXRT_LSPI_PODF_DIVIDER 8
|
||||
|
||||
#define IMXRT_LPI2C_CLK_SELECT CCM_CSCDR2_LPI2C_CLK_SEL_PLL3_60M
|
||||
#define IMXRT_LSI2C_PODF_DIVIDER 5
|
||||
|
||||
#define IMXRT_USDHC1_CLK_SELECT CCM_CSCMR1_USDHC1_CLK_SEL_PLL2_PFD0
|
||||
#define IMXRT_USDHC1_PODF_DIVIDER 2
|
||||
|
||||
#define IMXRT_USB1_PLL_DIV_SELECT CCM_ANALOG_PLL_USB1_DIV_SELECT_20
|
||||
|
||||
#define IMXRT_SYS_PLL_SELECT CCM_ANALOG_PLL_SYS_DIV_SELECT_22
|
||||
|
||||
#define IMXRT_USB1_PLL_DIV_SELECT CCM_ANALOG_PLL_USB1_DIV_SELECT_20
|
||||
|
||||
#define BOARD_CPU_FREQUENCY \
|
||||
(BOARD_XTAL_FREQUENCY * (IMXRT_ARM_PLL_DIV_SELECT / 2)) / IMXRT_ARM_PODF_DIVIDER
|
||||
|
||||
#define BOARD_GPT_FREQUENCY \
|
||||
(BOARD_CPU_FREQUENCY / IMXRT_IPG_PODF_DIVIDER) / IMXRT_PERCLK_PODF_DIVIDER
|
||||
|
||||
/* Define this to enable tracing */
|
||||
#if CONFIG_USE_TRACE
|
||||
# define IMXRT_TRACE_PODF_DIVIDER 1
|
||||
# define IMXRT_TRACE_CLK_SELECT CCM_CBCMR_TRACE_CLK_SEL_PLL2_PFD0
|
||||
#endif
|
||||
|
||||
/* SDIO *****************************************************************************/
|
||||
|
||||
/* Pin drive characteristics */
|
||||
|
||||
#define USDHC1_DATAX_IOMUX (IOMUX_SLEW_FAST | IOMUX_DRIVE_130OHM | IOMUX_PULL_UP_47K | IOMUX_SCHMITT_TRIGGER)
|
||||
#define USDHC1_CMD_IOMUX (IOMUX_SLEW_FAST | IOMUX_DRIVE_130OHM | IOMUX_PULL_UP_47K | IOMUX_SCHMITT_TRIGGER)
|
||||
#define USDHC1_CLK_IOMUX (IOMUX_SLEW_FAST | IOMUX_DRIVE_130OHM | IOMUX_SPEED_MAX)
|
||||
#define USDHC1_CD_IOMUX (IOMUX_PULL_UP_47K | IOMUX_SCHMITT_TRIGGER)
|
||||
|
||||
#define PIN_USDHC1_D0 (GPIO_USDHC1_DATA0_1 | USDHC1_DATAX_IOMUX) /* GPIO_SD_B0_02 */
|
||||
#define PIN_USDHC1_D1 (GPIO_USDHC1_DATA1_1 | USDHC1_DATAX_IOMUX) /* GPIO_SD_B0_03 */
|
||||
#define PIN_USDHC1_D2 (GPIO_USDHC1_DATA2_1 | USDHC1_DATAX_IOMUX) /* GPIO_SD_B0_04 */
|
||||
#define PIN_USDHC1_D3 (GPIO_USDHC1_DATA3_1 | USDHC1_DATAX_IOMUX) /* GPIO_SD_B0_05 */
|
||||
#define PIN_USDHC1_DCLK (GPIO_USDHC1_CLK_1 | USDHC1_CLK_IOMUX) /* GPIO_SD_B0_01 */
|
||||
#define PIN_USDHC1_CMD (GPIO_USDHC1_CMD_1 | USDHC1_CMD_IOMUX) /* GPIO_SD_B0_00 */
|
||||
#define PIN_USDHC1_CD (GPIO_USDHC1_CD_2 | USDHC1_CD_IOMUX) /* GPIO_B1_12 */
|
||||
|
||||
/* Ideal 400Khz for initial inquiry.
|
||||
* Given input clock 198 Mhz.
|
||||
* 386.71875 KHz = 198 Mhz / (256 * 2)
|
||||
*/
|
||||
|
||||
#define BOARD_USDHC_IDMODE_PRESCALER USDHC_SYSCTL_SDCLKFS_DIV256
|
||||
#define BOARD_USDHC_IDMODE_DIVISOR USDHC_SYSCTL_DVS_DIV(2)
|
||||
|
||||
/* Ideal 25 Mhz for other modes
|
||||
* Given input clock 198 Mhz.
|
||||
* 24.75 MHz = 198 Mhz / (8 * 1)
|
||||
*/
|
||||
|
||||
#define BOARD_USDHC_MMCMODE_PRESCALER USDHC_SYSCTL_SDCLKFS_DIV8
|
||||
#define BOARD_USDHC_MMCMODE_DIVISOR USDHC_SYSCTL_DVS_DIV(1)
|
||||
|
||||
#define BOARD_USDHC_SD1MODE_PRESCALER USDHC_SYSCTL_SDCLKFS_DIV8
|
||||
#define BOARD_USDHC_SD1MODE_DIVISOR USDHC_SYSCTL_DVS_DIV(1)
|
||||
|
||||
#define BOARD_USDHC_SD4MODE_PRESCALER USDHC_SYSCTL_SDCLKFS_DIV8
|
||||
#define BOARD_USDHC_SD4MODE_DIVISOR USDHC_SYSCTL_DVS_DIV(1)
|
||||
|
||||
/* LED definitions ******************************************************************/
|
||||
/* The nxp fmutr1062 board has numerous LEDs but only three, LED_GREEN a Green LED,
|
||||
* LED_BLUE a Blue LED and LED_RED a Red LED, that can be controlled by software.
|
||||
*
|
||||
* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in any way.
|
||||
* The following definitions are used to access individual LEDs.
|
||||
*/
|
||||
|
||||
/* LED index values for use with board_userled() */
|
||||
|
||||
#define BOARD_LED1 0
|
||||
#define BOARD_LED2 1
|
||||
#define BOARD_LED3 2
|
||||
#define BOARD_NLEDS 3
|
||||
|
||||
#define BOARD_LED_RED BOARD_LED1
|
||||
#define BOARD_LED_GREEN BOARD_LED2
|
||||
#define BOARD_LED_BLUE BOARD_LED3
|
||||
|
||||
/* LED bits for use with board_userled_all() */
|
||||
|
||||
#define BOARD_LED1_BIT (1 << BOARD_LED1)
|
||||
#define BOARD_LED2_BIT (1 << BOARD_LED2)
|
||||
#define BOARD_LED3_BIT (1 << BOARD_LED3)
|
||||
|
||||
/* If CONFIG_ARCH_LEDS is defined, the usage by the board port is defined in
|
||||
* include/board.h and src/stm32_leds.c. The LEDs are used to encode OS-related
|
||||
* events as follows:
|
||||
*
|
||||
*
|
||||
* SYMBOL Meaning LED state
|
||||
* Red Green Blue
|
||||
* ---------------------- -------------------------- ------ ------ ----*/
|
||||
|
||||
#define LED_STARTED 0 /* NuttX has been started OFF OFF OFF */
|
||||
#define LED_HEAPALLOCATE 1 /* Heap has been allocated OFF OFF ON */
|
||||
#define LED_IRQSENABLED 2 /* Interrupts enabled OFF ON OFF */
|
||||
#define LED_STACKCREATED 3 /* Idle stack created OFF ON ON */
|
||||
#define LED_INIRQ 4 /* In an interrupt N/C N/C GLOW */
|
||||
#define LED_SIGNAL 5 /* In a signal handler N/C GLOW N/C */
|
||||
#define LED_ASSERTION 6 /* An assertion failed GLOW N/C GLOW */
|
||||
#define LED_PANIC 7 /* The system has crashed Blink OFF N/C */
|
||||
#define LED_IDLE 8 /* MCU is is sleep mode ON OFF OFF */
|
||||
|
||||
/* Thus if the Green LED is statically on, NuttX has successfully booted and
|
||||
* is, apparently, running normally. If the Red LED is flashing at
|
||||
* approximately 2Hz, then a fatal error has been detected and the system
|
||||
* has halted.
|
||||
*/
|
||||
|
||||
/* PIO Disambiguation ***************************************************************/
|
||||
/* LPUARTs
|
||||
*/
|
||||
#define LPUART_IOMUX (IOMUX_PULL_UP_22K | IOMUX_DRIVE_40OHM | IOMUX_SLEW_SLOW | IOMUX_SPEED_LOW | IOMUX_SCHMITT_TRIGGER)
|
||||
|
||||
/* GPS 1 */
|
||||
|
||||
#define GPIO_LPUART2_RX (GPIO_LPUART2_RX_1 | LPUART_IOMUX) /* EVK J22-8 */ /* GPIO_AD_B1_03 */
|
||||
#define GPIO_LPUART2_TX (GPIO_LPUART2_TX_1 | LPUART_IOMUX) /* EVK J22-7 */ /* GPIO_AD_B1_02 */
|
||||
|
||||
/* N.B. Rev B schematic did not change the names of the nets. Just the silk screen renamed the ports
|
||||
* Such that Telem 2 had the real HW HS signals. The imx driver to dated does not support GOIO controlled
|
||||
* HS lines
|
||||
*/
|
||||
|
||||
/* Telem 1 */
|
||||
|
||||
#define HS_INPUT_IOMUX (IOMUX_CMOS_INPUT | IOMUX_SLEW_SLOW | IOMUX_DRIVE_HIZ | IOMUX_SPEED_MEDIUM | IOMUX_PULL_UP_47K)
|
||||
#define HS_OUTPUT_IOMUX (IOMUX_CMOS_OUTPUT | IOMUX_SLEW_FAST | IOMUX_DRIVE_33OHM | IOMUX_SPEED_MEDIUM | IOMUX_PULL_KEEP)
|
||||
|
||||
#define GPIO_LPUART3_RX (GPIO_LPUART3_RX_3 | LPUART_IOMUX) /* GPIO_B0_09 */
|
||||
#define GPIO_LPUART3_TX (GPIO_LPUART3_TX_3 | LPUART_IOMUX) /* GPIO_B0_08 */
|
||||
#define GPIO_LPUART3_CTS (GPIO_PORT3 | GPIO_PIN4 | GPIO_INPUT | HS_INPUT_IOMUX) /* GPIO_SD_B1_04 GPIO3_IO04 (GPIO only, no HW Flow control) */
|
||||
#define GPIO_LPUART3_RTS (GPIO_PORT4 | GPIO_PIN24 | GPIO_OUTPUT | GPIO_OUTPUT_ZERO | HS_OUTPUT_IOMUX) /* GPIO_EMC_24 GPIO4_IO24 (GPIO only, no HW Flow control) */
|
||||
|
||||
/* Telem 2 */
|
||||
|
||||
#define GPIO_LPUART4_RX (GPIO_LPUART4_RX_2 | LPUART_IOMUX) /* GPIO_EMC_20 */
|
||||
#define GPIO_LPUART4_TX (GPIO_LPUART4_TX_2 | LPUART_IOMUX) /* GPIO_EMC_19 */
|
||||
#define GPIO_LPUART4_CTS (GPIO_LPUART4_CTS_1 | LPUART_IOMUX) /* GPIO_EMC_17 */
|
||||
#define GPIO_LPUART4_RTS (GPIO_LPUART4_RTS_1 | LPUART_IOMUX) /* GPIO_EMC_18 */
|
||||
|
||||
/* GPS2 */
|
||||
|
||||
#define GPIO_LPUART5_RX (GPIO_LPUART5_RX_1 | LPUART_IOMUX) /* GPIO_B1_13 */
|
||||
#define GPIO_LPUART5_TX (GPIO_LPUART5_TX_2 | LPUART_IOMUX) /* GPIO_EMC_23 */
|
||||
|
||||
/* RC INPUT single wire mode on TX, RX is not used */
|
||||
|
||||
#define GPIO_LPUART6_RX (GPIO_LPUART6_RX_2 | LPUART_IOMUX) /* GPIO_EMC_26 */
|
||||
#define GPIO_LPUART6_TX (GPIO_LPUART6_TX_2 | LPUART_IOMUX) /* GPIO_EMC_25 */
|
||||
|
||||
#define GPIO_LPUART7_RX (GPIO_LPUART7_RX_1 | LPUART_IOMUX) /* GPIO_EMC_32 */
|
||||
#define GPIO_LPUART7_TX (GPIO_LPUART7_TX_1 | LPUART_IOMUX) /* GPIO_EMC_31 */
|
||||
|
||||
#define GPIO_LPUART8_RX (GPIO_LPUART8_RX_2 | LPUART_IOMUX) /* GPIO_EMC_39 */
|
||||
#define GPIO_LPUART8_TX (GPIO_LPUART8_TX_2 | LPUART_IOMUX) /* GPIO_EMC_38 */
|
||||
|
||||
/* CAN
|
||||
*
|
||||
* CAN1 is routed to transceiver.
|
||||
* CAN2 is routed to transceiver.
|
||||
* CAN3 is routed to transceiver.
|
||||
*/
|
||||
#define FLEXCAN_IOMUX (IOMUX_PULL_UP_100K | IOMUX_DRIVE_40OHM | IOMUX_SLEW_FAST | IOMUX_SPEED_MEDIUM)
|
||||
|
||||
#define GPIO_FLEXCAN1_RX (GPIO_FLEXCAN1_RX_2 | FLEXCAN_IOMUX) /* GPIO_B0_03 */
|
||||
#define GPIO_FLEXCAN1_TX (GPIO_FLEXCAN1_TX_4 | FLEXCAN_IOMUX) /* GPIO_SD_B1_02 */
|
||||
#define GPIO_FLEXCAN2_RX (GPIO_FLEXCAN2_RX_1 | FLEXCAN_IOMUX) /* GPIO_AD_B0_03 */
|
||||
#define GPIO_FLEXCAN2_TX (GPIO_FLEXCAN2_TX_1 | FLEXCAN_IOMUX) /* GPIO_AD_B0_02 */
|
||||
#define GPIO_FLEXCAN3_RX (GPIO_FLEXCAN3_RX_1 | FLEXCAN_IOMUX) /* GPIO_AD_B0_11 */
|
||||
#define GPIO_FLEXCAN3_TX (GPIO_FLEXCAN3_TX_3 | FLEXCAN_IOMUX) /* GPIO_EMC_36 */
|
||||
|
||||
/* LPSPI */
|
||||
#define LPSPI_IOMUX (IOMUX_PULL_UP_100K | IOMUX_DRIVE_33OHM | IOMUX_SLEW_FAST | IOMUX_SPEED_MAX)
|
||||
|
||||
#define GPIO_LPSPI1_SCK (GPIO_LPSPI1_SCK_1 | LPSPI_IOMUX) /* GPIO_EMC_27 */
|
||||
#define GPIO_LPSPI1_MISO (GPIO_LPSPI1_SDI_1 | LPSPI_IOMUX) /* GPIO_EMC_29 */
|
||||
#define GPIO_LPSPI1_MOSI (GPIO_LPSPI1_SDO_1 | LPSPI_IOMUX) /* GPIO_EMC_28 */
|
||||
|
||||
#define GPIO_LPSPI2_SCK (GPIO_LPSPI2_SCK_1 | LPSPI_IOMUX) /* GPIO_EMC_00 */
|
||||
#define GPIO_LPSPI2_MISO (GPIO_LPSPI2_SDI_1 | LPSPI_IOMUX) /* GPIO_EMC_03 */
|
||||
#define GPIO_LPSPI2_MOSI (GPIO_LPSPI2_SDO_1 | LPSPI_IOMUX) /* GPIO_EMC_02 */
|
||||
|
||||
#define GPIO_LPSPI3_SCK (GPIO_LPSPI3_SCK_1 | LPSPI_IOMUX) /* GPIO_AD_B1_15 */
|
||||
#define GPIO_LPSPI3_MISO (GPIO_LPSPI3_SDI_1 | LPSPI_IOMUX) /* GPIO_AD_B1_13 */
|
||||
#define GPIO_LPSPI3_MOSI (GPIO_LPSPI3_SDO_1 | LPSPI_IOMUX) /* GPIO_AD_B1_14 */
|
||||
|
||||
#define GPIO_LPSPI4_SCK (GPIO_LPSPI4_SCK_1 | LPSPI_IOMUX) /* GPIO_B1_07 */
|
||||
#define GPIO_LPSPI4_MISO (GPIO_LPSPI4_SDI_1 | LPSPI_IOMUX) /* GPIO_B1_05 */
|
||||
#define GPIO_LPSPI4_MOSI (GPIO_LPSPI4_SDO_2 | LPSPI_IOMUX) /* GPIO_B0_02 */
|
||||
|
||||
/* LPI2Cs */
|
||||
|
||||
#define LPI2C_IOMUX (IOMUX_SPEED_MEDIUM | IOMUX_DRIVE_33OHM | IOMUX_OPENDRAIN | GPIO_SION_ENABLE)
|
||||
#define LPI2C_IO_IOMUX (IOMUX_SPEED_MAX | IOMUX_SLEW_FAST | IOMUX_DRIVE_33OHM | IOMUX_OPENDRAIN | IOMUX_PULL_NONE)
|
||||
|
||||
#define GPIO_LPI2C1_SDA (GPIO_LPI2C1_SDA_2 | LPI2C_IOMUX) /* EVK J24-9 R276 */ /* GPIO_AD_B1_01 */
|
||||
#define GPIO_LPI2C1_SCL (GPIO_LPI2C1_SCL_2 | LPI2C_IOMUX) /* EVK J24-10 R277 */ /* GPIO_AD_B1_00 */
|
||||
|
||||
#define GPIO_LPI2C1_SDA_RESET (GPIO_PORT1 | GPIO_PIN17 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | LPI2C_IO_IOMUX) /* GPIO_AD_B1_01 GPIO1_IO17 */
|
||||
#define GPIO_LPI2C1_SCL_RESET (GPIO_PORT1 | GPIO_PIN16 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | LPI2C_IO_IOMUX) /* GPIO_AD_B1_00 GPIO1_IO16 */
|
||||
|
||||
#define GPIO_LPI2C2_SDA (GPIO_LPI2C2_SDA_1 | LPI2C_IOMUX) /* EVK J8-A25 */ /* GPIO_B0_05 */
|
||||
#define GPIO_LPI2C2_SCL (GPIO_LPI2C2_SCL_1 | LPI2C_IOMUX) /* EVK J8-A24 */ /* GPIO_B0_04 */
|
||||
|
||||
#define GPIO_LPI2C2_SDA_RESET (GPIO_PORT2 | GPIO_PIN5 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | LPI2C_IO_IOMUX) /* GPIO_B0_05 GPIO2_IO5 */
|
||||
#define GPIO_LPI2C2_SCL_RESET (GPIO_PORT2 | GPIO_PIN4 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | LPI2C_IO_IOMUX) /* GPIO_B0_04 GPIO2_IO4 */
|
||||
|
||||
#define GPIO_LPI2C3_SDA (GPIO_LPI2C3_SDA_2 | LPI2C_IOMUX) /* GPIO_EMC_21 */
|
||||
#define GPIO_LPI2C3_SCL (GPIO_LPI2C3_SCL_2 | LPI2C_IOMUX) /* GPIO_EMC_22 */
|
||||
|
||||
#define GPIO_LPI2C3_SDA_RESET (GPIO_PORT4 | GPIO_PIN21 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | LPI2C_IO_IOMUX) /* GPIO_EMC_21 GPIO4_IO21 */
|
||||
#define GPIO_LPI2C3_SCL_RESET (GPIO_PORT4 | GPIO_PIN22 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | LPI2C_IO_IOMUX) /* GPIO_EMC_22 GPIO4_IO22 */
|
||||
|
||||
/* Board provides GPIO or other Hardware for signaling to timing analyzer */
|
||||
|
||||
#if defined(CONFIG_BOARD_USE_PROBES)
|
||||
#include <imxrt_gpio.h>
|
||||
#include <imxrt_iomuxc.h>
|
||||
// add -I<full path> build/nxp_fmurt1062-v1_default/NuttX/nuttx/arch/arm/src/chip \ to NuttX Makedefs.in
|
||||
#define PROBE_IOMUX (IOMUX_SPEED_MAX | IOMUX_SLEW_FAST | IOMUX_DRIVE_33OHM | IOMUX_CMOS_OUTPUT | IOMUX_PULL_NONE)
|
||||
# define PROBE_N(n) (1<<((n)-1))
|
||||
# define PROBE_1 /* GPIO_B0_06 */ (GPIO_PORT2 | GPIO_PIN6 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | PROBE_IOMUX)
|
||||
# define PROBE_2 /* GPIO_EMC_08 */ (GPIO_PORT4 | GPIO_PIN8 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | PROBE_IOMUX)
|
||||
# define PROBE_3 /* GPIO_EMC_10 */ (GPIO_PORT4 | GPIO_PIN10 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | PROBE_IOMUX)
|
||||
# define PROBE_4 /* GPIO_AD_B0_09 */ (GPIO_PORT1 | GPIO_PIN9 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | PROBE_IOMUX)
|
||||
# define PROBE_5 /* GPIO_EMC_33 */ (GPIO_PORT3 | GPIO_PIN19 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | PROBE_IOMUX)
|
||||
# define PROBE_6 /* GPIO_EMC_30 */ (GPIO_PORT4 | GPIO_PIN30 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | PROBE_IOMUX)
|
||||
# define PROBE_7 /* GPIO_EMC_04 */ (GPIO_PORT4 | GPIO_PIN4 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | PROBE_IOMUX)
|
||||
# define PROBE_8 /* GPIO_EMC_01 */ (GPIO_PORT4 | GPIO_PIN1 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | PROBE_IOMUX)
|
||||
|
||||
# define PROBE_INIT(mask) \
|
||||
do { \
|
||||
if ((mask)& PROBE_N(1)) { imxrt_config_gpio(PROBE_1); } \
|
||||
if ((mask)& PROBE_N(2)) { imxrt_config_gpio(PROBE_2); } \
|
||||
if ((mask)& PROBE_N(3)) { imxrt_config_gpio(PROBE_3); } \
|
||||
if ((mask)& PROBE_N(4)) { imxrt_config_gpio(PROBE_4); } \
|
||||
if ((mask)& PROBE_N(5)) { imxrt_config_gpio(PROBE_5); } \
|
||||
if ((mask)& PROBE_N(6)) { imxrt_config_gpio(PROBE_6); } \
|
||||
if ((mask)& PROBE_N(7)) { imxrt_config_gpio(PROBE_7); } \
|
||||
if ((mask)& PROBE_N(8)) { imxrt_config_gpio(PROBE_8); } \
|
||||
} while(0)
|
||||
|
||||
# define PROBE(n,s) do {imxrt_gpio_write(PROBE_##n,(s));}while(0)
|
||||
# define PROBE_MARK(n) PROBE(n,false);PROBE(n,true)
|
||||
#else
|
||||
# define PROBE_INIT(mask)
|
||||
# define PROBE(n,s)
|
||||
# define PROBE_MARK(n)
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __NUTTX_CONFIG_NXP_FMURT1062_V1_INCLUDE_BOARD_H */
|
||||
@ -1,299 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/imxrt/imxrt1060-evk/scripts/flash-ocram.ld
|
||||
*
|
||||
* Copyright (C) 2018, 2020 Gregory Nutt. All rights reserved.
|
||||
* Authors: Ivan Ucherdzhiev <ivanucherdjiev@gmail.com>
|
||||
* David Sidrane <david.sidrane@nscdg.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* The FMURT1062 has 8MiB of QSPI FLASH beginning at address,
|
||||
* 0x0060:0000, Up to 512Kb of DTCM RAM beginning at 0x2000:0000, and 1MiB OCRAM
|
||||
* beginning at 0x2020:0000. Neither DTCM or SDRAM are used in this
|
||||
* configuration.
|
||||
*
|
||||
* The default flexram setting on the iMXRT 1062 is
|
||||
* 256Kib to OCRRAM, 128Kib ITCM and 128Kib DTCM.
|
||||
* This can be changed by using a dcd by minipulating
|
||||
* IOMUX GPR16 and GPR17.
|
||||
* The configuration we will use is 384Kib to OCRRAM, 0Kib ITCM and
|
||||
* 128Kib DTCM.
|
||||
*
|
||||
* This is the OCRAM inker script.
|
||||
* The NXP ROM bootloader will move the FLASH image to OCRAM.
|
||||
* We must reserve 32K for the bootloader' OCRAM usage from the OCRAM Size
|
||||
* and an additinal 8K for the ivt_s which is IVT_SIZE(8K) This 40K can be
|
||||
* reused once the application is running.
|
||||
*
|
||||
* 0x2020:A000 to 0x202d:ffff - The application Image's vector table
|
||||
* 0x2020:8000 to 0x2020:A000 - IVT
|
||||
* 0x2020:0000 to 0x2020:7fff - NXP ROM bootloader.
|
||||
*
|
||||
* We artificially split the FLASH to allow locating sections that we do not
|
||||
* want loaded inoto OCRAM. This is to save on OCRAM where the speen of the
|
||||
* code does not matter.
|
||||
*
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
flash (rx) : ORIGIN = 0x60000000, LENGTH = 7M
|
||||
flashxip (rx) : ORIGIN = 0x60700000, LENGTH = 1M
|
||||
/* Vectors @ boot+ivt OCRAM2 Flex RAM Boot IVT */
|
||||
sram (rwx) : ORIGIN = 0x2020A000, LENGTH = 512K + 256K + 128K - (32K + 8K)
|
||||
itcm (rwx) : ORIGIN = 0x00000000, LENGTH = 0K
|
||||
dtcm (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
EXTERN(_vectors)
|
||||
EXTERN(g_flash_config)
|
||||
EXTERN(g_image_vector_table)
|
||||
EXTERN(g_boot_data)
|
||||
EXTERN(g_dcd_data)
|
||||
|
||||
ENTRY(_stext)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/* Image Vector Table and Boot Data for booting from external flash */
|
||||
|
||||
.boot_hdr : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
__boot_hdr_start__ = ABSOLUTE(.) ;
|
||||
KEEP(*(.boot_hdr.conf))
|
||||
. = 0x1000 ;
|
||||
KEEP(*(.boot_hdr.ivt))
|
||||
. = 0x1020 ;
|
||||
KEEP(*(.boot_hdr.boot_data))
|
||||
. = 0x1030 ;
|
||||
KEEP(*(.boot_hdr.dcd_data))
|
||||
__boot_hdr_end__ = ABSOLUTE(.) ;
|
||||
. = 0x2000 ;
|
||||
} > flash
|
||||
|
||||
/* Catch all the section we want not in OCRAM so that the *(.text .text.*) in flash does not */
|
||||
/* Sift and sort with arm-none-eabi-nm -C -S -n build/nxp_fmurt1062-v1_default/nxp_fmurt1062-v1_default.elf > list.txt */
|
||||
|
||||
.flashxip : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
/* Order matters */
|
||||
*(.text.__start)
|
||||
*(.text.imxrt_ocram_initialize)
|
||||
*(.slow_memory)
|
||||
*(.text.romfs*)
|
||||
*(.text.cromfs*)
|
||||
*(.text.mpu*)
|
||||
*(.text.arm_memfault*)
|
||||
*(.text.arm_hardfault*)
|
||||
*(.text.up_assert*)
|
||||
*(.text.up_stackdump*)
|
||||
*(.text.up_taskdump*)
|
||||
*(.text.up_mdelay*)
|
||||
*(.text.up_udelay*)
|
||||
*(.text.board_on_reset*)
|
||||
*(.text.board_spi_reset*)
|
||||
*(.text.board_query_manifest*)
|
||||
*(.text.board_reset*)
|
||||
*(.text.board_get*)
|
||||
*(.text.board_mcu*)
|
||||
*(.text.imxrt_xbar_connect*)
|
||||
*(.text.bson*)
|
||||
*(.text.*print_load*)
|
||||
*(.text.*px4_mft*)
|
||||
*(.text.*px4_mtd*)
|
||||
*(.text.syslog*)
|
||||
*(.text.register_driver*)
|
||||
*(.text.nx_start*)
|
||||
*(.text.nx_bringup*)
|
||||
*(.text.irq_unexpected_isr*)
|
||||
*(.text.group*)
|
||||
*(.text.*setenv*)
|
||||
*(.text.*env*)
|
||||
*(.text.cmd*)
|
||||
*(.text.readline*)
|
||||
*(.text.mkfatfs*)
|
||||
*(.text.builtin*)
|
||||
*(.text.basename*)
|
||||
*(.text.dirname*)
|
||||
*(.text.gmtime_r*)
|
||||
*(.text.chdir*)
|
||||
*(.text.devnull*)
|
||||
*(.text.ramdisk*)
|
||||
*(.text.files*)
|
||||
*(.text.unregister_driver*)
|
||||
*(.text.register_blockdriver*)
|
||||
*(.text.bchdev_register*)
|
||||
*(.text.part*)
|
||||
*(.text.ftl*)
|
||||
*(.text.*I2CBusIterator*)
|
||||
*(.text.*SPIBusIterator*)
|
||||
*(.text.*BusCLIArguments*)
|
||||
*(.text.*WorkQueueManager*)
|
||||
*(.text.*param_export*)
|
||||
*(.text.*param_import*)
|
||||
*(.text.*param_load*)
|
||||
*(.text.*BusInstanceIterator*)
|
||||
*(.text.*PRINT_MODULE_USAGE*)
|
||||
*(.text.*px4_getopt*)
|
||||
*(.text.*main*)
|
||||
*(.text.*instantiate*)
|
||||
*(.text.*ADC*)
|
||||
*(.text.*MS5611*)
|
||||
*(.text.*I2CSPIDriver*)
|
||||
*(.text.*CameraCapture*)
|
||||
*(.text.*i2cdetect*)
|
||||
*(.text.*usage*)
|
||||
/* *(.text.*Bosch*) 2% CPU .5% RAM */
|
||||
*(.text.*Tunes*)
|
||||
*(.text.*printStatistics*)
|
||||
*(.text.*init*)
|
||||
*(.text.*test*)
|
||||
*(.text.*task_spawn*)
|
||||
*(.text.*custom_command*)
|
||||
*(.text.*print_usage*)
|
||||
*(.text.*print_status*)
|
||||
*(.text.*status*)
|
||||
*(.text.*CameraInterface*)
|
||||
*(.text.*CameraTrigger*)
|
||||
*(.text.*ModuleBase*)
|
||||
*(.text.*print_message*)
|
||||
*(.text._ZN4Ekf2C2Eb)
|
||||
*(.text._ZN9CommanderC2Ev)
|
||||
*(.text.*PreFlightCheck*)
|
||||
*(.text.*calibrat*)
|
||||
*(.text.*initEv)
|
||||
*(.text.*probe*)
|
||||
*(.text.*thread_main*);
|
||||
*(.text.*listener*)
|
||||
*(.text.*BlockLocalPositionEstimator*)
|
||||
*(.text.nsh_*)
|
||||
*(.text.lib_vscanf)
|
||||
*(.text.lib_vsprintf)
|
||||
*(.text.*configure_streams_to_default*)
|
||||
*(.text.*_main)
|
||||
*(.text.*GPSDriverAshtech*)
|
||||
*(.text.*GPSDriver*)
|
||||
*(.text.*Mavlink*)
|
||||
*(.rodata .rodata.*)
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
*(.gnu.linkonce.t.*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.got)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.r.*)
|
||||
|
||||
} > flashxip
|
||||
|
||||
/* Sections that will go to OCRAM */
|
||||
|
||||
.text :
|
||||
{
|
||||
_stext = ABSOLUTE(.);
|
||||
*(.vectors)
|
||||
*(.text .text.*)
|
||||
_etext = ABSOLUTE(.);
|
||||
|
||||
} > sram AT> flash
|
||||
|
||||
/*
|
||||
* Init functions (static constructors and the like)
|
||||
*/
|
||||
|
||||
.init_section :
|
||||
{
|
||||
_sinit = ABSOLUTE(.);
|
||||
KEEP(*(.init_array .init_array.*))
|
||||
_einit = ABSOLUTE(.);
|
||||
} > flash
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab*)
|
||||
} > flash
|
||||
|
||||
__exidx_start = ABSOLUTE(.);
|
||||
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx*)
|
||||
__exidx_end = ABSOLUTE(.);
|
||||
} > flash
|
||||
|
||||
_eronly = ABSOLUTE(.);
|
||||
|
||||
.data :
|
||||
{
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data .data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
CONSTRUCTORS
|
||||
. = ALIGN(4);
|
||||
_edata = ABSOLUTE(.);
|
||||
} > sram AT > flash
|
||||
|
||||
.ramfunc ALIGN(4):
|
||||
{
|
||||
_sramfuncs = ABSOLUTE(.);
|
||||
*(.ramfunc .ramfunc.*)
|
||||
_eramfuncs = ABSOLUTE(.);
|
||||
} > sram AT > flash
|
||||
|
||||
_framfuncs = LOADADDR(.ramfunc);
|
||||
|
||||
.bss :
|
||||
{
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
}
|
||||
@ -1,163 +0,0 @@
|
||||
/****************************************************************************
|
||||
* configs/nxp_fmurt1062-v1/scripts/flash.ld
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* The FMURT1062 has 8MiB of QSPI FLASH beginning at address,
|
||||
* 0x0060:0000, Up to 512Kb of DTCM RAM beginning at 0x2000:0000, and 1MiB OCRAM
|
||||
* beginning at 0x2020:0000. Neither DTCM or SDRAM are used in this
|
||||
* configuratin.
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
flash (rx) : ORIGIN = 0x60000000, LENGTH = 8M
|
||||
sram (rwx) : ORIGIN = 0x20200000, LENGTH = 768K
|
||||
itcm (rwx) : ORIGIN = 0x00000000, LENGTH = 128K
|
||||
dtcm (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
EXTERN(_vectors)
|
||||
EXTERN(g_flash_config)
|
||||
EXTERN(g_image_vector_table)
|
||||
EXTERN(g_boot_data)
|
||||
|
||||
ENTRY(_stext)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/* Image Vector Table and Boot Data for booting from external flash */
|
||||
|
||||
.boot_hdr : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
__boot_hdr_start__ = ABSOLUTE(.) ;
|
||||
KEEP(*(.boot_hdr.conf))
|
||||
. = 0x1000 ;
|
||||
KEEP(*(.boot_hdr.ivt))
|
||||
. = 0x1020 ;
|
||||
KEEP(*(.boot_hdr.boot_data))
|
||||
. = 0x1030 ;
|
||||
KEEP(*(.boot_hdr.dcd_data))
|
||||
__boot_hdr_end__ = ABSOLUTE(.) ;
|
||||
. = 0x2000 ;
|
||||
} >flash
|
||||
|
||||
.text :
|
||||
{
|
||||
_stext = ABSOLUTE(.);
|
||||
*(.vectors)
|
||||
*(.text .text.*)
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
*(.rodata .rodata.*)
|
||||
*(.gnu.linkonce.t.*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.got)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.r.*)
|
||||
_etext = ABSOLUTE(.);
|
||||
|
||||
} > flash
|
||||
|
||||
/*
|
||||
* Init functions (static constructors and the like)
|
||||
*/
|
||||
|
||||
.init_section :
|
||||
{
|
||||
_sinit = ABSOLUTE(.);
|
||||
KEEP(*(.init_array .init_array.*))
|
||||
_einit = ABSOLUTE(.);
|
||||
} > flash
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab*)
|
||||
} > flash
|
||||
|
||||
__exidx_start = ABSOLUTE(.);
|
||||
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx*)
|
||||
} > flash
|
||||
__exidx_end = ABSOLUTE(.);
|
||||
|
||||
_eronly = ABSOLUTE(.);
|
||||
|
||||
.data :
|
||||
{
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data .data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
CONSTRUCTORS
|
||||
_edata = ABSOLUTE(.);
|
||||
} > sram AT > flash
|
||||
|
||||
.ramfunc ALIGN(4):
|
||||
{
|
||||
_sramfuncs = ABSOLUTE(.);
|
||||
*(.ramfunc .ramfunc.*)
|
||||
_eramfuncs = ABSOLUTE(.);
|
||||
} > sram AT > flash
|
||||
|
||||
_framfuncs = LOADADDR(.ramfunc);
|
||||
|
||||
.bss :
|
||||
{
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
_ebss = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
}
|
||||
@ -1,502 +0,0 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018-2019 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file board_config.h
|
||||
*
|
||||
* NXP fmukrt1062-v1 internal definitions
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/****************************************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************************************/
|
||||
|
||||
#include <px4_platform_common/px4_config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "imxrt_gpio.h"
|
||||
#include "imxrt_iomuxc.h"
|
||||
#include "hardware/imxrt_pinmux.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
/****************************************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************************************/
|
||||
|
||||
/* PX4IO connection configuration */
|
||||
|
||||
#if 0 // There is no PX4IO Support on first out
|
||||
// This requires serial DMA driver
|
||||
#define BOARD_USES_PX4IO_VERSION 2
|
||||
#define PX4IO_SERIAL_DEVICE "/dev/ttyS6"
|
||||
#define PX4IO_SERIAL_TX_GPIO GPIO_LPUART8_TX_2
|
||||
#define PX4IO_SERIAL_RX_GPIO GPIO_LPUART8_RX_2
|
||||
#define PX4IO_SERIAL_BASE IMXRT_LPUART8_BASE
|
||||
#define PX4IO_SERIAL_VECTOR IMXRT_IRQ_LPUART8
|
||||
#define PX4IO_SERIAL_TX_DMAMAP
|
||||
#define PX4IO_SERIAL_RX_DMAMAP
|
||||
#define PX4IO_SERIAL_RCC_REG
|
||||
#define PX4IO_SERIAL_RCC_EN
|
||||
#define PX4IO_SERIAL_CLOCK
|
||||
#define PX4IO_SERIAL_BITRATE 1500000 /* 1.5Mbps -> max rate for IO */
|
||||
#endif
|
||||
|
||||
/* Configuration ************************************************************************************/
|
||||
|
||||
/* FMURT1062 GPIOs ***********************************************************************************/
|
||||
/* LEDs */
|
||||
/* An RGB LED is connected through GPIO as shown below:
|
||||
*/
|
||||
#define LED_IOMUX (IOMUX_OPENDRAIN | IOMUX_PULL_NONE | IOMUX_DRIVE_33OHM | IOMUX_SPEED_MEDIUM | IOMUX_SLEW_SLOW)
|
||||
#define GPIO_nLED_RED /* GPIO_B0_00 QTIMER1_TIMER0 GPIO2_IO0 */ (GPIO_PORT2 | GPIO_PIN0 | GPIO_OUTPUT | GPIO_OUTPUT_ZERO | LED_IOMUX)
|
||||
#define GPIO_nLED_GREEN /* GPIO_B0_01 QTIMER1_TIMER1 GPIO2_IO1 */ (GPIO_PORT2 | GPIO_PIN1 | GPIO_OUTPUT | GPIO_OUTPUT_ZERO | LED_IOMUX)
|
||||
#define GPIO_nLED_BLUE /* GPIO_B1_08 QTIMER1_TIMER3 GPIO2_IO24 */ (GPIO_PORT2 | GPIO_PIN24 | GPIO_OUTPUT | GPIO_OUTPUT_ZERO | LED_IOMUX)
|
||||
|
||||
#define BOARD_HAS_CONTROL_STATUS_LEDS 1
|
||||
#define BOARD_OVERLOAD_LED LED_RED
|
||||
#define BOARD_ARMED_STATE_LED LED_BLUE
|
||||
|
||||
/*
|
||||
* Define the ability to shut off off the sensor signals
|
||||
* by changing the signals to inputs
|
||||
*/
|
||||
|
||||
#define _PIN_OFF(def) (((def) & (GPIO_PORT_MASK | GPIO_PIN_MASK)) | (GPIO_INPUT | IOMUX_PULL_DOWN_100K | IOMUX_CMOS_INPUT))
|
||||
|
||||
/* Define the Chip Selects, Data Ready and Control signals per SPI bus */
|
||||
|
||||
#define CS_IOMUX (IOMUX_CMOS_OUTPUT | IOMUX_PULL_UP_100K | IOMUX_DRIVE_33OHM | IOMUX_SPEED_LOW | IOMUX_SLEW_FAST)
|
||||
#define OUT_IOMUX (IOMUX_CMOS_OUTPUT | IOMUX_PULL_UP_100K | IOMUX_DRIVE_50OHM | IOMUX_SPEED_MEDIUM | IOMUX_SLEW_FAST)
|
||||
|
||||
|
||||
/* SPI1 off */
|
||||
|
||||
#define _GPIO_LPSPI1_SCK /* GPIO_EMC_27 GPIO4_IO27 */ (GPIO_PORT4 | GPIO_PIN27 | CS_IOMUX)
|
||||
#define _GPIO_LPSPI1_MISO /* GPIO_EMC_29 GPIO4_IO29 */ (GPIO_PORT4 | GPIO_PIN29 | CS_IOMUX)
|
||||
#define _GPIO_LPSPI1_MOSI /* GPIO_EMC_28 GPIO4_IO28 */ (GPIO_PORT4 | GPIO_PIN28 | CS_IOMUX)
|
||||
|
||||
#define GPIO_SPI1_SCK_OFF _PIN_OFF(_GPIO_LPSPI1_SCK)
|
||||
#define GPIO_SPI1_MISO_OFF _PIN_OFF(_GPIO_LPSPI1_MISO)
|
||||
#define GPIO_SPI1_MOSI_OFF _PIN_OFF(_GPIO_LPSPI1_MOSI)
|
||||
|
||||
#define _GPIO_LPSPI3_SCK /* GPIO_AD_B1_15 GPIO1_IO27 */ (GPIO_PORT1 | GPIO_PIN31 | CS_IOMUX)
|
||||
#define _GPIO_LPSPI3_MISO /* GPIO_AD_B1_13 GPIO1_IO27 */ (GPIO_PORT1 | GPIO_PIN29 | CS_IOMUX)
|
||||
#define _GPIO_LPSPI3_MOSI /* GPIO_AD_B1_14 GPIO1_IO27 */ (GPIO_PORT1 | GPIO_PIN30 | CS_IOMUX)
|
||||
|
||||
#define GPIO_SPI3_SCK_OFF _PIN_OFF(_GPIO_LPSPI3_SCK)
|
||||
#define GPIO_SPI3_MISO_OFF _PIN_OFF(_GPIO_LPSPI3_MISO)
|
||||
#define GPIO_SPI3_MOSI_OFF _PIN_OFF(_GPIO_LPSPI3_MOSI)
|
||||
|
||||
/* Define the SPI4 Data Ready and Control signals */
|
||||
|
||||
#define GPIO_SPI4_DRDY7_EXTERNAL1 /* GPIO_EMC_35 GPIO3_IO21*/ (GPIO_PORT3 | GPIO_PIN21 | GPIO_INPUT | DRDY_IOMUX)
|
||||
#define GPIO_nSPI4_RESET_EXTERNAL1 /* GPIO_B1_00 GPIO2_IO16 */ (GPIO_PORT2 | GPIO_PIN16 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | OUT_IOMUX)
|
||||
#define GPIO_SPI4_SYNC_EXTERNAL1 /* GPIO_EMC_05 GPIO4_IO5 */(GPIO_PORT4 | GPIO_PIN5 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | OUT_IOMUX)
|
||||
|
||||
#define GPIO_DRDY_OFF_SPI4_DRDY7_EXTERNAL1 _PIN_OFF(GPIO_SPI4_DRDY7_EXTERNAL1)
|
||||
#define GPIO_nSPI4_RESET_EXTERNAL1_OFF _PIN_OFF(GPIO_nSPI4_RESET_EXTERNAL1)
|
||||
#define GPIO_SPI4_SYNC_EXTERNAL1_OFF _PIN_OFF(GPIO_SPI4_SYNC_EXTERNAL1)
|
||||
|
||||
|
||||
#define ADC_IOMUX (IOMUX_CMOS_INPUT | IOMUX_PULL_NONE | IOMUX_DRIVE_HIZ)
|
||||
|
||||
#define ADC1_CH(n) (n)
|
||||
#define ADC1_GPIO(n, p) (GPIO_PORT1 | GPIO_PIN##p | ADC_IOMUX) //
|
||||
|
||||
/* Define GPIO pins used as ADC N.B. Channel numbers are for reference, */
|
||||
|
||||
#define PX4_ADC_GPIO \
|
||||
/* BATTERY1_VOLTAGE GPIO_AD_B1_11 GPIO1 Pin 27 */ ADC1_GPIO(0, 27), \
|
||||
/* BATTERY1_CURRENT GPIO_AD_B0_12 GPIO1 Pin 12 */ ADC1_GPIO(1, 12), \
|
||||
/* BATTERY2_VOLTAGE GPIO_AD_B0_13 GPIO1 Pin 13 */ ADC1_GPIO(2, 13), \
|
||||
/* BATTERY2_CURRENT GPIO_AD_B0_14 GPIO1 Pin 14 */ ADC1_GPIO(3, 14), \
|
||||
/* SPARE_2_CHANNEL GPIO_AD_B0_15 GPIO1 Pin 15 */ ADC1_GPIO(4, 15), \
|
||||
/* HW_VER_SENSE GPIO_AD_B1_04 GPIO1 Pin 20 */ ADC1_GPIO(9, 20), \
|
||||
/* SCALED_V5 GPIO_AD_B1_05 GPIO1 Pin 21 */ ADC1_GPIO(10, 21), \
|
||||
/* SCALED_VDD_3V3_SENSORS GPIO_AD_B1_06 GPIO1 Pin 22 */ ADC1_GPIO(11, 22), \
|
||||
/* HW_REV_SENSE GPIO_AD_B1_08 GPIO1 Pin 24 */ ADC1_GPIO(13, 24), \
|
||||
/* SPARE_1 GPIO_AD_B1_09 GPIO1 Pin 25 */ ADC1_GPIO(14, 25), \
|
||||
/* RSSI_IN GPIO_AD_B1_10 GPIO1 Pin 26 */ ADC1_GPIO(15, 26)
|
||||
|
||||
/* Define Channel numbers must match above GPIO pin IN(n)*/
|
||||
|
||||
#define ADC_BATTERY1_VOLTAGE_CHANNEL /* GPIO_AD_B1_11 GPIO1 Pin 27 */ ADC1_CH(0)
|
||||
#define ADC_BATTERY1_CURRENT_CHANNEL /* GPIO_AD_B0_12 GPIO1 Pin 12 */ ADC1_CH(1)
|
||||
#define ADC_BATTERY2_VOLTAGE_CHANNEL /* GPIO_AD_B0_13 GPIO1 Pin 13 */ ADC1_CH(2)
|
||||
#define ADC_BATTERY2_CURRENT_CHANNEL /* GPIO_AD_B0_14 GPIO1 Pin 14 */ ADC1_CH(3)
|
||||
#define ADC1_SPARE_2_CHANNEL /* GPIO_AD_B0_15 GPIO1 Pin 15 */ ADC1_CH(4)
|
||||
#define ADC_HW_VER_SENSE_CHANNEL /* GPIO_AD_B1_04 GPIO1 Pin 20 */ ADC1_CH(9)
|
||||
#define ADC_SCALED_V5_CHANNEL /* GPIO_AD_B1_05 GPIO1 Pin 21 */ ADC1_CH(10)
|
||||
#define ADC_SCALED_VDD_3V3_SENSORS_CHANNEL /* GPIO_AD_B1_06 GPIO1 Pin 22 */ ADC1_CH(11)
|
||||
#define ADC_HW_REV_SENSE_CHANNEL /* GPIO_AD_B1_08 GPIO1 Pin 24 */ ADC1_CH(13)
|
||||
#define ADC1_SPARE_1_CHANNEL /* GPIO_AD_B1_09 GPIO1 Pin 25 */ ADC1_CH(14)
|
||||
#define ADC_RSSI_IN_CHANNEL /* GPIO_AD_B1_10 GPIO1 Pin 26 */ ADC1_CH(15)
|
||||
|
||||
#define ADC_CHANNELS \
|
||||
((1 << ADC_BATTERY1_VOLTAGE_CHANNEL) | \
|
||||
(1 << ADC_BATTERY1_CURRENT_CHANNEL) | \
|
||||
(1 << ADC_BATTERY2_VOLTAGE_CHANNEL) | \
|
||||
(1 << ADC_BATTERY2_CURRENT_CHANNEL) | \
|
||||
(1 << ADC1_SPARE_2_CHANNEL) | \
|
||||
(1 << ADC_RSSI_IN_CHANNEL) | \
|
||||
(1 << ADC_SCALED_V5_CHANNEL) | \
|
||||
(1 << ADC_SCALED_VDD_3V3_SENSORS_CHANNEL) | \
|
||||
(1 << ADC_HW_VER_SENSE_CHANNEL) | \
|
||||
(1 << ADC_HW_REV_SENSE_CHANNEL) | \
|
||||
(1 << ADC1_SPARE_1_CHANNEL))
|
||||
|
||||
/* HW has to large of R termination on ADC todo:change when HW value is chosen */
|
||||
|
||||
#define BOARD_ADC_OPEN_CIRCUIT_V (5.6f)
|
||||
|
||||
/* HW Version and Revision drive signals Default to 1 to detect */
|
||||
|
||||
#define BOARD_HAS_HW_VERSIONING
|
||||
|
||||
#define HW_IOMUX (IOMUX_CMOS_OUTPUT | IOMUX_PULL_NONE | IOMUX_DRIVE_33OHM | IOMUX_SPEED_MAX | IOMUX_SLEW_FAST)
|
||||
|
||||
#define GPIO_HW_VER_REV_DRIVE /* GPIO_AD_B0_01 GPIO1_IO01 */ (GPIO_PORT1 | GPIO_PIN1 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | HW_IOMUX)
|
||||
#define GPIO_HW_REV_SENSE /* GPIO_AD_B1_08 GPIO1 Pin 24 */ ADC1_GPIO(13, 24)
|
||||
#define GPIO_HW_VER_SENSE /* GPIO_AD_B1_04 GPIO1 Pin 20 */ ADC1_GPIO(9, 20)
|
||||
#define HW_INFO_INIT_PREFIX "V5"
|
||||
#define V500 HW_VER_REV(0x0,0x0) // FMUV5, Rev 0
|
||||
#define V540 HW_VER_REV(0x4,0x0) // mini no can 2,3, Rev 0
|
||||
|
||||
/* CAN Silence
|
||||
*
|
||||
* Silent mode control \ ESC Mux select
|
||||
*/
|
||||
|
||||
#define SILENT_IOMUX (IOMUX_CMOS_OUTPUT | IOMUX_PULL_NONE | IOMUX_DRIVE_33OHM | IOMUX_SPEED_MAX | IOMUX_SLEW_FAST)
|
||||
#define GPIO_CAN1_SILENT_S0 /* GPIO_AD_B0_10 GPIO1_IO10 */ (GPIO_PORT1 | GPIO_PIN10 | GPIO_OUTPUT | GPIO_OUTPUT_ZERO | SILENT_IOMUX)
|
||||
#define GPIO_CAN2_SILENT_S1 /* GPIO_EMC_06 GPIO4_IO06 */ (GPIO_PORT4 | GPIO_PIN6 | GPIO_OUTPUT | GPIO_OUTPUT_ZERO | SILENT_IOMUX)
|
||||
#define GPIO_CAN3_SILENT_S2 /* GPIO_EMC_09 GPIO4_IO09 */ (GPIO_PORT4 | GPIO_PIN9 | GPIO_OUTPUT | GPIO_OUTPUT_ZERO | SILENT_IOMUX)
|
||||
|
||||
/* HEATER
|
||||
* PWM in future
|
||||
*/
|
||||
#define HEATER_IOMUX (IOMUX_CMOS_OUTPUT | IOMUX_PULL_NONE | IOMUX_DRIVE_50OHM | IOMUX_SPEED_MEDIUM | IOMUX_SLEW_FAST)
|
||||
#define GPIO_HEATER_OUTPUT /* GPIO_B1_09 QTIMER2_TIMER3 GPIO2_IO25 */ (GPIO_QTIMER2_TIMER3_1 | HEATER_IOMUX)
|
||||
#define HEATER_OUTPUT_EN(on_true) px4_arch_gpiowrite(GPIO_HEATER_OUTPUT, (on_true))
|
||||
|
||||
/* PWM Capture
|
||||
*
|
||||
* 2 PWM Capture inputs are supported
|
||||
*/
|
||||
#define DIRECT_PWM_CAPTURE_CHANNELS 2
|
||||
#define CAP_IOMUX (IOMUX_CMOS_OUTPUT | IOMUX_PULL_NONE | IOMUX_DRIVE_50OHM | IOMUX_SPEED_MEDIUM | IOMUX_SLEW_FAST)
|
||||
#define PIN_FLEXPWM2_PWMB0 /* P2:7 PWM2 B0 FMU_CAP1 */ (CAP_IOMUX | GPIO_FLEXPWM2_PWMB00_2)
|
||||
#define PIN_FLEXPWM2_PWMB3 /* P3:3 PWM2 A1 FMU_CAP2 */ (CAP_IOMUX | GPIO_FLEXPWM2_PWMB03_3)
|
||||
|
||||
#define nARMED_INPUT_IOMUX (IOMUX_CMOS_INPUT | IOMUX_PULL_UP_22K | IOMUX_DRIVE_HIZ)
|
||||
#define nARMED_OUTPUT_IOMUX (IOMUX_CMOS_OUTPUT | IOMUX_PULL_KEEP | IOMUX_DRIVE_33OHM | IOMUX_SPEED_MEDIUM | IOMUX_SLEW_FAST)
|
||||
|
||||
#define GPIO_nARMED_INIT /* GPIO_SD_B1_01 GPIO3_IO1 */ (GPIO_PORT3 | GPIO_PIN1 | GPIO_INPUT | nARMED_INPUT_IOMUX)
|
||||
#define GPIO_nARMED /* GPIO_SD_B1_01 GPIO3_IO1 */ (GPIO_PORT3 | GPIO_PIN1 | GPIO_OUTPUT | GPIO_OUTPUT_ZERO | nARMED_OUTPUT_IOMUX)
|
||||
|
||||
#define BOARD_INDICATE_EXTERNAL_LOCKOUT_STATE(enabled) px4_arch_configgpio((enabled) ? GPIO_nARMED : GPIO_nARMED_INIT)
|
||||
#define BOARD_GET_EXTERNAL_LOCKOUT_STATE() px4_arch_gpioread(GPIO_nARMED)
|
||||
|
||||
|
||||
/* PWM
|
||||
*/
|
||||
|
||||
#define DIRECT_PWM_OUTPUT_CHANNELS 8
|
||||
#define BOARD_NUM_IO_TIMERS 8
|
||||
|
||||
// Input Capture not supported on MVP
|
||||
|
||||
#define BOARD_HAS_NO_CAPTURE
|
||||
|
||||
//#define BOARD_HAS_UI_LED_PWM 1 Not ported yet (Still Kinetis driver)
|
||||
#define BOARD_HAS_LED_PWM 1
|
||||
#define BOARD_LED_PWM_DRIVE_ACTIVE_LOW 1
|
||||
|
||||
/* UI LEDs are driven by timer 4 the pins have no alternates
|
||||
*
|
||||
* nUI_LED_RED GPIO_B0_10 GPIO2_IO10 QTIMER4_TIMER1
|
||||
* nUI_LED_GREEN GPIO_B0_11 GPIO2_IO11 QTIMER4_TIMER2
|
||||
* nUI_LED_BLUE GPIO_B1_11 GPIO2_IO27 QTIMER4_TIMER3
|
||||
*/
|
||||
|
||||
|
||||
/* Power supply control and monitoring GPIOs */
|
||||
|
||||
#define GENERAL_INPUT_IOMUX (IOMUX_CMOS_INPUT | IOMUX_PULL_UP_47K | IOMUX_DRIVE_HIZ)
|
||||
#define GENERAL_OUTPUT_IOMUX (IOMUX_CMOS_OUTPUT | IOMUX_PULL_KEEP | IOMUX_DRIVE_33OHM | IOMUX_SPEED_MEDIUM | IOMUX_SLEW_FAST)
|
||||
|
||||
#define GPIO_nPOWER_IN_A /* GPIO_B0_12 GPIO2_IO12 */ (GPIO_PORT2 | GPIO_PIN12 | GPIO_INPUT | GENERAL_INPUT_IOMUX)
|
||||
#define GPIO_nPOWER_IN_B /* GPIO_B0_13 GPIO2_IO13 */ (GPIO_PORT2 | GPIO_PIN13 | GPIO_INPUT | GENERAL_INPUT_IOMUX)
|
||||
#define GPIO_nPOWER_IN_C /* GPIO_B0_14 GPIO2_IO14 */ (GPIO_PORT2 | GPIO_PIN14 | GPIO_INPUT | GENERAL_INPUT_IOMUX)
|
||||
|
||||
#define GPIO_nVDD_BRICK1_VALID GPIO_nPOWER_IN_A /* Brick 1 Is Chosen */
|
||||
#define GPIO_nVDD_BRICK2_VALID GPIO_nPOWER_IN_B /* Brick 2 Is Chosen */
|
||||
#define BOARD_NUMBER_BRICKS 2
|
||||
#define GPIO_nVDD_USB_VALID GPIO_nPOWER_IN_C /* USB Is Chosen */
|
||||
|
||||
#define OC_INPUT_IOMUX (IOMUX_CMOS_INPUT | IOMUX_PULL_NONE | IOMUX_DRIVE_HIZ)
|
||||
|
||||
#define GPIO_nVDD_5V_PERIPH_EN /* GPIO_B1_03 GPIO2_IO19 */ (GPIO_PORT2 | GPIO_PIN19 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | GENERAL_OUTPUT_IOMUX)
|
||||
#define GPIO_nVDD_5V_PERIPH_OC /* GPIO_B1_04 GPIO2_IO20 */ (GPIO_PORT2 | GPIO_PIN20 | GPIO_INPUT | OC_INPUT_IOMUX)
|
||||
#define GPIO_nVDD_5V_HIPOWER_EN /* GPIO_B1_01 GPIO2_IO17 */ (GPIO_PORT2 | GPIO_PIN17 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | GENERAL_OUTPUT_IOMUX)
|
||||
#define GPIO_nVDD_5V_HIPOWER_OC /* GPIO_B1_02 GPIO2_IO18 */ (GPIO_PORT2 | GPIO_PIN18 | GPIO_INPUT | OC_INPUT_IOMUX)
|
||||
#define GPIO_VDD_3V3_SENSORS_EN /* GPIO_EMC_41 GPIO3_IO27 */ (GPIO_PORT3 | GPIO_PIN27 | GPIO_OUTPUT | GPIO_OUTPUT_ZERO | GENERAL_OUTPUT_IOMUX)
|
||||
#define GPIO_VDD_3V3_SPEKTRUM_POWER_EN /* GPIO_AD_B0_00 GPIO1_IO00 */ (GPIO_PORT1 | GPIO_PIN0 | GPIO_OUTPUT | GPIO_OUTPUT_ZERO | GENERAL_OUTPUT_IOMUX)
|
||||
#define GPIO_VDD_5V_RC_EN /* GPIO_AD_B0_08 GPIO1_IO08 */ (GPIO_PORT1 | GPIO_PIN8 | GPIO_OUTPUT | GPIO_OUTPUT_ZERO | GENERAL_OUTPUT_IOMUX)
|
||||
#define GPIO_VDD_5V_WIFI_EN /* PMIC_STBY_REQ GPIO5_IO02 */ (GPIO_PORT5 | GPIO_PIN2 | GPIO_OUTPUT | GPIO_OUTPUT_ZERO | GENERAL_OUTPUT_IOMUX)
|
||||
#define GPIO_VDD_3V3_SD_CARD_EN /* GPIO_EMC_13 GPIO4_IO13 */ (GPIO_PORT4 | GPIO_PIN13 | GPIO_OUTPUT | GPIO_OUTPUT_ZERO |GENERAL_OUTPUT_IOMUX)
|
||||
|
||||
/* Define True logic Power Control in arch agnostic form */
|
||||
|
||||
#define VDD_5V_PERIPH_EN(on_true) px4_arch_gpiowrite(GPIO_nVDD_5V_PERIPH_EN, !(on_true))
|
||||
#define VDD_5V_HIPOWER_EN(on_true) px4_arch_gpiowrite(GPIO_nVDD_5V_HIPOWER_EN, !(on_true))
|
||||
#define VDD_3V3_SENSORS_EN(on_true) px4_arch_gpiowrite(GPIO_VDD_3V3_SENSORS_EN, (on_true))
|
||||
#define VDD_3V3_SPEKTRUM_POWER_EN(on_true) px4_arch_gpiowrite(GPIO_VDD_3V3_SPEKTRUM_POWER_EN, (on_true))
|
||||
#define READ_VDD_3V3_SPEKTRUM_POWER_EN() px4_arch_gpioread(GPIO_VDD_3V3_SPEKTRUM_POWER_EN)
|
||||
#define VDD_5V_RC_EN(on_true) px4_arch_gpiowrite(GPIO_VDD_5V_RC_EN, (on_true))
|
||||
#define VDD_5V_WIFI_EN(on_true) px4_arch_gpiowrite(GPIO_VDD_5V_WIFI_EN, (on_true))
|
||||
#define VDD_3V3_SD_CARD_EN(on_true) px4_arch_gpiowrite(GPIO_VDD_3V3_SD_CARD_EN, (on_true))
|
||||
|
||||
/* Tone alarm output */
|
||||
|
||||
#define TONE_ALARM_TIMER 2 /* GPT 2 */
|
||||
#define TONE_ALARM_CHANNEL 3 /* GPIO_AD_B1_07 GPT2_COMPARE3 */
|
||||
|
||||
#define GPIO_BUZZER_1 /* GPIO_AD_B1_07 GPIO1_IO23 */ (GPIO_PORT1 | GPIO_PIN23 | GPIO_OUTPUT | GPIO_OUTPUT_ZERO | GENERAL_OUTPUT_IOMUX)
|
||||
|
||||
#define GPIO_TONE_ALARM_IDLE GPIO_BUZZER_1
|
||||
#define GPIO_TONE_ALARM (GPIO_GPT2_COMPARE3_2 | GENERAL_OUTPUT_IOMUX)
|
||||
|
||||
/* USB OTG FS
|
||||
*
|
||||
* VBUS_VALID is detected in USB_ANALOG_USB1_VBUS_DETECT_STAT
|
||||
*/
|
||||
|
||||
/* High-resolution timer */
|
||||
#define HRT_TIMER 1 /* use GPT1 for the HRT */
|
||||
#define HRT_TIMER_CHANNEL 1 /* use capture/compare channel 1 */
|
||||
|
||||
#define HRT_PPM_CHANNEL /* GPIO_B1_06 GPT1_CAPTURE2 */ 2 /* use capture/compare channel 2 */
|
||||
#define GPIO_PPM_IN /* GPIO_B1_06 GPT1_CAPTURE2 */ (GPIO_GPT1_CAPTURE2_2 | GENERAL_INPUT_IOMUX)
|
||||
|
||||
#define RC_SERIAL_PORT "/dev/ttyS5"
|
||||
#define RC_SERIAL_SINGLEWIRE
|
||||
|
||||
/* PWM input driver. Use FMU AUX5 pins attached to GPIO_EMC_33 GPIO3_IO19 FLEXPWM3_PWMA2 */
|
||||
|
||||
#define PWMIN_TIMER /* FLEXPWM3_PWMA2 */ 3
|
||||
#define PWMIN_TIMER_CHANNEL /* FLEXPWM3_PWMA2 */ 2
|
||||
#define GPIO_PWM_IN /* GPIO_EMC_33 GPIO3_IO19 */ (GPIO_FLEXPWM3_PWMA02_1 | GENERAL_INPUT_IOMUX)
|
||||
|
||||
/* Shared pins Both FMU and PX4IO control/monitor
|
||||
* FMU Initializes these pins to passive input until it is known
|
||||
* if we have and PX4IO on board
|
||||
*/
|
||||
|
||||
#define GPIO_RSSI_IN /* GPIO_AD_B1_10 GPIO1_IO26 */ (GPIO_PORT1 | GPIO_PIN26 | GPIO_INPUT | ADC_IOMUX)
|
||||
#define GPIO_RSSI_IN_INIT /* GPIO_AD_B1_10 GPIO1_IO26 */ 0 /* Using 0 will Leave as ADC RSSI_IN */
|
||||
|
||||
/* Safety Switch is HW version dependent on having an PX4IO
|
||||
* So we init to a benign state with the _INIT definition
|
||||
* and provide the the non _INIT one for the driver to make a run time
|
||||
* decision to use it.
|
||||
*/
|
||||
#define SAFETY_INIT_IOMUX (IOMUX_CMOS_INPUT | IOMUX_PULL_NONE | IOMUX_DRIVE_HIZ)
|
||||
#define SAFETY_IOMUX (IOMUX_CMOS_OUTPUT | IOMUX_PULL_NONE | IOMUX_DRIVE_33OHM | IOMUX_SPEED_MEDIUM | IOMUX_SLEW_SLOW)
|
||||
#define SAFETY_SW_IOMUX (IOMUX_CMOS_INPUT | IOMUX_PULL_UP_22K | IOMUX_DRIVE_HIZ)
|
||||
|
||||
#define GPIO_nSAFETY_SWITCH_LED_OUT_INIT /* GPIO_B0_15 GPIO2_IO15 */ (GPIO_PORT2 | GPIO_PIN15 | GPIO_INPUT | SAFETY_INIT_IOMUX)
|
||||
#define GPIO_nSAFETY_SWITCH_LED_OUT /* GPIO_B0_15 GPIO2_IO15 */ (GPIO_PORT2 | GPIO_PIN15 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | SAFETY_IOMUX)
|
||||
|
||||
/* Enable the FMU to control it if there is no px4io fixme:This should be BOARD_SAFETY_LED(__ontrue) */
|
||||
#define GPIO_LED_SAFETY GPIO_nSAFETY_SWITCH_LED_OUT
|
||||
#define GPIO_SAFETY_SWITCH_IN /* GPIO_AD_B1_12 GPIO1_IO28 */ (GPIO_PORT1 | GPIO_PIN28 | GPIO_INPUT | SAFETY_SW_IOMUX)
|
||||
/* Enable the FMU to use the switch it if there is no px4io fixme:This should be BOARD_SAFTY_BUTTON() */
|
||||
#define GPIO_BTN_SAFETY GPIO_SAFETY_SWITCH_IN /* Enable the FMU to control it if there is no px4io */
|
||||
|
||||
/*
|
||||
* FMUv5 has a separate RC_IN
|
||||
*
|
||||
* GPIO PPM_IN on GPIO_EMC_23 GPIO4 Pin 23 GPT1_CAPTURE2
|
||||
* Inversion is possible in the UART and can drive GPIO PPM_IN as an output
|
||||
*/
|
||||
|
||||
#define GPIO_PPM_IN_AS_OUT /* GPIO_B1_06 GPIO2_IO23 GPT1_CAPTURE2 GPT1_CAPTURE2 */ (GPIO_PORT2 | GPIO_PIN23 | GPIO_OUTPUT | GPIO_OUTPUT_ONE | GENERAL_OUTPUT_IOMUX)
|
||||
|
||||
#define SDIO_SLOTNO 0 /* Only one slot */
|
||||
#define SDIO_MINOR 0
|
||||
|
||||
/* SD card bringup does not work if performed on the IDLE thread because it
|
||||
* will cause waiting. Use either:
|
||||
*
|
||||
* CONFIG_BOARDCTL=y, OR
|
||||
* CONFIG_BOARD_INITIALIZE=y && CONFIG_BOARD_INITTHREAD=y
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_BOARD_INITIALIZE) && !defined(CONFIG_BOARDCTL) && \
|
||||
!defined(CONFIG_BOARD_INITTHREAD)
|
||||
# warning SDIO initialization cannot be perfomed on the IDLE thread
|
||||
#endif
|
||||
|
||||
/* By Providing BOARD_ADC_USB_CONNECTED (using the px4_arch abstraction)
|
||||
* this board support the ADC system_power interface, and therefore
|
||||
* provides the true logic GPIO BOARD_ADC_xxxx macros.
|
||||
*/
|
||||
|
||||
#define BOARD_ADC_USB_VALID (!px4_arch_gpioread(GPIO_nVDD_USB_VALID))
|
||||
#define BOARD_ADC_USB_CONNECTED (board_read_VBUS_state() == 0)
|
||||
|
||||
/* FMUv5 never powers odd the Servo rail */
|
||||
|
||||
#define BOARD_ADC_SERVO_VALID (1)
|
||||
|
||||
#define BOARD_ADC_BRICK1_VALID (!px4_arch_gpioread(GPIO_nVDD_BRICK1_VALID))
|
||||
#define BOARD_ADC_BRICK2_VALID (!px4_arch_gpioread(GPIO_nVDD_BRICK2_VALID))
|
||||
|
||||
#define BOARD_ADC_PERIPH_5V_OC (!px4_arch_gpioread(GPIO_nVDD_5V_PERIPH_OC))
|
||||
#define BOARD_ADC_HIPOWER_5V_OC (!px4_arch_gpioread(GPIO_nVDD_5V_HIPOWER_OC))
|
||||
|
||||
|
||||
/* This board provides a DMA pool and APIs */
|
||||
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
||||
|
||||
/* This board provides the board_on_reset interface */
|
||||
|
||||
#define BOARD_HAS_ON_RESET 1
|
||||
|
||||
#define PX4_GPIO_INIT_LIST { \
|
||||
GPIO_nARMED_INIT, \
|
||||
PX4_ADC_GPIO, \
|
||||
GPIO_HW_VER_REV_DRIVE, \
|
||||
GPIO_FLEXCAN1_TX, \
|
||||
GPIO_FLEXCAN1_RX, \
|
||||
GPIO_FLEXCAN2_TX, \
|
||||
GPIO_FLEXCAN2_RX, \
|
||||
GPIO_FLEXCAN3_TX, \
|
||||
GPIO_FLEXCAN3_RX, \
|
||||
GPIO_CAN1_SILENT_S0, \
|
||||
GPIO_CAN2_SILENT_S1, \
|
||||
GPIO_CAN3_SILENT_S2, \
|
||||
GPIO_HEATER_OUTPUT, \
|
||||
GPIO_nPOWER_IN_A, \
|
||||
GPIO_nPOWER_IN_B, \
|
||||
GPIO_nPOWER_IN_C, \
|
||||
GPIO_nVDD_5V_PERIPH_EN, \
|
||||
GPIO_nVDD_5V_PERIPH_OC, \
|
||||
GPIO_nVDD_5V_HIPOWER_EN, \
|
||||
GPIO_nVDD_5V_HIPOWER_OC, \
|
||||
GPIO_VDD_3V3_SENSORS_EN, \
|
||||
GPIO_VDD_3V3_SD_CARD_EN, \
|
||||
GPIO_VDD_3V3_SPEKTRUM_POWER_EN, \
|
||||
GPIO_VDD_5V_RC_EN, \
|
||||
GPIO_VDD_5V_WIFI_EN, \
|
||||
GPIO_TONE_ALARM_IDLE, \
|
||||
GPIO_RSSI_IN_INIT, \
|
||||
GPIO_nSAFETY_SWITCH_LED_OUT_INIT, \
|
||||
GPIO_nSPI4_RESET_EXTERNAL1, \
|
||||
GPIO_SPI4_SYNC_EXTERNAL1, \
|
||||
GPIO_SAFETY_SWITCH_IN \
|
||||
}
|
||||
|
||||
#define BOARD_ENABLE_CONSOLE_BUFFER
|
||||
__BEGIN_DECLS
|
||||
|
||||
/****************************************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************************************/
|
||||
|
||||
/****************************************************************************************************
|
||||
* Public data
|
||||
****************************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: fmurt1062_usdhc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize SDIO-based MMC/SD card support
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int fmurt1062_usdhc_initialize(void);
|
||||
|
||||
/****************************************************************************************************
|
||||
* Name: imxrt_spidev_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called to configure SPI chip select GPIO pins for the PX4FMU board.
|
||||
*
|
||||
****************************************************************************************************/
|
||||
|
||||
extern void imxrt_spidev_initialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: imxrt_spi_bus_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called to configure SPI Buses.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
extern int imxrt1062_spi_bus_initialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: imxrt_usb_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called to configure USB.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
extern int imxrt_usb_initialize(void);
|
||||
|
||||
extern void imxrt_usbinitialize(void);
|
||||
|
||||
extern void board_peripheral_reset(int ms);
|
||||
|
||||
extern void fmurt1062_timer_initialize(void);
|
||||
|
||||
#include <px4_platform_common/board_common.h>
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
__END_DECLS
|
||||
@ -1,64 +0,0 @@
|
||||
/****************************************************************************
|
||||
* config/imxrt1060-evk/src/imxrt_flexspi_nor_boot.c
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Ivan Ucherdzhiev <ivanucherdjiev@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "imxrt_flexspi_nor_boot.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
__attribute__((section(".boot_hdr.ivt")))
|
||||
const struct ivt_s g_image_vector_table = {
|
||||
IVT_HEADER, /* IVT Header */
|
||||
IMAGE_ENTRY_ADDRESS, /* Image Entry Function */
|
||||
IVT_RSVD, /* Reserved = 0 */
|
||||
(uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */
|
||||
(uint32_t)BOOT_DATA_ADDRESS, /* Address where BOOT Data Structure is stored */
|
||||
(uint32_t)IMAG_VECTOR_TABLE, /* Pointer to IVT Self (absolute address */
|
||||
(uint32_t)CSF_ADDRESS, /* Address where CSF file is stored */
|
||||
IVT_RSVD /* Reserved = 0 */
|
||||
};
|
||||
|
||||
__attribute__((section(".boot_hdr.boot_data")))
|
||||
const struct boot_data_s g_boot_data = {
|
||||
IMAGE_DEST, /* boot start location */
|
||||
(IMAGE_DEST_END - IMAGE_DEST), /* size */
|
||||
PLUGIN_FLAG, /* Plugin flag */
|
||||
0xffffffff /* empty - extra data word */
|
||||
};
|
||||
@ -1,198 +0,0 @@
|
||||
/****************************************************************************
|
||||
* config/imxrt1060-evk/src/imxrt_flexspi_nor_flash.c
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Authors: Ivan Ucherdzhiev <ivanucherdjiev@gmail.com>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* Included Files
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#include "imxrt_flexspi_nor_flash.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* Public Data
|
||||
******************************************************************************/
|
||||
|
||||
#if defined (CONFIG_NXP_FMURT1062_V3_HYPER_FLASH)
|
||||
__attribute__((section(".boot_hdr.conf")))
|
||||
const struct flexspi_nor_config_s g_flash_config = {
|
||||
.mem_config =
|
||||
{
|
||||
.tag = FLEXSPI_CFG_BLK_TAG,
|
||||
.version = FLEXSPI_CFG_BLK_VERSION,
|
||||
.read_sample_clksrc = FLASH_READ_SAMPLE_CLK_EXTERNALINPUT_FROM_DQSPAD,
|
||||
.cs_hold_time = 3u,
|
||||
.cs_setup_time = 3u,
|
||||
.column_address_width = 3u,
|
||||
|
||||
/* Enable DDR mode, Word addassable, Safe configuration, Differential clock */
|
||||
|
||||
.controller_misc_option = (1u << FLEXSPIMISC_OFFSET_DDR_MODE_EN) |
|
||||
(1u << FLEXSPIMISC_OFFSET_WORD_ADDRESSABLE_EN) |
|
||||
(1u << FLEXSPIMISC_OFFSET_SAFECONFIG_FREQ_EN) |
|
||||
(1u << FLEXSPIMISC_OFFSET_DIFFCLKEN),
|
||||
.sflash_pad_type = SERIAL_FLASH_8PADS,
|
||||
.serial_clk_freq = FLEXSPI_SERIAL_CLKFREQ_133MHz,
|
||||
.sflash_a1size = 64u * 1024u * 1024u,
|
||||
.data_valid_time = {16u, 16u},
|
||||
.lookup_table =
|
||||
{
|
||||
/* Read LUTs */
|
||||
|
||||
FLEXSPI_LUT_SEQ(CMD_DDR, FLEXSPI_8PAD, 0xA0, RADDR_DDR, FLEXSPI_8PAD, 0x18),
|
||||
FLEXSPI_LUT_SEQ(CADDR_DDR, FLEXSPI_8PAD, 0x10, DUMMY_DDR, FLEXSPI_8PAD, 0x06),
|
||||
FLEXSPI_LUT_SEQ(READ_DDR, FLEXSPI_8PAD, 0x04, STOP, FLEXSPI_1PAD, 0x0),
|
||||
},
|
||||
},
|
||||
.page_size = 512u,
|
||||
.sector_size = 256u * 1024u,
|
||||
.blocksize = 256u * 1024u,
|
||||
.is_uniform_blocksize = 1,
|
||||
};
|
||||
|
||||
#elif defined (CONFIG_NXP_FMURT1062_V3_QSPI_FLASH)
|
||||
__attribute__((section(".boot_hdr.conf")))
|
||||
const struct flexspi_nor_config_s g_flash_config = {
|
||||
.mem_config =
|
||||
{
|
||||
.tag = FLEXSPI_CFG_BLK_TAG,
|
||||
.version = FLEXSPI_CFG_BLK_VERSION,
|
||||
.read_sample_clksrc = FLASH_READ_SAMPLE_CLK_LOOPBACK_FROM_SCKPAD,
|
||||
.cs_hold_time = 3u,
|
||||
.cs_setup_time = 3u,
|
||||
.column_address_width = 0u,
|
||||
.device_type = FLEXSPI_DEVICE_TYPE_SERIAL_NOR,
|
||||
.sflash_pad_type = SERIAL_FLASH_4PADS,
|
||||
.serial_clk_freq = FLEXSPI_SERIAL_CLKFREQ_60MHz,
|
||||
.sflash_a1size = 8u * 1024u * 1024u,
|
||||
.data_valid_time = {16u, 16u},
|
||||
.lookup_table =
|
||||
{
|
||||
/* LUTs */
|
||||
/* 0 Fast read Quad IO DTR Mode Operation in SPI Mode (normal read)*/
|
||||
|
||||
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xED, RADDR_DDR, FLEXSPI_4PAD, 0x18),
|
||||
FLEXSPI_LUT_SEQ(DUMMY_DDR, FLEXSPI_4PAD, 0x0C, READ_DDR, FLEXSPI_4PAD, 0x08),
|
||||
FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
|
||||
FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
|
||||
|
||||
/* 1 Read Status */
|
||||
|
||||
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05, READ_SDR, FLEXSPI_1PAD, 0x1),
|
||||
FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
|
||||
FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
|
||||
FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
|
||||
|
||||
/* 2 */
|
||||
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
|
||||
/* 3 */
|
||||
|
||||
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06, STOP, FLEXSPI_1PAD, 0x0),
|
||||
FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
|
||||
FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
|
||||
FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
|
||||
|
||||
/* 4 */
|
||||
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
|
||||
/* 5 Erase Sector */
|
||||
|
||||
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD7, RADDR_SDR, FLEXSPI_1PAD, 0x18),
|
||||
FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
|
||||
FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
|
||||
FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
|
||||
|
||||
/* 6 */
|
||||
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
|
||||
/* 7 */
|
||||
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
|
||||
/* 8 */
|
||||
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
|
||||
/* 9 Page Program */
|
||||
|
||||
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02, RADDR_SDR, FLEXSPI_1PAD, 0x18),
|
||||
FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x8, STOP, FLEXSPI_1PAD, 0x0),
|
||||
FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
|
||||
FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
|
||||
|
||||
/* 10 */
|
||||
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
|
||||
/* 11 Chip Erase */
|
||||
|
||||
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xC7, STOP, FLEXSPI_1PAD, 0x0),
|
||||
FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
|
||||
FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
|
||||
FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0),
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
.page_size = 256u,
|
||||
.sector_size = 4u * 1024u,
|
||||
.blocksize = 32u * 1024u,
|
||||
.is_uniform_blocksize = false,
|
||||
};
|
||||
#else
|
||||
# error Boot Flash type not chosen!
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user