Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
17c6849
resilience feature added for auth and jamm/spoofing states monitoring
Tory9 Sep 1, 2025
10ba229
bitmask fix applied
Tory9 Sep 3, 2025
a0ef72c
pre-commit: Discover typos in Python files using codespell
cclauss Sep 1, 2025
72ae585
waf: Fix typos discovered by codespell
cclauss Sep 1, 2025
3a5e300
AP_Generator: Fix typos discovered by codespell
cclauss Sep 1, 2025
306aa63
autotest: Fix typos discovered by codespell
cclauss Sep 1, 2025
b65fe26
Tools: Fix typos discovered by codespell
cclauss Sep 1, 2025
ce6dc89
pre-commit: Add a job that runs ament_pep257 Tools/ros2
cclauss Jun 24, 2025
128e46a
precommit: Add pre-commit hook to check copyright in ros2 files
cclauss Sep 2, 2025
497965d
Tools: Add pre-commit hook to check copyright in ros2 files
cclauss Sep 2, 2025
e41558a
tests: Add pre-commit hook to check copyright in ros2 files
cclauss Sep 2, 2025
bff699e
AP_HAL: added is_pending() method for sockets
tridge Aug 22, 2025
3393fa2
AP_Scripting: added is_pending() method on sockets
tridge Aug 22, 2025
98ba837
AP_Networking: 3s timeout on TCP connect
tridge Aug 23, 2025
241ca7c
GCS_MAVLink: fix MAVn_OPTIONS doc
robertlong13 Sep 3, 2025
44d58b5
autotest: relax TetherStuck test constraints
rishabsingh3003 Sep 3, 2025
6a8c9b9
AP_RangeFinder: correct the reported types for CAN range finders
Charlie-Burge Sep 3, 2025
2cac019
fallthrough fixed
Tory9 Sep 4, 2025
a7e623e
.github: pin/bump MicroXRCEDDSGen
Ryanf55 Sep 4, 2025
629c678
Dockerfile: Pin uxrceddsgen to 4.7.1
Ryanf55 Sep 4, 2025
d11a435
AP_Common: effectively wrap malloc to zero memory in SITL under Cygwin
tpwrules Sep 3, 2025
a6308cb
Tools/ardupilotwaf: remove Cygwin malloc wrap
tpwrules Sep 3, 2025
4b8be6e
Tools: correct running of elf-diff tool
peterbarker Sep 1, 2025
c0ccb83
AP_HAL_ESP32: define stampfly IMU in hwdef.dat
peterbarker Aug 31, 2025
b260680
Tools: put elf diff output in current directory
peterbarker Sep 3, 2025
6b577f1
AP_HAL_ESP32: add support for i2c buses and devices
peterbarker Aug 31, 2025
4d89cb0
AP_HAL_ESP32: support definition of serial devices into hwdef.dat
peterbarker Aug 31, 2025
7a4ad19
AP_HAL_ESP32: allow rc outputs to be defined in hwdef.dat
peterbarker Aug 31, 2025
6a0db3d
AP_HAL_ESP32: move remainder of StampFly stuff into hwdef.dat
peterbarker Aug 31, 2025
89808ff
Tools: don't catch elf_diff exceptions
peterbarker Sep 1, 2025
5a270e4
AP_HAL_ESP32: remove forced triple-IMU support for stampfly
peterbarker Sep 3, 2025
caaa6c1
AP_HAL_ESP32: esp32s3m5stampfly: remove no-longer-required defines
peterbarker Sep 5, 2025
07cd29f
Tools: improve venv install and add wxpython wheel for ubuntu
khancyr Jul 16, 2025
907f9b4
CI: fail fast on rover PPP install
tpwrules Sep 6, 2025
ca3b9cc
AP_CANManager: make a stand-alone singleton for mavlink-to-CAN
peterbarker Jul 31, 2025
875534b
GCS_MAVLink: use new CANMAVLink object
peterbarker Jul 31, 2025
4677151
GCS_MAVLink: adjust streamrates in messages to avoid cruft on AP_Periph
peterbarker Jul 31, 2025
607b9df
AP_CANManager: make process_frame_buffer private in AP_MAVLinkCAN
peterbarker Aug 6, 2025
5e8fd13
suggestions from peterbarker applied
Tory9 Sep 8, 2025
d067850
Merge remote-tracking branch 'upstream/master' into pr-resilience3
Tory9 Sep 9, 2025
c89ee9e
missing guard checks introduced
Tory9 Sep 9, 2025
2edb4e8
map added for authintification status mapping and MSG_GNSS_INTEGRITY …
Tory9 Sep 16, 2025
531e2c6
getters removed, has_gnss_integrity state variable added and send_mav…
Tory9 Sep 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/colcon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ jobs:
- name: install Micro-XRCE-DDS-Gen from source
run: |
cd /tmp
git clone --depth 1 --recurse-submodules --branch v4.7.0 https://github.com/ardupilot/Micro-XRCE-DDS-Gen.git
git clone --depth 1 --recurse-submodules --branch v4.7.1 https://github.com/ardupilot/Micro-XRCE-DDS-Gen.git
cd Micro-XRCE-DDS-Gen
./gradlew assemble
- name: Build with colcon
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ jobs:
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: pre-commit/action@v3.0.1
- run: python3 -m pip install --upgrade pip
- run: python3 -m pip install pytest
- run: PYTHONPATH="." pytest tests/test_pre_commit_copyright.py
2 changes: 1 addition & 1 deletion .github/workflows/test_dds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ jobs:
- name: install Micro-XRCE-DDS-Gen from source
run: |
cd /tmp
git clone --recurse-submodules https://github.com/ardupilot/Micro-XRCE-DDS-Gen.git
git clone --depth 1 --recurse-submodules --branch v4.7.1 https://github.com/ardupilot/Micro-XRCE-DDS-Gen.git
cd Micro-XRCE-DDS-Gen
./gradlew assemble
- name: test ${{matrix.config}}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_sitl_rover.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ jobs:
run: |
sudo apt-get update || true
sudo apt-get -y install ppp || true
pppd --help # fail with `command not found` if ppp install failed
git config --global --add safe.directory ${GITHUB_WORKSPACE}
if [[ ${{ matrix.toolchain }} == "clang" ]]; then
export CC=clang
Expand Down
40 changes: 39 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exclude: |

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
#- id: trailing-whitespace
#- id: end-of-file-fixer
Expand Down Expand Up @@ -55,6 +55,44 @@ repos:
rev: 7.3.0
hooks:
- id: flake8

- repo: local
hooks:
- id: ament-pep257
name: Run ament_pep257 on Tools/ros2
entry: bash -c 'ament_pep257 Tools/ros2 > /dev/null'
language: python
additional_dependencies:
- ament-lint-pep257
- tomli;python_version<'3.11'
pass_filenames: false
files: ^Tools/ros2/

- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell # See pyproject.toml for args
types_or: [python]
args:
- --ignore-words-list=afile,bodgy,chek,commitish,edn,empy,finis,fram,mot,ned,parm,releas,parms,rin,ser,sitl,siz
additional_dependencies:
- tomli

- repo: local
hooks:
- id: check-copyright
name: check copyright notice in files
entry: Tools/gittools/pre_commit_copyright.py
language: python
files: |
(?x)^(
Tools/ros2/.*\.py
)$
args: [
--ignore=Tools/ros2/ardupilot_dds_tests/setup.py,
--ignore=Tools/ros2/ardupilot_dds_tests/test/test_pep257.py,
--ignore=Tools/ros2/ardupilot_dds_tests/test/test_copyright.py,
]

# # Use to sort python imports by name and put system import first.
# - repo: https://github.com/pycqa/isort
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ RUN git config --global --add safe.directory $PWD
RUN echo "if [ -d \"\$HOME/.local/bin\" ] ; then\nPATH=\"\$HOME/.local/bin:\$PATH\"\nfi" >> ~/.ardupilot_env

# Clone & install Micro-XRCE-DDS-Gen dependency
RUN git clone --recurse-submodules https://github.com/ardupilot/Micro-XRCE-DDS-Gen.git /home/${USER_NAME}/Micro-XRCE-DDS-Gen \
RUN git clone --recurse-submodules --depth 1 --branch v4.7.1 https://github.com/ardupilot/Micro-XRCE-DDS-Gen.git /home/${USER_NAME}/Micro-XRCE-DDS-Gen \
&& cd /home/${USER_NAME}/Micro-XRCE-DDS-Gen \
&& ./gradlew assemble \
&& export AP_ENV_LOC="/home/${USER_NAME}/.ardupilot_env" \
Expand Down
5 changes: 2 additions & 3 deletions Tools/ardupilotwaf/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def srcpath(path):
# need to check the hwdef.h file for the board to see if dds is enabled
# the issue here is that we need to configure the env properly to include
# the DDS library, but the definition is the the hwdef file
# and can be overriden by the commandline options
# and can be overridden by the commandline options
with open(env.BUILDROOT + "/hwdef.h", 'r', encoding="utf8") as file:
if "#define AP_DDS_ENABLED 1" in file.read():
# Enable DDS if the hwdef file has it enabled
Expand Down Expand Up @@ -833,8 +833,7 @@ def configure_env(self, cfg, env):

# wrap malloc to ensure memory is zeroed
if cfg.env.DEST_OS == 'cygwin':
# on cygwin we need to wrap _malloc_r instead
env.LINKFLAGS += ['-Wl,--wrap,_malloc_r']
pass # handled at runtime in libraries/AP_Common/c++.cpp
elif platform.system() != 'Darwin':
env.LINKFLAGS += ['-Wl,--wrap,malloc']

Expand Down
7 changes: 4 additions & 3 deletions Tools/autotest/arducopter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9537,11 +9537,12 @@ def TestTetherStuck(self):

# Simulate vehicle getting stuck by increasing RC throttle
self.set_rc(3, 1900)
self.delay_sim_time(5, reason='let tether get stuck')
self.delay_sim_time(10, reason='let tether get stuck')

# Monitor behavior for 10 seconds
tstart = self.get_sim_time()
initial_alt = self.get_altitude()
self.progress(f"initial_alt={initial_alt}")
stuck = True # Assume it's stuck unless proven otherwise

while self.get_sim_time() - tstart < 10:
Expand All @@ -9556,7 +9557,7 @@ def TestTetherStuck(self):

# Check if the vehicle is stuck.
# We assume the vehicle is stuck if the current is high and the altitude is not changing
if battery_status and (battery_status.current_battery < 6500 or abs(current_alt - initial_alt) > 2):
if battery_status and (battery_status.current_battery < 6500 or abs(current_alt - initial_alt) > 3):
stuck = False # Vehicle moved or current is abnormal
break

Expand Down Expand Up @@ -13999,7 +14000,7 @@ def RudderDisarmMidair(self):
self.wait_ready_to_arm()
self.change_mode('STABILIZE')

# Set home current location, this gives a large home vs orgin difference
# Set home current location, this gives a large home vs origin difference
self.set_home(self.mav.location())

self.set_rc(4, 2000)
Expand Down
4 changes: 2 additions & 2 deletions Tools/autotest/quadplane.py
Original file line number Diff line number Diff line change
Expand Up @@ -2835,8 +2835,8 @@ def TerrainAvoidApplet(self):
"SIM_SONAR_SCALE": 10,
})

# This mission triggers an intersting selection of "Pitching", "Quading" and "CMTC" events
# it's not always consistent, perhaps due to wind, so the tests try to accomodate variances.
# This mission triggers an interesting selection of "Pitching", "Quading" and "CMTC" events
# it's not always consistent, perhaps due to wind, so the tests try to accommodate variances.
filename = "TopOfTheWorldShort.waypoints"
self.progress("Flying mission %s" % filename)
num_wp = self.load_mission(filename)
Expand Down
55 changes: 48 additions & 7 deletions Tools/environment_install/install-prereqs-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,9 @@ if $IS_DOCKER; then
echo "# ArduPilot env file. Need to be loaded by your Shell." > ~/$SHELL_LOGIN
fi

SCRIPT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
ARDUPILOT_ROOT=$(realpath "$SCRIPT_DIR/../../")

PIP_USER_ARGUMENT="--user"

# create a Python venv on more recent releases:
Expand All @@ -433,14 +436,31 @@ fi

if [ -n "$PYTHON_VENV_PACKAGE" ]; then
$APT_GET install $PYTHON_VENV_PACKAGE
python3 -m venv --system-site-packages $HOME/venv-ardupilot

# Check if venv already exists in ARDUPILOT_ROOT (check both venv-ardupilot and venv)
VENV_PATH=""
if [ -d "$ARDUPILOT_ROOT/venv-ardupilot" ]; then
VENV_PATH="$ARDUPILOT_ROOT/venv-ardupilot"
echo "Found existing venv at $VENV_PATH"
elif [ -d "$ARDUPILOT_ROOT/venv" ]; then
VENV_PATH="$ARDUPILOT_ROOT/venv"
echo "Found existing venv at $VENV_PATH"
elif [ -d "$ARDUPILOT_ROOT/.venv" ]; then
VENV_PATH="$ARDUPILOT_ROOT/.venv"
echo "Found existing venv at $VENV_PATH"
else
VENV_PATH="$HOME/venv-ardupilot"
echo "Creating new venv at $VENV_PATH"
python3 -m venv --system-site-packages "$VENV_PATH"
fi

SOURCE_LINE="source $VENV_PATH/bin/activate"

# activate it:
SOURCE_LINE="source $HOME/venv-ardupilot/bin/activate"
$SOURCE_LINE
PIP_USER_ARGUMENT=""

if [[ -z "${DO_PYTHON_VENV_ENV}" ]] && maybe_prompt_user "Make ArduPilot venv default for python [N/y]?" ; then
if [[ -z "${DO_PYTHON_VENV_ENV}" ]] && maybe_prompt_user "Make ArduPilot venv default for python [N/y]?\nThis means that any terminal will open and load ArduPilot venv" ; then
DO_PYTHON_VENV_ENV=1
fi

Expand Down Expand Up @@ -478,8 +498,32 @@ fi
for PACKAGE in $PYTHON_PKGS; do
if [ "$PACKAGE" == "wxpython" ]; then
echo "##### $PACKAGE takes a *VERY* long time to install (~30 minutes). Be patient."

# Use wheel repository for specific supported Ubuntu releases only
case ${RELEASE_CODENAME} in
focal)
echo "##### Adding wxpython wheel repository for faster installation"
WXPYTHON_WHEEL_REPO="https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04"
time $PIP install $PIP_USER_ARGUMENT -U -f $WXPYTHON_WHEEL_REPO $PACKAGE
;;
jammy)
echo "##### Adding wxpython wheel repository for faster installation"
WXPYTHON_WHEEL_REPO="https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04"
time $PIP install $PIP_USER_ARGUMENT -U -f $WXPYTHON_WHEEL_REPO $PACKAGE
;;
noble)
echo "##### Adding wxpython wheel repository for faster installation"
WXPYTHON_WHEEL_REPO="https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-24.04"
time $PIP install $PIP_USER_ARGUMENT -U -f $WXPYTHON_WHEEL_REPO $PACKAGE
;;
*)
echo "##### Installing wxpython from PyPI (no specific wheel repository for this release)"
time $PIP install $PIP_USER_ARGUMENT -U $PACKAGE
;;
esac
else
time $PIP install $PIP_USER_ARGUMENT -U $PACKAGE
fi
time $PIP install $PIP_USER_ARGUMENT -U $PACKAGE
done

# somehow Plucky really wants Pillow reinstalled or MAVProxy's map
Expand Down Expand Up @@ -509,9 +553,6 @@ fi

heading "Adding ArduPilot Tools to environment"

SCRIPT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
ARDUPILOT_ROOT=$(realpath "$SCRIPT_DIR/../../")

if [[ $DO_AP_STM_ENV -eq 1 ]]; then
exportline="export PATH=$OPT/$ARM_ROOT/bin:\$PATH";
grep -Fxq "$exportline" ~/$SHELL_LOGIN 2>/dev/null || {
Expand Down
109 changes: 109 additions & 0 deletions Tools/gittools/pre_commit_copyright.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#!/usr/bin/env python3

# CAUTION: The first docstring in this file will be the copyright notice that will be
# looked for in all file paths that the pre-commit hook passes in. If all files
# contain the __doc__ text below, the commit will be allowed to proceed.

"""ArduPilot.org.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
"""

# --- Do not merges these two docstrings. See CAUTION above. ---

from argparse import ArgumentParser
from pathlib import Path

r"""
A pre-commit hook that will use the content of __doc__ and then ensure all files
processed contain that same copyright information. This is useful to ensure that all
those files consistent copyright notices, which is important for legal and compliance
reasons. If any files does not contain the expected copyright information, the commit
will be aborted and an error message will be displayed with the file paths of all files
that do not match.

Place an entry into the local `.pre-commit-config.yaml` file to run this job.
```yaml
- repo: local
hooks:
- id: check-copyright
name: check copyright notice in files
entry: Tools/gittools/pre_commit_copyright.py
language: python
files: |
(?x)^(
Tools/ros2/.*\.py
)$
args: [
--ignore=excluded_file.py,
--ignore=another_excluded.py,
]
```

Usage:
1. Place this script in the `Tools/gittools/pre_commit_copyright.py` file.
2. Ensure the docstring of this file is set to the expected copyright notice.
3. Add the entry to your `.pre-commit-config.yaml` file as shown above.
4. Run `pre-commit install` to set up the pre-commit hooks.
5. Now, when you try to commit changes, this hook will check for the copyright notice.
6. If any files do not contain the expected copyright notice, the commit will be aborted.
7. The error message will list all files that do not match the expected copyright notice.
8. Use --ignore=file_path to exclude specific files from copyright checking.

Command line usage:
python pre_commit_copyright.py file1.py file2.py --ignore=excluded_file.py \
--ignore=another_excluded.py
"""


def get_file_paths() -> list[str]:
"""Parse command line arguments and return a sorted list of file paths excluding
ignored files."""
parser = ArgumentParser(description="Check copyright notice in files")
parser.add_argument("files", nargs="+", help="File paths to check")
parser.add_argument(
"--ignore",
action="append",
default=[],
help="File paths to ignore (can be used multiple times)",
)
args = parser.parse_args()
return sorted(set(args.files) - set(args.ignore))


def check_copyright(file_path: Path) -> bool:
"""Check if the file contains the expected copyright notice."""
try:
return __doc__ in file_path.read_text()
except Exception as e: # noqa: BLE001 Path.read_text() can raise many exceptions
print(f"Error reading {file_path}: {e}")
return False


def main():
"""Main function to check all file paths from command line arguments.

pre-commit will repeatedly call this function and each time it will pass ~four file
paths to be checked.

Supports --ignore flags to exclude specific files from copyright checking.
"""
if failed_files := [
path for path in get_file_paths() if not check_copyright(Path(path))
]:
raise SystemExit(f"Copyright not found in: {', '.join(failed_files)}")


if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions Tools/scripts/build_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ for t in $CI_BUILD_TARGET; do
if [ "$t" == "sitltest-rover" ]; then
sudo apt-get update || /bin/true
sudo apt-get install -y ppp || /bin/true
pppd --help # fail with `command not found` if ppp install failed
run_autotest "Rover" "build.Rover" "test.Rover"
continue
fi
Expand Down
2 changes: 1 addition & 1 deletion Tools/scripts/build_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def config_option(self):
Feature('AP_Periph', 'LONG_TEXT', 'HAL_PERIPH_SUPPORT_LONG_CAN_PRINTF', 'Enable extended length text strings', 0, None),
Feature('AP_Periph', 'PERIPH_DEVICE_TEMPERATURE', 'AP_PERIPH_DEVICE_TEMPERATURE_ENABLED', 'Emit DroneCAN Temperature Messages for AP_Temperature sensors', 0, 'TEMP'), # noqa
Feature('AP_Periph', 'PERIPH_MSP', 'AP_PERIPH_MSP_ENABLED', 'Emit MSP protocol messages from AP_Periph', 0, 'MSP'),
Feature('AP_Periph', 'PERIPH_NOTIFY', 'AP_PERIPH_NOTIFY_ENABLED', 'Handle DroneCAN messages for notification equipments (e.g. buzzers, lights etc.)', 0, None), # noqa
Feature('AP_Periph', 'PERIPH_NOTIFY', 'AP_PERIPH_NOTIFY_ENABLED', 'Handle DroneCAN messages for notification equipment (e.g. buzzers, lights etc.)', 0, None), # noqa
Feature('AP_Periph', 'PERIPH_SERIAL_OPTIONS', 'AP_PERIPH_SERIAL_OPTIONS_ENABLED', 'Enable Serial Options on AP_Periph', 0, None), # noqa
Feature('AP_Periph', 'PERIPH_BATTERY', 'AP_PERIPH_BATTERY_ENABLED', 'Emit DroneCAN battery info messages using AP_BattMonitor', 0, None), # noqa
Feature('AP_Periph', 'PERIPH_RELAY', 'AP_PERIPH_RELAY_ENABLED', 'Handle DroneCAN hardpoint command', 0, 'RELAY'),
Expand Down
Loading