Commit Graph
304 Commits
Author SHA1 Message Date
Mathéo Taillandier e1e1122af5 feat(simulation): enable airspeed sensor failure injection on gazebo too (#29210)
* feat(simulation): enable failure injection on gazebo sensor too

* docs(failure_injection): remove added dot
2026-11-19 12:58:23 +01:00
Matthew Charles Vladislav Busel 5c1a57d6d5 feat(simulation): add a differential rover to SIH (#29852)
* feat(simulation): add a differential rover to SIH

Add SIH_VEHICLE_TYPE 6 (Rover Differential) and the
10048_sihsim_rover_differential airframe, so rover_differential runs
headless with `make px4_sitl_sih sihsim_rover_differential`.

The model is a unicycle: each wheel is driven towards the ground speed
its motor command asks for (2 m/s at full command, matching
RO_MAX_THR_SPEED) up to its traction limit, and a lateral force keeps
the wheels from slipping sideways. Motor 1 is the right wheel and
motor 2 the left, as in the gz differential rover.

Closes #29838

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

* docs(simulation): explain the forces in the SIH differential rover model

Label the longitudinal force block and the force, moment and drag
outputs of generate_rover_differential_dynamics(), as suggested in
review. Comments only, no change in behaviour.

Assisted-by: Claude:claude-opus-5-5
2026-11-19 09:22:21 +01:00
Matthias Grob dbe4cd3e2e style(modules_drivers): name parameter members after their parameter name
Produced by make format with the new parameter member name check, plus the AFBRS50 calibration offsets used outside the declaring files.
2026-11-18 18:40:12 +01:00
Balduin da7f6cccd4 fix(parameters): add missing units to parameter metadata (#29819)
* docs(parameters): add 4 new units

 - A/V (ampere per volt)
 - Pa (pascal)
 - Pa/V (pascal per volt)
 - MHz (megahertz)

* docs(parameters): add missing units

These parameters have a physical unit (often stated in their own
description) but no unit field, so QGC and the parameter reference show
them as unitless.

Add the missing units to 116 parameters.

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

* docs(parameters): drop units from descriptions now in the unit field

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

* fix(microstrain): label orientation parameters deg

src/drivers/ins/microstrain/MicroStrain.cpp requires these to be in
degrees (they are converted to radians at line 1121-1124), but the param
docstring mentioned which was moved to the unit field just before.

Fix by labelling correctly as degrees.

Signed-off-by: Balduin <balduin@auterion.com>

* docs(parameters): fix smaller inconsistencies

Address review from @dakejahl:
 - mc_nn_control: MC_NN_MIN_RPM also in units of rpm
 - sensors: remove redundant '#unit: Pa' comment
 - microstrain: Typo in MS_GNSS_OFF2_Z

Signed-off-by: Balduin <balduin@auterion.com>

---------

Signed-off-by: Balduin <balduin@auterion.com>
2026-11-17 10:36:24 -07:00
Matthias Grob c339b0a8c8 refactor(simulator_sih): keep terrain argument parsing out of NuttX builds (#29778)
Select the terrain model directly in sih.hpp, dropping the extra
Terrain.hpp header. Only build load_terrain() and the -t usage for POSIX
because NuttX has no DEM to load, and make TerrainFlat::load() non-virtual
so it is no longer linked there. This saves 368 bytes of flash on
px4_fmu-v6c_default.

SITL builds without the DEM libraries still refuse to start when given a
terrain file.
2026-11-12 13:54:44 +01:00
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
Jacob Dahl e192036345 fix(commander): ack calibration cancels once and stop promptly (#29514)
* feat(simulator_sih): add orient command to pose the vehicle for calibration

Accel and mag calibration need the vehicle held still on each side and
rotated, which SIH could not do, so neither could be tested in
simulation. `simulator_sih orient` sets the attitude kinematically,
keeping the IMU and the simulated mag consistent with it, and `orient
all` runs every side in turn so a calibration started from a GCS
completes on its own.

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

* fix(commander): hand a calibration cancel to the running calibration

A cancel got TEMPORARILY_REJECTED from Commander and ACCEPTED from the
calibration, in either order. The calibration polled for it with a
fresh vehicle_command subscription that only saw the newest command,
filtered it by a per-side start time, and did not poll while waiting
for the vehicle to be still or while measuring a side. Baro and level
calibration never polled. A cancel could be lost or take until the
vehicle was held still.

Commander now hands the cancel to the running calibration, which acks
it once when it stops, or rejects it if it ends without stopping.
Every calibration loop checks for it, and accel calibration no longer
reports a failure after a cancel.

Fixes #29424

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

* test(mavsdk_tests): run accel and mag calibration and cancels on SIH

Covers a full accel and mag calibration, and a cancel in each place it
used to be missed or delayed, checking it gets exactly one ack.

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

* perf(simulator_sih): build the orient command for SITL only

Commander denies sensor calibration when SIH runs on flight controller
hardware, so orient was about 1.8 KB of unusable code on every NuttX
board that builds SIH.

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

* fix(commander): open calibration cancels before the worker thread starts

Commander handles one command per loop and the worker thread runs at
low priority, so a cancel queued right behind the start could be
rejected before the worker opened it, and the calibration kept running.

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

* fix(commander): stop reporting a cancelled gyro calibration as failed

A cancel broke out of the retry loop into the failure report, as accel
calibration did before.

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

* test(mavsdk_tests): cover gyro cancel and remove two calibration races

A retried start is rejected once the calibration runs, and that late
ack could be counted against the cancel, so the start is sent once.
The baro cancel landed 1 s into a 3 s calibration, about 200 ms of
host time at speed factor 10; it is now sent right after the start.

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

* style(mavsdk_tests): wrap the calibration start assert for flake8

The 104-character line failed the Python CI checks.

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

* fix(commander): require param7 zero for a calibration cancel

An ESC calibration (param7 = 1) or baro temperature calibration
(param7 = 3) sent while a calibration ran matched the cancel test. It
stopped the running calibration and was acked ACCEPTED, though the
requested calibration never started. `commander calibrate esc` did the
same.

Assisted-by: Claude:claude-fable-5-2
2026-11-11 14:38:01 -07:00
e03e075003 feat(rover): add high level encoder support (#28848)
* feat(rover): add high level encoder support

Signed-off-by: dirksavage88 <dirksavage88@gmail.com>

* fix(rover): add gz mixing interface to output encoder position

Signed-off-by: dirksavage88 <dirksavage88@gmail.com>

* fix(rover): add wheel encoder to logged topics, high rate sensors

Signed-off-by: dirksavage88 <dirksavage88@gmail.com>

* fix(rover): fix wheel encoder division by zero and stream iteration

Corrected Roboclaw driver to initialize counts_per_rev, fixed wheel encoder stream to iterate over multiple wheels, and added trapezoidal integration to GZMixingInterfaceWheel. Removed unused RO_WHEEL_RAD from position controllers and restricted the wheel encoder stream to rover targets.

Assisted-by: Qwen-Code

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Signed-off-by: dirksavage88 <dirksavage88@gmail.com>

* fix(rover): adjust wheel radius default for SITL

Signed-off-by: dirksavage88 <dirksavage88@gmail.com>

* Update src/lib/rover_control/rovercontrol_params.yaml

Co-authored-by: Michael Fritsche <64464652+Frigiii@users.noreply.github.com>

* Update src/lib/rover_control/rovercontrol_params.yaml

Co-authored-by: Michael Fritsche <64464652+Frigiii@users.noreply.github.com>

* Update msg/WheelEncoders.msg

Co-authored-by: Michael Fritsche <64464652+Frigiii@users.noreply.github.com>

* chore(rover): fixes to decimal and constrained flash mavlink message

Signed-off-by: dirksavage88 <dirksavage88@gmail.com>

* chore(gz): update encoder counts reference

Signed-off-by: dirksavage88 <dirksavage88@gmail.com>

* chore(rover): fix to outdated encoder pos reference

* fix(rover): update uorb message to account for 4 wheel encoders

Signed-off-by: dirksavage88 <dirksavage88@gmail.com>

* Update msg/WheelEncoders.msg

Co-authored-by: Michael Fritsche <64464652+Frigiii@users.noreply.github.com>

* fix(roboclaw): add in encoder position, counts per rev. Msg desc update

Signed-off-by: dirksavage88 <dirksavage88@gmail.com>

* chore(wheel_encoders): add description to top of msg file for docs

Signed-off-by: dirksavage88 <dirksavage88@gmail.com>

* chore(sim): fixes to initialize wheel pos m, rename wheel_encoder to wheel_distance

Signed-off-by: dirksavage88 <dirksavage88@gmail.com>

* Update src/lib/rover_control/rovercontrol_params.yaml

Co-authored-by: Michael Fritsche <64464652+Frigiii@users.noreply.github.com>

* Update src/modules/mavlink/streams/WHEEL_DISTANCE.hpp

Co-authored-by: Michael Fritsche <64464652+Frigiii@users.noreply.github.com>

* Update src/modules/simulation/gz_bridge/GZMixingInterfaceWheel.cpp

Co-authored-by: Michael Fritsche <64464652+Frigiii@users.noreply.github.com>

* Update src/modules/simulation/gz_bridge/GZMixingInterfaceWheel.hpp

Co-authored-by: Michael Fritsche <64464652+Frigiii@users.noreply.github.com>

* chore(rover): update wheel encoder msg, fixes to gz bridge

Signed-off-by: dirksavage88 <dirksavage88@gmail.com>

* chore(rover): Apply batched suggestions from code review

Co-authored-by: Michael Fritsche <64464652+Frigiii@users.noreply.github.com>

---------

Signed-off-by: dirksavage88 <dirksavage88@gmail.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Michael Fritsche <64464652+Frigiii@users.noreply.github.com>
2026-11-10 08:54:19 -05:00
440179383a feat(SIH): Added optical flow sensor continues on #28270 (#29676)
* feat(sih): model the distance sensor range limits, quality and noise

The simulated distance sensor reported a noise free reading with no signal
quality, and saturated only against the upper range limit. Readings below the
minimum range were passed through unchanged, which is not what a range finder
does.

Report the raw saturated value with a zero quality outside of the measurement
range, derate the quality over the last 20% of the range, and add configurable
Gaussian noise (SIH_DISTSNSR_NOI). The quality is decided on the true distance
so that a measurement sitting at a range limit does not flicker in and out of
validity.

The sensor is now enabled with SIH_DISTSNSR_EN instead of by an out of band
value of the override parameter, and the ground distance computation moves into
a helper.

* feat(sih): add optical flow simulation

Simulate a downward facing optical flow sensor in SIH so that flow aided
navigation can be exercised without a rendered camera image. The flow rate is
the sum of the body rates and of the ground relative velocity scaled by the
distance to the ground, integrated over one publication interval and published
on sensor_optical_flow with configurable rate (SIH_OF_RATE) and noise
(SIH_OF_NOISE).

The sensor reports the integrated flow only: the flow module completes the
sample with the vehicle gyro and the downward facing distance sensor, which
therefore has to be enabled as well. Quality drops to zero above
SIH_OF_H_MAX or when the flow rate exceeds what the sensor can correlate.

The topic is advertised before the simulated clock starts, because the sensors
module brings up its flow pipeline on the first appearance of the topic, and
publishing during startup deadlocks the lockstep clock this thread advances.

Add the quadx_flow and standard_vtol_flow models with matching airframes:
SYS_AUTOSTART 10046 flies the multicopter on flow only with no GNSS, 10047
fuses the flow next to GNSS on a VTOL.

* prune configs

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

* more config cleanup

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

* added EKF2_HGT_REF to vtol flow config

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

* feat(simulation): added tests for optical flow for both quadx and stanard vtol
modes and enable them in CI

- for the test we monitor error on ground truth position and velocity

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

* feat(docs): document addition of optical flow in SIH

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

* fix(mavsdk_tests): unsubscribe flow ground truth comparison on destruction

The ground truth comparison callbacks capture `this` and touch members of
AutopilotTesterFlow. If a REQUIRE fails between start and stop, the tester
is destroyed during unwinding while the subscriptions are still active,
so a callback could run on the destroyed mutex and sample buffers.

Make stop idempotent and call it from the destructor, and stop any running
comparison before starting a new one.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: RomanBapst <bapstroman@gmail.com>

* tests for python

* fix(mavsdk_tests): start the VTOL flow loiter already on its radius

The loiter was centered on the vehicle's position right after the
transition, so it started at the center and had to fly straight out to the commanded
radius before the lateral guidance curved onto the track.

Assisted-by: Claude:claude-sonnet-5

* fix(mavsdk_tests): resend the flow test EKF origin until it is taken

The SITL startup script starts ekf2 after MAVLink. When MAVSDK connected
first, the single SET_GPS_GLOBAL_ORIGIN was published before ekf2 existed
and MAVSDK's RUN_PREARM_CHECKS followed it. Ekf2 then subscribed, saw
only the newest vehicle command and never got an origin. The Coverage
build starts slowly enough to hit this every time.

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

* ci(sitl_tests): run the VTOL flow test without coverage

As a Coverage job it built with coverage on every PR and uploaded the
sitl-vtol flag from PRs, which replaced main's carried-forward VTOL
coverage with the flow-only flight. The quadx_flow entry also sat
between the Coverage comment and the standard_vtol entry it describes.

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

* fix(mavsdk_tests): sum the flow test heading sweep with its sign

Adding up the absolute heading changes counted yaw oscillation toward the
360 degrees, so the wait could end before a full orbit was flown.

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

* refactor(airframes): keep only the non-default params in the SIH flow airframes

SIH_OF_H_MAX, SIH_DISTSNSR_EN and EKF2_OF_CTRL were set to their defaults
and SENS_EN_GPSSIM is already set by the quadx base airframe. The quadx
forced EKF2_RNG_CTRL to 2 while the VTOL used the conditional default for
no stated reason, so both now use the default.

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

* docs(sim_sih): mark the SIH flow airframes as new in PX4 v2.0

release/1.18 has branched, so these airframes first ship in v2.0, not
v1.17.

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

---------

Signed-off-by: RomanBapst <bapstroman@gmail.com>
Co-authored-by: RomanBapst <bapstroman@gmail.com>
Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-11-09 11:13:16 -07:00
Mathéo Taillandier e82e109073 fix(gz_plugins/gstreamer): force I420 before H.264 encoder (#29635)
From RGB appsrc input, videoconvert negotiates Y444 by default, so
x264enc produces a High 4:4:4 Predictive stream. Many decoders
(openh264dec, most hardware and browser decoders) cannot play that
profile, so the simulated camera stream fails to display.

Pin the converter output to I420 with a capsfilter so the encoder
emits a standard High profile stream. I420 is also accepted by the
NVENC path.

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

Signed-off-by: Matheo-13 <matheo.taillandier@gmail.com>
2026-11-06 10:52:45 -07:00
Balduin 52145bd8e2 refactor(simulation): share one white Gaussian noise generator (#29593)
Seven modules (sih, gz_bridge, the sensor_*_sim modules and
BlockRandGauss) each carried an identical copy of the polar Box-Muller
sampler, including the noiseGauss3f() helper. Move it into mathlib so there is one
implementation to maintain and test, and add a gtest checking the
sample statistics.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Balduin <balduin@auterion.com>
2026-11-03 23:28:44 +01:00
Beniamino PozzanandHamish Willee 05d2b24c94 feat(commander): add rpm-based motor stuck detection for MC (#29436)
* feat(commander): disarm if a motor is not spinning right after arming

During the spool-up window, while landed and before takeoff is detected,
a motor that is commanded to run but never reports RPM, or reports the
motor-stuck fault, raises a new failsafe flag. The failsafe then disarms,
like the existing ESC arming and battery spool-up failures. Motors with
a NaN command are ignored.

The check runs only for rotary-wing vehicles, since it assumes the
minimum output spins the motors. It is enabled by COM_ARM_CHK_ESCS and
needs per-motor RPM telemetry. It adds no parameters; timing is a
fraction of COM_SPOOLUP_TIME: nothing is evaluated up to 50%, and the
decision is made at 80%.

Assisted-by: Claude:claude-sonnet-5-5

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

* feat(sih): add motor stuck failure injection

`failure motor stuck -i N` models a stuck rotor with a healthy ESC: the
motor is still commanded but produces no thrust, and the ESC stays
online reporting zero RPM. The failure detector and control allocator
are not informed, unlike `motor off` and `motor wrong`.

The failure injection catalogue now accepts STUCK for the motor unit,
and SIH zeroes the thrust of the addressed motors, which also zeroes
their reported RPM. Other environments accept the command but do not
apply it, as documented in the failure injection table.

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

* feat(sih): publish esc status for standard VTOL pusher

add case in motor_inded_from_actuator for StandardVTOL

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

* chore(params): increase COM_SPOOLUP_TIME default value to 2 seconds

This is to ensure that the motor has enough time to try to start
and the stuck-detection logic does not return false negative
when an attemp of spin is marked as healty motor

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

---------

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>
2026-11-02 09:30:56 +00:00
Mathéo Taillandier c70cd8bfa2 fix(simulation): fix range finder orientation (#29172)
* fix(simulation): change the way the laserScantoLidarSensorCallback determines orientation

* style(simulation): ran make format

* fix(simulation): fix orientation computation

* fix(gz_bridge): drop lidar link warning on vehicles without a lidar

SIM_GZ_EN_LIDAR defaults to enabled, so every vehicle without a lidar
(gz_x500, standard_vtol, rovers) printed a lidar_sensor_link warning at
startup even though nothing was wrong.

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

* fix(gz_bridge): publish lidar orientation in FRD

Collision prevention reads distance_sensor.q as FRD, but the custom
quaternion was published in Gazebo's FLU frame, so a right-facing lidar
landed in the left bins. Right, backward and upward lidars are also
mapped to their enums now: an upward lidar left as ROTATION_CUSTOM
bypassed the up/down exclusion in collision prevention and ended up in
the horizontal obstacle map.

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

* fix(gz_bridge): look up lidar link pose before subscribing

The scan subscription started before the scene/info request, so scans
arriving during the request (up to 1 s) read _lidar_link_q while init
was still writing it, and a down-facing lidar's first samples went out
as forward-facing.

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

* fix(gz_bridge): skip lidar when its link orientation is unknown

When scene/info failed, timed out or did not contain the model,
_lidar_link_q stayed identity and every in-tree down-facing lidar (link
pitched 90 deg, sensor rolled 180 deg) was published as forward-facing,
so EKF2 dropped it. Publishing nothing is safer than guessing. Models
without a lidar_sensor_link are now skipped silently instead of
subscribing to a topic that has no publisher.

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

* docs(gz_bridge): explain the frame of the lidar world_pose field

Assisted-by: Claude:claude-opus-5-5
2026-10-30 11:54:22 -06:00
Andrea Bernasconi 0aa0553dca fix(params): raise decimal places to match parameter limits (#29495)
Several float parameters had a min, default or increment with more
fractional digits than their decimal setting, so ground stations rounded
them in the help text and value field. For MPC_JERK_MAX (min 0.5,
decimal 0) the help text showed "Min: 1" while the range check rejected
values outside 0.5..500, and an entered 0.5 was displayed as 0.

Only the decimal field changes; defaults and limits are untouched.
Radian parameters whose limits are approximations of pi are left as is.

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

Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>
2026-10-30 04:30:52 +13:00
Abel Mendoza ebbb909885 feat(simulation): apply VIO failure injection in gz_bridge (#29361)
The Gazebo bridge publishes vehicle_visual_odometry from the model's
odometry topic without consulting the failure state, so `failure vio`
had no effect on Gazebo (the support table listed it as `—`).

Route the odometry sample through the shared failure_injection::process()
so `off` suppresses the publication and `stuck` replays the last good
sample with fresh timestamps, matching how the bridge already handles
GPS. Allow `stuck` for VIO in the manager's capability table so the
command is not rejected before it reaches the bridge.

Add a functional test for the odometry callback (stuck, off, isolation
from a GPS failure, recovery) and pin VIO's capabilities in the
FailureTable catalogue test. Update the failure injection docs.

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

Signed-off-by: Abel Mendoza <abelxmendoza@gmail.com>
2026-10-28 16:52:26 -06:00
9e9bee968e feat(simulation): multiple IMU, magnetometer, barometer and GNSS sensors (#28357)
feat(simulation): support multiple IMU, magnetometer, barometer and GNSS sensors

The Gazebo bridge subscribed to exactly one sensor of each type, so
redundancy and multi-EKF behavior could not be exercised in simulation.

SIM_GZ_EN_IMU, _MAG, _BARO and _GPS now take a sensor count instead of
a 0/1 flag (max 3 for IMU, 2 for the others). Additional sensors are
named with a _1, _2 suffix in the model SDF, and each one is published
as its own uORB instance. Topic names are built in one helper instead
of three. A single sensor behaves as before.

Verified in SITL with two of each sensor: failing the first accelerometer
with the failure injection command makes the EKF2 selector switch to the
second instance.

---------

Co-authored-by: Matheo Taillandier <matheo.taillandier@rigi.tech>
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
2026-10-20 17:58:53 -04:00
Jacob Dahl 9ad42167e0 fix(simulation): publish every gz optical flow frame (#29306)
The plugin gave the flow library the camera rate as its output rate. The
library's rate limiter publishes only after more than one period has
passed, so it withheld every other frame and returned quality -1 for it.
The plugin published those frames anyway and the bridge stored -1 as
quality 255, so over a featureless floor EKF2 fused zero flow at full
quality and the vehicle drifted. The averaged frames counted the time of a
quality-0 frame but not its motion, under-reading flow on patchy texture.

Output rate 0 disables the limiter, so every frame goes out with its own
quality and a 20 ms integration time.

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

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-10-18 17:55:50 -06:00
Jonas Peroliniandjonas 7cc4bc18b5 build(modules): remove MAX_CUSTOM_OPT_LEVEL from SIH and config-mode builds (#29208)
* build(simulation): remove MAX_CUSTOM_OPT_LEVEL from SIH build (back to -Os)

* build(build): remove MAX_CUSTOM_OPT_LEVEL on other config and idle modes

* build(control_allocation): remove MAX_CUSTOM_OPT_LEVEL from actuator effectiveness lib

* build(logger): use default optimization for setup helpers

* build(modules): remove size optimisation from ActuatorEffectiveness and follow_target_estimator

* build(flight_mode): remove MAX_CUSTOM_OPT_LEVEL from follow_target_estimator

---------

Co-authored-by: jonas <jonas.perolini@rigi.tech>
2026-10-14 20:21:22 -06:00
Mahima Yoga f16f99d4b5 feat(sensors): support multiple airspeed sensors (#28832)
* feat(lib/sensor_calibration): add differential pressure calibration

Airspeed sensors had a single global zero offset, so a second or third
sensor could not be calibrated.

Link the calibration to the sensor's device ID, following the existing
barometer and magnetometer pattern, so the offsets stay bound to physical
sensors rather than to uORB instance order.

Signed-off-by: mahima-yoga <mahima@auterion.com>

* feat(sensors): support multiple airspeed sensors

The airspeed selector has always been able to validate and fail over
between three airspeed sensors, but nothing ever produced more than one.

Give each differential pressure sensor its own VehicleAirspeed item,
which owns its calibration, validator and airspeed publication, following the
VehicleIMU pattern.

Airspeed carries the device ID of the sensor it came from, so consumers
can tell the instances apart. The calibration routine now calibrates every
connected sensor.

Signed-off-by: mahima-yoga <mahima@auterion.com>

* refactor(sensors)!: replace SENS_DPRES_OFF with per-sensor calibration

SENS_DPRES_OFF applied one zero offset to whichever airspeed sensor
happened to come first, which cannot work once there is more than one
sensor. It is superseded by CAL_DPRESx_OFF.

BREAKING CHANGE: SENS_DPRES_OFF is removed. Ground stations that read it
to decide whether airspeed has been calibrated must check CAL_DPRES0_ID
instead, matching how CAL_MAG0_ID, CAL_GYRO0_ID and CAL_ACC0_ID are
already used.

Signed-off-by: mahima-yoga <mahima@auterion.com>

* feat(logger): log all airspeed and differential pressure instances

The airspeed selector supports up to three airspeed sensors, but the
logger only recorded one airspeed instance and two differential pressure
instances.

Signed-off-by: mahima-yoga <mahima@auterion.com>

* fix(commander): stop airspeed calibration consuming a new slot each time

Signed-off-by: mahima-yoga <mahima@auterion.com>

* fix(sensors): give the analogue airspeed sensor a device ID

Signed-off-by: mahima-yoga <mahima@auterion.com>

* fix(boards): keep the airspeed conversion in ITCM

Signed-off-by: mahima-yoga <mahima@auterion.com>

* refactor(sensors): initialise airspeed instances outside the main loop

Signed-off-by: mahima-yoga <mahima@auterion.com>

* chore(sensors): correct the copyright year on the new CMakeLists

Signed-off-by: mahima-yoga <mahima@auterion.com>

* refactor(airspeed_selector): share the airspeed sensor count constant

Signed-off-by: mahima-yoga <mahima@auterion.com>

* docs(sensor_calibration): explain the unusable calibration slot guard

Signed-off-by: mahima-yoga <mahima@auterion.com>

* fix(sensors): keep SENS_DPRES_OFF as a mirror of the first sensor

Signed-off-by: mahima-yoga <mahima@auterion.com>

---------

Signed-off-by: mahima-yoga <mahima@auterion.com>
2026-10-12 10:51:22 +02:00
porhandJacob Dahl 4b1ac1879d fix(simulation): prevent unbounded memory growth in GstCameraSystem (#27873)
* fix(simulation): prevent unbounded memory growth in GstCameraSystem

Each CameraStream pushed camera frames into an appsrc with no queue
bound (block=false, enough-data unhandled) and never read the pipeline
bus, so when the pipeline stalled the frames accumulated silently at
frame_size x fps (~110 MB/s per camera at 1280x960@30) until the host
froze. The stall is guaranteed on modern NVIDIA drivers because the
nvh264enc path sets legacy NVENC properties they reject, killing caps
negotiation before data ever flows, while set_state() only being
checked for FAILURE (pipelines with sinks return ASYNC) hid the error.

Bound the appsrc queue (max-buffers=3, leaky-type=downstream) so a
stalled pipeline drops frames instead of hoarding them, surface bus
errors/warnings through gzerr/gzwarn, verify the async transition to
PLAYING, retry once with software x264 when the NVIDIA encoder fails,
drop the driver-incompatible encoder properties, and guard the frame
memcpy against undersized frames. Also make ~CameraStream() call
stop() unconditionally: after a pipeline failure (_running == false)
the streaming thread could still be joinable, and destroying a
joinable std::thread terminates the process.

Signed-off-by: PasinJ <porh8pasin@gmail.com>

* fix(simulation): end the camera stream loop on stop during pipeline setup

stop() can run before runPipeline() sets _running, which then overwrote the cleared flag; the frame loop never checked _stopRequested, so join() blocked gz shutdown. The pipeline cleanup in stop() was unreachable: runPipeline() releases the pipeline on every return.

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

* fix(simulation): retry the camera stream with x264 only after an NVENC failure

The retry fired on any pipeline error, including runs where the NVIDIA element was never created and x264 was already in use, so it rebuilt the same pipeline under a misleading warning.

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

* fix(simulation): drop the PLAYING wait from the camera stream start

It cannot see an encoder failure, which happens on the first frame, and with rtmpsink it blocked for the full 5 s because the sink cannot preroll until this thread pushes a frame. The bus loop reports both kinds of failure.

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

* fix(simulation): warn once about undersized camera frames

The warning fired on every frame at the camera rate. GST_MESSAGE_SRC_NAME also handles a bus message without a source.

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

---------

Signed-off-by: PasinJ <porh8pasin@gmail.com>
Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-10-11 17:17:07 -06:00
E-Krantz 0ff5a60adc feat(uavcan): add signed commands for non-motor ESC outputs (#26903)
* feat(uavcan): add signed commands for non-motor ESC outputs

* fix(uavcan): preserve signed non-motor failsafe outputs

* fix(uavcan): apply signed conversion to failsafe outputs

* fix(simulation): disable unused ATMOS magnetometer

* chore(atmos): move airframe changes to separate PR
2026-10-09 16:13:37 -06:00
Mathéo Taillandier 03c32c66f6 fix(build): move gz_env.sh out of rootfs (#28977) 2026-10-02 11:51:26 -06:00
Julian Oes 9fd6eb745e fix(simulation): parse gz motor joint names without std::regex (#28941)
Replace the std::regex match for "rotor_<n>_joint" in the motor failure
plugin with a plain prefix/suffix/digit check to fix the build.

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

Signed-off-by: Julian Oes <julian@oes.ch>
2026-10-01 15:46:52 +13:00
onelittlechild 320c912f57 fix(mavlink): derive unknown HIL_GPS ground speed from velocity (#28906)
Derive missing scalar ground speed from the valid horizontal velocity
components instead of publishing the UINT16_MAX sentinel as 655.35 m/s.


Assisted-by: Codex

Signed-off-by: onelittlechildawa <onelittlechild@outlook.com>
2026-09-30 17:19:22 -06:00
0462e3a31e fix(gz_bridge): use the corrected Gazebo magnetometer frame and units (#28877)
* fix(gz_bridge): use the corrected Gazebo magnetometer frame and units

The Gazebo magnetometer system defaults to a legacy mode: it computes the
field in NED, places it into the ENU world frame without converting, and
reports gauss. The bridge swapped body axes to compensate, but no body-axis
swap undoes a mirrored world-frame field at every attitude. At the default
world location this left the heading about 6 deg off on the ground.

gz-sim 8.6 added use_units_gauss and use_earth_frame_ned (gz-sim#2460).
Turn both off in server.config, so the field is in tesla and physically
correct in the sensor's FLU frame, and convert it like the IMU: FLU -> FRD,
tesla -> gauss.

Other ways of starting gz (standalone mode, gz-sim < 8.6, worlds with their
own systems) still deliver the legacy output. Detect it from the field
magnitude, keep the previous mapping for it and warn once.

Needs the x500 (and other) model magnetometer noise in tesla, see
PX4-gazebo-models.

* docs(gz_bridge): describe the legacy magnetometer frame accurately

NED components on ENU axes is a 180 degree rotation about the horizontal
axis between north and east, not a mirror.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* build(simulation): bump gz models for magnetometer noise in tesla

The gz_bridge server.config now runs the Magnetometer system in tesla, so
the models need their noise in tesla too, otherwise it is 1 gauss and PX4
refuses to arm. Also pulls in the advanced_plane parachute plugin and the
default world elevation fix.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

---------

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Co-authored-by: matteo <197973584+megavedl@users.noreply.github.com>
Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-09-30 16:45:43 -06:00
Jacob Dahl e40501eba0 refactor(msg): rename GPS to GNSS in messages, topics and sensor parameters (#24399)
* refactor(msg): rename SensorGps to SensorGnss and add VehicleGnss

GPS is one constellation; the receivers and the rest of PX4 handle GNSS. Field names lose their units (latitude, speed_accuracy, course, ...), which move into the metadata comments. The sensors module's output becomes VehicleGnss on vehicle_gnss: the selected receiver's sample next to what the sensors module adds to it (corrected sample time, antenna position, selected instance), so a consumer can tell the two apart and later selection and check results have a place to go.

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

* refactor(drivers/gps): publish sensor_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(drivers/septentrio): publish sensor_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(drivers/pps_capture): read sensor_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(lib/gnss): select receivers on sensor_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(sensors): publish VehicleGnss on vehicle_gnss and rename SENS_GPS* to SENS_GNSS*

The sensors module's output nests the selected receiver's sample, with the corrected sample time, antenna position and selected instance next to it. SENS_GPS_MASK/TAU/PRIME and SENS_GPSn_ID/OFFX/OFFY/OFFZ/DELAY take the SENS_GNSS name the heading parameters already use; saved parameters migrate on import, and the EKF2_GPS_POS/EKF2_GPS_DELAY translations now land on the new names directly.

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

* refactor(logger): log sensor_gnss and vehicle_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(ekf2): fuse vehicle_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(replay): replay vehicle_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(local_position_estimator): read vehicle_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(attitude_estimator_q): read vehicle_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(lib/terrain_estimation): take sensor_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(lib/wind_estimator): read vehicle_gnss in the replay script

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(vision_target_estimator): read vehicle_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(navigator): read vehicle_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(commander): read sensor_gnss and vehicle_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(mavlink): stream sensor_gnss and vehicle_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(uxrce_dds_client): bridge vehicle_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(zenoh): bridge vehicle_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(failure_injection): inject GNSS failures on sensor_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(drivers/ins): publish sensor_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(drivers/uavcan): publish sensor_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(drivers/uavcannode): read sensor_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(drivers/cyphal): bridge sensor_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(drivers/telemetry): read vehicle_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(drivers/rc): read vehicle_gnss for telemetry

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(drivers/osd): read vehicle_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(drivers/transponder): read sensor_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(boards/modalai): publish sensor_gnss from the voxl2 drivers

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(examples): publish sensor_gnss and read vehicle_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(simulation): publish sensor_gnss

Follows the SensorGps to SensorGnss and vehicle_gps_position to VehicleGnss rename.

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

* refactor(gnss): name GNSS variables gnss in the sensors module and receiver drivers

GPS is one constellation. Identifiers that hold or handle GNSS samples, or bind to the renamed parameters, follow the message and parameter rename; classes, files, modules and names tied to parameters that keep GPS stay.

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

* refactor(gnss): name GNSS variables gnss in the estimators and navigator

GPS is one constellation. Identifiers that hold or handle GNSS samples, or bind to the renamed parameters, follow the message and parameter rename; classes, files, modules and names tied to parameters that keep GPS stay.

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

* refactor(gnss): name GNSS variables gnss in commander, mavlink and failure injection

GPS is one constellation. Identifiers that hold or handle GNSS samples, or bind to the renamed parameters, follow the message and parameter rename; classes, files, modules and names tied to parameters that keep GPS stay.

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

* refactor(gnss): name GNSS variables gnss in the remaining drivers and simulation

GPS is one constellation. Identifiers that hold or handle GNSS samples, or bind to the renamed parameters, follow the message and parameter rename; classes, files, modules and names tied to parameters that keep GPS stay.

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

* docs(gnss): reference sensor_gnss, vehicle_gnss and SENS_GNSS* parameters

The upgrade guide covers the topic, field, ROS 2, parameter and Cyphal register renames.

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

* fix(boards): name EKF2::UpdateGnssSample in the fmu-v6xrt ITCM lists

The rename left the old UpdateGpsSample symbol in the lists, so the ITCM check fails and the function drops out of ITCM on the boards it doesn't check.

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

* chore(drivers/gps): bump PX4-GPSDrivers to the merged sensor_gnss rename

The submodule pointed at the PX4-GPSDrivers#243 branch commit; #243 is merged.

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

* docs(msg): restore WGS84 in SensorGnss and point VehicleGlobalPosition at vehicle_gnss

The rename dropped the only mention of the WGS84 datum and ellipsoid, and left VehicleGlobalPosition referring to the removed vehicle_gps_position topic.

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

* refactor(msg): drop selected_instance from VehicleGnss

receiver.device_id already names the selected receiver, and 0 while blended. The sensor_gnss instance depends on the order drivers advertise at boot, so it doesn't identify a receiver across boots or logs, and nothing reads it. It would also be meaningless on the per-receiver VehicleGnss instances proposed in #28894.

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

* refactor(gnss): fuse vehicle_gnss.timestamp_sample directly and document the receiver's corrected time

vehicle_gnss.timestamp is now the sensors module's publish time, so EKF2's check of timestamp_sample against it was always true; the sensors module always fills timestamp_sample. The message docs described receiver.timestamp_sample as the driver's uncorrected value, but the sensors module writes the corrected time into it as well.

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

* docs(msg): point VehicleGnss users at the top-level timestamp_sample

uXRCE-DDS shifts only top-level timestamp and timestamp_sample into agent time, so receiver.timestamp_sample reaches ROS 2 on the PX4 boot clock even though it holds the same value on uORB.

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

* docs(releases): tell ROS 2 users which VehicleGnss timestamps to read

Only top-level timestamps are converted to ROS time, so a port that reads receiver.timestamp gets the PX4 boot clock, and vehicle_gnss.timestamp is now the sensors module's publish time rather than the receiver's.

Assisted-by: Claude:claude-opus-5-5
2026-09-29 10:36:49 -06:00
Jacob Dahl eb8f2f9b42 refactor(ekf2): separate GNSS heading from position into independent topic (#27102)
* feat(sensors/vehicle_gps_position): publish GNSS heading on its own topic

Dual-antenna heading was only reachable through the blended
vehicle_gps_position, so it carried the position timestamp, followed the
position blending weights and was published at the position rate.
vehicle_gnss_heading carries one selected source at a time, preferring
sensor_gnss_relative (callback driven) and falling back to
sensor_gps.heading for receivers that do not publish it. Per-receiver
delay and the driver heading offset are resolved by device_id; a sample
timestamp within 10 ms of the publish timestamp is treated as unset so
the configured delay applies.

* refactor(ekf2): fuse GNSS heading from its own sample buffer

Heading rode on gnssSample and was only fused when a position sample was
popped: faster heading was dropped by the observation rate limit, its
timestamp was the position timestamp and a position outage blocked the
start. gnssYawSample has its own TimestampedRingBuffer and pop. Non-finite
yaw is rejected at the interface and a NaN heading_offset is treated as
zero instead of reaching the fusion Jacobian. The test simulator feeds
heading as an independent sensor.

* feat(sensors/vehicle_gps_position): per-receiver baseline rotation SENS_GPSn_ROT

The antenna baseline orientation lived in three places depending on the
transport: the serial driver (GPS_YAW_OFFSET), the Septentrio receiver
(SEP_YAW_OFFS, SEP_PITCH_OFFS) and EKF2 for anything arriving with a NaN
offset, in practice CAN receivers (EKF2_GPS_YAW_OFF). A second receiver
with a different baseline had no parameter at all. Drivers now publish
the raw baseline heading and vehicle_gps_position rotates it into the
body frame from the receiver's SENS_GPSn_* slot, the same Rotation enum
the other sensors use, before blending and before publishing
vehicle_gnss_heading. Bumps PX4-GPSDrivers so sensor_gnss_relative
carries a real UTC time and no parse-time sample timestamp, which lets
the relative-position heading be delay-compensated and PPS-aligned.

* refactor(drivers/gps): drop the UBX heading_offset setting

Bumps PX4-GPSDrivers to PX4/PX4-GPSDrivers#241, which removes the
driver-side heading offset now that SENS_GPSn_ROT is the only place the
baseline is rotated.

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

* refactor(sensors/vehicle_gps_position): remove sensor_gps.heading_offset

With the baseline rotation in SENS_GPSn_ROT, a finite offset only meant
"the driver already rotated this heading, skip SENS_GPSn_ROT". The only
remaining writer was older DroneCAN node firmware through the Fix2 ECEF
hack, which made a CAN node's heading switch between two conventions
depending on whether a RelPosHeading arrived between Fix2 messages: with
a non-zero SENS_GPSn_ROT yaw the heading jumped by that angle. Every
receiver's heading is now the measured baseline and SENS_GPSn_ROT is the
only rotation. MicroStrain external heading aiding, which recovered the
baseline heading from vehicle_gps_position, reads vehicle_gnss_heading.

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

* fix(mavlink): report the body-frame GNSS heading in GPS_RAW_INT and GPS2_RAW

sensor_gps now carries the measured baseline heading, so for a baseline
not along the body x axis the yaw field was off by the mounting angle.
The body-frame heading is taken from vehicle_gnss_heading when the
streamed receiver is the heading source.

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

* fix(replay): replay vehicle_gnss_heading to EKF2

ReplayEkf2 publishes only the topics it lists from inside the lockstep
barrier, so EKF2 replay never received the heading.

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

* feat(parameters): migrate GNSS heading offsets to SENS_GPSn_YAW

GPS_YAW_OFFSET, SEP_YAW_OFFS and EKF2_GPS_YAW_OFF were removed without a
migration, so an upgraded vehicle silently lost its antenna mounting
offset and its GNSS yaw was off by that angle.

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

* fix(sensors/vehicle_gps_position): build GNSS heading only where it is consumed

The heading selection, baseline rotation and SENS_GPSn_ROT parameters
overflowed diatone_mamba-f405-mk2 flash by 657 bytes. Boards built
without EKF2 GNSS yaw fusion or MicroStrain have no consumer for
vehicle_gnss_heading, so SENSORS_VEHICLE_GNSS_HEADING defaults on only
with one of them. The parameter migration also drops fmodf, since the
old parameters never exceeded one wrap.

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

* feat(sensors/vehicle_gps_position): carry the heading receiver's jamming and spoofing state

So that EKF2 can gate GNSS yaw on the receiver providing the heading, which is not necessarily the position receiver.

Assisted-by: Claude:claude-fable-5-1

* fix(ekf2): gate GNSS yaw on the heading, not the position checks

Yaw fusion could only start once the position checks passed, and stopped with them. On an ARK G5 outdoors the heading was good from 36 s after power-up and was first fused at 104 s, held back by EPV while Galileo HAS converged; a 0.45 s PDOP failure while the vehicle was handled on the ground stopped yaw for 10 s with its innovations under 5.4 deg.

The heading is its own observation, often from its own receiver: yaw now starts on fresh data, tilt alignment and the heading receiver's spoofing and jamming state under the EKF2_GPS_CHECK bits, and keeps running when position and velocity fusion stop. The hold-off after a yaw fusion failure was a side effect of the position checks resetting; it is now a yaw timer that withholds the heading from a reset for the GNSS health time.

Assisted-by: Claude:claude-fable-5-1

* fix(sensors/vehicle_gps_position): carry an unknown GNSS sample time as 0

A GNSS sample time within 10 ms of the publish time was treated as unset and replaced by SENS_GPSn_DELAY. An ARK G5 over DroneCAN measures 8.3 to 21.5 ms from epoch to receipt, so 0.4% of its headings were re-stamped 110 ms early; at 20 Hz EKF2 dropped them as out of order, at a lower rate they would have been fused 100 ms late. A stamp meaning unset that crossed a busy bus in more than 10 ms would have been trusted instead.

Unknown is now 0 end to end: the serial driver leaves timestamp_sample at 0, the CAN node sends RelPosHeading's timestamp as UNKNOWN for it, and the autopilot's bridge publishes 0 when the node timestamp can't be used. Any other sample time before the publish time is trusted.

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

* feat(sensors/vehicle_gps_position): derive the GNSS heading baseline from antenna positions

SENS_GPSn_ROT and its Euler angles carried one number: roll never moves a baseline along x, pitch only flagged a vertical one, and the heading model uses the baseline yaw alone. Nothing checked the heading against the installation either, so a receiver that flagged float solutions as valid reset yaw 87 deg wrong at first fix on an ARK G5 moving-base pair.

As in ArduPilot, the baseline now comes from the antenna positions: SENS_GPSn_HDG selects the other receiver's antenna (moving base, from both slots' SENS_GPSn_OFF) or a custom SENS_GPSn_BLX/Y/Z (single dual-antenna receiver), and a heading is used only when the receiver reports a baseline within 20% of it in length and in its vertical component over the sample's attitude. Those float solutions reported 10.9 m and 1.04 m for a 0.347 m baseline. A source is published once it has passed for 1 s: the headings right after the base antenna was re-plugged passed for 0.9 s while up to 25 deg wrong. vehicle_gnss_heading logs the reported baseline length.

A yaw offset can't be turned into a baseline, so GPS_YAW_OFFSET, SEP_YAW_OFFS and EKF2_GPS_YAW_OFF are not migrated; GNSS yaw stays off, with a warning, until SENS_GPSn_HDG is set.

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

* fix(ekf2): stop GNSS yaw on a spoofed or jammed heading receiver

The heading receiver's spoofing and jamming state only kept yaw fusion from starting; a receiver that reported spoofing in flight kept feeding yaw, where position fusion stops. Its samples are now not fused, the fusion stops once none has been for the reset timeout, and a reset to its heading waits for the GNSS health time, as for position.

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

* docs(dronecan): configure the ARK G5 heading baseline on the autopilot

The page still configured the heading offset with the module's SEP_OFFS_YAW, and required GPS blending for the heading to be published, which no longer carries it.

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

* fix(sensors/vehicle_gps_position): drop a mismatched GNSS heading without restarting the settle

Outdoors on an ARK G5 moving-base pair 0.35 m apart, the reported down component of the baseline scattered by up to 0.16 m while the airframe was turned, and 9 cm at rest, against the 7 cm the vertical check allows. The rejected headings were as good as the accepted ones, but every rejection restarted the 1 s settle, so during 720 deg turns a heading was published for 4 to 62% of the time.

A sample that fails the baseline checks is now only dropped; the settle restarts when the receiver reports no heading. Replayed on that log, 85 to 99% of the turns get a heading.

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

* fix(sensors/vehicle_gps_position): drop the GNSS heading baseline's vertical check

The check compared the reported down component of the baseline with the configured baseline rotated by the vehicle attitude, within 20% of the baseline length. On an ARK G5 moving-base pair 0.35 m apart the down component scattered by up to 9 cm at rest and 0.16 m while the airframe was turned, so it rejected good headings: across seven outdoor logs it rejected 184 samples under 5 deg of error and 6 over 10 deg, all of which the EKF innovation gate would handle, and nothing the length check missed on a receiver that withholds float headings.

The length check and the near-vertical check on the reported baseline stay. The sensors module no longer reads the vehicle attitude to check the heading.

* feat(sensors/vehicle_gps_position): SENS_GNSSn_HDG with the auxiliary antenna position

The heading parameters are new, so they take the GNSS name the rest of the SENS_GPS family moves to rather than being renamed again shortly. The setup names what the receiver is: the rover of a moving base pair, or a receiver with two antennas. For the latter the second antenna is given by its position, like the main one's SENS_GPSn_OFF, so every setup derives the baseline from antenna positions.

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

* feat(drivers/septentrio): publish the heading baseline on sensor_gnss_relative

The heading only reached PX4 through sensor_gps, without the baseline the receiver measured, so the sensors module could not check it against the configured one and a heading from float ambiguities, confident on a baseline metres off, was used. AuxAntPositions (dual antenna) or BaseVectorGeod (moving base rover) now go out with the heading of the same epoch on sensor_gnss_relative at EndOfAtt, the heading valid only with fixed ambiguities. Ported from ARK's driver, where it was tested outdoors on mosaic-G5 P3H, P6 and P8.

A receiver that rejects the extra blocks falls back to the previous output without a heading. The heading accuracy is the square root of the reported variance; it was the deg^2 variance scaled as if it were degrees.

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

* refactor(sensors/vehicle_gps_position): take GNSS heading only from sensor_gnss_relative

The sensor_gps fallback carried no reported baseline, so its headings skipped the length check that rejects a wrong ambiguity fix. Every receiver that matters now reports on sensor_gnss_relative: u-blox, Septentrio, the Unicore UM982 (PX4/PX4-GPSDrivers bump) and DroneCAN RelPosHeading. The heading fields of sensor_gps go, with the paths that filled them: NMEA HDT, Trimble MB-Two, Femtomes, SBG and MicroStrain, the heading in DroneCAN Fix2 on both the node and the autopilot, and the RelPosHeading copy into sensor_gps.

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

* docs(gps_compass): configure GNSS heading with SENS_GNSSn_HDG

The heading parameters were renamed and the heading now only comes from receivers that report their baseline, so the Trimble MB-Two and Femtomes pages no longer describe a heading setup. The antenna spacing is the recommended 30 cm rather than the 5 cm the code rejects below.

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

* chore(drivers/gps): point PX4-GPSDrivers at the merged PX4/PX4-GPSDrivers#242

The submodule tracked the PR's branch commit; the squash-merged commit has the same tree.

Assisted-by: Claude:claude-opus-5-5
2026-09-28 17:37:58 -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 4dbd2e069a fix(simulation): cast gz airspeed temperature to double (#28843)
The macOS build has been failing since #28842: clang reports the
implicit float to double conversion under -Wdouble-promotion, which the
build treats as an error. GCC does not warn for argument conversions,
so the Linux builds passed.

Assisted-by: Claude:claude-opus-5-5
2026-09-25 12:05:22 -06:00
Balduin 1cd0440b68 fix(simulation): set temp in gz airspeed plugin (#28842)
The plugin already calculates a temperature which is used to adjust air
density influence on differential pressure. But it does not give the
airspeed message the temperature, so the differential pressure
temperature ends up being 0.
2026-09-25 09:32:07 -06:00
Jacob Dahl 85459fae96 fix(lockstep): stop SIH from passing the barrier on banked releases (#28802) 2026-09-23 09:35:18 +12:00
Claudio Chies 29ac50fd63 fix(sensor_gps_sim): implement RTCM correction handling for improved GPS fix accuracy (#28741) 2026-09-21 16:35:18 -06:00
jmackay2andjmackay2 fd1ddbc22e fix(simulation): remove unnecessary double-float conversion (#28715)
Co-authored-by: jmackay2 <jmackay2@gmail.com>
2026-09-16 18:10:24 +01:00
Mathéo TaillandierandMatheo Taillandier 09369af53f fix(simulation): fix mismatched baro device ID (#28646)
Co-authored-by: Matheo Taillandier <matheo.taillandier@rigi.tech>
2026-09-10 09:14:10 +02:00
Thomas Stauber 662dd41db8 fix(simulation): correctly fill the device_id of the simulated sensor_gps message (#28592) 2026-09-08 11:34:44 +02:00
LtxxandFarhang 2c47a16f56 fix(simulation): restore Gazebo fallback targets (#28339)
* fix(simulation): restore Gazebo fallback targets

Move the airframe glob outside the dependency check and create one fallback target per Gazebo airframe when dependencies are missing.

Assisted-by: OpenAI Codex: GPT-5

---------

Co-authored-by: Farhang <46557204+farhangnaderi@users.noreply.github.com>
2026-09-07 15:59:53 -04:00
Anil Kircaliali ed772c0c3d feat(battery_simulator): simulate up to 3 battery instances (#28385)
* feat(battery_simulator): simulate all battery instances with per-battery drain

Simulate one battery per battery_status instance instead of a single
hardcoded one. The Battery array is constructed in place from
battery_status_s::MAX_INSTANCES, so the simulator follows the maximum
number of batteries without code changes. A battery is only published
when its BAT<N>_SOURCE is set to power module, which keeps the default
SITL behavior of a single battery unchanged.

Add SIM_BAT<N>_DRAIN and SIM_BAT<N>_MIN_PCT to override the shared
SIM_BAT_DRAIN and SIM_BAT_MIN_PCT per battery (-1 inherits the shared
value), and integrate the state of charge per battery. This allows
testing multi-battery behavior such as one battery draining faster
than the others.

* docs(simulation): describe simulating multiple batteries

Document how additional simulated batteries are enabled through
BAT<N>_SOURCE and how SIM_BAT<N>_DRAIN and SIM_BAT<N>_MIN_PCT override
the shared drain parameters per battery.

* docs(simulation): clarify per-battery fallback rules
2026-09-01 09:09:37 +02:00
Saibernard 2de7ab05fa fix(gz_bridge): support GPS failure injection (#28398)
* fix(gz_bridge): support GPS failure injection

Modern Gazebo publishes sensor_gps directly from GZBridge, bypassing the shared failure-injection processing. Route each NavSat sample through process_gnss using the actual uORB publication instance so off, stuck, wrong, and recovery work for the addressed receiver.

Add functional regression coverage for the real GZBridge NavSat callback and sensor_gps publication path, plus recovery coverage for the shared GNSS processor.

Fixes #22296

Assisted-by: Codex:gpt-5
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>

* docs: gps failure injection is available on Gazebo

The gz_bridge now applies the shared GNSS failure state to the
simulator's NavSat data, so the table entry and the SIM_GZ_EN_GPS
workaround note are out of date.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>

---------

Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>
2026-08-28 11:28:57 -06:00
Jaeyoung Lim 6011989fbc Fix imu time stamp to publication time for gz sim (#28414) 2026-08-27 16:30:43 -06:00
55bb872df1 feat(failure_injection): add ADS-B traffic failure injection and battery severity levels (#27950)
* feat(failure_injection): add ADS-B traffic-avoidance failure injection

Wire up FAILURE_UNIT_SYSTEM_TRAFFIC_AVOIDANCE (107) for the MAVLink-based
traffic avoidance path:

- OFF suppresses and STUCK freezes the incoming transponder_report, applied
  both at the MAVLink ADS-B ingestion (handle_message_adsb_vehicle) and at
  the navigator consumer (check_traffic), so it works for real ADS-B over
  MAVLink, simulated ADS-B and the fake_traffic command.
- OFF additionally marks the ADS-B/FLARM heartbeat unhealthy so the traffic
  avoidance system health check fails, using a message-less process()
  overload.
- Add the unit to the capability catalogue (OK/OFF/STUCK), the failure
  console command, the RC-switch unit selector and the docs.

The matching MAVLink FAILURE_UNIT enum entry lives in the mavlink submodule
(common.xml) and is handled by a separate PR; the uORB mirrors in
VehicleCommand.msg and FailureInjection.msg are included here.

* feat(failure_injection): enhance battery failure injection with severity levels

* feat(failure_injection): improve battery failure handling with dynamic threshold parameters

* refactor(failure_injection): remove traffic avoidance example from documentation

* docs(docs): subedit

* feat(failure_injection): add variance setting for distance sensor and integrate rangefinder in simulator

* feat(docs): add failure injection to release notes

* docs(docs): Add sim_mavlink back to heading

* fix(failure_injection): update default battery failure injection severity to Emergency

* docs(docs): get away from footnotes

* feat(failure_injection): enhance battery failure injection handling and update traffic unit support

* feat(failure_injection): add traffic avoidance handling tests and configurations

* [AUTO COMMIT] update EKF change indication

See .github/workflows/checks.yml for more details

* Apply suggestion from @hamishwillee

* feat(failure_injection): update failure types and handling for traffic avoidance and ESC telemetry

* fix(typo)

* [AUTO COMMIT] update EKF change indication

See .github/workflows/checks.yml for more details

* fix(docs): clarify notes on GPS and airspeed handling in failure injection documentation

---------

Co-authored-by: Claudio Chies <chiesc@chies.com>
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
2026-08-21 14:23:06 +02:00
Claudio Chies 28bb9556cb feat(failure-injection): implement GNSS failure injection handling and add GPS wrong-failure fix type parameter (#28139) 2026-08-13 16:27:52 +02:00
Himesh Vijay d4ab050e71 fix(simulation): use automatic NVENC encoder selection for GStreamer (#27944) 2026-08-12 19:55:13 +01:00
danielbuleandra 4bb943bf6d feat(clock_source): Create new system clock source parameter in order to select the main clock source 2026-08-07 09:55:32 +02:00
Gennaro GuidoneandMatthias Grob e816025c3d feat(failure_injection): add ESC failure unit (off/wrong) with correct MAVLink semantics (#28088)
* feat(failure_injection): add process_esc() telemetry helper

Add a shared helper that applies the active FAILURE_UNIT_SYSTEM_ESC (106)
failures to an esc_status before it is published, matched per ESC by
esc_report.actuator_function: Off reports the ESC offline (clears its
esc_online_flags bit) so it reads as "completely non-responsive"; Wrong keeps
the ESC online but reports consistently wrong values. Mirrors process_battery();
a no-op stub keeps builds without the failure injection manager zero-cost.
Unit tested here.

* feat(failure_injection): inject ESC failures at the esc_status producers

Call process_esc() where esc_status is produced (UAVCAN ESC driver and SIH) so
injected ESC failures reach every consumer. Wire the ESC unit end to end: add
the "esc" key to the failure CLI and mark FAILURE_UNIT_SYSTEM_ESC as supporting
Off and Wrong. Regroup MOTOR to Off-only (actuation): its stuck/wrong were
never implemented, so stop advertising them.

* refactor(failure_detector): drop the misplaced ESC telemetry injection masks

FailureInjector mapped FAILURE_UNIT_SYSTEM_MOTOR Stuck/Wrong to ESC-telemetry
masks consumed by manipulateEscStatus() -- on the wrong MAVLink unit (telemetry
belongs to FAILURE_UNIT_SYSTEM_ESC) and dead code: manipulateEscStatus() has had
no callers since the ESC checks moved into escCheck. The equivalent behaviour
now lives on the ESC unit in process_esc (Wrong directly; the old zero+offline
"Stuck" as esc off). Remove the masks and the dead method; the motor-stop (Off)
path ControlAllocator consumes is unchanged.

* refactor(failure_injection): do the copy for the amneded esc_status in the process_esc() function

This results in a clearer interface with less lines to call and the same overhead of copying once.

* fix(failure_injection): add esc telemetry failure support for all simulation interfaces

* fix(failure_injection): zero a disconnected ESCs telemetry

It's not entirely realistic because the value would go stale in a real disconnect but better than just flagging it offline but still reporting new telemetry.

---------

Co-authored-by: Matthias Grob <maetugr@gmail.com>
2026-07-31 15:50:49 +02:00
James Botwina 47ce421a88 fix(simulator_sih): restore xvert front transition (#28090)
* fix(simulator_sih): correct tailsitter pitot axis

Signed-off-by: jbotwina <jimbotwina16@gmail.com>

* fix(airframes/10042): tune xvert transition

Signed-off-by: jbotwina <jimbotwina16@gmail.com>

* test(mavsdk_tests): cover xvert transition

Signed-off-by: jbotwina <jimbotwina16@gmail.com>

* fix(airframes/10042): disable airspeed scaling

Signed-off-by: jbotwina <jimbotwina16@gmail.com>

---------

Signed-off-by: jbotwina <jimbotwina16@gmail.com>
2026-07-29 13:01:51 -06:00
gguidone eca039bd52 fix(simulation): model reverse thrust for reversible motors in SIH hexacopter
The SIH hexacopter dynamics squared the motor command (u_sq = u * u),
which discards its sign, so a reversed (negative) command produced
forward thrust instead of reverse. pwm_out_sim already emits signed
[-1, 1] outputs for reversible motors, so only the plant model dropped
the sign.

Use a signed square (u * |u|) so a reversed command yields reverse
thrust and the correspondingly flipped roll/pitch/yaw torque.
Behaviour-neutral for non-reversible motors (u >= 0), which is the only
regime the previous plain square could represent.
2026-07-28 16:41:01 +02:00
mahima-yoga 00f436698b fix(simulation): wind_info topic takes precedence over the wind entity
Follow-up to #28042: the ECM wind entity read ran every step and would
overwrite wind published on the wind_info topic. Only default to the
wind entity until the first wind_info message is received, from then on
the topic value is used exclusively.

Signed-off-by: mahima-yoga <mahima@auterion.com>
2026-07-22 18:55:08 +02:00
Mahima Yoga 01193bf86b fix(simulation): make wind affect the airspeed sensor in gz (#28042)
* feat(simulation): load gz WindEffects system globally

Nothing published the world wind (wind_info topic / wind entity
velocity) so far, leaving the airspeed sensor and drag systems without
wind data in worlds that define one.

No effect in worlds without a wind definition.

Signed-off-by: mahima-yoga <mahima@auterion.com>

* fix(simulation): read wind from the ECM in the gz airspeed plugin

The wind_info topic is only published when the wind changes, so a model
that spawns after the world has loaded misses it and simulates a
wind-blind pitot: so the EKF never estimates the wind. Read the wind entity
velocity from the EntityComponentManager each step instead.

Signed-off-by: mahima-yoga <mahima@auterion.com>

---------

Signed-off-by: mahima-yoga <mahima@auterion.com>
2026-07-22 15:22:52 +02:00
jbotwina c0112e70eb fix(simulation): fix Gazebo gimbal ROI yaw frame and tracking
Gazebo gimbal joints consume vehicle-relative angles, but the gz_bridge
passed Earth-frame ROI attitude setpoints straight through, applying the
vehicle heading twice. Respect the yaw-frame flags and rotate Earth-frame
setpoints into the vehicle frame with the inverse vehicle attitude before
commanding the joints.

The MAVLink v2 gimbal output also only recomputed the geographic ROI
bearing when a new ROI command arrived, so the setpoint froze while the
vehicle translated. Refresh position-based setpoints every update cycle,
matching the v1 output.

Signed-off-by: jbotwina <jimbotwina16@gmail.com>
2026-07-22 16:19:21 +12:00