Commit Graph
30 Commits
Author SHA1 Message Date
cb00217286 feat(sih): add optional support for non-flat terrain for MC, FW and VTOL (#29619)
* feat(simulator_sih): add a GeoTIFF terrain elevation model for SITL

SIH only simulates flat ground. This adds the loader for a terrain
elevation model (DEM) in a GeoTIFF file, the base for non-flat terrain
in SITL.

The DEM is read with libtiff and libgeotiff. A DEM in a projected CRS is
resampled once at load time with PROJ onto a WGS84 lat/lon grid, so a
lookup in the simulation loop is a plain bilinear interpolation. It is
built only for px4_sitl and only when the three libraries are found, so
hardware builds and SITL without them are unchanged.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Beniamino Pozzan <beniamino.pozzan@auterion.com>

* feat(simulator_sih): use the terrain DEM for ground contact and the rangefinder

With PX4_SIH_TERRAIN set to a GeoTIFF DEM, SIH in SITL places the vehicle
on the terrain at start, lands it on the terrain, ray-casts the downward
distance sensor against it, and publishes it as the groundtruth
terrain_alt. Outside the DEM the ground stays flat at SIH_LOC_H0.

Terrain is only used for multicopters, VTOLs and fixed-wing; other
vehicle types keep flat ground. The DEM is loaded in task_spawn() so a
bad file fails the start command, and because the SIH task stack is too
small for libtiff and PROJ.

The groundtruth terrain_alt now holds the WGS84 terrain altitude, as the
message documents, instead of the height above the origin.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Beniamino Pozzan <beniamino.pozzan@auterion.com>

* build(setup): install the SIH terrain dependencies with the simulation tools

Install libtiff, libgeotiff and PROJ so SITL builds SIH with terrain
elevation (DEM) support. They are optional: without them SIH builds as
before.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Beniamino Pozzan <beniamino.pozzan@auterion.com>

* docs(sim_sih): document terrain elevation from a GeoTIFF DEM

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Beniamino Pozzan <beniamino.pozzan@auterion.com>

* docs(sim_sih): fix and clarify the terrain elevation section

Address review findings on the new terrain section: list the sample
types the loader actually reads, note that the prebuilt px4 package and
px4io/px4-sitl container are built without terrain support, and say
when SIH_LOC_H0 still sets the start altitude.

Also add a version badge, link GeoTIFF, EPSG and GDAL, mention the
dist_bottom groundtruth field, and correct the GLO-30 coverage.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>

* fix: cast to double for MAC builds

Signed-off-by: Beniamino Pozzan <beniamino.pozzan@auterion.com>

* chore: implement TerrainBase interface

Assisted-by: Claude:claude-opus-5-5

Signed-off-by: Beniamino Pozzan <beniamino.pozzan@auterion.com>

* chore: improve isolation of terrain logic from sih core

Signed-off-by: Beniamino Pozzan <beniamino.pozzan@auterion.com>

* refactor(simulator_sih): move DEM handling into the terrain classes

SIH should only use the terrain, not manage it. TerrainFlat becomes the
base class, since flat ground is what every terrain model builds on, and
TerrainDem falls back to it until a DEM is loaded. Terrain.hpp picks the
model at compile time, so SIH holds the terrain by value with no #ifdef,
new/delete or pointer handover, and NuttX builds only get the flat model.

Tracking whether the vehicle is inside the DEM, and the matching
warnings and status, move from SIH into TerrainDem.

The DEM is still loaded in task_spawn() because the SIH task stack is too
small for libtiff and PROJ, so the terrain is a static member that the
instance uses directly instead of moving it.

A terrain file with an unsupported vehicle type now fails the start like
a bad file instead of silently using flat ground.

---------

Signed-off-by: Beniamino Pozzan <beniamino.pozzan@auterion.com>
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
Co-authored-by: Matthias Grob <maetugr@gmail.com>
2026-11-12 16:49:11 +11:00
Ramon Roche d6cd502f2d ci(macos): stop pinning Homebrew to older commits
The macOS job checked out Homebrew 7.0.6 and a 2026-09-18 package index
on a runner image whose packages a newer Homebrew had installed. The
image refreshed on 2026-10-29 with openssl@4 as the linked default, and
the pinned Homebrew deadlocked on its own openssl@4 lock while linking
the pinned openssl@3 for ccache, so ccache never installed and every
run since failed. Homebrew fixed the nested lock in 7.0.10, but any pin
older than the image repeats the problem at the next refresh.

The pins were added to keep Gazebo on bottles built against one
protobuf. Gazebo now comes from the conda-forge lock in macos/pixi.toml,
so install from the Homebrew and index the image ships, with auto-update
off so the index stays the one its packages came from. macos.sh goes
back to plain brew tap and cask installs, which is what it already does
on developer machines.

Assisted-by: Claude:claude-mythos-5-1
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-10-30 09:13:13 -07:00
Julian Oes 1c7a07a411 test(mavsdk_tests): rewrite the integration tests in Python (#29332)
* build(mavsdk_tests): stop building the C++ integration tests

The integration tests are moving to the native MAVSDK Python package, so
the C++ test binary and its pinned libmavsdk-dev package are no longer
needed. The C++ sources stay in the tree as a reference until all tests
are ported.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* test(mavsdk_tests): run the integration tests with MAVSDK Python

The MAVSDK pip package is now a native binding of the C++ library, so
the tests can be written in Python without a C++ build or a matching
libmavsdk-dev package, and the version is pinned in requirements.txt.

The existing runner keeps starting PX4 for each case; only the test
executable changes to pytest. Cases are pytest node IDs and the Catch2
tags become pytest markers.

The tester is a port of the C++ AutopilotTester core. Checks done in
telemetry callbacks are collected and fail the test at teardown, since
MAVSDK Python swallows exceptions raised in callbacks.

The first ported test is takeoff and hold position.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* test(mavsdk_tests): port the multicopter tests to Python

Ports missions, offboard, manual flight, failsafes, failure injection,
RTL with rally points and geofence avoidance, home yaw and parameter FTP.
The tester gains the raw mission, manual control, failure, FTP and
MavlinkDirect helpers these need, plus an RTL subclass for rally points
and the geofence breach monitor.

The failsafe tests are parametrized over the height source instead of
being duplicated.

The parameter FTP download test now waits for the baro GNSS calibration
before comparing, since the offset it writes could otherwise change
between the PARAM_VALUE and the FTP download.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* test(mavsdk_tests): port the VTOL and control allocation tests to Python

Ports the VTOL missions, the VTOL return tests, figure eight, loiter
reposition, airspeed failure, the SIH XVert transition and the
gazebo-classic control allocation tests.

The loiter and figure-eight testers are merged into one loiter tester
that sends its commands as COMMAND_INT through MavlinkDirect. NaN fields
are sent as JSON null, since NaN is not valid JSON and MAVSDK reads null
as NaN.

Timeouts that were host time in C++ (approaches, figure eight) are now
sim time with values that fit the speed factors used in CI.

The gazebo runner can now take the world from the config, since pytest
node IDs no longer carry "(name.world)".

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* test(mavsdk_tests): settle the hover before injecting motor failures

The altitude and speed waits both pass while the vehicle is still
slowing down at the top of the climb, so the altitude reference for the
failure was taken mid-climb. At 30x speed the following overshoot was
just over the 1 m tolerance.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* test(mavsdk_tests): port the follow-me tests to Python

The C++ follow-me tests were never built: they were disabled pending a
MAVSDK change that has long since been merged, and the RC adjustment
test did not even compile. They now run with the other multicopter
tests.

Running them for the first time showed a few test bugs: target
locations were sent before follow-me was active, manual control was
dropped after 20 s, and the angle check ignored the rate limit from
FLW_TGT_MAX_VEL. The RC checks now measure the change from right before
each stick input.

The follow distance adjusts at about 40% of the nominal speed, since
PX4 only grows the setpoint while the drone is within 1 m of it. The
test accepts that for now.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* test(mavsdk_tests): remove the C++ integration tests

All tests now run with MAVSDK Python, so the C++ tests, the tester
classes and the bundled Catch2 are no longer needed.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* build(setup): install the integration test requirements

The MAVSDK and pytest pins move to Tools/setup/test-requirements.txt,
which the setup scripts and the dev container now install, so the
integration tests work after the normal environment setup. The mavsdk
pin allows 4.0.x patch releases only.

The file lives in Tools/setup because that is the dev container's build
context. Container builds that stage only requirements.txt skip it.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* docs(test_and_ci): describe the Python MAVSDK integration tests

Covers the setup, running test cases by pytest ID, running a test
against a PX4 instance started by hand, and writing tests with the
testers and fixtures. Drops the Catch2 notes and the outdated list of
test cases.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* refactor(packaging): port the SIH container mission test to MAVSDK v4

Since v4, the mavsdk package is the native binding with a different API,
so the script failed to import with the version the setup scripts now
install. It now uses the synchronous API.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* test(mavsdk_tests): work around MAVSDK-Python unsubscribe crash

Up to MAVSDK-Python 4.0.6, unsubscribe_*() releases the callback
trampoline before the C unsubscribe returns, so a callback that is
running or waiting for the GIL can jump into freed memory. This crashed
the hex test in CI. Keep the subscription entries until the tester is
closed, until the pin includes the fix.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* test(mavsdk_tests): retry the param FTP comparison until values settle

Waiting for CAL_BARO0_OFF to change does not work everywhere: at the
CI home location the baro already matches GNSS and the calibration
writes an offset of 0. Instead, compare the PARAM_VALUE and FTP
downloads and retry a few times while parameters still settle.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* test(mavsdk_tests): port the vision target tests to Python

Port the precision landing tests from #29265: the pad is simulated with
TARGET_RELATIVE and TARGET_ABSOLUTE sent through MavlinkDirect, and the
estimate is checked from LANDING_TARGET.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* test(mavsdk_tests): fail when a filter or case selects nothing

A config filter that matched no test, for example because of a typo,
ran zero cases and passed. Also, --case used fnmatch, which reads the
brackets of parametrized test IDs as a character class, so such a test
could not be selected by its ID. Treat brackets literally and fail when
nothing is selected.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* test(mavsdk_tests): check the COMMAND_ACK of sent commands

Commands sent through MavlinkDirect were sent once and the ACK was
ignored, so a dropped or denied command only showed up later as an
unrelated timeout. Retry until acked like MAVSDK does, and check the
result.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* test(mavsdk_tests): check the condition once more on poll timeout

Also make the comment of check_rtl_approaches say that it can't fail.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* test(mavsdk_tests): disable baro auto-calibration in the param FTP test

Port #29359 to the Python test: the baro GNSS calibration can save a
new CAL_BARO0_OFF between the PARAM_VALUE and FTP downloads. Disable it
instead of retrying the comparison.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

---------

Signed-off-by: Julian Oes <julian@oes.ch>
2026-10-26 08:50:51 -06:00
Ramon Roche a8b0e91ebe feat(setup): install macOS Gazebo from a locked conda-forge environment
Homebrew rebuilds and drops the gz bottles whenever homebrew-core bumps
protobuf or abseil, which breaks the macOS Gazebo install until the pins
catch up. conda-forge keeps every package it has published, so
Tools/setup/macos/pixi.toml and its lock install the same gz, protobuf,
abseil, OpenCV and GStreamer binaries until the lock is updated on
purpose. OpenCV is the headless build, and GStreamer brings the good,
bad and ugly plugin sets the gz camera plugin's pipeline uses.

macos.sh installs the environment with pixi and loads it from the venv
activation through a small script, since pixi shell-hook would export
the installing shell's PATH. The build and the gz launch do not depend
on that activation: CMake searches the environment like it pins the
.venv Python, and px4-rc.gzsim sources gz_env.sh before it looks for
gz, which loads the environment when it is not already active and puts
its lib dir ahead of Homebrew's in the dyld fallback path.
conda-forge's gz-transport13 does not pull in cppzmq, so the manifest
lists it.

The osrf/simulation pin, the protobuf pin and the weekly bot that
refreshed them are removed. The homebrew-core commit moves into
homebrew-pins.txt unchanged.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-26 15:12:00 -07:00
Ramon Roche a23449cbe5 feat(simulation)!: remove jMAVSim
PX4 SIH with the Hawkeye visualizer replaces jMAVSim, in SITL and as the
display-only viewer for SIH running on hardware. Drop the jMAVSim
submodule, its make targets, px4-rc.jmavsim, the 10017_jmavsim_iris
airframe and the VS Code debug helpers, stop installing Java and ant in
the macOS and Arch setup scripts, and point the remaining mentions at SIH
and Hawkeye.

BREAKING CHANGE: make px4_sitl jmavsim and SYS_AUTOSTART 10017 no longer
exist. Use make px4_sitl_sih sihsim_quadx with Hawkeye instead.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-09-26 14:28:26 -07:00
Jacob Dahl fbfc1386ee ci(macos): install from pinned Homebrew commits
The job ran brew update and then installed whatever Homebrew was publishing, except Gazebo, which stayed on one commit. Those were built against different protobufs, so a release upstream failed the build with no commit here. Check the package repos out at commits recorded in the tree and do not update them. Run on macos-15 only, so the OS label cannot move either.

Assisted-by: Grok:grok-4.7
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-09-21 16:55:31 -07:00
Jacob Dahl 49339b843f ci(macos): remove the MacOS workflows
The build runs brew update and then pours Gazebo from one pinned tap commit while the rest of the install, including protobuf, comes from current Homebrew. A release in either repo fails the check with no commit here, and the GitHub-hosted image moves on its own, so the job cannot be a closed set. Drop the build and the weekly pin refresh. The setup script, the pins, and the refresh script stay for local use.

Assisted-by: Grok:grok-4.7
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-09-21 16:55:31 -07:00
Julian Oes 1d7b23e198 build(macos): pin protobuf to what the gz bottles need (#28774)
Every gz .pb.h refuses to compile against anything but the exact protobuf
its gencode came from, so the bottles gz-tap-pin.txt holds osrf/simulation
at only build against the protobuf homebrew-core shipped the day OSRF built
them. homebrew-core moves protobuf on its own schedule and OSRF rebuilds
days later, so `make px4_sitl` has been failing on macOS on every branch
since homebrew-core shipped protobuf 36.2.

Pin protobuf as well, to the homebrew-core revision that installs the
version the pinned gz bottles carry, and derive that pin from the bottles
themselves so the two can never disagree. A protobuf release then becomes a
no-op here instead of days of red CI while OSRF catches up.

The pinned install has to run after the other simulation packages and with
the dependents check off: opencv@4 depends on protobuf too, brew resolves a
dependency against the versions recorded in the dependent's bottle, and it
reinstalls dependents whose linkage it has just broken. Pinning the formula
with `brew pin` is not an option either, brew then refuses to install
anything that depends on it.

Assisted-by: Claude:claude-opus-5

Signed-off-by: Julian Oes <julian@oes.ch>
2026-09-22 10:15:13 +12:00
3309f497d8 fix(macos.sh): trust brew taps before tapping them (#28702)
* fix(macos.sh): trust brew taps before tapping them

Recent Homebrew validates every formula of a tap while tapping it. On
Homebrew 6.0+ loading a formula from an untrusted tap is refused, so
`brew tap osx-cross/arm` and `brew tap PX4/px4` now fail with
"Cannot tap ...: invalid syntax in tap!" because `brew trust` only ran
afterwards. Without the PX4/px4 tap, `brew install` aborts on `fastdds`
before pouring any package, ccache included, and the macOS CI job dies
with `ccache: command not found`. main has been red since 2026-09-14.

Run `brew trust` before `brew tap`; it accepts taps that are not
installed yet.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(macos.sh): trust osrf/simulation tap before tapping it

Same ordering problem as the toolchain taps: with Homebrew 6.0+ tapping
an untrusted tap fails, so there is no tap clone to apply the
gz-tap-pin.txt pin to. The later install of
osrf/simulation/gz-harmonic then taps it implicitly at HEAD, silently
skipping the pin and risking Gazebo building from source.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Julian Oes <julian@oes.ch>

* fix(macos.sh): set -e to abort on first failure

The script kept going after a failed `brew tap` or `brew install`, so
the macOS CI job only failed much later with `ccache: command not
found`, far away from the actual cause.

Add `set -e`. Commands that are allowed to fail (`brew uninstall flock`
on a machine without it, `brew doctor` warnings, fetching the gz tap pin
whose failure is already handled by the following checkout) get an
explicit `|| true`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Signed-off-by: Julian Oes <julian@oes.ch>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Julian Oes <julian@oes.ch>
2026-09-15 11:17:37 +02:00
FARHANG d840da70b6 build(macos): pin gz tap unconditionally, add weekly refresh
macos.sh only pinned osrf/simulation when --ci was passed, so dev
machines still hit OSRF's bottle-gap window and built Gazebo from
source. Apply it whenever --sim-tools runs.

The pin is a point-in-time SHA with nothing to advance it, so add a
weekly workflow that checks whether osrf/simulation HEAD is fully
bottled and opens a PR bumping gz-tap-pin.txt when it is.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: FARHANG <farhang.nba@gmail.com>
2026-09-04 13:26:30 -07:00
Matthias Grob 52dc99f395 fix(macos.sh): replace discoteq/discoteq/flock since there's homebrew/core/flock now 2026-08-26 07:56:01 -07:00
Ramon Roche 6ed16e2748 build(macos): pin osrf/simulation tap under --ci
When homebrew-core bumps a shared dependency, OSRF's bot bumps each gz
formula's revision and deletes its bottle block within minutes of the upstream
merge. The matching rebuild is a separate, unautomated step: across 2026 the
gap ran 0.5 to 11 days, median 2.5, leaving gz unbottled roughly 18% of the
time. In that window macos.sh compiles gz-sim8, gz-msgs10 and five others from
source and the setup step goes from ~8min to 20-30min.

The removal only edits the formula. The bottle tarballs are never deleted from
OSRF's S3 bucket, so pinning to the last fully bottled revision keeps installs
binary while upstream catches up.

Gated behind a new --ci flag rather than applied unconditionally. Automation
wants a reproducible, fast install; development machines want the current
formulae and can absorb a source build, and should not have their tap left on
a detached HEAD as a side effect of running the setup script.

Only the gz tap is pinned. opencv@4, protobuf, gstreamer and the rest still
track homebrew-core, so CI keeps catching upstream formula breakage on every
PR, which is the reason --sim-tools runs there in the first place.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-08-19 13:10:10 -07:00
Jackson Korba f71763989a fix(macos): install opencv@4 and hint its prefix
macos.sh --sim-tools installs the unversioned Homebrew opencv formula, which
is now 5.0.0, and PX4-OpticalFlow does not build against it:

  klt_feature_tracker/src/trackFeatures.cpp:43:10:
    fatal error: 'opencv2/core/types_c.h' file not found
  PX4-OpticalFlow/src/flow_opencv.cpp:110:7:
    fatal error: no member named 'undistortPoints' in namespace 'cv'

types_c.h was removed in OpenCV 5, and undistortPoints moved when calib3d was
split into 3d/calib. The failure lands about a thousand targets into
make px4_sitl and points at submodule sources rather than at the dependency.

ubuntu.sh takes libopencv-dev from apt, which is still 4.x, so CI never sees
this.

Install opencv@4 instead. It is keg-only, so find_package still resolves to
5.0.0 without a prefix hint. Add one alongside the qt@5 hint from 9c2e634325,
which is keg-only for the same reason.

Assisted-by: Claude:claude-opus-5[1m]
Signed-off-by: Jackson Korba <jackson.korba@gmail.com>
2026-08-10 18:17:21 -07:00
Cade Andersen d067ce19c3 fix(macos): trust osrf/simulation tap in --sim-tools block (#27891)
Homebrew 6.0+ refuses to load formulae from untrusted third-party taps. This adds a trusted block for OSRF taps. 

Signed-off-by: Cade Andersen <cadecandersen@gmail.com>
2026-07-14 01:55:16 -04:00
Ramon Roche 3db36cb022 ci(macos): trust PX4 brew taps for Homebrew 6.0
Homebrew 6.0 (2026-06-11) makes tap-trust mandatory and refuses to load
formulae from untrusted third-party taps. This broke every macOS build:
brew install aborted with "Refusing to load formula px4/px4/fastdds from
untrusted tap px4/px4" before pouring any package, so ccache (and the
rest of the toolchain) was never installed and setup-ccache failed with
"ccache: command not found".

Trust the three required taps non-interactively before installing from
them. Guarded behind a brew trust capability check so older Homebrew,
which has no trust gate, skips it.

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-06-25 13:23:29 -07:00
Jukka Laitinen 839b7a470f fix(CI): Prerequisites for nuttx update (#27509)
* src/drivers/cdcacm_autostart: Include posix.h for px4_close

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>

* platforms/nuttx/CMakeLists.txt: Fix linking of nuttx libaries for memalign

This fixes memalign not found in linking step for some boards

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>

* Add "flock" to macos.sh setup script

"flock" is not standard on macOS, and a dependency was missing from the
macOS setup path.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>

* Fix clang-tidy errors in Bitset.hpp and in src/lib/matrix

Fix the "bugprone-dynamic-static-initializers" linter errors.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>

* systemlib/hardfault_log: Fix clang-diagnostics error

Fix for
"[error] clang-diagnostic-error [error]
 use of undeclared identifier XCPTCONTEXT_REGS".

XCPTCONTEXT_REGS is defined in nuttx irq.h, so include that.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>

* uORB: Fix clang-tidy error "bugprone-dynamic-static-initializers"

Fix the clang-tidy error appearing on uORBManager _Instance variable by
adding a getter for the reference to the _Instance and using that instead.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>

* CI: Add default ubuntu mirrors as fallback

In case of specified aws mirror doesn't have the package idicated by the
metadata, a the default ubuntu mirror as a backup.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>

---------

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2026-06-02 11:27:50 -06:00
Ramon Roche 9c2e634325 build(macos): make gz SITL work out-of-box after homebrew 4.5
The px4-sim / px4-sim-gazebo Homebrew meta-formulae can no longer
pull their Gazebo dependency chain because Homebrew 4.5+ stopped
auto-resolving cross-tap deps. PX4/homebrew-px4#104 already
deprecated px4-dev into a no-op; #111 does the same for the sim
formulae. This PR is the PX4-side counterpart: move the sim install
into Tools/setup/macos.sh with an explicit package list and tap
registration, mirroring the pattern already used for the toolchain
block. Adds xquartz install on --sim-tools.

Beyond install, three runtime and configure gaps kept make px4_sitl
gz_x500 from working on a clean macOS:

- gz-gui8 (pulled in by gz-sim8) links against Qt5, but Homebrew's
  qt@5 is keg-only so CMake cannot find it. Add a POSIX-scoped hint
  in platforms/posix/cmake/px4_impl_os.cmake that resolves
  brew --prefix qt@5 and appends it to CMAKE_PREFIX_PATH. No-ops on
  non-APPLE builds and respects a user-set Qt5_DIR.

- On macOS, dyld does not search /opt/homebrew/lib by default.
  gobject-introspection typelibs reference libs by bare basename,
  causing gst-plugin-scanner to fail to load plugins and adding
  ~90s of timeout to Gazebo's cold start. Set
  DYLD_FALLBACK_LIBRARY_PATH to the Homebrew prefix lib dir in
  gz_env.sh so the bridge launch inherits it. Darwin-scoped, no
  effect on Linux or CI.

- configure_file on gz_env.sh.in now uses @ONLY so shell ${VAR}
  references pass through untouched.

Verified locally on macOS 26.4 / arm64 / Homebrew 5.1.7: configure
clean, 1119/1119 targets compile and link, vehicle spawns in
Gazebo Harmonic 8.11.0 with a single "Waiting for Gazebo world"
wait (was ~18 before the dyld fix).

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-04-20 16:15:41 -07:00
Kristiyan DimitrovandRamon Roche b5e632ccf4 build(macos): add Python venv support to setup script (#26702)
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
Co-authored-by: Ramon Roche <mrpollo@gmail.com>
2026-04-20 09:45:54 -07:00
Ramon Roche a6d1822521 build(macos): inline homebrew deps in setup script, drop px4-dev meta-formula
Homebrew 4.5 (April 2026) stopped auto-tapping cross-tap
dependencies declared in formulae, as a security + performance
change. The px4-dev meta-formula pulled in packages from
osx-cross/arm, PX4/px4, and discoteq/discoteq, so 'brew install
px4-dev' now aborts before any real work unless every tap has been
added explicitly. On macos-latest CI runners the chain broke at the
first unreachable dep (discoteq/discoteq/flock) and subsequent make
steps failed with 'ccache: command not found'.

Since Tools/setup/macos.sh is the canonical install path and already
tapped osx-cross/arm and PX4/px4 before calling brew install, the
simplest fix is to inline the package list and call brew install
directly. The px4-dev meta-formula will be kept upstream as a
deprecated no-op so older copies of macos.sh on long-lived branches
and cached Docker images keep working.

The inlined package list is the same set px4-dev depended on, minus
the dead-weight flock dependency that hadn't been invoked in the PX4
build since the NuttX 9.1.x era. See the accompanying PX4/homebrew-px4
PR for formula changes.

Docs updated to match: docs/en/dev_setup/dev_env_mac.md no longer
names the px4-dev formula, describes the package list directly.

Verified locally on macOS ARM64:
- ./Tools/setup/macos.sh runs to completion with both taps and all 13
  packages resolving correctly
- make distclean && make px4_fmu-v6x_default builds successfully
  (1250/1250 ninja steps, 1930096 B FLASH used)

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-04-18 13:04:26 -07:00
Ramon Roche 4f2918ee3b feat(sim): add SIH SITL build target and multi-instance args
- Add boards/px4/sitl/sih.px4board disabling Gazebo bridge/msgs/plugins
- Update sitl_multiple_run.sh to accept model and build target arguments
- Add openjdk@17 to macOS setup script for jMAVSim display-only mode

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-03-31 17:01:10 -06:00
eafb6c396b [Docs] macOS Dev environment installation (#25204)
* Initial changes

* index fix

* gz index fix2

* gz index fix 3

* updates

* Run prettier

* zsh env
removed gz classic

* Corrections 2

* Cleanups

* Update docs/en/dev_setup/dev_env_mac.md

* Apply suggestions from code review

* Minor subedit and prettier

* small correction

* cleanups gz harmonic brew formula

* fix(macos.sh): invert px4-sim install condition for --sim-tools

The condition checked if px4-sim WAS installed before running
brew install, meaning it would never install on a fresh system.
Add the missing negation so it installs when NOT already present.

Signed-off-by: Ramon Roche <mrpollo@gmail.com>

* docs: rewrite macOS dev environment setup guide

- Add Xcode Command Line Tools as prerequisite
- Default to ~/.zshrc (macOS default since Catalina)
- Explain why ulimit change is needed and why in startup file
- Add reminder to open new terminal after shell config changes
- Remove broken pip3 alias workaround
- Split git clone into clone + submodule update (canonical form)
- Recommend --sim-tools flag since first build uses gz_x500
- Document what macos.sh installs and its --reinstall flag
- Clarify Gazebo comes from --sim-tools / px4-sim formula
- Add XQuartz requirement for Gazebo display
- Add verification section with key tool checks and smoke test
- Remove outdated video guide comment block

Signed-off-by: Ramon Roche <mrpollo@gmail.com>

* conventions

---------

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
Co-authored-by: Ramon Roche <mrpollo@gmail.com>
2026-02-18 18:40:53 -05:00
Julian Oes e239c017d1 Revert "CI: add ccache to macOS"
This reverts commit f751974b41.
2026-02-11 19:14:07 -08:00
Julian Oes f751974b41 CI: add ccache to macOS 2026-02-12 09:17:33 +13:00
Ramon Roche e021a1c946 Tools: Update macos dependencies (#25361)
* tools: macos.sh update cross-compiler

* tools: editor styleguide for bash scripts

---------

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-08-04 22:15:30 -04:00
Daniel Agar 808fd67fcb Tools/setup: macos.sh add python-tk for kconfig gui (boardguiconfig) 2023-12-16 16:29:07 -05:00
Julian Oes 5ece24cdc4 setup: attempt to fix macOS CI
Somehow the wheel install of pymavlink fails without future, let's try
to work around that.
2022-09-07 13:49:37 +12:00
Peter van der Perk 815617e670 Added common options for sensor drivers
uavcan_board_identity check for existance
Added kconfig for compiler definitions
2021-10-07 10:09:01 -04:00
Daniel Agar c71a228f15 Tools/setup: macos use pip as python3 module 2021-04-23 16:47:49 -04:00
Julian Oes 7c49afa716 setup: only install homebrew if not already there 2020-07-17 14:58:31 -04:00
Julian Oes 7667298c86 setup: move the OSX.sh script to macos.sh
It's called macOS for a while now, and no longer OSX.
2020-07-17 14:58:31 -04:00