Compare commits

...

98 Commits

Author SHA1 Message Date
Claudio Chies 4d003fd782 MPC: LAND: create Stop motion primitive to also be used elsewhere 2024-12-16 15:30:30 +01:00
Claudio Chies b04b64c260 Expanded Vehicleconstraints to xy for emergency braking 2024-12-16 15:30:30 +01:00
Claudio Chies ca141642ac MPC: LAND: Split Landing out of the FlightTask Auto, any by that is able to compensate initial velocities better. 2024-12-16 15:30:30 +01:00
Roman Bapst 93c25efb62 Fixed-wing Position Control: Split up control methods for VTOL backtransition (#23893)
* split methods to control backtransition depening on availablity of position

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* fixed sign error and replace hardcoded number with constant

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* make changes such that controller holds initial heading during transition

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* use reference instead of copy

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* added comment

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* flash reduction

Signed-off-by: RomanBapst <bapstroman@gmail.com>

---------

Signed-off-by: RomanBapst <bapstroman@gmail.com>
2024-12-16 16:16:25 +03:00
Claudio Chies 051ced0fee SENS: RNG: SF45: Added timeout to sensor measurements, to compensate the lower loop time of CollisionPrevention 2024-12-16 10:49:13 +01:00
Alexander Lerach f34b22907c SENS: RNG: SF45:Fix startup problems, increase frequency, robust parser, use nonblocking reads 2024-12-16 10:49:13 +01:00
Alexander Lerach 88d771e3e5 SENS: RNG: SF45: Fixed sf45 parser, added general checks to avoid potential out-of-bound access 2024-12-16 10:49:13 +01:00
Claudio Chies 1718b37fe4 SENS: RNG: SF45 changed data processing and publication design, moved to a publishing per sector design.
other minor improvements
2024-12-16 10:49:13 +01:00
PX4 BuildBot a751e900f5 Update submodule mavlink to latest Sat Dec 14 00:39:04 UTC 2024
- mavlink in PX4/Firmware (661ae0c0e3ac493ceddd13120e8ccb5bac47d887): https://github.com/mavlink/mavlink/commit/0e420102dbdd7e9f59617dd00c05a2470f22eef2
    - mavlink current upstream: https://github.com/mavlink/mavlink/commit/5e3a42b8f3f53038f2779f9f69bd64767b913bb8
    - Changes: https://github.com/mavlink/mavlink/compare/0e420102dbdd7e9f59617dd00c05a2470f22eef2...5e3a42b8f3f53038f2779f9f69bd64767b913bb8

    5e3a42b8 2024-12-12 Hamish Willee - development: Remove parameter transaction proposal (#2169)
25f4e9f0 2024-12-11 Hamish Willee - STANDARD_MODE_SAFE_RECOVERY + RTL merge (#2191)
d5a8cb43 2024-12-11 Hamish Willee - Docs generate fix (#2194)
35f70c4a 2024-12-05 Hamish Willee - Create index.md, dialects.md and make notes/warning work with vitepress (#2193)
57c02856 2024-12-05 Hamish Willee - CAMERA_THERMAL_RANGE - no longer WIP (#2189)
1ee2ebe1 2024-12-04 Hamish Willee - fetch_dialect_ardupilotmega.yml: Not fail if nothing to commit (#2181)
1aa8c2d0 2024-12-04 Hamish Willee - ardupilotmega - remove_mav_cmd_external_estimate (#2187)
49fa509a 2024-11-30 github-actions[bot] - ardupilotmega dialects from ArduPilot/mavlink: Fri Nov 29 23:49:36 UTC 2024 (#2185)
75ebfc8f 2024-11-30 Hamish Willee - Update fetch_dialect_ardupilotmega.yml - fix copy error (#2184)
8e97709d 2024-11-30 Hamish Willee - fetch_dialect_ardupilotmega.yml - add loweheiser (#2183)
82b81aa8 2024-11-27 github-actions[bot] - ardupilotmega.xml from ArduPilot/mavlink: Wed Nov 27 04:13:16 UTC 2024 (#2178)
5c421a33 2024-11-27 Hamish Willee - Speed uncertainty units /s (#2180)
33f8a327 2024-11-24 David Sastre - Some modifications to multi-GCS protocol (#2179)
9938f940 2024-11-21 Hamish Willee - fetch_dialect_ardupilotmega - create (#2177)
a55d0ec5 2024-11-21 Hamish Willee - MAV_CMD_GROUP_START and _GROUP_END delete wip (#2176)
1cf3c721 2024-11-21 Hamish Willee - dev: move FUEL_STATUS to common (#2170)
7ecb8e33 2024-11-21 Hamish Willee - WIFI_NETWORK_SECURITY - wip removal (#2164)
2024-12-13 20:57:48 -05:00
Silvan Fuhrer 4db55cd25f mixer: FunctionMotors: compare against FLT_EPSILON instead of 0.f
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2024-12-13 17:56:46 +01:00
Silvan Fuhrer d7904b5f2c mixer: FunctionMotors: leave NAN control values at NAN with non-zero THR_MDL_FAC
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2024-12-13 17:56:46 +01:00
bresch 3941b19968 ekf2_replay: log groundtruth messages 2024-12-13 17:40:08 +01:00
bresch 3165a77e26 SIH-AGP: add sensor failure simulation 2024-12-13 17:40:08 +01:00
bresch 2a08d4bdb8 add SensorAgpSim to generate Aux Global Position data 2024-12-13 17:40:08 +01:00
GuillaumeLaine 2e166379c7 docs: split msgs as un/versioned 2024-12-13 16:34:37 +01:00
GuillaumeLaine 4d62522942 uxrce_dds_client: remove unused msgdir arg from script 2024-12-13 16:34:37 +01:00
GuillaumeLaine 58e5b75d06 jenkins: update after msg/ restructure 2024-12-13 16:34:37 +01:00
GuillaumeLaine 2d667238f7 tools: update scripts after msg/ restructure 2024-12-13 16:34:37 +01:00
GuillaumeLaine 4fe7d713d3 msg: introduce message versioning 2024-12-13 16:34:37 +01:00
bresch f9140fcd50 ekf2: set baro bias when GNSS is alt ref
Do this even when GNSS altitude fusion is disabled.
2024-12-13 14:55:46 +01:00
bresch fad9ae855d EKF2: reset aid src when resetting state to measurement
Filtered innovations and test ratios can be large before the reset and
would trigger pre-flight warnings
2024-12-13 14:26:57 +01:00
Jacob Dahl eb829676b0 sim: gz: remove Garden from cmake 2024-12-13 13:20:20 +01:00
Silvan Fuhrer 896c08bd68 COMMON_DISTANCE_SENSOR: remove srf02 from the list
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2024-12-13 11:40:59 +01:00
Silvan Fuhrer f4b5d8e3d8 COMMON_DISTANCE_SENSOR: remove gy_us42 from the list
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2024-12-13 11:40:59 +01:00
Silvan Fuhrer 0b4b794de7 COMMON_DISTANCE_SENSOR: remove leddar_one from the list
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2024-12-13 11:40:59 +01:00
bresch cc92979b06 ekf-agp: fix timeout 2024-12-12 15:49:04 +01:00
Pernilla fc6c678274 Remove gz-garden as it reached EOL 2024-12-12 15:11:54 +01:00
Matthias Grob d5c9ea048e LidarLitePWM: refactor static cast and comment 2024-12-12 13:50:17 +01:00
Matthias Grob 5010b01e2e PCF8583: refactor 1e6f for 1000000.f 2024-12-12 13:50:17 +01:00
Matthias Grob cbde9729e8 Airframes: remove unnecessary double newlines 2024-12-12 13:50:17 +01:00
Julian Oes 091974e6c5 listener: only clear screen with multiple messages (#24019)
* listener: only clear screen with multiple messages

* listener: fully clear before printing again

Otherwise, we end up seeing artifacts from the previous print.
2024-12-11 10:00:36 +13:00
Vincent Poon 0f1a4eb72c update H-Flow Boot config and add stm32_configgpio (#24086) 2024-12-11 09:49:06 +13:00
Alexander Lerach bdbf7fd1dd Also consider targets that include a '-' (#24087) 2024-12-10 11:05:55 +01:00
Alexander Lerach f9ecc0fcd1 Added various features to flash analysis (#24072)
* Added various features to flash analysis (also run with FLASH overflow, summary in comment output, newer bloaty version, only add comment if change is large enough, ...)

* Added feedback from review

* Use wildcards

* Removed backward-compat logic and use correct base
2024-12-10 10:15:49 +01:00
Riccardo Mengoli 09cd42911d Mission: Replay gimbal cached items before reaching mission waypoint (#24085)
When flying patterns, photos are sometimes taken while the gimbal is pitching up or down. To address this, we orient the gimbal before reaching the mission waypoint, allowing more time to complete the action. Additionally, we verify if the vehicle is climbing to avoid orienting the gimbal while on the ground.
2024-12-10 09:20:53 +01:00
PX4 BuildBot 430f0888b3 update all px4board kconfig 2024-12-06 22:09:46 -05:00
Jaeyoung Lim 197aed8bdd Add mavlink stream for plane camera (#24081) 2024-12-06 14:52:54 +01:00
Jari Nippula 814b243931 Tools/decrypt_ulog.py: support for .ulge log files 2024-12-05 07:25:29 +01:00
Jari Nippula 2da944a834 Logger: combined key & cipher file
Use one single .ulge file to store both wrapped symmetric key and
encrypted ulog data instead of creating separate .ulgk/ulgc files
2024-12-05 07:25:29 +01:00
Jacob Dahl ae61b4bfe0 params: flash: erase corrupt sector (#24065) 2024-12-05 07:24:56 +01:00
Julian Oes 1778692ca2 gps: heading fixes for NMEA/Unicore
This updates the GPS submodule which includes NMEA/Unicore fixes:

- Add correct return value for sat infos
- Only publish on position updates
- Request required topics at 5 Hz for Unicore
2024-12-05 08:58:22 +13:00
Ramon Roche 28487350d3 ci: update actions and images
Updates some actions to run build steps in container instead of the
whole workflow.
2024-12-04 12:59:27 -05:00
Matthias Grob d416cd2a6c Commander: remove COM_POS_FS_DELAY
A user configurable delay for the internal `vehicle_local_position` seems confusing in my eyes. It's a different timeout for fixed-wing and multirotor which might have made sense earlier but not really anymore since the topic is constantly published by the estimator and not expected to time out on either vehicle type and the parameter description is also misleading because it's outdated.
2024-12-03 17:31:56 +01:00
Perre dfa48f988d ESC check: Avoid unsigned timestamp underflow in telemtry timeout (#24069)
* Avoid unsigned integer underflow

* ESC check: add brackets to timeout for readability

---------

Co-authored-by: Matthias Grob <maetugr@gmail.com>
2024-12-03 17:14:09 +01:00
bresch 8626019ae0 EKF2: reset global position using variance 2024-12-03 13:04:25 +01:00
bresch 6b637f82f8 lla; fix conversion to ECEF 2024-12-03 13:03:54 +01:00
Perre 4696338d29 Add gz model for quadtailsitter (#23943)
* Add gazebo airspeed plugin and add a tailsitter model
---------

Co-authored-by: Claudio Chies <61051109+Claudio-Chies@users.noreply.github.com>
2024-12-02 17:27:23 +01:00
Claudio Chies 1a165a4956 Added possibility to modify the start position from external sources, as its done in the _getMaxXYSpeed 2024-12-02 14:52:31 +01:00
Matthias Grob 7dcfeb2f77 PositionSmoothing: refactor _getMaxZSpeed() 2024-12-02 14:52:31 +01:00
Matthias Grob 092e5e8f9d TrajectoryConstraints: clarify waypoint indexing 2024-12-02 14:52:31 +01:00
Claudio Chies 06dde4ede8 MPC: PositonSmoothing, change test to reflect that we have to come inwithing the acceptance radius, and not exact position. 2024-12-02 14:52:31 +01:00
Claudio Chies 72e758950b Included turning radius calculations for vertical changes and removed the requirement for the same altitude in the 2D turning radius logic. 2024-12-02 14:52:31 +01:00
Hamish Willee 5ce2bf662b airframes markdownout.py - br rather than p for generated code 2024-12-02 11:55:25 +01:00
chfriedrich98 be2a3afb83 mecanum: update parameter description 2024-12-02 10:54:43 +01:00
chfriedrich98 ff55313b0b mecanum: update current position in main file 2024-12-02 10:54:43 +01:00
chfriedrich98 a1b68fcac2 mecanum: update SITL airframe parameters 2024-12-02 10:54:43 +01:00
chfriedrich98 369ce37d65 mecanum: adjust speed setpoints to always be feasible 2024-12-02 10:54:43 +01:00
chfriedrich98 2eda5659eb mecanum: fix inverse kinematics 2024-12-02 10:54:43 +01:00
chfriedrich98 5dcccd999c mecanum: add slew rates to yaw, yaw rate and speed setpoints 2024-12-02 10:54:43 +01:00
chfriedrich98 54abc59283 mecanum: deprecate RM_MAN_YAW_SCALE 2024-12-02 10:54:43 +01:00
chfriedrich98 6cce443005 mecanum: deprecate RM_MISS_SPD_DEF 2024-12-02 10:54:43 +01:00
chfriedrich98 7e705bbf55 differential: add slow down effect in mission mode 2024-12-02 10:44:22 +01:00
chfriedrich98 8880569b31 differential: adjust speed setpoint based on yaw rate setpoint 2024-12-02 10:44:22 +01:00
bresch b06ff99a3e disable SIH on x21-777 and v6u to save flash 2024-11-29 14:21:29 +01:00
Marco Hauswirth db0160bf7c fix sih hitl plane airframe 2024-11-29 14:21:29 +01:00
bresch 8b1975cb98 SIH: lower IMU noise before takeoff
This speeds-up the EKF alignment
2024-11-29 14:21:29 +01:00
bresch b30ea40c6d SIH: set GNSS delay to 0 as delay is not simulated 2024-11-29 14:21:29 +01:00
bresch cd18138b1c SIH: add transport rate acceleration to local acceleration 2024-11-29 14:21:29 +01:00
bresch 674aa474e7 SIH: use LatLonAlt class 2024-11-29 14:21:29 +01:00
bresch 189122d553 lla: add gravity constant at equator 2024-11-29 14:21:29 +01:00
bresch b6658df169 lla: move to lib directory 2024-11-29 14:21:29 +01:00
bresch 7cf42727fb lla: add functions to convert from and to ECEF 2024-11-29 14:21:29 +01:00
bresch 7ee69d616d SIH: rework FW ground contact 2024-11-29 14:21:29 +01:00
bresch 5d33971712 SIH: refactor MC ground contact 2024-11-29 14:21:29 +01:00
bresch 9b172d36a2 matrix: allow casting float<->double 2024-11-29 14:21:29 +01:00
Marco Hauswirth 5d7b734bc9 SIH: ellipsoidal earth model
SIH: use projection functions and constants from geo lib

SIH: remove unnecessary member variable

SIH: clarify names of rotation matrices and frames

SIH: do not store DCM corresponding to quaternion attitude

Using DCM is more efficient when more than 1 rotation needs to be done,
which is not the case here.

SIH: don't store local variable as member

SIH: use Wgs84 constants everywhere

SIH: do not store delta_quaternion

Converting an AxisAngle to a Quaternion uses the exponenial

SIH: organise ECEF member variables

SIH: add earth spin rate to gyro data

Co-authored-by: bresch <brescianimathieu@gmail.com>
2024-11-29 14:21:29 +01:00
Matthias Grob ce3fcd503f navigator: unify timeout waiting for payload to execute mission item command
Used for winch, gripper, gimbal to reach the desired state before continuing the mission.
Ideally we'd have feedback from all these components and not just a feed-forward delay.
2024-11-28 20:23:36 +01:00
Matthias Grob 17c24bafbc mission_block: simplify timeout check 2024-11-28 20:23:36 +01:00
Matthias Grob ec1cf04bc9 mission_block: fix style, shorten debug message strings 2024-11-28 20:23:36 +01:00
Stefano Colli 8b3c78a0a4 Navigator: add optional delay after gimbal mission items 2024-11-28 20:23:36 +01:00
Sergei Grichine ab320017cc boards: emlid_navio - support 64-bit OS on Raspberry Pi 4,5 (#24006)
adds the `emlid_navio2_arm64` build target - supports 64-bit OS on Raspberry Pi 4,5 (#24006)
2024-11-28 08:44:44 -08:00
Julian Oes 95b5859913 boards: add SPA06 to KakuteH7/H7mini/H7v2 boards 2024-11-28 12:18:44 +13:00
Julian Oes def6ab5a6b drivers: add SPA06 2024-11-28 12:18:44 +13:00
Julian Oes f7b62961cb drivers: Copy SPL06 to SPA06 2024-11-28 12:18:44 +13:00
Ramon Roche 1b6215fcf3 readme: update ci badge 2024-11-27 17:41:43 -05:00
Daniel Agar 990b067b25 uxrce_dds_client: update cmake requirements to match Micro-XRCE-DDS-Client submodule 2024-11-27 14:09:13 -08:00
Daniel Agar 68cbbaab92 Tools/astyle: check_code_style_all.sh skip pre-commit hook if non-interactive 2024-11-27 13:51:10 -08:00
Ramon Roche 22c1f07f0c container: use PX4 tags whiel tagging images 2024-11-27 16:42:13 -05:00
Ramon Roche f2bbb6f407 ci: disable publishing PR images to docker hub
Docker hub is rate limiting our API access, as a result tests are
failing for no apparent reason. This change will decrease the API calls
by at least 80%

We have applied for an Open Source account with greater API limits, I
will come back to this and update as necessary when and if they grant us
access to their program.
2024-11-27 16:42:13 -05:00
bresch 85bc8ef885 SIH-plane: fix actuator mapping 2024-11-27 11:14:56 -05:00
bresch 8a9bac29a2 SIH-FW: allow pitching up during takeoff
Otherwise difficult to get lift
2024-11-27 11:14:56 -05:00
bresch 7236ef2d17 SIH-FW: fix aileron and elevator signs
This broken when changing from mixer files to the control allocation module.
2024-11-27 11:14:56 -05:00
bresch 1dad25b763 SIH: do not assume being a tailsitter when creating airspeed measurement 2024-11-27 11:14:56 -05:00
Matthias Grob a280d67be8 PID: Fix test to respect integral updates being applied in the next iteration
Co-authored-by: chfriedrich98 <125505139+chfriedrich98@users.noreply.github.com>
2024-11-26 16:13:48 +01:00
Matthias Grob f9bcbc31ae PID: protect from division by zero because of dt
Co-authored-by: chfriedrich98 <125505139+chfriedrich98@users.noreply.github.com>
2024-11-26 16:13:48 +01:00
Matthias Grob b89c53d28c Replace old pid library with new one 2024-11-26 16:13:48 +01:00
Matthias Grob e047972cde Add new C++ PID library 2024-11-26 16:13:48 +01:00
Daniel Agar e194a52907 ekf2: derivation.py remove sideslip small angle approximation 2024-11-25 08:53:57 +01:00
214 changed files with 4393 additions and 2087 deletions
+20 -21
View File
@@ -25,28 +25,27 @@ jobs:
"NO_NINJA_BUILD=1 px4_fmu-v5_default",
"NO_NINJA_BUILD=1 px4_sitl_default",
"px4_sitl_allyes",
"airframe_metadata",
"module_documentation",
"parameters_metadata",
]
container:
image: px4io/px4-dev-nuttx-focal:2022-08-12
options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v1
with:
token: ${{ secrets.ACCESS_TOKEN }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: check environment
run: |
export
ulimit -a
- name: ${{matrix.check}}
run: make ${{matrix.check}}
- name: upload coverage
if: contains(matrix.check, 'coverage')
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
file: coverage/lcov.info
- name: Building [${{ matrix.check }}]
uses: addnab/docker-run-action@v3
with:
image: px4io/px4-dev-nuttx-focal:2022-08-12
options: -v ${{ github.workspace }}:/workspace
run: |
cd /workspace
git config --global --add safe.directory /workspace
make ${{ matrix.check }}
- name: Uploading Coverage to Codecov.io
if: contains(matrix.check, 'coverage')
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
file: coverage/lcov.info
+10 -6
View File
@@ -11,13 +11,17 @@ on:
jobs:
build:
runs-on: ubuntu-latest
container: px4io/px4-dev-clang:2021-09-08
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
with:
token: ${{secrets.ACCESS_TOKEN}}
fetch-depth: 0
- uses: corrupt952/actions-retry-command@v1.0.7
- name: Testing (clang-tidy-quiet)
uses: addnab/docker-run-action@v3
with:
command: make clang-tidy-quiet
max_attempts: 3
image: px4io/px4-dev-clang:2021-09-08
options: -v ${{ github.workspace }}:/workspace
run: |
cd /workspace
git config --global --add safe.directory /workspace
make clang-tidy-quiet
+3 -5
View File
@@ -19,13 +19,11 @@ jobs:
]
steps:
- name: install Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: actions/checkout@v1
with:
token: ${{secrets.ACCESS_TOKEN}}
- uses: actions/checkout@v4
- name: setup
run: ./Tools/setup/macos.sh; ./Tools/setup/macos.sh
@@ -37,7 +35,7 @@ jobs:
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
- name: ccache cache files
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.ccache
key: macos_${{matrix.config}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
+9 -4
View File
@@ -25,8 +25,14 @@ jobs:
submodules: false
fetch-depth: 0
- name: Set PX4 Tag
id: px4-tag
run: |
echo "tag=$(git describe --tags --match 'v[0-9]*')" >> $GITHUB_OUTPUT
- name: Login to Docker Hub
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
@@ -44,16 +50,15 @@ jobs:
with:
images: |
ghcr.io/PX4/px4-dev
px4io/px4-dev
${{ (github.event_name != 'pull_request') && 'px4io/px4-dev' || '' }}
tags: |
type=schedule
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=ref,event=branch,suffix=-{{date 'YYYYMMDD'}},priority=600
type=ref,event=branch,value=${{ steps.px4-tag.outputs.tag }},priority=700
type=ref,event=branch,suffix=-{{date 'YYYY-MM-DD'}},priority=600
type=ref,event=branch,suffix=,priority=500
type=ref,event=pr
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
@@ -1,21 +1,28 @@
name: EKF Change Indicator
on: pull_request
on:
pull_request:
branches:
- '*'
jobs:
unit_tests:
runs-on: ubuntu-latest
container: px4io/px4-dev-base-focal:2021-09-08
steps:
- uses: actions/checkout@v2.3.1
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: checkout newest version of branch
run: |
git fetch origin pull/${{github.event.pull_request.number}}/head:${{github.head_ref}}
git checkout ${GITHUB_HEAD_REF}
- name: main test
run: make tests TESTFILTER=EKF
uses: addnab/docker-run-action@v3
with:
image: px4io/px4-dev-base-focal:2021-09-08
options: -v ${{ github.workspace }}:/workspace
run: |
cd /workspace
git config --global --add safe.directory /workspace
make tests TESTFILTER=EKF
- name: Check if there is a functional change
run: git diff --exit-code
working-directory: src/modules/ekf2/test/change_indication
@@ -5,25 +5,40 @@ on: push
jobs:
unit_tests:
runs-on: ubuntu-latest
container: px4io/px4-dev-base-focal:2021-09-08
env:
GIT_COMMITTER_EMAIL: bot@px4.io
GIT_COMMITTER_NAME: PX4BuildBot
steps:
- uses: actions/checkout@v2.3.1
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: main test updates change indication files
run: make tests TESTFILTER=EKF
- name: main test
uses: addnab/docker-run-action@v3
with:
image: px4io/px4-dev-base-focal:2021-09-08
options: -v ${{ github.workspace }}:/workspace
run: |
cd /workspace
git config --global --add safe.directory /workspace
make tests TESTFILTER=EKF
- name: Check if there exists diff and save result in variable
run: echo "CHANGE_INDICATED=$(git diff --exit-code --output=/dev/null || echo $?)" >> $GITHUB_ENV
id: diff-check
run: echo "CHANGE_INDICATED=$(git diff --exit-code --output=/dev/null || echo $?)" >> $GITHUB_OUTPUT
working-directory: src/modules/ekf2/test/change_indication
- name: auto-commit any changes to change indication
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: '[AUTO COMMIT] update change indication'
file_pattern: 'src/modules/ekf2/test/change_indication/*.csv'
commit_user_name: ${GIT_COMMITTER_NAME}
commit_user_email: ${GIT_COMMITTER_EMAIL}
- if: ${{env.CHANGE_INDICATED}}
name: if there is a functional change, fail check
commit_message: |
'[AUTO COMMIT] update change indication'
See .github/workflopws/ekf_update_change_indicator.yml for more details
- name: if there is a functional change, fail check
if: ${{ steps.diff-check.outputs.CHANGE_INDICATED }}
run: exit 1
+19 -17
View File
@@ -24,21 +24,23 @@ jobs:
image: px4io/px4-dev-nuttx-focal:2022-08-12
options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v1
with:
token: ${{ secrets.ACCESS_TOKEN }}
- name: Install Node v20.18.0
uses: actions/setup-node@v4
with:
node-version: 20.18.0
- name: check environment
run: |
export
ulimit -a
- name: install emscripten
run: |
git clone https://github.com/emscripten-core/emsdk.git _emscripten_sdk
cd _emscripten_sdk
./emsdk install latest
./emsdk activate latest
- name: ${{matrix.check}}
run: |
. ./_emscripten_sdk/emsdk_env.sh
make ${{matrix.check}}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install empscripten
run: |
git clone https://github.com/emscripten-core/emsdk.git _emscripten_sdk
cd _emscripten_sdk
./emsdk install latest
./emsdk activate latest
- name: Testing [${{ matrix.check }}]
run: |
. ./_emscripten_sdk/emsdk_env.sh
make ${{ matrix.check }}
+39 -16
View File
@@ -8,6 +8,10 @@ on:
branches:
- '*'
env:
MIN_FLASH_POS_DIFF_FOR_COMMENT: 50
MIN_FLASH_NEG_DIFF_FOR_COMMENT: -50
jobs:
analyze_flash:
name: Analyzing ${{ matrix.target }}
@@ -18,8 +22,10 @@ jobs:
matrix:
target: [px4_fmu-v5x, px4_fmu-v6x]
outputs:
px4_fmu-v5x: ${{ steps.gen-output.outputs.output_px4_fmu-v5x }}
px4_fmu-v6x: ${{ steps.gen-output.outputs.output_px4_fmu-v6x }}
px4_fmu-v5x-bloaty-output: ${{ steps.gen-output.outputs.px4_fmu-v5x-bloaty-output }}
px4_fmu-v5x-bloaty-summary-map: ${{ steps.gen-output.outputs.px4_fmu-v5x-bloaty-summary-map }}
px4_fmu-v6x-bloaty-output: ${{ steps.gen-output.outputs.px4_fmu-v6x-bloaty-output }}
px4_fmu-v6x-bloaty-summary-map: ${{ steps.gen-output.outputs.px4_fmu-v6x-bloaty-summary-map }}
steps:
- uses: actions/checkout@v4
with:
@@ -30,19 +36,20 @@ jobs:
run: git config --system --add safe.directory '*'
- name: Build Target
run: make ${{ matrix.target }}
run: make ${{ matrix.target }}_flash-analysis
- name: Store the ELF with the change
run: cp ./build/${{ matrix.target }}_default/${{ matrix.target }}_default.elf ./with-change.elf
run: cp ./build/**/*.elf ./with-change.elf
- name: Clean previous build
run: |
make clean
make distclean
- name: If it's a PR checkout the base commit
- name: If it's a PR checkout the base branch
if: ${{ github.event.pull_request }}
run: git checkout ${{ github.event.pull_request.base.sha }}
# As checkout creates a merge commit (merging the base branch into the PR branch), the base branch is the base for a diff of the PR changes.
run: git checkout ${{ github.event.pull_request.base.ref }}
- name: If it's a push checkout the previous commit
if: github.event_name == 'push'
@@ -52,30 +59,39 @@ jobs:
run: make submodulesupdate
- name: Build
run: make ${{ matrix.target }}
run: make ${{ matrix.target }}_flash-analysis
- name: Store the ELF before the change
run: cp ./build/${{ matrix.target }}_default/${{ matrix.target }}_default.elf ./before-change.elf
run: cp ./build/**/*.elf ./before-change.elf
- name: bloaty-action
uses: carlosperate/bloaty-action@v1.1.0
uses: PX4/bloaty-action@v1.0.0
id: bloaty-step
with:
bloaty-args: -d sections,compileunits -n 0 ./with-change.elf -- ./before-change.elf
bloaty-file-args: ./with-change.elf -- ./before-change.elf
bloaty-additional-args: -d sections,compileunits -s vm -n 20
output-to-summary: true
- name: Generate output
id: gen-output
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "output_${{ matrix.target }}<<$EOF" >> $GITHUB_OUTPUT
echo "${{ matrix.target }}-bloaty-output<<$EOF" >> $GITHUB_OUTPUT
echo "${{ steps.bloaty-step.outputs.bloaty-output-encoded }}" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
echo "${{ matrix.target }}-bloaty-summary-map<<$EOF" >> $GITHUB_OUTPUT
echo '${{ steps.bloaty-step.outputs.bloaty-summary-map }}' >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
post_pr_comment:
name: Publish Results
runs-on: [runs-on,runner=1cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false]
needs: [analyze_flash]
env:
V5X-SUMMARY-MAP-ABS: ${{ fromJSON(fromJSON(needs.analyze_flash.outputs.px4_fmu-v5x-bloaty-summary-map).vm-absolute) }}
V5X-SUMMARY-MAP-PERC: ${{ fromJSON(fromJSON(needs.analyze_flash.outputs.px4_fmu-v5x-bloaty-summary-map).vm-percentage) }}
V6X-SUMMARY-MAP-ABS: ${{ fromJSON(fromJSON(needs.analyze_flash.outputs.px4_fmu-v6x-bloaty-summary-map).vm-absolute) }}
V6X-SUMMARY-MAP-PERC: ${{ fromJSON(fromJSON(needs.analyze_flash.outputs.px4_fmu-v6x-bloaty-summary-map).vm-percentage) }}
if: ${{ github.event.pull_request }}
steps:
- name: Find Comment
@@ -92,25 +108,32 @@ jobs:
echo "timestamp=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_OUTPUT
- name: Create or update comment
# This can't be moved to the job-level conditions, as GH actions don't allow a job-level if condition to access the env.
if: |
steps.fc.outputs.comment-id != '' ||
env.V5X-SUMMARY-MAP-ABS >= fromJSON(env.MIN_FLASH_POS_DIFF_FOR_COMMENT) ||
env.V5X-SUMMARY-MAP-ABS <= fromJSON(env.MIN_FLASH_NEG_DIFF_FOR_COMMENT) ||
env.V6X-SUMMARY-MAP-ABS >= fromJSON(env.MIN_FLASH_POS_DIFF_FOR_COMMENT) ||
env.V6X-SUMMARY-MAP-ABS <= fromJSON(env.MIN_FLASH_NEG_DIFF_FOR_COMMENT)
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
## FLASH Analysis
## 🔎 FLASH Analysis
<details>
<summary>px4_fmu-v5x</summary>
<summary>px4_fmu-v5x [Total VM Diff: ${{ env.V5X-SUMMARY-MAP-ABS }} byte (${{ env.V5X-SUMMARY-MAP-PERC}} %)]</summary>
```
${{ needs.analyze_flash.outputs.px4_fmu-v5x }}
${{ needs.analyze_flash.outputs.px4_fmu-v5x-bloaty-output }}
```
</details>
<details>
<summary>px4_fmu-v6x</summary>
<summary>px4_fmu-v6x [Total VM Diff: ${{ env.V6X-SUMMARY-MAP-ABS }} byte (${{ env.V6X-SUMMARY-MAP-PERC }} %)]</summary>
```
${{ needs.analyze_flash.outputs.px4_fmu-v6x }}
${{ needs.analyze_flash.outputs.px4_fmu-v6x-bloaty-output }}
```
</details>
+14 -119
View File
@@ -11,131 +11,26 @@ on:
jobs:
build:
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
strategy:
fail-fast: false
matrix:
config:
- {vehicle: "iris", mission: "MC_mission_box", build_type: "RelWithDebInfo"}
- {vehicle: "rover", mission: "rover_mission_1", build_type: "RelWithDebInfo"}
#- {vehicle: "plane", mission: "FW_mission_1", build_type: "RelWithDebInfo"}
#- {vehicle: "plane_catapult",mission: "FW_mission_1", build_type: "RelWithDebInfo"}
#- {vehicle: "standard_vtol", mission: "VTOL_mission_1", build_type: "Coverage"}
#- {vehicle: "standard_vtol", mission: "VTOL_mission_1", build_type: "AddressSanitizer"}
#- {vehicle: "tailsitter", mission: "VTOL_mission_1", build_type: "RelWithDebInfo"}
#- {vehicle: "tiltrotor", mission: "VTOL_mission_1", build_type: "RelWithDebInfo"}
- {vehicle: "iris", mission: "MC_mission_box"}
- {vehicle: "rover", mission: "rover_mission_1"}
container:
image: px4io/px4-dev-ros-melodic:2021-09-08
options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
with:
token: ${{ secrets.ACCESS_TOKEN }}
fetch-depth: 0
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
- name: ccache cache files
uses: actions/cache@v2
- name: Build SITL and Run Tests
uses: addnab/docker-run-action@v3
with:
path: ~/.ccache
key: sitl_tests-${{matrix.config.build_type}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: sitl_tests-${{matrix.config.build_type}}-ccache-
- name: setup ccache
run: |
mkdir -p ~/.ccache
echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf
echo "compression = true" >> ~/.ccache/ccache.conf
echo "compression_level = 6" >> ~/.ccache/ccache.conf
echo "max_size = 100M" >> ~/.ccache/ccache.conf
echo "hash_dir = false" >> ~/.ccache/ccache.conf
ccache -s
ccache -z
- name: check environment
run: |
export
ulimit -a
- name: Build PX4 and sitl_gazebo-classic
env:
PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}}
run: |
ccache -z
make px4_sitl_default
make px4_sitl_default sitl_gazebo-classic
ccache -s
- name: Core dump settings
run: |
ulimit -c unlimited
echo "`pwd`/%e.core" > /proc/sys/kernel/core_pattern
- name: Run SITL tests
env:
PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}}
run: |
export
./test/rostest_px4_run.sh mavros_posix_test_mission.test mission:=${{matrix.config.mission}} vehicle:=${{matrix.config.vehicle}}
timeout-minutes: 45
- name: Look at core files
if: failure()
run: gdb build/px4_sitl_default/bin/px4 px4.core -ex "thread apply all bt" -ex "quit"
- name: Upload px4 coredump
if: failure()
uses: actions/upload-artifact@v3
with:
name: coredump
path: px4.core
- name: ecl EKF analysis
if: always()
run: ./Tools/ecl_ekf/process_logdata_ekf.py ~/.ros/log/*/*.ulg || true
- name: Upload logs to flight review
if: always()
run: ./Tools/upload_log.py -q --description "${GITHUB_WORKFLOW} ${GITHUB_RUN_ID}" --feedback "${GITHUB_WORKFLOW} ${GITHUB_RUN_ID} ${GITHUB_REPOSITORY} ${GITHUB_REF}" --source CI ~/.ros/log/*/*.ulg
- name: Upload px4 binary
if: failure()
uses: actions/upload-artifact@v3
with:
name: binary
path: build/px4_sitl_default/bin/px4
- name: Store PX4 log
if: failure()
uses: actions/upload-artifact@v3
with:
name: px4_log
path: ~/.ros/log/*/*.ulg
- name: Store ROS log
if: failure()
uses: actions/upload-artifact@v3
with:
name: ros_log
path: ~/.ros/**/rostest-*.log
# Report test coverage
- name: Upload coverage
if: contains(matrix.config.build_type, 'Coverage')
run: |
git config --global credential.helper "" # disable the keychain credential helper
git config --global --add credential.helper store # enable the local store credential helper
echo "https://x-access-token:${{ secrets.ACCESS_TOKEN }}@github.com" >> ~/.git-credentials # add credential
git config --global url."https://github.com/".insteadof git@github.com: # credentials add credential
mkdir -p coverage
lcov --directory build/px4_sitl_default --base-directory build/px4_sitl_default --gcov-tool gcov --capture -o coverage/lcov.info
- name: Upload coverage information to Codecov
if: contains(matrix.config.build_type, 'Coverage')
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: mavros_mission
file: coverage/lcov.info
image: px4io/px4-dev-ros-melodic:2021-09-08
options: -v ${{ github.workspace }}:/workspace
run: |
cd /workspace
git config --global --add safe.directory /workspace
make px4_sitl_default
make px4_sitl_default sitl_gazebo-classic
./test/rostest_px4_run.sh mavros_posix_test_mission.test mission:=${{matrix.config.mission}} vehicle:=${{matrix.config.vehicle}}
+13 -112
View File
@@ -17,120 +17,21 @@ jobs:
fail-fast: false
matrix:
config:
- {test_file: "mavros_posix_tests_offboard_posctl.test", vehicle: "iris", build_type: "RelWithDebInfo"}
#- {test_file: "mavros_posix_tests_offboard_attctl.test", vehicle: "iris", build_type: "RelWithDebInfo"}
#- {test_file: "mavros_posix_tests_offboard_rpyrt_ctl.test", vehicle: "iris", build_type: "RelWithDebInfo"}
- {test_file: "mavros_posix_tests_offboard_posctl.test", vehicle: "iris"}
container:
image: px4io/px4-dev-ros-melodic:2021-09-08
options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
with:
token: ${{ secrets.ACCESS_TOKEN }}
fetch-depth: 0
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
- name: ccache cache files
uses: actions/cache@v2
- name: Build PX4 and Run Tests
uses: addnab/docker-run-action@v3
with:
path: ~/.ccache
key: sitl_tests-${{matrix.config.build_type}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: sitl_tests-${{matrix.config.build_type}}-ccache-
- name: setup ccache
run: |
mkdir -p ~/.ccache
echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf
echo "compression = true" >> ~/.ccache/ccache.conf
echo "compression_level = 6" >> ~/.ccache/ccache.conf
echo "max_size = 100M" >> ~/.ccache/ccache.conf
echo "hash_dir = false" >> ~/.ccache/ccache.conf
ccache -s
ccache -z
- name: check environment
run: |
export
ulimit -a
- name: Build PX4 and sitl_gazebo-classic
env:
PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}}
run: |
ccache -z
make px4_sitl_default
make px4_sitl_default sitl_gazebo-classic
ccache -s
- name: Core dump settings
run: |
ulimit -c unlimited
echo "`pwd`/%e.core" > /proc/sys/kernel/core_pattern
- name: Run SITL tests
env:
PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}}
run: |
export
./test/rostest_px4_run.sh ${{matrix.config.test_file}} vehicle:=${{matrix.config.vehicle}}
timeout-minutes: 45
- name: Look at core files
if: failure()
run: gdb build/px4_sitl_default/bin/px4 px4.core -ex "thread apply all bt" -ex "quit"
- name: Upload px4 coredump
if: failure()
uses: actions/upload-artifact@v3
with:
name: coredump
path: px4.core
- name: ecl EKF analysis
if: always()
run: ./Tools/ecl_ekf/process_logdata_ekf.py ~/.ros/log/*/*.ulg || true
- name: Upload logs to flight review
if: always()
run: ./Tools/upload_log.py -q --description "${GITHUB_WORKFLOW} ${GITHUB_RUN_ID}" --feedback "${GITHUB_WORKFLOW} ${GITHUB_RUN_ID} ${GITHUB_REPOSITORY} ${GITHUB_REF}" --source CI ~/.ros/log/*/*.ulg
- name: Upload px4 binary
if: failure()
uses: actions/upload-artifact@v3
with:
name: binary
path: build/px4_sitl_default/bin/px4
- name: Store PX4 log
if: failure()
uses: actions/upload-artifact@v3
with:
name: px4_log
path: ~/.ros/log/*/*.ulg
- name: Store ROS log
if: failure()
uses: actions/upload-artifact@v3
with:
name: ros_log
path: ~/.ros/**/rostest-*.log
# Report test coverage
- name: Upload coverage
if: contains(matrix.config.build_type, 'Coverage')
run: |
git config --global credential.helper "" # disable the keychain credential helper
git config --global --add credential.helper store # enable the local store credential helper
echo "https://x-access-token:${{ secrets.ACCESS_TOKEN }}@github.com" >> ~/.git-credentials # add credential
git config --global url."https://github.com/".insteadof git@github.com: # credentials add credential
mkdir -p coverage
lcov --directory build/px4_sitl_default --base-directory build/px4_sitl_default --gcov-tool gcov --capture -o coverage/lcov.info
- name: Upload coverage information to Codecov
if: contains(matrix.config.build_type, 'Coverage')
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: mavros_offboard
file: coverage/lcov.info
image: px4io/px4-dev-ros-melodic:2021-09-08
options: -v ${{ github.workspace }}:/workspace
run: |
cd /workspace
git config --global --add safe.directory /workspace
make px4_sitl_default
make px4_sitl_default sitl_gazebo-classic
./test/rostest_px4_run.sh ${{matrix.config.test_file}} vehicle:=${{matrix.config.vehicle}}
+19 -14
View File
@@ -11,22 +11,27 @@ on:
jobs:
build:
runs-on: ubuntu-latest
container: px4io/px4-dev-nuttx-focal:2022-08-12
strategy:
matrix:
config: [
px4_fmu-v5,
px4_fmu-v5_default,
]
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
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build PX4 and Run Test [${{ matrix.config }}]
uses: addnab/docker-run-action@v3
with:
image: px4io/px4-dev-nuttx-focal:2022-08-12
options: -v ${{ github.workspace }}:/workspace
run: |
cd /workspace
git config --global --add safe.directory /workspace
export PX4_EXTRA_NUTTX_CONFIG="CONFIG_NSH_LOGIN_PASSWORD=\"test\";CONFIG_NSH_CONSOLE_LOGIN=y"
echo "PX4_EXTRA_NUTTX_CONFIG: $PX4_EXTRA_NUTTX_CONFIG"
make ${{ matrix.config }} nuttx_context
echo "Check that the config option is set"
grep CONFIG_NSH_LOGIN_PASSWORD build/${{ matrix.config }}/NuttX/nuttx/.config
+6 -2
View File
@@ -12,14 +12,18 @@ jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
with:
token: ${{ secrets.ACCESS_TOKEN }}
fetch-depth: 0
- name: Install Python3
run: sudo apt-get install python3 python3-setuptools python3-pip -y
- name: Install tools
run: python3 -m pip install mypy types-requests flake8 --break-system-packages
- name: Check MAVSDK test scripts with mypy
run: $HOME/.local/bin/mypy --strict test/mavsdk_tests/*.py
- name: Check MAVSDK test scripts with flake8
run: $HOME/.local/bin/flake8 test/mavsdk_tests/*.py
Vendored
+4
View File
@@ -231,9 +231,13 @@ 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/msg/versioned/*.msg')
sh('rm -f px4_msgs/srv/*.srv')
sh('rm -f px4_msgs/srv/versioned/*.srv')
sh('cp msg/*.msg px4_msgs/msg/')
sh('mkdir -p px4_msgs/msg/versioned && cp msg/versioned/*.msg px4_msgs/msg/versioned/')
sh('cp srv/*.srv px4_msgs/srv/')
sh('mkdir -p px4_msgs/srv/versioned && cp srv/versioned/*.srv px4_msgs/srv/versioned/')
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')
+1 -1
View File
@@ -2,7 +2,7 @@
[![Releases](https://img.shields.io/github/release/PX4/PX4-Autopilot.svg)](https://github.com/PX4/PX4-Autopilot/releases) [![DOI](https://zenodo.org/badge/22634/PX4/PX4-Autopilot.svg)](https://zenodo.org/badge/latestdoi/22634/PX4/PX4-Autopilot)
[![Nuttx Targets](https://github.com/PX4/PX4-Autopilot/workflows/Nuttx%20Targets/badge.svg)](https://github.com/PX4/PX4-Autopilot/actions?query=workflow%3A%22Nuttx+Targets%22?branch=master) [![SITL Tests](https://github.com/PX4/PX4-Autopilot/workflows/SITL%20Tests/badge.svg?branch=master)](https://github.com/PX4/PX4-Autopilot/actions?query=workflow%3A%22SITL+Tests%22)
[![Build Targets](https://github.com/PX4/PX4-Autopilot/actions/workflows/build_all_targets.yml/badge.svg?branch=main)](https://github.com/PX4/PX4-Autopilot/actions/workflows/build_all_targets.yml) [![SITL Tests](https://github.com/PX4/PX4-Autopilot/workflows/SITL%20Tests/badge.svg?branch=master)](https://github.com/PX4/PX4-Autopilot/actions?query=workflow%3A%22SITL+Tests%22)
[![Discord Shield](https://discordapp.com/api/guilds/1022170275984457759/widget.png?style=shield)](https://discord.gg/dronecode)
@@ -38,4 +38,6 @@ param set-default PWM_MAIN_FUNC2 102
param set-default PWM_MAIN_FUNC3 103
param set-default PWM_MAIN_FUNC4 104
param set-default EKF2_GPS_DELAY 0
param set SIH_VEHICLE_TYPE 0
@@ -45,7 +45,9 @@ param set-default CA_SV_CS1_TRQ_P 1
param set-default CA_SV_CS1_TYPE 3
param set-default CA_SV_CS2_TRQ_Y 1
param set-default CA_SV_CS2_TYPE 4
param set-default PWM_MAIN_FUNC3 201
param set-default PWM_MAIN_FUNC4 202
param set-default PWM_MAIN_FUNC5 203
param set-default PWM_MAIN_FUNC6 101
param set-default PWM_MAIN_FUNC1 201
param set-default PWM_MAIN_FUNC2 202
param set-default PWM_MAIN_FUNC3 203
param set-default PWM_MAIN_FUNC4 101
param set-default EKF2_GPS_DELAY 0
@@ -11,6 +11,7 @@
PX4_SIMULATOR=${PX4_SIMULATOR:=sihsim}
PX4_SIM_MODEL=${PX4_SIM_MODEL:=xvert}
param set-default EKF2_GPS_DELAY 0
param set-default EKF2_FUSE_BETA 0 # side slip fusion is currently not supported for tailsitters
param set-default SENS_EN_GPSSIM 1
@@ -0,0 +1 @@
mavlink start -x -u 14558 -r 4000 -f -m onboard -o 14530 -p
@@ -26,7 +26,6 @@ param set-default RD_MAX_THR_SPD 2.15
param set-default RD_SPEED_P 0.1
param set-default RD_SPEED_I 0.01
param set-default RD_MAX_YAW_RATE 180
param set-default RD_MISS_SPD_DEF 2
param set-default RD_TRANS_DRV_TRN 0.349066
param set-default RD_TRANS_TRN_DRV 0.174533
param set-default RD_MAX_YAW_ACCEL 1000
@@ -29,7 +29,6 @@ param set-default RD_MAX_SPEED 8
param set-default RD_YAW_P 5
param set-default RD_YAW_I 0.1
param set-default RD_MAX_YAW_RATE 30
param set-default RD_MISS_SPD_DEF 8
param set-default RD_TRANS_DRV_TRN 0.349066
param set-default RD_TRANS_TRN_DRV 0.174533
@@ -13,18 +13,18 @@ param set-default SIM_GZ_EN 1 # Gazebo bridge
# Rover parameters
param set-default RM_WHEEL_TRACK 0.3
param set-default RM_MAN_YAW_SCALE 0.1
param set-default RM_YAW_RATE_I 0
param set-default RM_YAW_RATE_P 0.01
param set-default RM_YAW_RATE_I 0.1
param set-default RM_YAW_RATE_P 0.1
param set-default RM_MAX_ACCEL 3
param set-default RM_MAX_DECEL 5
param set-default RM_MAX_JERK 5
param set-default RM_MAX_SPEED 4
param set-default RM_MAX_THR_SPD 7
param set-default RM_MAX_THR_YAW_R 7.5
param set-default RM_MAX_SPEED 2
param set-default RM_MAX_THR_SPD 2.2
param set-default RM_MAX_THR_YAW_R 1.2
param set-default RM_YAW_P 5
param set-default RM_YAW_I 0.1
param set-default RM_MAX_YAW_RATE 180
param set-default RM_MISS_SPD_DEF 3
param set-default RM_MAX_YAW_RATE 120
param set-default RM_MAX_YAW_ACCEL 240
param set-default RM_MISS_VEL_GAIN 1
param set-default RM_SPEED_I 0.01
param set-default RM_SPEED_P 0.1
@@ -42,23 +42,23 @@ param set-default SENS_EN_ARSPDSIM 0
# Actuator mapping
param set-default SIM_GZ_WH_FUNC1 102 # right wheel front
param set-default SIM_GZ_WH_MIN1 0
param set-default SIM_GZ_WH_MAX1 200
param set-default SIM_GZ_WH_MIN1 70
param set-default SIM_GZ_WH_MAX1 130
param set-default SIM_GZ_WH_DIS1 100
param set-default SIM_GZ_WH_FUNC2 101 # left wheel front
param set-default SIM_GZ_WH_MIN2 0
param set-default SIM_GZ_WH_MAX2 200
param set-default SIM_GZ_WH_MIN2 70
param set-default SIM_GZ_WH_MAX2 130
param set-default SIM_GZ_WH_DIS2 100
param set-default SIM_GZ_WH_FUNC3 104 # right wheel back
param set-default SIM_GZ_WH_MIN3 0
param set-default SIM_GZ_WH_MAX3 200
param set-default SIM_GZ_WH_MIN3 70
param set-default SIM_GZ_WH_MAX3 130
param set-default SIM_GZ_WH_DIS3 100
param set-default SIM_GZ_WH_FUNC4 103 # left wheel back
param set-default SIM_GZ_WH_MIN4 0
param set-default SIM_GZ_WH_MAX4 200
param set-default SIM_GZ_WH_MIN4 70
param set-default SIM_GZ_WH_MAX4 130
param set-default SIM_GZ_WH_DIS4 100
param set-default SIM_GZ_WH_REV 10
@@ -0,0 +1,97 @@
#!/bin/sh
#
# @name Quadrotor + Tailsitter
#
# @type VTOL Quad Tailsitter
#
. ${R}etc/init.d/rc.vtol_defaults
PX4_SIMULATOR=${PX4_SIMULATOR:=gz}
PX4_GZ_WORLD=${PX4_GZ_WORLD:=default}
PX4_SIM_MODEL=${PX4_SIM_MODEL:=quadtailsitter}
param set-default SIM_GZ_EN 1 # Gazebo bridge
param set-default SENS_EN_GPSSIM 1
param set-default SENS_EN_BAROSIM 0
param set-default SENS_EN_MAGSIM 1
param set-default SENS_EN_ARSPDSIM 0
param set-default MAV_TYPE 20
param set-default CA_AIRFRAME 4
param set-default CA_ROTOR_COUNT 4
param set-default CA_ROTOR0_PX 0.15
param set-default CA_ROTOR0_PY 0.23
param set-default CA_ROTOR0_KM 0.05
param set-default CA_ROTOR1_PX -0.15
param set-default CA_ROTOR1_PY -0.23
param set-default CA_ROTOR1_KM 0.05
param set-default CA_ROTOR2_PX 0.15
param set-default CA_ROTOR2_PY -0.23
param set-default CA_ROTOR2_KM -0.05
param set-default CA_ROTOR3_PX -0.15
param set-default CA_ROTOR3_PY 0.23
param set-default CA_ROTOR3_KM -0.05
param set-default CA_SV_CS_COUNT 0
param set-default SIM_GZ_EC_FUNC1 101
param set-default SIM_GZ_EC_FUNC2 102
param set-default SIM_GZ_EC_FUNC3 103
param set-default SIM_GZ_EC_FUNC4 104
param set-default SIM_GZ_EC_MIN1 10
param set-default SIM_GZ_EC_MIN2 10
param set-default SIM_GZ_EC_MIN3 10
param set-default SIM_GZ_EC_MIN4 10
param set-default SIM_GZ_EC_MAX1 1500
param set-default SIM_GZ_EC_MAX2 1500
param set-default SIM_GZ_EC_MAX3 1500
param set-default SIM_GZ_EC_MAX4 1500
param set-default FD_FAIL_R 70
param set-default FW_P_TC 0.6
param set-default FW_PR_I 0.3
param set-default FW_PR_P 0.5
param set-default FW_PSP_OFF 2
param set-default FW_RR_FF 0.1
param set-default FW_RR_I 0.1
param set-default FW_RR_P 0.2
param set-default FW_YR_FF 0 # make yaw rate controller very weak, only keep default P
param set-default FW_YR_I 0
param set-default FW_THR_TRIM 0.35
param set-default FW_THR_MAX 0.8
param set-default FW_THR_MIN 0.05
param set-default FW_T_CLMB_MAX 6
param set-default FW_T_HRATE_FF 0.5
param set-default FW_T_SINK_MAX 3
param set-default FW_T_SINK_MIN 1.6
param set-default FW_AIRSPD_STALL 10
param set-default FW_AIRSPD_MIN 14
param set-default FW_AIRSPD_TRIM 18
param set-default FW_AIRSPD_MAX 22
param set-default MC_AIRMODE 2
param set-default MAN_ARM_GESTURE 0 # required for yaw airmode
param set-default MC_ROLL_P 3
param set-default MC_PITCH_P 3
param set-default MC_ROLLRATE_P 0.3
param set-default MC_PITCHRATE_P 0.3
param set-default VT_ARSP_TRANS 15
param set-default VT_B_TRANS_DUR 5
param set-default VT_FW_DIFTHR_EN 7
param set-default VT_FW_DIFTHR_S_Y 1
param set-default VT_F_TRANS_DUR 1.5
param set-default VT_TYPE 0
param set-default WV_EN 0
param set-default EKF2_FUSE_BETA 0
@@ -49,6 +49,7 @@ px4_add_romfs_files(
1022_gazebo-classic_uuv_bluerov2_heavy
1030_gazebo-classic_plane
1031_gazebo-classic_plane_cam
1031_gazebo-classic_plane_cam.post
1032_gazebo-classic_plane_catapult
1033_jsbsim_rascal
1034_flightgear_rascal-electric
@@ -89,6 +90,7 @@ px4_add_romfs_files(
4015_gz_r1_rover_mecanum
4016_gz_x500_lidar_down
4017_gz_x500_lidar_front
4018_gz_quadtailsitter
6011_gazebo-classic_typhoon_h480
6011_gazebo-classic_typhoon_h480.post
@@ -33,6 +33,10 @@ if [ "$PX4_SIMULATOR" = "sihsim" ] || [ "$(param show -q SYS_AUTOSTART)" -eq "0"
then
sensor_mag_sim start
fi
if param compare -s SENS_EN_AGPSIM 1
then
sensor_agp_sim start
fi
else
echo "ERROR [init] simulator_sih failed to start"
@@ -153,6 +157,10 @@ elif [ "$PX4_SIMULATOR" = "gz" ] || [ "$(param show -q SIM_GZ_EN)" = "1" ]; then
then
sensor_airspeed_sim start
fi
if param compare -s SENS_EN_AGPSIM 1
then
sensor_agp_sim start
fi
elif [ "$PX4_SIM_MODEL" = "jmavsim_iris" ] || [ "$(param show -q SYS_AUTOSTART)" -eq "10017" ]; then
@@ -12,28 +12,24 @@
. ${R}etc/init.d/rc.fw_defaults
param set UAVCAN_ENABLE 0
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 4
param set-default CA_SV_CS0_TRQ_R 0.5
param set-default CA_SV_CS0_TYPE 2
param set-default CA_SV_CS_COUNT 3
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_P 1
param set-default CA_SV_CS1_TYPE 3
param set-default CA_SV_CS2_TRQ_Y 1
param set-default CA_SV_CS2_TYPE 4
param set-default CA_SV_CS3_TYPE 10
param set-default HIL_ACT_REV 2
param set-default HIL_ACT_FUNC1 201
param set-default HIL_ACT_FUNC2 202
param set-default HIL_ACT_FUNC3 203
param set-default HIL_ACT_FUNC4 101
param set-default HIL_ACT_FUNC5 204
param set-default HIL_ACT_FUNC6 400
param set HIL_ACT_REV 1
param set HIL_ACT_FUNC1 201
param set HIL_ACT_FUNC2 202
param set HIL_ACT_FUNC3 203
param set HIL_ACT_FUNC4 101
# set SYS_HITL to 2 to start the SIH and avoid sensors startup
param set-default SYS_HITL 2
@@ -21,7 +21,6 @@
. ${R}etc/init.d/rc.mc_defaults
param set-default MAV_TYPE 14
param set-default CA_ROTOR_COUNT 8
@@ -11,7 +11,6 @@
. ${R}etc/init.d/rc.heli_defaults
# Disable PID gains for initial setup. These should be enabled after setting the FF gain.
# P is expected to be lower than FF.
param set-default MC_ROLLRATE_P 0
@@ -22,7 +22,6 @@
. ${R}etc/init.d/rc.fw_defaults
param set-default BAT1_CAPACITY 2500
param set-default BAT1_N_CELLS 3
@@ -41,7 +40,6 @@ param set-default FW_P_LIM_MAX 25
param set-default FW_P_LIM_MIN -5
param set-default FW_P_RMAX_NEG 20
param set-default CA_AIRFRAME 1
param set-default CA_ROTOR_COUNT 1
@@ -20,7 +20,6 @@
. ${R}etc/init.d/rc.fw_defaults
param set-default BAT1_CAPACITY 3300
param set-default BAT1_N_CELLS 3
@@ -19,7 +19,6 @@ param set-default NAV_ACC_RAD 2
param set-default RTL_DESCEND_ALT 10
param set-default RTL_RETURN_ALT 30
param set-default CA_ROTOR_COUNT 12
# Bottom motors
param set-default CA_ROTOR0_PX 0
@@ -21,7 +21,6 @@ param set-default MC_PITCHRATE_P 0.08
param set-default MC_PITCHRATE_D 0.001
param set-default MC_YAW_P 4
param set-default MC_ROLLRATE_MAX 1600
param set-default MC_PITCHRATE_MAX 1600
param set-default MC_YAWRATE_MAX 1000
@@ -38,7 +38,6 @@ param set-default COM_FLTMODE5 -1
param set-default COM_FLTMODE6 1
param set-default COM_RC_LOSS_T 3
# ekf2
param set-default EKF2_BARO_NOISE 2
@@ -79,19 +78,16 @@ param set-default EKF2_RNG_POS_Z 0.033
param set-default EKF2_TERR_NOISE 1
# Maximum allowed angle velocity in the landed state
param set-default LNDMC_ROT_MAX 40
# Maximum vertical velocity allowed in the landed state
param set-default LNDMC_Z_VEL_MAX 0.7
# filtering
param set-default IMU_DGYRO_CUTOFF 50
param set-default IMU_GYRO_CUTOFF 65
# Pitch angle & rate setting
param set-default MC_PITCHRATE_P 0.075
param set-default MC_PITCHRATE_I 0.1
@@ -148,7 +144,6 @@ param set-default RC_MAP_RETURN_SW 7
param set-default RC1_TRIM 1000
# optical flow
param set-default SENS_FLOW_MAXR 7.4
param set-default SENS_FLOW_MINHGT 0.15
@@ -30,7 +30,6 @@ param set-default IMU_DGYRO_CUTOFF 90
param set-default IMU_GYRO_CUTOFF 100
# System
param set-default SENS_BOARD_ROT 10
# EKF2
@@ -18,7 +18,6 @@
#
. ${R}etc/init.d/rc.mc_defaults
param set-default SYS_HAS_MAG 0
param set-default EKF2_OF_CTRL 1
param set-default EKF2_GPS_CTRL 0
@@ -85,6 +84,5 @@ 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
@@ -31,7 +31,6 @@ param set-default RD_MAX_THR_SPD 1.9
param set-default RD_MAX_THR_YAW_R 0.7
param set-default RD_MAX_YAW_ACCEL 600
param set-default RD_MAX_YAW_RATE 250
param set-default RD_MISS_SPD_DEF 1.5
param set-default RD_SPEED_P 0.1
param set-default RD_SPEED_I 0.01
param set-default RD_TRANS_DRV_TRN 0.785398
@@ -41,7 +40,6 @@ param set-default RD_YAW_I 0.1
param set-default RD_YAW_RATE_P 0.1
param set-default RD_YAW_RATE_I 0.01
# Pure pursuit parameters
param set-default PP_LOOKAHD_MAX 10
param set-default PP_LOOKAHD_MIN 1
@@ -15,7 +15,6 @@
. ${R}etc/init.d/rc.rover_defaults
param set-default BAT1_N_CELLS 2
param set-default EKF2_ANGERR_INIT 0.01
@@ -22,7 +22,6 @@
. ${R}etc/init.d/rc.uuv_defaults
param set-default MAV_1_CONFIG 102
param set-default BAT1_A_PER_V 37.8798
@@ -13,8 +13,6 @@ param set-default MAV_TYPE 1
#
# Default parameters for fixed wing UAVs.
#
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 3
+7
View File
@@ -211,6 +211,13 @@ then
spl06 -X -a 0x77 start
fi
# SPA06 sensor external I2C
if param compare -s SENS_EN_SPA06 1
then
spa06 -X start
spa06 -X -a 0x77 start
fi
# PCF8583 counter (RPM sensor)
if param compare -s SENS_EN_PCF8583 1
then
+1
View File
@@ -386,6 +386,7 @@ else
sensor_baro_sim start
sensor_mag_sim start
sensor_gps_sim start
sensor_agp_sim start
fi
else
+1 -1
View File
@@ -43,7 +43,7 @@ fi
# install git pre-commit hook
HOOK_FILE="$DIR/../../.git/hooks/pre-commit"
if [ ! -f $HOOK_FILE ] && [ "$CI" != "true" ]; then
if [ ! -f $HOOK_FILE ] && [ "$CI" != "true" ] && [ $- == *i* ]; then
echo ""
echo -e "\033[31mNinja tip: add a git pre-commit hook to automatically check code style\033[0m"
echo -e "Would you like to install one now? (\033[94mcp ./Tools/astyle/pre-commit .git/hooks/pre-commit\033[0m): [y/\033[1mN\033[0m]"
+1 -1
View File
@@ -73,7 +73,7 @@ def process_target(px4board_file, target_name):
px4board_file.endswith("bootloader.px4board"):
kconf.load_config(px4board_file, replace=True)
else: # Merge config with default.px4board
default_kconfig = re.sub(r'[a-zA-Z\d_]+\.px4board', 'default.px4board', px4board_file)
default_kconfig = re.sub(r'[a-zA-Z\d_-]+\.px4board', 'default.px4board', px4board_file)
kconf.load_config(default_kconfig, replace=True)
kconf.load_config(px4board_file, replace=False)
+48 -19
View File
@@ -1,62 +1,91 @@
#!/usr/bin/env python3
import sys
try:
from Crypto.Cipher import ChaCha20
except ImportError as e:
print("Failed to import crypto: " + str(e))
print("")
print("You may need to install it using:")
print(" pip3 install --user pycryptodome")
print("")
sys.exit(1)
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP
from Crypto.Cipher import ChaCha20
from Crypto.Hash import SHA256
import binascii
from pathlib import Path
import argparse
#from pathlib import Path
import sys
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="""CLI tool to decrypt an ulog file\n""")
parser.add_argument("ulog_file", help=".ulog file", nargs='?', default=None)
parser.add_argument("ulog_key", help=".ulogk, encrypted key", nargs='?', default=None)
parser.add_argument("ulog_file", help=".ulge/.ulgc, encrypted log file", nargs='?', default=None)
parser.add_argument("ulog_key", help=".ulgk, legacy encrypted key (give empty string '' to ignore for .ulge)", nargs='?', default=None)
parser.add_argument("rsa_key", help=".pem format key for decrypting the ulog key", nargs='?', default=None)
args = parser.parse_args()
# Only generate a key pair, don't sign
if not args.ulog_file or not args.ulog_key or not args.rsa_key:
print('Need all arguments, the encrypted ulog file, the key and the key decryption key')
sys.exit(1);
# Check all arguments are given
if not args.rsa_key:
print('Need all arguments, the encrypted ulog file, key file (or empty string if not needed) and the key decryption key (.pem)')
sys.exit(1)
# Read the private RSA key to decrypt the cahcha key
with open(args.rsa_key, 'rb') as f:
r = RSA.importKey(f.read(), passphrase='')
# Read the encrypted xchacha key and the nonce
with open(args.ulog_key, 'rb') as f:
if args.ulog_key == "":
key_data_filename = args.ulog_file
magic = "ULogEnc"
else:
key_data_filename = args.ulog_key
magic = "ULogKey"
with open(key_data_filename, 'rb') as f:
# Read the encrypted xchacha key and the nonce
ulog_key_header = f.read(22)
# Parse the header
try:
# magic
if not ulog_key_header.startswith(bytearray("ULogKey".encode())):
if not ulog_key_header.startswith(bytearray(magic.encode())):
print("Incorrect header magic")
raise Exception()
# version
if ulog_key_header[7] != 1:
print("Unsupported header version")
raise Exception()
# expected key exchange algorithm (RSA_OAEP)
if ulog_key_header[16] != 4:
print("Unsupported key algorithm")
raise Exception()
key_size = ulog_key_header[19] << 8 | ulog_key_header[18];
nonce_size = ulog_key_header[21] << 8 | ulog_key_header[20];
key_size = ulog_key_header[19] << 8 | ulog_key_header[18]
nonce_size = ulog_key_header[21] << 8 | ulog_key_header[20]
ulog_key_cipher = f.read(key_size)
nonce = f.read(nonce_size)
except:
print("Keyfile format error")
sys.exit(1);
print("Keydata format error")
sys.exit(1)
if magic == "ULogEnc":
data_offset = 22 + key_size + nonce_size
else:
data_offset = 0
# Decrypt the xchacha key
cipher_rsa = PKCS1_OAEP.new(r,SHA256)
ulog_key = cipher_rsa.decrypt(ulog_key_cipher)
#print(binascii.hexlify(ulog_key))
# Read and decrypt the .ulgc
# Read and decrypt the ulog data
cipher = ChaCha20.new(key=ulog_key, nonce=nonce)
outfilename = Path(args.ulog_file).stem + ".ulog"
with open(args.ulog_file, 'rb') as f:
with open(args.ulog_file.rstrip(args.ulog_file[-1]), 'wb') as out:
if data_offset > 0:
f.seek(data_offset)
with open(outfilename, 'wb') as out:
out.write(cipher.decrypt(f.read()))
+40 -9
View File
@@ -11,9 +11,22 @@ import sys
def get_msgs_list(msgdir):
"""
Makes list of msg files in the given directory
Makes a list of relative paths of .msg files in the given directory
and its subdirectories.
Parameters:
msgdir (str): The directory to search for .msg files.
Returns:
list: A list of relative paths to .msg files.
"""
return [fn for fn in os.listdir(msgdir) if fn.endswith(".msg")]
msgs = []
for root, _, files in os.walk(msgdir):
for fn in files:
if fn.endswith(".msg"):
relative_path = os.path.relpath(os.path.join(root, fn), msgdir)
msgs.append(relative_path)
return msgs
if __name__ == "__main__":
@@ -29,10 +42,11 @@ if __name__ == "__main__":
msg_files = get_msgs_list(msg_path)
msg_files.sort()
filelist_in_markdown=''
versioned_msgs_list = ''
unversioned_msgs_list = ''
for msg_file in msg_files:
msg_name = os.path.splitext(msg_file)[0]
msg_name = os.path.splitext(os.path.basename(msg_file))[0]
output_file = os.path.join(output_dir, msg_name+'.md')
msg_filename = os.path.join(msg_path, msg_file)
print("{:} -> {:}".format(msg_filename, output_file))
@@ -81,10 +95,17 @@ if __name__ == "__main__":
with open(output_file, 'w') as content_file:
content_file.write(markdown_output)
index_markdown_file_link='- [%s](%s.md)' % (msg_name,msg_name)
if summary_description:
index_markdown_file_link+="%s" % summary_description
filelist_in_markdown+=index_markdown_file_link+"\n"
# Categorize as versioned or unversioned
if "versioned" in msg_file:
versioned_msgs_list += '- [%s](%s.md)' % (msg_name, msg_name)
if summary_description:
versioned_msgs_list += "%s" % summary_description
versioned_msgs_list += "\n"
else:
unversioned_msgs_list += '- [%s](%s.md)' % (msg_name, msg_name)
if summary_description:
unversioned_msgs_list += "%s" % summary_description
unversioned_msgs_list += "\n"
# Write out the index.md file
index_text="""# uORB Message Reference
@@ -94,10 +115,20 @@ This list is [auto-generated](https://github.com/PX4/PX4-Autopilot/blob/main/Too
:::
This topic lists the UORB messages available in PX4 (some of which may be may be shared by the [PX4-ROS 2 Bridge](../ros/ros2_comm.md)).
[Versioned messages](../middleware/uorb.md#message-versioning) track changes to their definitions, with each modification resulting in a version increment.
These messages are most likely shared through the PX4-ROS 2 Bridge.
Graphs showing how these are used [can be found here](../middleware/uorb_graph.md).
## Versioned Messages
%s
""" % (filelist_in_markdown)
## Unversioned Messages
%s
""" % (versioned_msgs_list, unversioned_msgs_list)
index_file = os.path.join(output_dir, 'index.md')
with open(index_file, 'w') as content_file:
content_file.write(index_text)
+1 -1
View File
@@ -137,7 +137,7 @@ div.frame_variant td, div.frame_variant th {
#print(output_name,value, attribstrs[0].strip(),attribstrs[1].strip())
outputs += '</ul>'
if has_outputs:
outputs_entry = '<p><b>Specific Outputs:</b>' + outputs + '</p>'
outputs_entry = '<br><b>Specific Outputs:</b>' + outputs
else:
outputs_entry = ''
-11
View File
@@ -179,17 +179,6 @@ if [[ $INSTALL_SIM == "true" ]]; then
gazebo_classic_version=11
gazebo_packages="gazebo$gazebo_classic_version libgazebo$gazebo_classic_version-dev"
fi
elif [[ "${UBUNTU_RELEASE}" == "21.3" ]]; then
echo "Gazebo (Garden) will be installed"
echo "Earlier versions will be removed"
# Add Gazebo binary repository
sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable jammy main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
sudo apt-get update -y --quiet
# Install Gazebo
gazebo_packages="gz-garden"
else
# Expects Ubuntu 22.04 > by default
echo "Gazebo (Harmonic) will be installed"
+1
View File
@@ -0,0 +1 @@
CONFIG_BOARD_TOOLCHAIN="aarch64-linux-gnu"
+5 -2
View File
@@ -46,9 +46,8 @@
/* CAN Silent mode control */
#define GPIO_CAN1_SILENT_S0 /* PB7 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN7)
// TODO: figure out
/* Boot config */
//#define GPIO_BOOT_CONFIG /* PC15 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTC|GPIO_PIN15|GPIO_EXTI)
#define GPIO_BOOT_CONFIG /* PC14 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTC|GPIO_PIN14|GPIO_EXTI)
/* LEDs are driven with push open drain to support Anode to 5V or 3.3V */
#define GPIO_nLED_RED /* PB0 */ (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN0)
@@ -68,6 +67,10 @@
// TODO figure out
#define GPIO_GETNODEINFO_JUMPER 0 //(GPIO_BOOT_CONFIG & ~GPIO_EXTI)
// CAN termination set by param, available from RC02
#define GPIO_CAN1_TERMINATION /* PA12 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN12)
#define GPIO_CAN_TERM GPIO_CAN1_TERMINATION
#define FLASH_BASED_PARAMS
/* High-resolution timer */
+1
View File
@@ -96,6 +96,7 @@ __EXPORT void stm32_boardinitialize(void)
stm32_configgpio(GPIO_CAN1_TX);
stm32_configgpio(GPIO_CAN1_SILENT_S0);
stm32_configgpio(GPIO_CAN1_TERMINATION);
// Configure SPI all interfaces GPIO & enable power.
stm32_spiinitialize();
@@ -11,4 +11,7 @@ then
icm42688p -R 6 -s start
fi
bmp280 -X start
if ! bmp280 -X start
then
spa06 -X start
fi
@@ -12,4 +12,7 @@ then
fi
fi
bmp280 -X start
if ! bmp280 -X start
then
spa06 -X start
fi
@@ -9,4 +9,7 @@ then
icm42688p -R 0 -s start
fi
bmp280 -X start
if ! bmp280 -X start
then
spa06 -X start
fi
-1
View File
@@ -67,7 +67,6 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIMULATION_SIMULATOR_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y
@@ -0,0 +1 @@
CONFIG_BOARD_LINKER_PREFIX="flash-analysis"
@@ -0,0 +1,6 @@
INCLUDE "script.ld"
MEMORY
{
FLASH_AXIM (rx) : ORIGIN = 0x08008000, LENGTH = 10080K
}
-1
View File
@@ -68,7 +68,6 @@ CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIMULATION_SIMULATOR_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
@@ -0,0 +1 @@
CONFIG_BOARD_LINKER_PREFIX="flash-analysis"
@@ -0,0 +1,6 @@
INCLUDE "script.ld"
MEMORY
{
FLASH (rx) : ORIGIN = 0x08020000, LENGTH = 10080K
}
+1
View File
@@ -52,6 +52,7 @@ CONFIG_MODULES_ROVER_POS_CONTROL=y
CONFIG_MODULES_SENSORS=y
CONFIG_COMMON_SIMULATION=y
CONFIG_MODULES_SIMULATION_GZ_BRIDGE=y
CONFIG_MODULES_SIMULATION_SENSOR_AGP_SIM=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UUV_ATT_CONTROL=y
CONFIG_MODULES_UUV_POS_CONTROL=y
+33 -33
View File
@@ -40,19 +40,14 @@ set(msg_files
ActionRequest.msg
ActuatorArmed.msg
ActuatorControlsStatus.msg
ActuatorMotors.msg
ActuatorOutputs.msg
ActuatorServos.msg
ActuatorServosTrim.msg
ActuatorTest.msg
AdcReport.msg
Airspeed.msg
AirspeedValidated.msg
AirspeedWind.msg
ArmingCheckReply.msg
ArmingCheckRequest.msg
AutotuneAttitudeControlStatus.msg
BatteryStatus.msg
Buffer128.msg
ButtonEvent.msg
CameraCapture.msg
@@ -61,7 +56,6 @@ set(msg_files
CanInterfaceStatus.msg
CellularStatus.msg
CollisionConstraints.msg
ConfigOverrides.msg
ControlAllocatorStatus.msg
Cpuload.msg
DatamanRequest.msg
@@ -109,7 +103,6 @@ set(msg_files
GimbalManagerSetAttitude.msg
GimbalManagerSetManualControl.msg
GimbalManagerStatus.msg
GotoSetpoint.msg
GpioConfig.msg
GpioIn.msg
GpioOut.msg
@@ -119,7 +112,6 @@ set(msg_files
Gripper.msg
HealthReport.msg
HeaterStatus.msg
HomePosition.msg
HoverThrustEstimate.msg
InputRc.msg
InternalCombustionEngineStatus.msg
@@ -135,7 +127,6 @@ set(msg_files
LogMessage.msg
MagnetometerBiasEstimate.msg
MagWorkerData.msg
ManualControlSetpoint.msg
ManualControlSwitches.msg
MavlinkLog.msg
MavlinkTunnel.msg
@@ -144,7 +135,6 @@ set(msg_files
Mission.msg
MissionResult.msg
MountOrientation.msg
ModeCompleted.msg
NavigatorMissionItem.msg
NavigatorStatus.msg
NormalizedUnsignedSetpoint.msg
@@ -181,8 +171,6 @@ set(msg_files
RateCtrlStatus.msg
RcChannels.msg
RcParameterMap.msg
RegisterExtComponentReply.msg
RegisterExtComponentRequest.msg
RoverAckermannGuidanceStatus.msg
RoverAckermannSetpoint.msg
RoverAckermannStatus.msg
@@ -223,7 +211,6 @@ set(msg_files
TiltrotorExtraControls.msg
TimesyncStatus.msg
TrajectoryBezier.msg
TrajectorySetpoint.msg
TrajectoryWaypoint.msg
TransponderReport.msg
TuneControl.msg
@@ -231,39 +218,52 @@ set(msg_files
UavcanParameterValue.msg
UlogStream.msg
UlogStreamAck.msg
UnregisterExtComponent.msg
VehicleAcceleration.msg
VehicleAirData.msg
VehicleAngularAccelerationSetpoint.msg
VehicleAngularVelocity.msg
VehicleAttitude.msg
VehicleAttitudeSetpoint.msg
VehicleCommand.msg
VehicleCommandAck.msg
VehicleConstraints.msg
VehicleControlMode.msg
VehicleGlobalPosition.msg
VehicleImu.msg
VehicleImuStatus.msg
VehicleLandDetected.msg
VehicleLocalPosition.msg
VehicleLocalPositionSetpoint.msg
VehicleMagnetometer.msg
VehicleOdometry.msg
VehicleOpticalFlow.msg
VehicleOpticalFlowVel.msg
VehicleRatesSetpoint.msg
VehicleRoi.msg
VehicleStatus.msg
VehicleThrustSetpoint.msg
VehicleTorqueSetpoint.msg
VehicleTrajectoryBezier.msg
VehicleTrajectoryWaypoint.msg
VelocityLimits.msg
VtolVehicleStatus.msg
WheelEncoders.msg
Wind.msg
YawEstimatorStatus.msg
versioned/ActuatorMotors.msg
versioned/ActuatorServos.msg
versioned/ArmingCheckReply.msg
versioned/ArmingCheckRequest.msg
versioned/BatteryStatus.msg
versioned/ConfigOverrides.msg
versioned/GotoSetpoint.msg
versioned/HomePosition.msg
versioned/ManualControlSetpoint.msg
versioned/ModeCompleted.msg
versioned/RegisterExtComponentReply.msg
versioned/RegisterExtComponentRequest.msg
versioned/TrajectorySetpoint.msg
versioned/UnregisterExtComponent.msg
versioned/VehicleAngularVelocity.msg
versioned/VehicleAttitude.msg
versioned/VehicleAttitudeSetpoint.msg
versioned/VehicleCommandAck.msg
versioned/VehicleCommand.msg
versioned/VehicleControlMode.msg
versioned/VehicleGlobalPosition.msg
versioned/VehicleLandDetected.msg
versioned/VehicleLocalPosition.msg
versioned/VehicleOdometry.msg
versioned/VehicleRatesSetpoint.msg
versioned/VehicleStatus.msg
versioned/VtolVehicleStatus.msg
)
list(SORT msg_files)
@@ -315,7 +315,7 @@ add_custom_command(
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
--headers
-f ${msg_files}
-i ${CMAKE_CURRENT_SOURCE_DIR}
-i ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/versioned
-o ${msg_out_path}
-e ${PX4_SOURCE_DIR}/Tools/msg/templates/uorb
DEPENDS
@@ -336,7 +336,7 @@ add_custom_command(
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
--json
-f ${msg_files}
-i ${CMAKE_CURRENT_SOURCE_DIR}
-i ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/versioned
-o ${msg_source_out_path}
-e ${PX4_SOURCE_DIR}/Tools/msg/templates/uorb
DEPENDS
@@ -374,7 +374,7 @@ add_custom_command(
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
--headers
-f ${msg_files}
-i ${CMAKE_CURRENT_SOURCE_DIR}
-i ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/versioned
-o ${ucdr_out_path}
-e ${PX4_SOURCE_DIR}/Tools/msg/templates/ucdr
DEPENDS
@@ -396,7 +396,7 @@ add_custom_command(
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
--sources
-f ${msg_files}
-i ${CMAKE_CURRENT_SOURCE_DIR}
-i ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/versioned
-o ${msg_source_out_path}
-e ${PX4_SOURCE_DIR}/Tools/msg/templates/uorb
DEPENDS
@@ -447,7 +447,7 @@ if(CONFIG_LIB_CDRSTREAM)
# Copy .msg files
foreach(msg_file ${msg_files})
get_filename_component(msg ${msg_file} NAME_WE)
configure_file(${PX4_SOURCE_DIR}/msg/${msg}.msg ${idl_out_path}/${msg}.msg COPYONLY)
configure_file(${msg_file} ${idl_out_path}/${msg}.msg COPYONLY)
list(APPEND uorb_cdr_idl ${idl_out_path}/${msg}.idl)
list(APPEND uorb_cdr_msg ${idl_out_path}/${msg}.msg)
list(APPEND uorb_cdr_idl_uorb ${idl_uorb_path}/${msg}.h)
@@ -492,7 +492,7 @@ if(CONFIG_LIB_CDRSTREAM)
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
--uorb-idl-header
-f ${msg_files}
-i ${CMAKE_CURRENT_SOURCE_DIR}
-i ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/versioned
-o ${idl_uorb_path}
-e ${PX4_SOURCE_DIR}/Tools/msg/templates/cdrstream
DEPENDS
+1 -1
View File
@@ -5,7 +5,7 @@ float32 forward_speed_setpoint_normalized # [-1, 1] Desired normalized forward s
float32 lateral_speed_setpoint # [m/s] Desired lateral speed
float32 lateral_speed_setpoint_normalized # [-1, 1] Desired normalized lateral speed
float32 yaw_rate_setpoint # [rad/s] Desired yaw rate
float32 yaw_rate_setpoint_normalized # [-1, 1] Desired normalized yaw rate
float32 speed_diff_setpoint_normalized # [-1, 1] Normalized speed difference between the left and right wheels
float32 yaw_setpoint # [rad] Desired yaw (heading)
# TOPICS rover_mecanum_setpoint
+13 -9
View File
@@ -1,13 +1,17 @@
uint64 timestamp # time since system start (microseconds)
float32 measured_forward_speed # [m/s] Measured speed in body x direction. Positiv: forwards, Negativ: backwards
float32 measured_lateral_speed # [m/s] Measured speed in body y direction. Positiv: right, Negativ: left
float32 adjusted_yaw_rate_setpoint # [rad/s] Yaw rate setpoint output of the closed loop yaw controller
float32 measured_yaw_rate # [rad/s] Measured yaw rate
float32 measured_yaw # [rad] Measured yaw
float32 pid_yaw_rate_integral # Integral of the PID for the closed loop yaw rate controller
float32 pid_yaw_integral # Integral of the PID for the closed loop yaw controller
float32 pid_forward_throttle_integral # Integral of the PID for the closed loop forward speed controller
float32 pid_lateral_throttle_integral # Integral of the PID for the closed loop lateral speed controller
float32 measured_forward_speed # [m/s] Measured speed in body x direction. Positiv: forwards, Negativ: backwards
float32 adjusted_forward_speed_setpoint # [m/s] Speed setpoint after applying slew rate
float32 measured_lateral_speed # [m/s] Measured speed in body y direction. Positiv: right, Negativ: left
float32 adjusted_lateral_speed_setpoint # [m/s] Speed setpoint after applying slew rate
float32 measured_yaw_rate # [rad/s] Measured yaw rate
float32 clyaw_yaw_rate_setpoint # [rad/s] Yaw rate setpoint output by the closed loop yaw controller
float32 adjusted_yaw_rate_setpoint # [rad/s] Yaw rate setpoint from the closed loop yaw controller
float32 measured_yaw # [rad] Measured yaw
float32 adjusted_yaw_setpoint # [rad] Yaw setpoint after applying slew rate
float32 pid_yaw_rate_integral # Integral of the PID for the closed loop yaw rate controller
float32 pid_yaw_integral # Integral of the PID for the closed loop yaw controller
float32 pid_forward_throttle_integral # Integral of the PID for the closed loop forward speed controller
float32 pid_lateral_throttle_integral # Integral of the PID for the closed loop lateral speed controller
# TOPICS rover_mecanum_status
+1
View File
@@ -5,5 +5,6 @@ uint64 timestamp # time since system start (microseconds)
float32 speed_up # in meters/sec
float32 speed_down # in meters/sec
float32 speed_xy # in meters/sec
bool want_takeoff # tell the controller to initiate takeoff when idling (ignored during flight)
@@ -1,4 +1,7 @@
# Motor control message
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
uint64 timestamp_sample # the timestamp the data this control response is based on was sampled
@@ -1,4 +1,7 @@
# Servo control message
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
uint64 timestamp_sample # the timestamp the data this control response is based on was sampled
@@ -1,3 +1,5 @@
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
uint8 request_id
@@ -1,3 +1,5 @@
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
# broadcast message to request all registered arming checks to be reported
@@ -1,3 +1,5 @@
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
bool connected # Whether or not a battery is connected, based on a voltage threshold
float32 voltage_v # Battery voltage in volts, 0 if unknown
@@ -1,4 +1,7 @@
# Configurable overrides by (external) modes or mode executors
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
bool disable_auto_disarm # Prevent the drone from automatically disarming after landing (if configured)
@@ -5,6 +5,8 @@
# Unset optional setpoints are not controlled
# Unset optional constraints default to vehicle specifications
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
# setpoints
@@ -1,5 +1,7 @@
# GPS home position in WGS84 coordinates.
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
float64 lat # Latitude in degrees
@@ -1,3 +1,5 @@
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
uint64 timestamp_sample # the timestamp of the raw data (microseconds)
@@ -2,6 +2,9 @@
# The possible values of nav_state are defined in the VehicleStatus msg.
# Note that this is not always published (e.g. when a user switches modes or on
# failsafe activation)
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
@@ -1,3 +1,5 @@
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
uint64 request_id # ID from the request
@@ -1,4 +1,7 @@
# Request to register an external component
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
uint64 request_id # ID, set this to a random value
@@ -3,6 +3,8 @@
# Needs to be kinematically consistent and feasible for smooth flight.
# setting a value to NaN means the state should not be controlled
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
# NED local world frame
@@ -1,3 +1,5 @@
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
char[25] name # either the mode name, or component name
@@ -1,3 +1,4 @@
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
uint64 timestamp_sample # timestamp of the data sample on which this message is based (microseconds)
@@ -1,6 +1,8 @@
# This is similar to the mavlink message ATTITUDE_QUATERNION, but for onboard use
# The quaternion uses the Hamilton convention, and the order is q(w, x, y, z)
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
uint64 timestamp_sample # the timestamp of the raw data (microseconds)
@@ -1,3 +1,5 @@
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
float32 yaw_sp_move_rate # rad/s (commanded by user)
@@ -1,6 +1,8 @@
# Vehicle Command uORB message. Used for commanding a mission / action / etc.
# Follows the MAVLink COMMAND_INT / COMMAND_LONG definition
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
uint16 VEHICLE_CMD_CUSTOM_0 = 0 # test command
@@ -2,6 +2,8 @@
# Used for acknowledging the vehicle command being received.
# Follows the MAVLink COMMAND_ACK message definition
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
# Result cases. This follows the MAVLink MAV_RESULT enum definition
@@ -1,3 +1,5 @@
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
bool flag_armed # synonym for actuator_armed.armed
@@ -5,6 +5,8 @@
# e.g. control inputs of the vehicle in a Kalman-filter implementation.
#
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
uint64 timestamp_sample # the timestamp of the raw data (microseconds)
@@ -1,3 +1,5 @@
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
bool freefall # true if vehicle is currently in free-fall
@@ -1,6 +1,8 @@
# Fused local position in NED.
# The coordinate system origin is the vehicle position at the time when the EKF2-module was started.
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
uint64 timestamp_sample # the timestamp of the raw data (microseconds)
@@ -1,4 +1,7 @@
# Vehicle odometry data. Fits ROS REP 147 for aerial vehicles
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
uint64 timestamp_sample
@@ -1,3 +1,5 @@
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
# body angular rates in FRD frame
@@ -1,5 +1,7 @@
# Encodes the system state of the vehicle published by commander
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
uint64 armed_time # Arming timestamp (microseconds)
@@ -1,4 +1,7 @@
# VEHICLE_VTOL_STATE, should match 1:1 MAVLinks's MAV_VTOL_STATE
uint32 MESSAGE_VERSION = 0
uint8 VEHICLE_VTOL_STATE_UNDEFINED = 0
uint8 VEHICLE_VTOL_STATE_TRANSITION_TO_FW = 1
uint8 VEHICLE_VTOL_STATE_TRANSITION_TO_MC = 2
+1
View File
@@ -11,6 +11,7 @@ menu "barometer"
select DRIVERS_BAROMETER_MS5611
select DRIVERS_BAROMETER_MAIERTEK_MPC2520
select DRIVERS_BAROMETER_GOERTEK_SPL06
select DRIVERS_BAROMETER_GOERTEK_SPA06
select DRIVERS_BAROMETER_INVENSENSE_ICP101XX
select DRIVERS_BAROMETER_INVENSENSE_ICP201XX
---help---
+2 -1
View File
@@ -1,6 +1,6 @@
############################################################################
#
# Copyright (c) 2022 PX4 Development Team. All rights reserved.
# Copyright (c) 2022-2024 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
@@ -32,3 +32,4 @@
############################################################################
add_subdirectory(spl06)
add_subdirectory(spa06)
@@ -0,0 +1,45 @@
############################################################################
#
# Copyright (c) 2024 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.
#
############################################################################
px4_add_module(
MODULE drivers__barometer__spa06
MAIN spa06
SRCS
SPA06.cpp
SPA06.hpp
SPA06_I2C.cpp
SPA06_SPI.cpp
spa06_main.cpp
DEPENDS
px4_work_queue
)
@@ -0,0 +1,5 @@
menuconfig DRIVERS_BAROMETER_GOERTEK_SPA06
bool "spa06"
default n
---help---
Enable support for spa06
@@ -0,0 +1,259 @@
/****************************************************************************
*
* Copyright (c) 2024 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.
*
****************************************************************************/
#include "SPA06.hpp"
SPA06::SPA06(const I2CSPIDriverConfig &config, spa06::ISPA06 *interface) :
I2CSPIDriver(config),
_interface(interface),
_sample_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": sample")),
_measure_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": measure")),
_comms_errors(perf_alloc(PC_COUNT, MODULE_NAME": comms errors"))
{
}
SPA06::~SPA06()
{
// free perf counters
perf_free(_sample_perf);
perf_free(_measure_perf);
perf_free(_comms_errors);
delete _interface;
}
/*
float
SPA06::scale_factor(int oversampling_rate)
{
float k;
switch (oversampling_rate) {
case 1:
k = 524288.0f;
break;
case 2:
k = 1572864.0f;
break;
case 4:
k = 3670016.0f;
break;
case 8:
k = 7864320.0f;
break;
case 16:
k = 253952.0f;
break;
case 32:
k = 516096.0f;
break;
case 64:
k = 1040384.0f;
break;
case 128:
k = 2088960.0f;
break;
default:
k = 0;
break;
}
return k;
}
*/
int
SPA06::calibrate()
{
uint8_t buf[21];
_interface->read(SPA06_ADDR_CAL, buf, sizeof(buf));
_cal.c0 = (uint16_t)(buf[0]) << 4 | (uint16_t)(buf[1]) >> 4;
// If value is negative, we need to fill the missing bits.
_cal.c0 = (_cal.c0 & 1 << 11) ? (0xf000 | _cal.c0) : _cal.c0;
_cal.c1 = (uint16_t)(buf[1] & 0x0F) << 8 | buf[2];
_cal.c1 = (_cal.c1 & 1 << 11) ? (0xf000 | _cal.c1) : _cal.c1;
_cal.c00 = (uint32_t)(buf[3]) << 12 | (uint32_t)(buf[4]) << 4 | (buf[5]) >> 4;
_cal.c00 = (_cal.c00 & 1 << 19) ? (0xfff00000 | _cal.c00) : _cal.c00;
_cal.c10 = (uint32_t)(buf[5] & 0x0F) << 16 | (uint32_t)(buf[6]) << 8 | buf[7];
_cal.c10 = (_cal.c10 & 1 << 19) ? (0xfff00000 | _cal.c10) : _cal.c10;
_cal.c01 = (uint16_t)(buf[8]) << 8 | buf[9];
_cal.c11 = (uint16_t)(buf[10]) << 8 | buf[11];
_cal.c20 = (uint16_t)(buf[12]) << 8 | buf[13];
_cal.c21 = (uint16_t)(buf[14]) << 8 | buf[15];
_cal.c30 = (uint16_t)(buf[16]) << 8 | buf[17];
_cal.c31 = (uint16_t)(buf[18]) << 4 | (uint16_t)(buf[19] & 0xF0) >> 4;
_cal.c31 = (_cal.c31 & 1 << 11) ? (0xf000 | _cal.c31) : _cal.c31;
_cal.c40 = (uint16_t)(buf[19] & 0x0F) << 8 | buf[20];
_cal.c40 = (_cal.c40 & 1 << 11) ? (0xf000 | _cal.c40) : _cal.c40;
PX4_DEBUG("c0:%d\nc1:%d\nc00:%ld\nc10:%ld\nc01:%d\nc11:%d\nc20:%d\nc21:%d\nc30:%d\nc31:%d\nc40:%d\n",
_cal.c0, _cal.c1,
_cal.c00, _cal.c10,
_cal.c01, _cal.c11, _cal.c20, _cal.c21, _cal.c30, _cal.c31, _cal.c40);
return OK;
}
int
SPA06::init()
{
int8_t tries = 5;
// reset sensor
_interface->set_reg(SPA06_VALUE_RESET, SPA06_ADDR_RESET);
usleep(10000);
// check id
if (_interface->get_reg(SPA06_ADDR_ID) != SPA06_VALUE_ID) {
PX4_DEBUG("id of your baro is not: 0x%02x", SPA06_VALUE_ID);
return -EIO;
}
while (tries--) {
uint8_t meas_cfg = _interface->get_reg(SPA06_ADDR_MEAS_CFG);
if (meas_cfg & (1 << 7) && meas_cfg & (1 << 6)) {
break;
}
usleep(10000);
}
if (tries < 0) {
PX4_DEBUG("spa06 sensor or coef not ready");
return -EIO;
}
// get calibration and pre process them
calibrate();
// set config, recommended settings
_interface->set_reg(_curr_prs_cfg, SPA06_ADDR_PRS_CFG);
kp = 253952.0f; // refer to scale_factor()
_interface->set_reg(_curr_tmp_cfg, SPA06_ADDR_TMP_CFG);
kt = 524288.0f;
// Enable FIFO
_interface->set_reg(1 << 2, SPA06_ADDR_CFG_REG);
// Continuous pressure and temperature mesasurement.
_interface->set_reg(7, SPA06_ADDR_MEAS_CFG);
Start();
return OK;
}
void
SPA06::Start()
{
// schedule a cycle to start things
ScheduleNow();
}
void
SPA06::RunImpl()
{
collect();
ScheduleDelayed(_measure_interval);
}
int
SPA06::collect()
{
perf_begin(_sample_perf);
// this should be fairly close to the end of the conversion, so the best approximation of the time
const hrt_abstime timestamp_sample = hrt_absolute_time();
if (_interface->read(SPA06_ADDR_DATA, (uint8_t *)&_data, sizeof(_data)) != OK) {
perf_count(_comms_errors);
perf_cancel(_sample_perf);
return -EIO;
}
int32_t temp_raw = (uint32_t)_data.t_msb << 16 | (uint32_t)_data.t_lsb << 8 | (uint32_t)_data.t_xlsb;
temp_raw = (temp_raw & 1 << 23) ? (0xff000000 | temp_raw) : temp_raw;
int32_t press_raw = (uint32_t)_data.p_msb << 16 | (uint32_t) _data.p_lsb << 8 | (uint32_t) _data.p_xlsb;
press_raw = (press_raw & 1 << 23) ? (0xff000000 | press_raw) : press_raw;
// calculate
float ftsc = (float)temp_raw / kt;
float fpsc = (float)press_raw / kp;
float qua2 = (float)_cal.c10 + fpsc * ((float)_cal.c20 + fpsc * ((float)_cal.c30) + fpsc * (float)_cal.c40);
float qua3 = ftsc * fpsc * ((float)_cal.c11 + fpsc * ((float)_cal.c21) + fpsc * (float)_cal.c31);
float fp = (float)_cal.c00 + fpsc * qua2 + ftsc * (float)_cal.c01 + qua3;
float temperature = (float)_cal.c0 * 0.5f + (float)_cal.c1 * ftsc;
sensor_baro_s sensor_baro{};
sensor_baro.timestamp_sample = timestamp_sample;
sensor_baro.device_id = _interface->get_device_id();
sensor_baro.pressure = fp;
sensor_baro.temperature = temperature;
sensor_baro.error_count = perf_event_count(_comms_errors);
sensor_baro.timestamp = hrt_absolute_time();
_sensor_baro_pub.publish(sensor_baro);
perf_end(_sample_perf);
return OK;
}
void
SPA06::print_status()
{
I2CSPIDriverBase::print_status();
perf_print_counter(_sample_perf);
perf_print_counter(_measure_perf);
perf_print_counter(_comms_errors);
}
@@ -0,0 +1,117 @@
/****************************************************************************
*
* Copyright (c) 2024 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.
*
****************************************************************************/
#pragma once
#include "spa06.h"
#include <drivers/drv_hrt.h>
#include <px4_platform_common/px4_config.h>
#include <px4_platform_common/i2c_spi_buses.h>
#include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp>
#include <lib/perf/perf_counter.h>
#include <uORB/PublicationMulti.hpp>
#include <uORB/topics/sensor_baro.h>
class SPA06 : public I2CSPIDriver<SPA06>
{
public:
SPA06(const I2CSPIDriverConfig &config, spa06::ISPA06 *interface);
virtual ~SPA06();
static I2CSPIDriverBase *instantiate(const I2CSPIDriverConfig &config, int runtime_instance);
static void print_usage();
int init();
void print_status();
void RunImpl();
private:
void Start();
// float scale_factor(int oversampling_rate);
int collect(); //get results and publish
int calibrate();
uORB::PublicationMulti<sensor_baro_s> _sensor_baro_pub{ORB_ID(sensor_baro)};
spa06::ISPA06 *_interface;
spa06::data_s _data;
spa06::calibration_s _cal{};
// set config, recommended settings
//
// oversampling rate : single | 2 | 4 | 8 | 16 | 32 | 64 | 128
// scale factor(KP/KT): 524288 | 1572864 | 3670016 | 7864320 | 253952 | 516096 | 1040384 | 2088960
// configuration of pressure measurement rate (PM_RATE) and resolution (PM_PRC)
//
// PM_RATE[7:4] : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15
// measurement rate: 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 25/16 | 25/8 | 25/4 | 25/2 | 25 | 50 | 100 | 200
// note: applicable for measurements in background mode only
//
// PM_PRC[3:0] : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
// oversampling (times): single | 2 | 4 | 8 | 16 | 32 | 64 | 128
// measurement time(ms): 3.6 | 5.2 | 8.4 | 14.8 | 27.6 | 53.2 | 104.4 | 206.8
// precision(PaRMS) : 5.0 | | 2.5 | | 1.2 | 0.9 | 0.5 |
// note: use in combination with a bit shift when the oversampling rate is > 8 times. see CFG_REG(0x19) register
//
// -> 32 measurements per second, 16 oversampling
static constexpr uint8_t _curr_prs_cfg{5 << 4 | 4};
// configuration of temperature measurment rate (TMP_RATE) and resolution (TMP_PRC)
//
// temperature measurement: internal sensor (in ASIC) | external sensor (in pressure sensor MEMS element)
// PM_RATE[7:4] : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15
// measurement rate: 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 25/16 | 25/8 | 25/4 | 25/2 | 25 | 50 | 100 | 200
// note: applicable for measurements in background mode only
//
// TMP_PRC[2:0] : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
// oversampling (times): single | 2 | 4 | 8 | 16 | 32 | 64 | 128
// note: single(default) measurement time 3.6ms, other settings are optional, and may not be relevant
// note: use in combination with a bit shift when the oversampling rate is > 8 times. see CFG_REG(0x19) register
// -> 32 measurements per second, single oversampling
static constexpr uint8_t _curr_tmp_cfg{5 << 4 | 0};
bool _collect_phase{false};
float kp;
float kt;
perf_counter_t _sample_perf;
perf_counter_t _measure_perf;
perf_counter_t _comms_errors;
static constexpr uint32_t _sample_rate{32};
static constexpr uint32_t _measure_interval{1000000 / _sample_rate};
};
@@ -0,0 +1,102 @@
/****************************************************************************
*
* Copyright (c) 2024 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 SPA06_I2C.cpp
*
* SPI interface for Goertek SPA06
*/
#include "spa06.h"
#include <px4_platform_common/px4_config.h>
#include <drivers/device/i2c.h>
#if defined(CONFIG_I2C)
class SPA06_I2C: public device::I2C, public spa06::ISPA06
{
public:
SPA06_I2C(uint8_t bus, uint32_t device, int bus_frequency);
virtual ~SPA06_I2C() override = default;
int init() override { return I2C::init(); }
uint8_t get_reg(uint8_t addr) override;
int set_reg(uint8_t value, uint8_t addr) override;
int read(uint8_t addr, uint8_t *buf, uint8_t len) override;
//spa06::data_s *get_data(uint8_t addr) override;
//spa06::calibration_s *get_calibration(uint8_t addr) override;
uint32_t get_device_id() const override { return device::I2C::get_device_id(); }
uint8_t get_device_address() const override { return device::I2C::get_device_address(); }
private:
spa06::calibration_s _cal{};
spa06::data_s _data{};
};
spa06::ISPA06 *spa06_i2c_interface(uint8_t busnum, uint32_t device, int bus_frequency)
{
return new SPA06_I2C(busnum, device, bus_frequency);
}
SPA06_I2C::SPA06_I2C(uint8_t bus, uint32_t device, int bus_frequency) :
I2C(DRV_BARO_DEVTYPE_SPA06, MODULE_NAME, bus, device, bus_frequency)
{
}
uint8_t
SPA06_I2C::get_reg(uint8_t addr)
{
uint8_t cmd[2] = { (uint8_t)(addr), 0};
transfer(&cmd[0], 1, &cmd[1], 1);
return cmd[1];
}
int
SPA06_I2C::set_reg(uint8_t value, uint8_t addr)
{
uint8_t cmd[2] = { (uint8_t)(addr), value};
return transfer(cmd, sizeof(cmd), nullptr, 0);
}
int
SPA06_I2C::read(uint8_t addr, uint8_t *buf, uint8_t len)
{
return transfer(&addr, 1, buf, len);
}
#endif // CONFIG_I2C
@@ -0,0 +1,104 @@
/****************************************************************************
*
* Copyright (c) 2024 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 SPA06_SPI.cpp
*
* SPI interface for Goertek SPA06
*/
#include "spa06.h"
#include <px4_platform_common/px4_config.h>
#include <drivers/device/spi.h>
#if defined(CONFIG_SPI)
/* SPI protocol address bits */
#define DIR_READ (1<<7) //for set
#define DIR_WRITE ~(1<<7) //for clear
class SPA06_SPI: public device::SPI, public spa06::ISPA06
{
public:
SPA06_SPI(uint8_t bus, uint32_t device, int bus_frequency, spi_mode_e spi_mode);
virtual ~SPA06_SPI() override = default;
int init() override { return SPI::init(); }
uint8_t get_reg(uint8_t addr) override;
int set_reg(uint8_t value, uint8_t addr) override;
int read(uint8_t addr, uint8_t *buf, uint8_t len) override;
uint32_t get_device_id() const override { return device::SPI::get_device_id(); }
uint8_t get_device_address() const override { return device::SPI::get_device_address(); }
};
spa06::ISPA06 *
spa06_spi_interface(uint8_t busnum, uint32_t device, int bus_frequency, spi_mode_e spi_mode)
{
return new SPA06_SPI(busnum, device, bus_frequency, spi_mode);
}
SPA06_SPI::SPA06_SPI(uint8_t bus, uint32_t device, int bus_frequency, spi_mode_e spi_mode) :
SPI(DRV_BARO_DEVTYPE_SPA06, MODULE_NAME, bus, device, spi_mode, bus_frequency)
{
}
uint8_t
SPA06_SPI::get_reg(uint8_t addr)
{
uint8_t cmd[2] = { (uint8_t)(addr | DIR_READ), 0}; // set MSB bit
transfer(&cmd[0], &cmd[0], 2);
return cmd[1];
}
int
SPA06_SPI::set_reg(uint8_t value, uint8_t addr)
{
uint8_t cmd[2] = { (uint8_t)(addr & DIR_WRITE), value}; // clear MSB bit
return transfer(&cmd[0], nullptr, 2);
}
int
SPA06_SPI::read(uint8_t addr, uint8_t *buf, uint8_t len)
{
uint8_t tx_buf[len + 1] = {(uint8_t)(addr | DIR_READ)}; // GCC support VLA, let's use it
return transfer(tx_buf, buf, len);
}
#endif // CONFIG_SPI
@@ -0,0 +1,41 @@
/****************************************************************************
*
* Copyright (c) 2024 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.
*
****************************************************************************/
/**
* Goertek SPA06 Barometer (external I2C)
*
* @reboot_required true
* @group Sensors
* @boolean
*/
PARAM_DEFINE_INT32(SENS_EN_SPA06, 0);

Some files were not shown because too many files have changed in this diff Show More