Compare commits

..

21 Commits

Author SHA1 Message Date
Ramon Roche a7e0f69d9e ci: debug with tmate
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-06-10 14:03:16 -07:00
Ramon Roche 09be71bce4 docs: update failsafe web metadata
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-06-10 13:33:31 -07:00
Ramon Roche 9fcfe538da ci: debug failsafe web
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-06-10 12:42:53 -07:00
Ramon Roche 1a56f79f2f ci: fix uorb graphs sort
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-06-10 11:52:34 -07:00
Ramon Roche 9ff5860c49 tools: sorted uorb graphs
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-06-10 11:23:52 -07:00
Ramon Roche 5dc041664b cmake: generate sorted dds topics metadata
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-06-10 08:26:27 -07:00
Ramon Roche 93fbea353d git: ignore metadata dep lib
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-06-10 06:48:21 -07:00
Ramon Roche 82a0f1ac17 docs: uorb graph updates
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-06-09 15:49:27 -07:00
Ramon Roche 3f14c1e3d4 tools: msg docs and dds docs
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-06-09 15:34:13 -07:00
Ramon Roche d912aac860 tools: generate dds topics to output_dir
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-06-09 15:33:51 -07:00
Ramon Roche b02215a529 docs: update dds_topics
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-06-09 15:25:12 -07:00
Ramon Roche 110d3da3fc tools: remove whitespace trimming
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-06-09 14:48:55 -07:00
Ramon Roche fe013702e3 docs: update uorb messages
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-06-09 14:48:29 -07:00
Ramon Roche e379b66717 tools: msg metadata strip ending whitespace
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-06-09 14:34:50 -07:00
Ramon Roche bd4856a4f2 build: generate uorb message documentation
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-06-09 14:21:11 -07:00
Ramon Roche e73de6914b drivers: update ll40ls_pwm module name
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-06-09 13:43:54 -07:00
Ramon Roche c1f23cf13d ci: only run on pull request
* runs all scripts
* runs on the exact commit not the merge commit

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-06-09 13:43:08 -07:00
Ramon Roche fa4c77cb11 docs: update module reference metadata 2025-06-05 11:51:15 -07:00
Ramon Roche 91bafed906 docs: update parameter reference metadata 2025-06-05 11:50:57 -07:00
Ramon Roche 742d3c3835 docs: metadata: update uORB graph JSONs 2025-06-05 11:50:09 -07:00
Ramon Roche 1a92ae05c1 ci: check for metadata changes
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2025-06-05 10:24:24 -07:00
554 changed files with 9683 additions and 18227 deletions
+47
View File
@@ -0,0 +1,47 @@
name: Docs Metadata
permissions:
contents: write
on:
pull_request: {}
jobs:
metadata-check:
name: ${{ matrix.name }}
runs-on: [runs-on,runner=2cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=true]
container:
image: ghcr.io/px4/px4-dev:v1.16.0-ondemand
strategy:
fail-fast: false
matrix:
include:
- name: uORB Graphs
script: Tools/ci/metadata_uorb_graph.sh
- name: Failsafe Web
script: Tools/ci/metadata_failsafe_web.sh --debug
- name: uORB Messages
script: Tools/ci/metadata_msg_docs.sh
- name: Parameter Reference
script: Tools/ci/metadata_parameters.sh
- name: Airframe Reference
script: Tools/ci/metadata_airframe.sh
- name: Module Reference
script: Tools/ci/metadata_modules.sh
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: true
- name: Mark all directories safe for Git
run: git config --system --add safe.directory '*'
- name: Run ${{ matrix.name }} metadata check
run: ${{ matrix.script }} --test-only
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
+1 -1
View File
@@ -27,7 +27,7 @@ jobs:
"failsafe_web",
]
container:
image: px4io/px4-dev:v1.16.0-rc1-258-g0369abd556
image: px4io/px4-dev:v1.16.0-ondemand
options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
steps:
- name: Install Node v20.18.0
+1 -1
View File
@@ -28,7 +28,7 @@ jobs:
name: Analyzing ${{ matrix.target }}
runs-on: [runs-on,runner=8cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false]
container:
image: px4io/px4-dev:v1.16.0-rc1-258-g0369abd556
image: px4io/px4-dev:v1.16.0-ondemand
strategy:
matrix:
target: [px4_fmu-v5x, px4_fmu-v6x]
+1 -1
View File
@@ -22,7 +22,7 @@ jobs:
name: Checking ${{ matrix.target }}
runs-on: [runs-on,runner=8cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false]
container:
image: px4io/px4-dev:v1.16.0-rc1-258-g0369abd556
image: px4io/px4-dev:v1.16.0-ondemand
strategy:
fail-fast: false
matrix:
+1 -1
View File
@@ -31,7 +31,7 @@ jobs:
- name: Build PX4 and Run Test [${{ matrix.config }}]
uses: addnab/docker-run-action@v3
with:
image: px4io/px4-dev:v1.16.0-rc1-258-g0369abd556
image: px4io/px4-dev:v1.16.0-ondemand
options: -v ${{ github.workspace }}:/workspace
run: |
cd /workspace
+3 -7
View File
@@ -11,11 +11,13 @@ on:
- 'main'
paths-ignore:
- 'docs/**'
- '.github/**'
pull_request:
branches:
- '**'
- '*'
paths-ignore:
- 'docs/**'
- '.github/**'
jobs:
build:
@@ -31,12 +33,6 @@ jobs:
- name: Git Ownership Workaround
run: git config --system --add safe.directory '*'
- name: Update ROS Keys
run: |
sudo rm /etc/apt/sources.list.d/ros2.list && \
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
- name: Install gazebo
run: |
apt update && apt install -y gazebo11 libgazebo11-dev gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly libgstreamer-plugins-base1.0-dev
+3
View File
@@ -109,3 +109,6 @@ src/systemcmds/topic_listener/listener_generated.cpp
# colcon
log/
keys/
# metadata dependencies
_emscripten_sdk/
-10
View File
@@ -6,11 +6,6 @@ CONFIG:
buildType: RelWithDebInfo
settings:
CONFIG: px4_sitl_default
px4_sitl_spacecraft:
short: px4_sitl_spacecraft
buildType: RelWithDebInfo
settings:
CONFIG: px4_sitl_spacecraft
px4_sitl_nolockstep:
short: px4_sitl_nolockstep
buildType: RelWithDebInfo
@@ -306,11 +301,6 @@ CONFIG:
buildType: MinSizeRel
settings:
CONFIG: holybro_durandal-v1_default
holybro_kakuteh7-wing_default:
short: holybro_kakuteh7-wing
buildType: MinSizeRel
settings:
CONFIG: holybro_kakuteh7-wing_default
holybro_kakuteh7dualimu_default:
short: holybro_kakuteh7dualimu
buildType: MinSizeRel
+16 -17
View File
@@ -7,34 +7,33 @@ See [the documentation on Maintainers](https://docs.px4.io/main/en/contribute/ma
| Name | Sector | GitHub | Chat | email
|-------------------------|--------|--------|------|----------------
| Lorenz Meier | Founder | [@LorenzMeier](https://github.com/LorenzMeier) | | <lorenz@px4.io>
| Daniel Agar | Architecture | [@dagar](https://github.com/dagar) | daniel_agar | <daniel@agar.ca>
| Beat Küng | Architecture | [@bkueng](https://github.com/bkueng) | beatkueng | <beat-kueng@gmx.net>
| Ramón Roche | CI / Testing | [@mrpollo](https://github.com/mrpollo) | rroche | <rroche@linuxfoundation.org>
| Mathieu Bresciani | State Estimation | [@bresch](https://github.com/bresch) | mbresch |
| Paul Riseborough | State Estimation | [@priseborough](https://github.com/priseborough) | |
| David Sidrane | RTOS / NuttX | [@davids5](https://github.com/davids5) | david_s5 | <David.Sidrane@Nscdg.com>
| Jayoung Lim | Simulation | [@Jaeyoung-Lim](https://github.com/Jaeyoung-Lim) | jaeyounglim. | <jalim@ethz.ch>
| Beniamino Pozzan | ROS 2 | [@beniaminopozzan](https://github.com/beniaminopozzan) | beniaminopozzan | <beniamino.pozzan@gmail.com>
| Matthias Grob | Multirotor | [@MaEtUgR](https://github.com/MaEtUgR) | maetugr |
| Silvan Fuhrer | Fixed-Wing / VTOL | [@sfuhrer](https://github.com/sfuhrer) | sfuhrer |
| Christian Friedrich | Rover | [@chfriedrich98](https://github.com/chfriedrich98) | christian982564 |
| Pedro Roque | Spacecraft | [@Pedro-Roque](https://github.com/Pedro-Roque) | .pedroroque | <padr@kth.se>
| Jacob Dahl | Simulation | [@dakejahl](https://github.com/dakejahl) | dakejahl | <dahl.jakejacob@gmail.com>
| Lorenz Meier | Founder | [LorenzMeier][LorenzMeier] | | <lorenz@px4.io>
| Daniel Agar | Architecture | [dagar][dagar] | daniel_agar | <daniel@agar.ca>
| Beat Küng | Architecture | [bkueng][bkueng] | beatkueng | <beat-kueng@gmx.net>
| Ramón Roche | CI / Testing | [mrpollo][mrpollo] | rroche | <rroche@linuxfoundation.org>
| Mathieu Bresciani | State Estimation | [bresch][bresch] | mbresch |
| Paul Riseborough | State Estimation | [priseborough][priseborough] | |
| David Sidrane | RTOS / NuttX | [davids5][davids5] | david_s5 | <David.Sidrane@Nscdg.com>
| Jayoung Lim | Simulation | [Jaeyoung-Lim][Jaeyoung-Lim] | jaeyounglim. | <jalim@ethz.ch>
| Beniamino Pozzan | ROS 2 | [beniaminopozzan][beniaminopozzan] | beniaminopozzan | <beniamino.pozzan@gmail.com>
| Matthias Grob | Multirotor | [MaEtUgR][MaEtUgR] | maetugr |
| Silvan Fuhrer | Fixed-Wing / VTOL | [sfuhrer][sfuhrer] | sfuhrer |
| Christian Friedrich | Rover | [chfriedrich98][chfriedrich98] | christian982564 |
| Pedro Roque | Spacecraft | [Pedro-Roque][Pedro-Roque] | .pedroroque | <padr@kth.se>
**Documentation Maintainers**
| Name | GitHub | Chat | email
|------|--------|------|----------------------
| Hamish Willee | [@hamishwillee](https://github.com/hamishwillee) | hamishwillee |
| Hamish Willee | [hamishwillee][hamishwillee] | hamishwillee |
**Release Managers**
| Name | GitHub | Chat | email
|------|--------|------|----------------------
| Ramón Roche | [@mrpollo](https://github.com/mrpollo) | rroche | <rroche@linuxfoundation.org>
| Daniel Agar | [@dagar](https://github.com/dagar) | daniel_agar | <daniel@agar.ca>
| Ramón Roche | [mrpollo][mrpollo] | rroche | <rroche@linuxfoundation.org>
| Daniel Agar | [dagar][dagar] | daniel_agar | <daniel@agar.ca>
**Retired Maintainers**
+4 -1
View File
@@ -379,7 +379,10 @@ module_documentation:
extract_events:
@$(MAKE) --no-print-directory px4_sitl_default metadata_extract_events ver_gen
px4_metadata: parameters_metadata airframe_metadata module_documentation extract_events
msg_docs:
@$(MAKE) --no-print-directory px4_sitl_default metadata_msg_documentation ver_gen
px4_metadata: parameters_metadata airframe_metadata module_documentation extract_events msg_docs
doxygen:
@mkdir -p "$(SRC_DIR)"/build/doxygen
+2 -23
View File
@@ -216,33 +216,12 @@ foreach(board_extra_file ${OPTIONAL_BOARD_EXTRAS})
if(CONFIG_SYSTEMCMDS_BL_UPDATE)
# generate rc.board_bootloader_upgrade
set(BOARD_FIRMWARE_BIN "${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_bootloader.bin")
message(STATUS "ROMFS: Adding platforms/nuttx/init/rc.board_bootloader_upgrade -> /etc/init.d/rc.board_bootloader_upgrade")
# Generate the file using configure_file at configure time to a temporary location
set(bootloader_upgrade_tmp ${CMAKE_CURRENT_BINARY_DIR}/rc.board_bootloader_upgrade.tmp)
configure_file(${PX4_SOURCE_DIR}/platforms/nuttx/init/rc.board_bootloader_upgrade.in ${bootloader_upgrade_tmp} @ONLY)
# Then copy it at build time with proper dependencies
add_custom_command(
OUTPUT
${romfs_gen_root_dir}/init.d/rc.board_bootloader_upgrade
rc.board_bootloader_upgrade.stamp
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${bootloader_upgrade_tmp} ${romfs_gen_root_dir}/init.d/rc.board_bootloader_upgrade
COMMAND ${CMAKE_COMMAND} -E touch rc.board_bootloader_upgrade.stamp
DEPENDS
${bootloader_upgrade_tmp}
${PX4_SOURCE_DIR}/platforms/nuttx/init/rc.board_bootloader_upgrade.in
romfs_copy.stamp
COMMENT "ROMFS: copying rc.board_bootloader_upgrade"
)
list(APPEND extras_dependencies
rc.board_bootloader_upgrade.stamp
)
configure_file(${PX4_SOURCE_DIR}/platforms/nuttx/init/rc.board_bootloader_upgrade.in ${romfs_gen_root_dir}/init.d/rc.board_bootloader_upgrade @ONLY)
else()
# remove bootloader from extras
list(REMOVE_ITEM OPTIONAL_BOARD_EXTRAS ${board_extra_file})
endif()
endif()
endforeach()
@@ -15,6 +15,7 @@ param set-default NAV_ACC_RAD 0.5
# Differential Parameters
param set-default RD_WHEEL_TRACK 0.3
param set-default RD_MAX_THR_YAW_R 1.5
param set-default RD_TRANS_DRV_TRN 0.349066
param set-default RD_TRANS_TRN_DRV 0.174533
@@ -30,16 +31,14 @@ param set-default RO_YAW_RATE_P 0.25
param set-default RO_YAW_RATE_LIM 180
param set-default RO_YAW_ACCEL_LIM 120
param set-default RO_YAW_DECEL_LIM 1000
param set-default RO_YAW_RATE_CORR 1.43
# Rover Attitude Control Parameters
param set-default RO_YAW_P 5
# Rover Velocity Control Parameters
# Rover Position Control Parameters
param set-default RO_SPEED_LIM 2
param set-default RO_SPEED_I 0.01
param set-default RO_SPEED_P 0.1
param set-defatul RO_SPEED_RED 1
# Pure Pursuit parameters
param set-default PP_LOOKAHD_GAIN 1
@@ -1,68 +1,51 @@
#!/bin/sh
# @name Gazebo - Zero Turn Lawnmower
# @name Gazebo lawnmower
# @type Rover
# @class Rover
. ${R}etc/init.d/rc.rover_differential_defaults
PX4_SIMULATOR=${PX4_SIMULATOR:=gz}
PX4_GZ_WORLD=${PX4_GZ_WORLD:=lawn}
PX4_GZ_WORLD=${PX4_GZ_WORLD:=default}
PX4_SIM_MODEL=${PX4_SIM_MODEL:=lawnmower}
param set-default SIM_GZ_EN 1 # Gazebo bridge
param set-default NAV_ACC_RAD 0.5
# We can arm and drive in manual mode when it slides and GPS check fails:
param set-default COM_ARM_WO_GPS 1
# Differential Parameters
# Rover parameters
param set-default RD_WHEEL_TRACK 0.9
param set-default RD_YAW_RATE_I 0.1
param set-default RD_YAW_RATE_P 5
param set-default RD_MAX_ACCEL 1
param set-default RD_MAX_JERK 3
param set-default RD_MAX_SPEED 8
param set-default RD_YAW_P 5
param set-default RD_YAW_I 0.1
param set-default RD_MAX_YAW_RATE 30
param set-default RD_TRANS_DRV_TRN 0.349066
param set-default RD_TRANS_TRN_DRV 0.174533
# Rover Control Parameters
param set-default RO_ACCEL_LIM 1.5
param set-default RO_DECEL_LIM 5
param set-default RO_JERK_LIM 15
param set-default RO_MAX_THR_SPEED 2.7
# Rover Rate Control Parameters
param set-default RO_YAW_RATE_I 0.2
param set-default RO_YAW_RATE_P 1.0
param set-default RO_YAW_RATE_LIM 60
param set-default RO_YAW_ACCEL_LIM 50
param set-default RO_YAW_DECEL_LIM 1000
param set-default RO_YAW_RATE_CORR 1.0
# Rover Attitude Control Parameters
param set-default RO_YAW_P 5
# Rover Velocity Control Parameters
param set-default RO_SPEED_LIM 2.1
param set-default RO_SPEED_I 0.01
param set-default RO_SPEED_P 0.1
param set-defatul RO_SPEED_RED 1.0
# Pure pursuit parameters
param set-default PP_LOOKAHD_MAX 30
param set-default PP_LOOKAHD_MIN 2
param set-default PP_LOOKAHD_GAIN 1
param set-default PP_LOOKAHD_MAX 10
param set-default PP_LOOKAHD_MIN 1
# Actuator mapping - set SITL motors/servos output parameters:
# "Motors" - motor channels 0 (Right) and 1 (Left) - via Wheels GZ bridge:
param set-default SIM_GZ_WH_FUNC1 101 # right wheel
param set-default SIM_GZ_WH_MIN1 87
param set-default SIM_GZ_WH_MAX1 113
param set-default SIM_GZ_WH_DIS1 100
param set-default SIM_GZ_WH_FAIL1 100
#param set-default SIM_GZ_WH_MIN1 0
#param set-default SIM_GZ_WH_MAX1 200
#param set-default SIM_GZ_WH_DIS1 100
#param set-default SIM_GZ_WH_FAIL1 100
param set-default SIM_GZ_WH_FUNC2 102 # left wheel
param set-default SIM_GZ_WH_MIN2 87
param set-default SIM_GZ_WH_MAX2 113
param set-default SIM_GZ_WH_DIS2 100
param set-default SIM_GZ_WH_FAIL2 100
#param set-default SIM_GZ_WH_MIN2 0
#param set-default SIM_GZ_WH_MAX2 200
#param set-default SIM_GZ_WH_DIS2 100
#param set-default SIM_GZ_WH_FAIL2 100
param set-default SIM_GZ_WH_REV 0 # no need to reverse any wheels
@@ -30,16 +30,14 @@ param set-default RO_MAX_THR_SPEED 3.1
param set-default RO_YAW_RATE_I 0.1
param set-default RO_YAW_RATE_P 1
param set-default RO_YAW_RATE_LIM 180
param set-default RO_YAW_RATE_CORR 1
# Rover Attitude Control Parameters
param set-default RO_YAW_P 3
# Rover Velocity Control Parameters
# Rover Position Control Parameters
param set-default RO_SPEED_LIM 3
param set-default RO_SPEED_I 0.1
param set-default RO_SPEED_P 1
param set-default RO_SPEED_RED 1
# Pure Pursuit parameters
param set-default PP_LOOKAHD_GAIN 1
@@ -15,6 +15,8 @@ param set-default NAV_ACC_RAD 0.5
# Mecanum Parameters
param set-default RM_WHEEL_TRACK 0.3
param set-default RM_MAX_THR_YAW_R 1.2
param set-default RM_MISS_SPD_GAIN 1
# Rover Control Parameters
param set-default RO_ACCEL_LIM 3
@@ -28,16 +30,14 @@ param set-default RO_YAW_RATE_P 0.1
param set-default RO_YAW_RATE_LIM 120
param set-default RO_YAW_ACCEL_LIM 240
param set-default RO_YAW_DECEL_LIM 1000
param set-default RO_YAW_RATE_CORR 1.75
# Rover Attitude Control Parameters
param set-default RO_YAW_P 5
# Rover Velocity Control Parameters
# Rover Position Control Parameters
param set-default RO_SPEED_LIM 2
param set-default RO_SPEED_I 0.5
param set-default RO_SPEED_P 1
param set-default RO_SPEED_RED 1
# Pure Pursuit parameters
param set-default PP_LOOKAHD_GAIN 0.5
@@ -0,0 +1,155 @@
#!/bin/sh
#
# @name 6DoF Spacecraft Model
#
# @type Freeflyer with 8 thrusters
#
# @maintainer Pedro Roque <padr@kth.se>
#
. ${R}etc/init.d/rc.sc_defaults
param set-default CA_AIRFRAME 15
param set-default MAV_TYPE 99
param set-default CA_THRUSTER_CNT 12
param set-default CA_R_REV 0
# param set-default FW_ARSP_MODE 1
# Auto to be provided by Custom Airframe
param set-default CA_METHOD 0
# disable attitude failure detection
param set-default FD_FAIL_P 0
param set-default FD_FAIL_R 0
# Set proper failsafes
param set-default COM_ACT_FAIL_ACT 0
param set-default COM_LOW_BAT_ACT 0
param set-default NAV_DLL_ACT 0
param set-default GF_ACTION 1
param set-default NAV_RCL_ACT 1
param set-default COM_POSCTL_NAVL 2
# Set thrusters
param set-default CA_THRUSTER0_PX -0.50
param set-default CA_THRUSTER0_PY 0.50
param set-default CA_THRUSTER0_PZ 0.0
param set-default CA_THRUSTER0_CT 0.237
param set-default CA_THRUSTER0_AX 0.0
param set-default CA_THRUSTER0_AY -1.0
param set-default CA_THRUSTER0_AZ 0.0
param set-default CA_THRUSTER1_PX 0.50
param set-default CA_THRUSTER1_PY 0.50
param set-default CA_THRUSTER1_PZ 0.0
param set-default CA_THRUSTER1_CT 0.237
param set-default CA_THRUSTER1_AX 0.0
param set-default CA_THRUSTER1_AY -1.0
param set-default CA_THRUSTER1_AZ 0.0
param set-default CA_THRUSTER2_PX 0.50
param set-default CA_THRUSTER2_PY -0.50
param set-default CA_THRUSTER2_PZ 0.0
param set-default CA_THRUSTER2_CT 0.237
param set-default CA_THRUSTER2_AX 0.0
param set-default CA_THRUSTER2_AY 1.0
param set-default CA_THRUSTER2_AZ 0.0
param set-default CA_THRUSTER3_PX -0.50
param set-default CA_THRUSTER3_PY -0.50
param set-default CA_THRUSTER3_PZ 0.0
param set-default CA_THRUSTER3_CT 0.237
param set-default CA_THRUSTER3_AX 0.0
param set-default CA_THRUSTER3_AY 1.0
param set-default CA_THRUSTER3_AZ 0.0
param set-default CA_THRUSTER4_PX -0.50
param set-default CA_THRUSTER4_PY 0.0
param set-default CA_THRUSTER4_PZ -0.50
param set-default CA_THRUSTER4_CT 0.237
param set-default CA_THRUSTER4_AX 1.0
param set-default CA_THRUSTER4_AY 0.0
param set-default CA_THRUSTER4_AZ 0.0
param set-default CA_THRUSTER5_PX 0.50
param set-default CA_THRUSTER5_PY 0.0
param set-default CA_THRUSTER5_PZ -0.50
param set-default CA_THRUSTER5_CT 0.237
param set-default CA_THRUSTER5_AX -1.0
param set-default CA_THRUSTER5_AY 0.0
param set-default CA_THRUSTER5_AZ 0.0
param set-default CA_THRUSTER6_PX 0.50
param set-default CA_THRUSTER6_PY 0.0
param set-default CA_THRUSTER6_PZ 0.50
param set-default CA_THRUSTER6_CT 0.237
param set-default CA_THRUSTER6_AX -1.0
param set-default CA_THRUSTER6_AY 0.0
param set-default CA_THRUSTER6_AZ 0.0
param set-default CA_THRUSTER7_PX -0.50
param set-default CA_THRUSTER7_PY 0.0
param set-default CA_THRUSTER7_PZ 0.50
param set-default CA_THRUSTER7_CT 0.237
param set-default CA_THRUSTER7_AX 1.0
param set-default CA_THRUSTER7_AY 0.0
param set-default CA_THRUSTER7_AZ 0.0
param set-default CA_THRUSTER8_PX 0.0
param set-default CA_THRUSTER8_PY -0.50
param set-default CA_THRUSTER8_PZ -0.50
param set-default CA_THRUSTER8_CT 0.237
param set-default CA_THRUSTER8_AX 0.0
param set-default CA_THRUSTER8_AY 0.0
param set-default CA_THRUSTER8_AZ 1.0
param set-default CA_THRUSTER9_PX 0.0
param set-default CA_THRUSTER9_PY 0.50
param set-default CA_THRUSTER9_PZ -0.50
param set-default CA_THRUSTER9_CT 0.237
param set-default CA_THRUSTER9_AX 0.0
param set-default CA_THRUSTER9_AY 0.0
param set-default CA_THRUSTER9_AZ 1.0
param set-default CA_THRUSTER10_PX 0.0
param set-default CA_THRUSTER10_PY 0.50
param set-default CA_THRUSTER10_PZ 0.50
param set-default CA_THRUSTER10_CT 0.237
param set-default CA_THRUSTER10_AX 0.0
param set-default CA_THRUSTER10_AY 0.0
param set-default CA_THRUSTER10_AZ -1.0
param set-default CA_THRUSTER11_PX 0.0
param set-default CA_THRUSTER11_PY -0.50
param set-default CA_THRUSTER11_PZ 0.50
param set-default CA_THRUSTER11_CT 0.237
param set-default CA_THRUSTER11_AX 0.0
param set-default CA_THRUSTER11_AY 0.0
param set-default CA_THRUSTER11_AZ -1.0
param set-default PWM_MAIN_FUNC1 101
param set-default PWM_MAIN_FUNC2 102
param set-default PWM_MAIN_FUNC3 103
param set-default PWM_MAIN_FUNC4 104
param set-default PWM_MAIN_FUNC5 105
param set-default PWM_MAIN_FUNC6 106
param set-default PWM_MAIN_FUNC7 107
param set-default PWM_MAIN_FUNC8 108
param set-default PWM_MAIN_FUNC9 109
param set-default PWM_MAIN_FUNC10 110
param set-default PWM_MAIN_FUNC11 111
param set-default PWM_MAIN_FUNC12 112
# PWM Simulation
param set PWM_SIM_PWM_MAX 10000
param set PWM_SIM_PWM_MIN 0
# Controller Tunings
param set-default SC_ROLLRATE_P 0.14
param set-default SC_PITCHRATE_P 0.14
param set-default SC_ROLLRATE_I 0.3
param set-default SC_PITCHRATE_I 0.3
param set-default SC_ROLLRATE_D 0.004
param set-default SC_PITCHRATE_D 0.004
@@ -20,7 +20,7 @@ param set-default COM_ARM_CHK_ESCS 0 # We don't have ESCs
param set-default FD_ESCS_EN 0 # We don't have ESCs - but maybe we need this later?
param set-default CA_AIRFRAME 14
param set-default MAV_TYPE 45
param set-default MAV_TYPE 99
param set-default CA_THRUSTER_CNT 8
param set-default CA_R_REV 0
@@ -114,6 +114,7 @@ px4_add_romfs_files(
17001_flightgear_tf-g1
17002_flightgear_tf-g2
71001_gazebo-classic_spacecraft_dart
71002_gz_spacecraft_2d
# [22000, 22999] Reserve for custom models
+11 -22
View File
@@ -110,36 +110,25 @@ if [ -n "${PX4_SIM_MODEL#*gz_}" ] && [ -z "${PX4_GZ_MODEL_NAME}" ]; then
MODEL_NAME="${PX4_SIM_MODEL#*gz_}"
MODEL_NAME_INSTANCE="${MODEL_NAME}_${px4_instance}"
sdf_pose_str=""
POSE_ARG=""
if [ -n "${PX4_GZ_MODEL_POSE}" ]; then
pose_x=$(echo "${PX4_GZ_MODEL_POSE}" | awk -F',' '{print $1}')
pose_y=$(echo "${PX4_GZ_MODEL_POSE}" | awk -F',' '{print $2}')
pose_z=$(echo "${PX4_GZ_MODEL_POSE}" | awk -F',' '{print $3}')
pose_roll=$(echo "${PX4_GZ_MODEL_POSE}" | awk -F',' '{print $4}')
pose_pitch=$(echo "${PX4_GZ_MODEL_POSE}" | awk -F',' '{print $5}')
pose_yaw=$(echo "${PX4_GZ_MODEL_POSE}" | awk -F',' '{print $6}')
pos_x=$(echo "${PX4_GZ_MODEL_POSE}" | awk -F',' '{print $1}')
pos_y=$(echo "${PX4_GZ_MODEL_POSE}" | awk -F',' '{print $2}')
pos_z=$(echo "${PX4_GZ_MODEL_POSE}" | awk -F',' '{print $3}')
pos_x=${pos_x:-0}
pos_y=${pos_y:-0}
pos_z=${pos_z:-0}
pose_x=${pose_x:-0}
pose_y=${pose_y:-0}
pose_z=${pose_z:-0}
pose_roll=${pose_roll:-0}
pose_pitch=${pose_pitch:-0}
pose_yaw=${pose_yaw:-0}
sdf_pose_str="<pose> ${pose_x} ${pose_y} ${pose_z} ${pose_roll} ${pose_pitch} ${pose_yaw} </pose>"
echo "INFO [init] Gazebo model pose: ${pose_x} ${pose_y} ${pose_z} ${pose_roll} ${pose_pitch} ${pose_yaw}"
POSE_ARG=", pose: { position: { x: ${pos_x}, y: ${pos_y}, z: ${pos_z} } }"
echo "INFO [init] Spawning model at position: ${pos_x} ${pos_y} ${pos_z}"
fi
echo "INFO [init] Spawning Gazebo model"
# include the actual SDF in this one, containing the pose if given
sdf_str="<sdf version=\"1.6\"> <include> <uri>file://${PX4_GZ_MODELS}/${MODEL_NAME}/model.sdf</uri> ${sdf_pose_str} </include> </sdf>"
echo "INFO [init] Spawning model"
# Spawn model
${gz_command} service -s "/world/${PX4_GZ_WORLD}/create" --reqtype gz.msgs.EntityFactory \
--reptype gz.msgs.Boolean --timeout 5000 \
--req "name: \"${MODEL_NAME_INSTANCE}\", allow_renaming: false, sdf: '${sdf_str}'" > /dev/null 2>&1
--req "sdf_filename: \"${PX4_GZ_MODELS}/${MODEL_NAME}/model.sdf\", name: \"${MODEL_NAME_INSTANCE}\", allow_renaming: false${POSE_ARG}" > /dev/null 2>&1
# Wait for model to spawn
sleep 1
@@ -26,6 +26,7 @@ param set-default NAV_ACC_RAD 0.5
# Differential Parameters
param set-default RD_WHEEL_TRACK 0.3
param set-default RD_MAX_THR_YAW_R 0.7
param set-default RD_TRANS_DRV_TRN 0.785398
param set-default RD_TRANS_TRN_DRV 0.139626
@@ -41,16 +42,14 @@ param set-default RO_YAW_RATE_P 0.1
param set-default RO_YAW_RATE_LIM 250
param set-default RO_YAW_ACCEL_LIM 600
param set-default RO_YAW_DECEL_LIM 600
param set-default RO_YAW_RATE_CORR 2.7
# Rover Attitude Control Parameters
param set-default RO_YAW_P 2.5
# Rover Velocity Control Parameters
# Rover Position Control Parameters
param set-default RO_SPEED_LIM 1.6
param set-default RO_SPEED_I 0.01
param set-default RO_SPEED_P 0.1
param set-default RO_SPEED_RED 1
# Pure Pursuit parameters
param set-default PP_LOOKAHD_GAIN 1
@@ -33,16 +33,14 @@ param set-default RO_MAX_THR_SPEED 2.8
param set-default RO_YAW_RATE_I 0.1
param set-default RO_YAW_RATE_P 0.1
param set-default RO_YAW_RATE_LIM 120
param set-default RO_YAW_RATE_CORR 1
# Rover Attitude Control Parameters
param set-default RO_YAW_P 2.5
# Rover Velocity Control Parameters
# Rover Position Control Parameters
param set-default RO_SPEED_LIM 2.5
param set-default RO_SPEED_I 0.01
param set-default RO_SPEED_P 0.1
param set-default RO_SPEED_RED 1
# Pure pursuit parameters
param set-default PP_LOOKAHD_GAIN 1
@@ -11,7 +11,7 @@
. ${R}etc/init.d/rc.sc_defaults
param set-default CA_AIRFRAME 14
param set-default MAV_TYPE 45
param set-default MAV_TYPE 99
param set-default CA_THRUSTER_CNT 8
param set-default CA_R_REV 0
-1
View File
@@ -14,7 +14,6 @@ control_allocator start
# Start attitude controller.
#
fw_rate_control start
fw_indi_pos_control start
fw_att_control start
fw_mode_manager start
fw_lat_lon_control start
+3 -3
View File
@@ -3,10 +3,10 @@
# NOTE: Script variables are declared/initialized/unset in the rcS script.
#
set VEHICLE_TYPE spacecraft
set VEHICLE_TYPE sc
# MAV_TYPE_SPACECRAFT_ORBITTER
param set-default MAV_TYPE 45
# MAV_TYPE_QUADROTOR 2
#param set-default MAV_TYPE 12
# Set micro-dds-client to use ethernet and IP-address 192.168.0.1
param set-default UXRCE_DDS_AG_IP -1062731775
@@ -68,15 +68,6 @@ then
. ${R}etc/init.d/rc.vtol_apps
fi
#
# Spapcecraft setup.
#
if [ $VEHICLE_TYPE = spacecraft ]
then
# Start standard multicopter apps.
. ${R}etc/init.d/rc.sc_apps
fi
#
# Airship setup.
#
-8
View File
@@ -280,14 +280,6 @@ else
#
send_event start
#
# Start the hardfault streamer.
#
if param compare -s SYS_HF_MAV 1
then
hardfault_stream start
fi
#
# Start the resource load monitor.
#
+2 -3
View File
@@ -35,7 +35,6 @@ if args.filter:
for board in args.filter.split(','):
board_filter.append(board)
default_container = 'ghcr.io/px4/px4-dev:v1.16.0-rc1-258-g0369abd556'
build_configs = []
grouped_targets = {}
excluded_boards = ['modalai_voxl2', 'px4_ros2'] # TODO: fix and enable
@@ -87,7 +86,7 @@ def process_target(px4board_file, target_name):
assert platform, f"PLATFORM not found in {px4board_file}"
if platform not in excluded_platforms:
container = default_container
container = 'ghcr.io/px4/px4-dev:v1.16.0-ondemand'
if platform == 'posix':
group = 'base'
if toolchain:
@@ -121,7 +120,7 @@ if(verbose):
# - Events
metadata_targets = ['airframe_metadata', 'parameters_metadata', 'extract_events']
grouped_targets['base'] = {}
grouped_targets['base']['container'] = default_container
grouped_targets['base']['container'] = 'ghcr.io/px4/px4-dev:v1.16.0-ondemand'
grouped_targets['base']['manufacturers'] = {}
grouped_targets['base']['manufacturers']['px4'] = []
grouped_targets['base']['manufacturers']['px4'] += metadata_targets
+68
View File
@@ -0,0 +1,68 @@
#!/usr/bin/env bash
#
# metadata_airframe.sh — generate and sync PX4 airframe reference documentation
#
# Usage:
# Tools/ci/metadata_airframe.sh [--test-only] [--debug]
#
# Options:
# --test-only Run make target and comparison; exit 1 if diffs found, without copying file
# --debug Show full make output and debug info for comparison
#
set -euo pipefail
shopt -s nullglob
# Parse flags
test_only=false
debug=false
while [[ $# -gt 0 ]]; do
case "$1" in
--test-only) test_only=true; shift ;;
--debug) debug=true; shift ;;
*) echo "Usage: $0 [--test-only] [--debug]"; exit 2 ;;
esac
done
# Paths and make target
make_target="airframe_metadata"
src_file="build/px4_sitl_default/docs/airframes.md"
dest_file="docs/en/airframes/airframe_reference.md"
# Run make target
if [ "$debug" = true ]; then
echo "🔧 Running 'make $make_target' (verbose)"
make $make_target
else
echo "🔧 Running 'make $make_target'"
make $make_target > /dev/null 2>&1
fi
# Verify build output
if [[ ! -f "$src_file" ]]; then
echo "❌ Generated file not found: $src_file"
exit 1
fi
echo "🔍 Comparing airframe reference docs"
# Compare files
if cmp -s "$src_file" "$dest_file"; then
echo "✅ Airframe reference is up to date."
exit 0
else
if [ "$debug" = true ]; then
echo "DEBUG: cmp -s '$src_file' '$dest_file'; echo \$?"
fi
echo "⚠️ Airframe reference needs updating."
if [ "$test_only" = true ]; then
exit 1
fi
# Copy over updated file
echo "📂 Copying updated airframe_reference.md"
cp -v "$src_file" "$dest_file"
echo "🚨 Airframe docs updated; commit the change:"
echo " git status -s $dest_file"
echo " git add $dest_file"
echo " git commit -m 'docs: update airframe reference metadata'"
exit 1
fi
+112
View File
@@ -0,0 +1,112 @@
#!/usr/bin/env bash
#
# metadata_failsafe_web.sh — build and sync failsafe webapp metadata files
#
# Usage:
# Tools/ci/metadata_failsafe_web.sh [--test-only] [--debug]
#
# Options:
# --test-only Run build and comparison; exit 1 if diffs found, without copying files
# --debug Show full build output and debug info for file comparisons and EMSDK install
#
set -euo pipefail
shopt -s nullglob
# Parse flags
test_only=false
debug=false
while [[ $# -gt 0 ]]; do
case "$1" in
--test-only) test_only=true; shift ;;
--debug) debug=true; shift ;;
*) echo "Usage: $0 [--test-only] [--debug]"; exit 2 ;;
esac
done
# Paths and commands
build_cmd="make failsafe_web"
src_dir="build/px4_sitl_default_failsafe_web"
dest_dir="docs/public/config/failsafe"
# Ensure Emscripten SDK is available
if ! command -v emcc >/dev/null 2>&1; then
echo "🔧 Emscripten not found. Ensuring EMSDK is installed."
# Clone SDK only if not already present
if [ ! -d "_emscripten_sdk" ]; then
if [ "$debug" = true ]; then
git clone https://github.com/emscripten-core/emsdk.git _emscripten_sdk
else
git clone https://github.com/emscripten-core/emsdk.git _emscripten_sdk > /dev/null 2>&1
fi
fi
pushd _emscripten_sdk >/dev/null
if [ "$debug" = true ]; then
./emsdk install latest
./emsdk activate latest
else
./emsdk install latest > /dev/null 2>&1
./emsdk activate latest > /dev/null 2>&1
fi
popd >/dev/null
# Load environment into current shell
if [ "$debug" = true ]; then
# shellcheck source=/dev/null
. ./_emscripten_sdk/emsdk_env.sh
else
# shellcheck source=/dev/null
. ./_emscripten_sdk/emsdk_env.sh > /dev/null 2>&1
fi
fi
# Build step
if [ "$debug" = true ]; then
echo "🔧 Running build: $build_cmd"
$build_cmd
else
echo "🔧 Running build"
$build_cmd > /dev/null 2>&1
fi
# Gather built files
src_files=("$src_dir"/*.{js,wasm,json})
if [ ${#src_files[@]} -eq 0 ]; then
echo "❌ No generated files found in $src_dir. Build failed or path wrong."
exit 1
fi
# Prepare destination
echo "🔍 Checking failsafe web metadata"
mkdir -p "$dest_dir"
changed=()
for src in "${src_files[@]}"; do
name=$(basename "$src")
dst="$dest_dir/$name"
if [[ ! -f "$dst" ]]; then
[ "$debug" = true ] && echo "DEBUG: missing $dst"
changed+=("$name")
elif ! cmp -s "$src" "$dst"; then
[ "$debug" = true ] && echo "DEBUG: cmp -s '$src' '$dst'; echo \$?"
changed+=("$name")
fi
done
if [ ${#changed[@]} -eq 0 ]; then
echo "✅ All failsafe web metadata files are in sync."
exit 0
fi
echo "⚠️ Detected updates in:"
for f in "${changed[@]}"; do echo " - $f"; done
if [ "$test_only" = true ]; then
echo "🚨 Failsafe web metadata needs update; rerun without --test-only to apply."
exit 1
fi
echo "📂 Copying updated files"
for f in "${changed[@]}"; do cp -v "$src_dir/$f" "$dest_dir/$f"; done
echo "🚨 Failsafe web metadata updated; please commit changes."
exit 1
+99
View File
@@ -0,0 +1,99 @@
#!/usr/bin/env bash
#
# metadata_modules.sh - generate and sync PX4 module reference documentation
#
# Usage:
# Tools/ci/metadata_modules.sh [--test-only] [--debug]
#
# Options:
# --test-only Run make target and comparison; exit 1 if diffs found, without copying files
# --debug Show full make output and debug info for file comparisons
#
set -euo pipefail
shopt -s nullglob
# Parse flags
test_only=false
debug=false
while [[ $# -gt 0 ]]; do
case "$1" in
--test-only) test_only=true; shift ;;
--debug) debug=true; shift ;;
*) echo "Usage: $0 [--test-only] [--debug]"; exit 2 ;;
esac
done
# Paths and make target
make_target="module_documentation"
src_dir="build/px4_sitl_default/docs/modules"
dest_dir="docs/en/modules"
# Run make target
if [ "$debug" = true ]; then
echo "🔧 Running 'make $make_target' (verbose)"
make $make_target
else
echo "🔧 Running 'make $make_target'"
make $make_target > /dev/null 2>&1
fi
# Verify build output
src_files=("$src_dir"/*)
if [ ${#src_files[@]} -eq 0 ]; then
echo "❌ No generated module docs found in $src_dir. Build failed or path wrong."
exit 1
fi
# ─── Strip trailing whitespace from all generated module docs (unless test-only) ─────────────
if [ "$test_only" = false ]; then
echo "✂️ Removing trailing whitespace from generated module docs"
for src in "${src_files[@]}"; do
sed -i 's/[[:space:]]\+$//' "$src"
done
else
[ "$debug" = true ] && echo "🧪 Test-only mode: skipping whitespace removal"
fi
echo "🔍 Checking module reference docs in $dest_dir"
mkdir -p "$dest_dir"
changed=()
for src in "${src_files[@]}"; do
name=$(basename "$src")
dst="$dest_dir/$name"
if [[ ! -e "$dst" ]]; then
[ "$debug" = true ] && echo "DEBUG: missing $dst"
changed+=("$name")
else
# Use diff -q -b (ignore whitespace changes) and --strip-trailing-cr (ignore CRLF vs LF)
if ! diff -q -b --strip-trailing-cr "$src" "$dst" > /dev/null; then
[ "$debug" = true ] && echo "DEBUG: diff -q -b --strip-trailing-cr '$src' '$dst' (exit_code=$?)"
changed+=("$name")
fi
fi
done
if [ ${#changed[@]} -eq 0 ]; then
echo "✅ All module reference docs are up to date."
exit 0
fi
echo "⚠️ Detected updates in module docs:"
for f in "${changed[@]}"; do echo " - $f"; done
if [ "$test_only" = true ]; then
echo "🚨 Module reference docs need updating; rerun without --test-only to apply."
exit 1
fi
echo "📂 Copying updated module docs to $dest_dir"
for f in "${changed[@]}"; do
cp -rv "$src_dir/$f" "$dest_dir/$f"
done
echo "🚨 Module reference docs updated; please commit changes:"
echo " git status -s $dest_dir"
echo " git add $dest_dir/*"
echo " git commit -m 'docs: update module reference metadata'"
exit 1
+97
View File
@@ -0,0 +1,97 @@
#!/usr/bin/env bash
#
# metadata_msg_docs.sh — generate and sync uORB message reference documentation
#
# Usage:
# Tools/ci/metadata_msg_docs.sh [--test-only] [--debug]
#
# Options:
# --test-only Run make target and comparison; exit 1 if diffs found, without copying files
# --debug Show full make output and debug info for file comparisons
#
set -euo pipefail
shopt -s nullglob
# Parse flags
test_only=false
debug=false
while [[ $# -gt 0 ]]; do
case "$1" in
--test-only) test_only=true; shift ;;
--debug) debug=true; shift ;;
*) echo "Usage: $0 [--test-only] [--debug]"; exit 2 ;;
esac
done
# Paths and make target
make_target="msg_docs"
src_dir="build/px4_sitl_default/msg_docs"
dest_dir="docs/en/msg_docs"
middleware_dir="docs/en/middleware"
# Run make target
if [ "$debug" = true ]; then
echo "🔧 Running 'make $make_target' (verbose)"
make $make_target
else
echo "🔧 Running 'make $make_target'"
make $make_target > /dev/null 2>&1
fi
# Verify build output
src_files=("$src_dir"/*)
if [ ${#src_files[@]} -eq 0 ]; then
echo "❌ No files found in $src_dir. Build target '$make_target' failed or path is wrong."
exit 1
fi
echo "🔍 Checking uORB message docs in $dest_dir"
mkdir -p "$dest_dir"
changed=()
for src in "${src_files[@]}"; do
name=$(basename "$src")
# special-case dds_topics.md
if [[ "$name" == "dds_topics.md" ]]; then
dst="$middleware_dir/$name"
else
dst="$dest_dir/$name"
fi
if [[ ! -f "$dst" ]]; then
[ "$debug" = true ] && echo "DEBUG: missing $dst"
changed+=("$name")
elif ! cmp -s "$src" "$dst"; then
[ "$debug" = true ] && echo "DEBUG: cmp -s '$src' '$dst'; echo \$?"
changed+=("$name")
fi
done
if [ ${#changed[@]} -eq 0 ]; then
echo "✅ All uORB message docs are up to date."
exit 0
fi
echo "⚠️ Detected updates in the following docs:"
for f in "${changed[@]}"; do echo " - $f"; done
if [ "$test_only" = true ]; then
echo "🚨 uORB message docs need updating! Rerun without --test-only to apply changes."
exit 1
fi
echo "📂 Copying updated doc files to $dest_dir"
for f in "${changed[@]}"; do
if [[ "$f" == "dds_topics.md" ]]; then
cp -v "$src_dir/$f" "$middleware_dir/$f"
else
cp -v "$src_dir/$f" "$dest_dir/$f"
fi
done
echo "🚨 uORB message docs updated; please commit changes:"
echo " git status -s $dest_dir"
echo " git add $dest_dir/*"
echo " git commit -m 'docs: update uORB message reference docs'"
exit 1
+71
View File
@@ -0,0 +1,71 @@
#!/usr/bin/env bash
#
# metadata_parameters.sh — generate and sync PX4 parameter reference documentation
#
# Usage:
# Tools/ci/metadata_parameters.sh [--test-only] [--debug]
#
# Options:
# --test-only Run make target and comparison; exit 1 if diffs found, without copying file
# --debug Show full make output and debug info for comparison
#
set -euo pipefail
# Parse flags
test_only=false
debug=false
while [[ $# -gt 0 ]]; do
case "$1" in
--test-only) test_only=true; shift ;;
--debug) debug=true; shift ;;
*) echo "Usage: $0 [--test-only] [--debug]"; exit 2 ;;
esac
done
# Paths and make target
make_target="parameters_metadata"
src_file="build/px4_sitl_default/docs/parameters.md"
dest_file="docs/en/advanced_config/parameter_reference.md"
# Run make target
if [ "$debug" = true ]; then
echo "🔧 Running 'make $make_target' (verbose)"
make $make_target
else
echo "🔧 Running 'make $make_target'"
make $make_target > /dev/null 2>&1
fi
# ─── Strip trailing whitespace from the newly generated Markdown ────────────────────────────────
echo "✂️ Removing trailing whitespace from $src_file"
sed -i 's/[[:space:]]\+$//' "$src_file"
# Verify build output
if [[ ! -f "$src_file" ]]; then
echo "❌ Generated file not found: $src_file"
exit 1
fi
echo "🔍 Comparing parameter docs"
# Compare files
if cmp -s "$src_file" "$dest_file"; then
echo "✅ Parameter reference is up to date."
exit 0
else
if [ "$debug" = true ]; then
echo "DEBUG: cmp -s '$src_file' '$dest_file'; echo \$?"
fi
echo "⚠️ Parameter reference needs updating."
if [ "$test_only" = true ]; then
exit 1
fi
# Copy over updated file
echo "📂 Copying updated parameter_reference.md"
cp -v "$src_file" "$dest_file"
echo "🚨 Parameter docs updated; commit the change:"
echo " git status -s $dest_file"
echo " git add $dest_file"
echo " git commit -m 'docs: update parameter reference metadata'"
exit 1
fi
+108
View File
@@ -0,0 +1,108 @@
#!/usr/bin/env bash
#
# update_uorb_graphs.sh — generate, compare, and sync uORB graph JSONs
#
# Usage:
# ./scripts/update_uorb_graphs.sh [--test-only] [--debug]
#
# Options:
# --test-only Run generation and comparison only; exit 1 if diffs found, without copying files
# --debug Echo debug info for missing or differing files and show full make output
#
# Examples:
# # CI mode: fail if docs need updates
# ./scripts/update_uorb_graphs.sh --test-only
#
# # Developer mode: regenerate and sync JSONs
# ./scripts/update_uorb_graphs.sh
#
set -euo pipefail
shopt -s nullglob
# Parse flags
test_only=false
debug=false
while [[ $# -gt 0 ]]; do
case "$1" in
--test-only)
test_only=true
shift
;;
--debug)
debug=true
shift
;;
*)
echo "Usage: $0 [--test-only] [--debug]"
exit 2
;;
esac
done
# Paths
graph_dir="Tools/uorb_graph"
dest_dir="docs/public/middleware"
# Generate uORB graphs (conditionally silent)
if [ "$debug" = true ]; then
echo "🔧 Generating uORB message graphs (verbose output)"
make uorb_graphs
else
echo "🔧 Generating uORB message graphs"
make uorb_graphs > /dev/null 2>&1
fi
# Verify generation
src_files=("$graph_dir"/*.json)
if [ ${#src_files[@]} -eq 0 ]; then
echo "❌ No JSON files found in $graph_dir. Generation failed or path is wrong."
exit 1
fi
echo "🔍 Checking for updated uORB graph JSONs"
mkdir -p "$dest_dir"
changed=()
for src in "${src_files[@]}"; do
name=$(basename "$src")
dst="$dest_dir/$name"
if [[ ! -f "$dst" ]]; then
[ "$debug" = true ] && echo "DEBUG: $dst missing"
changed+=("$name")
elif ! cmp -s "$src" "$dst"; then
[ "$debug" = true ] && echo "DEBUG: cmp -s '$src' '$dst'; echo \$?"
changed+=("$name")
fi
done
if [ ${#changed[@]} -eq 0 ]; then
echo "✅ All uORB graph JSONs are already in sync."
exit 0
fi
echo "⚠️ Detected updates in the following files:"
for name in "${changed[@]}"; do
echo " - $name"
done
if [ "$test_only" = true ]; then
echo
echo "🚨 uORB graph docs need updating! Rerun without --test-only to apply changes."
exit 1
fi
echo
echo "📂 Copying updated files over"
for name in "${changed[@]}"; do
cp -v "$graph_dir/$name" "$dest_dir/$name"
done
echo
echo "🚨 uORB graph docs need updating! Review above, then run:"
echo " git status -s $dest_dir/"
echo " git add $dest_dir/*.json"
echo " git commit -m 'docs: metadata: update uORB graph JSONs'"
exit 1
+1 -1
View File
@@ -15,7 +15,7 @@ fi
# otherwise default to nuttx
if [ -z ${PX4_DOCKER_REPO+x} ]; then
PX4_DOCKER_REPO="px4io/px4-dev:v1.16.0-rc1-258-g0369abd556"
PX4_DOCKER_REPO="px4io/px4-dev:v1.16.0-ondemand"
fi
echo "PX4_DOCKER_REPO: $PX4_DOCKER_REPO";
+22 -10
View File
@@ -12,14 +12,25 @@ import sys
import yaml
def generate_dds_yaml_doc(allMessageFiles, output_file = 'dds_topics.md'):
def sort_dds_topics(topics):
return sorted(
topics,
key=lambda pub: pub["type"].rsplit("::", 1)[-1]
)
def generate_dds_yaml_doc(allMessageFiles, output_dir):
"""
Generates human readable version of dds_topics.yaml.
Default output is to docs/en/middleware/dds_topics.md
"""
output_file = 'dds_topics.md'
dds_markdown = ""
if not os.path.isdir(output_dir):
print("Output directory not found")
sys.exit(1)
dds_file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),"../../src/modules/uxrce_dds_client/dds_topics.yaml")
output_file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),f"../../docs/en/middleware/{output_file}")
output_file_path = os.path.join(output_dir, output_file)
try:
with open(dds_file_path, 'r') as file:
@@ -43,7 +54,7 @@ def generate_dds_yaml_doc(allMessageFiles, output_file = 'dds_topics.md'):
all_topics.add(message['topic'].split('/')[-1])
for message in allMessageFiles:
all_messages_in_source.add(message.split('/')[-1].split('.')[0])
messagesNotExported = all_messages_in_source - all_message_types
messagesNotExported = sorted(all_messages_in_source - all_message_types)
# write out the dds file
dds_markdown="""# dds_topics.yaml — PX4 Topics Exposed to ROS 2
@@ -63,14 +74,14 @@ Topic | Type| Rate Limit
--- | --- | ---
"""
for message in data["publications"]:
for message in sort_dds_topics(data["publications"]):
type = message['type']
px4Type=type.split("::")[-1]
dds_markdown += f"`{message['topic']}` | [{type}](../msg_docs/{px4Type}.md) | {message.get('rate_limit','')}\n"
dds_markdown += "\n## Subscriptions\n\nTopic | Type\n--- | ---\n"
for message in data["subscriptions"]:
for message in sort_dds_topics(data["subscriptions"]):
type = message['type']
px4Type=type.split("::")[-1]
dds_markdown += f"{message['topic']} | [{type}](../msg_docs/{px4Type}.md)\n"
@@ -82,18 +93,17 @@ Topic | Type| Rate Limit
else:
print("Warning - we now have subscription_multi data - check format")
dds_markdown += "Topic | Type\n--- | ---\n"
for message in data["subscriptions_multi"]:
for message in sort_dds_topics(data["subscriptions_multi"]):
dds_markdown += f"{message['topic']} | {message['type']}\n"
if messagesNotExported:
# Print the topics that are not exported to DDS
dds_markdown += "\n## Not Exported\n\nThese messages are not listed in the yaml file.\nThey are not build into the module, and hence are neither published or subscribed."
dds_markdown += "\n\n::: details See messages\n"
for item in messagesNotExported:
for item in sorted(messagesNotExported):
dds_markdown += f"\n- [{item}](../msg_docs/{item}.md)"
dds_markdown += "\n:::\n" # End of details block
#print(dds_markdown)
with open(output_file_path, 'w') as content_file:
content_file.write(dds_markdown)
@@ -127,6 +137,7 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Generate docs from .msg files')
parser.add_argument('-d', dest='dir', help='output directory', required=True)
parser.add_argument('--dds_topics', dest='dds_topics', help='Generate dds yaml doc', action='store_true')
args = parser.parse_args()
output_dir = args.dir
@@ -137,6 +148,9 @@ if __name__ == "__main__":
msg_files = get_msgs_list(msg_path)
msg_files.sort()
if args.dds_topics:
generate_dds_yaml_doc(msg_files, output_dir)
versioned_msgs_list = ''
unversioned_msgs_list = ''
@@ -227,5 +241,3 @@ Graphs showing how these are used [can be found here](../middleware/uorb_graph.m
index_file = os.path.join(output_dir, 'index.md')
with open(index_file, 'w') as content_file:
content_file.write(index_text)
generate_dds_yaml_doc(msg_files)
-1
View File
@@ -27,4 +27,3 @@ six>=1.12.0
toml>=0.9
sympy>=1.10.1
pycryptodome
lark
+21 -10
View File
@@ -59,7 +59,7 @@ def get_N_colors(N, s=0.8, v=0.9):
def topic_filename(topic):
MSG_PATH = 'msg/'
file_list = os.listdir(MSG_PATH)
file_list = sorted(os.listdir(MSG_PATH))
msg_files = [file.replace('.msg', '') for file in file_list if file.endswith(".msg")]
if topic in msg_files:
@@ -369,12 +369,14 @@ class Graph(object):
if not scope.is_empty():
scopes_with_topic[name] = scope
# scopes_with_topic = sorted(scopes_with_topic)
self._print_ambiguities = ambiguous_topics
if use_topic_pubsub_union:
self._print_topics = subscribed_topics | published_topics
self._print_topics = sorted(subscribed_topics | published_topics)
self._print_scopes = scopes_with_topic
else:
self._print_topics = subscribed_topics & published_topics
self._print_topics = sorted(subscribed_topics & published_topics)
# cull scopes to only those that pub or sub to a topic that has both
intersect_scopes = {}
@@ -392,7 +394,7 @@ class Graph(object):
log.debug('ignoring excluded path '+path)
return
entries = os.listdir(path)
entries = sorted(os.listdir(path))
# check if entering a new scope
cmake_file = 'CMakeLists.txt'
@@ -685,8 +687,8 @@ class OutputJSON(object):
# edges
for name,scope in output_scopes.items():
for topic in scope.publications:
for name,scope in sorted(output_scopes.items(), key=lambda kv: kv[0]):
for topic in sorted(scope.publications):
if topic in output_topics:
edge = {}
edge['source'] = 'm_'+name
@@ -695,8 +697,8 @@ class OutputJSON(object):
edge['style'] = 'dashed'
edges.append(edge)
for name,scope in output_scopes.items():
for topic in scope.subscriptions:
for name,scope in sorted(output_scopes.items(), key=lambda kv: kv[0]):
for topic in sorted(scope.subscriptions):
if topic in output_topics:
edge = {}
edge['source'] = 't_'+topic
@@ -723,10 +725,16 @@ if "__main__" == __name__:
log.setLevel(logging.DEBUG)
print("set log level to DEBUG")
print('')
print('== Starting uorb_graph/create.py ==')
if args.file:
print(' =Filename:', os.path.basename(args.file))
# ignore topics that are subscribed/published by many topics, but are not really
# useful to show in the graph
topic_blacklist = [ 'parameter_update', 'mavlink_log', 'log_message' ]
print('Excluded topics: '+str(topic_blacklist))
print(' =Excluded Topics: '+str(topic_blacklist))
if len(args.modules) == 0:
scope_whitelist = []
@@ -757,7 +765,7 @@ if "__main__" == __name__:
if 0 < len(args.exclude_path):
path_blacklist = args.exclude_path
if path_blacklist:
print('Excluded Path: '+str(path_blacklist))
print(' =Excluded Path: '+str(path_blacklist))
graph.build(source_paths, path_blacklist=path_blacklist, use_topic_pubsub_union=args.use_topic_union, merge_depends=args.merge_depends)
@@ -784,3 +792,6 @@ if "__main__" == __name__:
pass
else:
print('Error: unknown output format '+args.output)
print("== Completed uorb_graph/create.py ==")
print("")
@@ -132,7 +132,6 @@ ENTRY(_stext)
*/
EXTERN(abort)
EXTERN(_bootdelay_signature)
EXTERN(board_get_manifest)
SECTIONS
{
@@ -48,7 +48,6 @@ else()
i2c.cpp
init.c
led.c
mtd.cpp
spi.cpp
timer_config.cpp
usb.c
@@ -1,76 +0,0 @@
/****************************************************************************
*
* Copyright (C) 2025 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#include <nuttx/spi/spi.h>
#include <px4_platform_common/px4_manifest.h>
// KiB BS nB
static const px4_mft_device_t spi2 = { // FM25V01A on FMUM native: 32K X 8, emulated as (1024 Blocks of 32)
.bus_type = px4_mft_device_t::SPI,
.devid = SPIDEV_FLASH(0)
};
static const px4_mtd_entry_t fmum_fram = {
.device = &spi2,
.npart = 1,
.partd = {
{
.type = MTD_PARAMETERS,
.path = "/fs/mtd_params",
.nblocks = (32768 / (1 << CONFIG_RAMTRON_EMULATE_PAGE_SHIFT))
},
},
};
static const px4_mtd_manifest_t board_mtd_config = {
.nconfigs = 1,
.entries = {
&fmum_fram
}
};
static const px4_mft_entry_s mtd_mft = {
.type = MTD,
.pmft = (void *) &board_mtd_config,
};
static const px4_mft_s mft = {
.nmft = 1,
.mfts = {
&mtd_mft
}
};
const px4_mft_s *board_get_manifest(void)
{
return &mft;
}
-1
View File
@@ -62,7 +62,6 @@ CONFIG_MODULES_FW_RATE_CONTROL=y
CONFIG_MODULES_GIMBAL=y
CONFIG_MODULES_GYRO_CALIBRATION=y
CONFIG_MODULES_GYRO_FFT=y
CONFIG_MODULES_HARDFAULT_STREAM=y
CONFIG_MODULES_LAND_DETECTOR=y
CONFIG_MODULES_LANDING_TARGET_ESTIMATOR=y
CONFIG_MODULES_LOAD_MON=y
@@ -34,25 +34,75 @@
#pragma once
// DMAMUX1 Using at most 8 Channels on DMA1 -------- Assigned
#define DMAMAP_SPI1_RX DMAMAP_DMA12_SPI1RX_0 // 1 DMA1:37 IIM-42653
#define DMAMAP_SPI1_TX DMAMAP_DMA12_SPI1TX_0 // 2 DMA1:38 IIM-42653
#define DMAMAP_USART1_RX DMAMAP_DMA12_USART1RX_0 // 3 DMA1:41 GPS1
#define DMAMAP_USART1_TX DMAMAP_DMA12_USART1TX_0 // 4 DMA1:42 GPS1
#define DMAMAP_USART6_RX DMAMAP_DMA12_USART6RX_0 // 5 DMA1:71 RC
#define DMAMAP_USART6_TX DMAMAP_DMA12_USART6TX_0 // 6 DMA1:72 RC
// Timer 4 (DMAMAP_DMA12_TIM4UP_0) // 7 DMA1:32 TIM4UP/TIM4CH1-4
// Timer 5 (DMAMAP_DMA12_TIM5UP_0) // 8 DMA1:50 TIM5UP/TIM5CH1-4
// V
// Timer 4 Channel 1 /* DMA1:29 TIM4CH1 */
#define DMAMAP_SPI1_RX DMAMAP_DMA12_SPI1RX_0 /* 1 DMA1:37 IIM-42653 */
#define DMAMAP_SPI1_TX DMAMAP_DMA12_SPI1TX_0 /* 2 DMA1:38 IIM-42653 */
//#define DMAMAP_SPI2_RX DMAMAP_DMA12_SPI2RX_0 /* 3 DMA1:39 ICM-42688-P */
//#define DMAMAP_SPI2_TX DMAMAP_DMA12_SPI2TX_0 /* 4 DMA1:40 ICM-42688-P */
#define DMAMAP_USART1_RX DMAMAP_DMA12_USART1RX_0 /* DMA1:41 GPS1 */
#define DMAMAP_USART1_TX DMAMAP_DMA12_USART1TX_0 /* DMA1:42 GPS1 */
//#define DMAMAP_USART3_RX DMAMAP_DMA12_USART3RX_0 /* DMA1:45 DEBUG */
//#define DMAMAP_USART3_TX DMAMAP_DMA12_USART3TX_0 /* DMA1:46 DEBUG */
// Timer 8 Channel 1 /* DMA1:47 TIM8CH1 */
// Timer 8 Channel 2 /* DMA1:48 TIM8CH2 */
// Timer 8 Channel 3 /* DMA1:49 TIM8CH3 */
// Timer 8 Channel 4 /* DMA1:50 TIM8CH4 */
// Timer 5 Channel 1 /* DMA1:55 TIM5CH1 */
// Timer 5 Channel 2 /* DMA1:56 TIM5CH2 */
// Timer 5 Channel 3 /* DMA1:57 TIM5CH3 */
// Timer 5 Channel 4 /* DMA1:58 TIM5CH4 */
// #define DMAMAP_UART4_RX DMAMAP_DMA12_UART4RX_0 /* DMA1:63 UART4 */
// #define DMAMAP_UART4_TX DMAMAP_DMA12_UART4TX_0 /* DMA1:64 UART4 */
#define DMAMAP_USART6_RX DMAMAP_DMA12_USART6RX_0 /* 5 DMA1:71 RC */
// #define DMAMAP_USART6_TX DMAMAP_DMA12_USART6TX_0 /* 6 DMA1:72 RC */
// Assigned in timer_config.cpp
// Timer 4 /* 7 DMA1:32 TIM4UP */
// Timer 5 /* 8 DMA1:50 TIM5UP */
// DMAMUX2 Using at most 8 Channels on DMA2 -------- Assigned
#define DMAMAP_USART2_RX DMAMAP_DMA12_USART2RX_1 // 1 DMA2:43 VTX
#define DMAMAP_UART5_RX DMAMAP_DMA12_UART5RX_1 // 2 DMA2:65 VTX
#define DMAMAP_UART5_TX DMAMAP_DMA12_UART5TX_1 // 3 DMA2:66 VTX
#define DMAMAP_UART7_RX DMAMAP_DMA12_UART7RX_1 // 4 DMA2:79 TELEM1
#define DMAMAP_UART7_TX DMAMAP_DMA12_UART7TX_1 // 5 DMA2:80 TELEM1
#define DMAMAP_USART3_RX DMAMAP_DMA12_USART3RX_1 // 6 DMA2:45 DEBUG
#define DMAMAP_USART3_TX DMAMAP_DMA12_USART3TX_1 // 7 DMA2:46 DEBUG
// available
// V
// Timer 4 Channel 1 /* DMA2:29 TIM4CH1 */
#define DMAMAP_USART2_RX DMAMAP_DMA12_USART2RX_1 /* 3 DMA2:43 TELEM3 */
#define DMAMAP_USART2_TX DMAMAP_DMA12_USART2TX_1 /* 4 DMA2:44 TELEM3 */
#define DMAMAP_USART3_RX DMAMAP_DMA12_USART3RX_1 /* 3 DMA2:45 DEBUG */
#define DMAMAP_USART3_TX DMAMAP_DMA12_USART3TX_1 /* 4 DMA2:46 DEBUG */
// Timer 8 Channel 1 /* DMA2:47 TIM8CH1 */
// Timer 8 Channel 2 /* DMA2:48 TIM8CH2 */
// Timer 8 Channel 3 /* DMA2:49 TIM8CH3 */
// Timer 8 Channel 4 /* DMA2:50 TIM8CH4 */
// Timer 5 Channel 1 /* DMA2:55 TIM5CH1 */
// Timer 5 Channel 2 /* DMA2:56 TIM5CH2 */
// Timer 5 Channel 3 /* DMA2:57 TIM5CH3 */
// Timer 5 Channel 4 /* DMA2:58 TIM5CH4 */
//#define DMAMAP_SPI3_RX DMAMAP_DMA12_SPI3RX_1 /* 1 DMA2:61 BMI088 */
//#define DMAMAP_SPI3_TX DMAMAP_DMA12_SPI3TX_1 /* 2 DMA2:62 BMI088 */
#define DMAMAP_UART5_RX DMAMAP_DMA12_UART5RX_1 /* 5 DMA2:65 TELEM2 */
#define DMAMAP_UART5_TX DMAMAP_DMA12_UART5TX_1 /* 6 DMA2:66 TELEM2 */
#define DMAMAP_UART7_RX DMAMAP_DMA12_UART7RX_1 /* 7 DMA1:79 TELEM1 */
#define DMAMAP_UART7_TX DMAMAP_DMA12_UART7TX_1 /* 8 DMA1:80 TELEM1 */
// DMAMUX2 Using at most 8 Channels on BDMA -------- Assigned
#define DMAMAP_SPI6_RX DMAMAP_BDMA_SPI6_RX // 1 BDMA:11 SPI J11
#define DMAMAP_SPI6_TX DMAMAP_BDMA_SPI6_TX // 2 BDMA:12 SPI J11
// V
#define DMAMAP_SPI6_RX DMAMAP_BDMA_SPI6_RX /* 1 BDMA:11 SPI J11 */
#define DMAMAP_SPI6_TX DMAMAP_BDMA_SPI6_TX /* 2 BDMA:12 SPI J11 */
+2 -1
View File
@@ -260,6 +260,8 @@ CONFIG_USART1_TXDMA=y
CONFIG_USART2_BAUD=57600
CONFIG_USART2_RXBUFSIZE=600
CONFIG_USART2_RXDMA=y
CONFIG_USART2_TXBUFSIZE=1500
CONFIG_USART2_TXDMA=y
CONFIG_USART3_BAUD=57600
CONFIG_USART3_RXBUFSIZE=180
CONFIG_USART3_RXDMA=y
@@ -270,7 +272,6 @@ CONFIG_USART6_BAUD=57600
CONFIG_USART6_RXBUFSIZE=600
CONFIG_USART6_RXDMA=y
CONFIG_USART6_TXBUFSIZE=1500
CONFIG_USART6_TXDMA=y
CONFIG_USBDEV=y
CONFIG_USBDEV_BUSPOWERED=y
CONFIG_USBDEV_MAXPOWER=500
-1
View File
@@ -43,7 +43,6 @@ CONFIG_FIGURE_OF_EIGHT=y
CONFIG_MODULES_FW_RATE_CONTROL=y
CONFIG_MODULES_GIMBAL=y
CONFIG_MODULES_GYRO_CALIBRATION=y
CONFIG_MODULES_HARDFAULT_STREAM=y
CONFIG_MODULES_LAND_DETECTOR=y
CONFIG_MODULES_LANDING_TARGET_ESTIMATOR=y
CONFIG_MODULES_LOAD_MON=y
+1 -2
View File
@@ -20,7 +20,6 @@ CONFIG_DRIVERS_GPS=y
CONFIG_DRIVERS_IMU_BOSCH_BMI088=y
CONFIG_DRIVERS_IMU_INVENSENSE_ICM20948=y
CONFIG_DRIVERS_IMU_INVENSENSE_IIM42652=y
CONFIG_DRIVERS_IMU_INVENSENSE_IIM42653=y
CONFIG_COMMON_INS=y
CONFIG_COMMON_LIGHT=y
CONFIG_COMMON_MAGNETOMETER=y
@@ -43,8 +42,8 @@ CONFIG_MODULES_EVENTS=y
CONFIG_MODULES_FLIGHT_MODE_MANAGER=y
CONFIG_MODULES_FW_ATT_CONTROL=y
CONFIG_MODULES_FW_AUTOTUNE_ATTITUDE_CONTROL=y
CONFIG_MODULES_FW_LATERAL_LONGITUDINAL_CONTROL=y
CONFIG_MODULES_FW_MODE_MANAGER=y
CONFIG_MODULES_FW_LATERAL_LONGITUDINAL_CONTROL=y
CONFIG_MODULES_FW_RATE_CONTROL=y
CONFIG_MODULES_GIMBAL=y
CONFIG_MODULES_GYRO_CALIBRATION=y
+2 -9
View File
@@ -12,17 +12,10 @@ else
fi
iim42652 -s -R 22 start
bmi088 -A -R 29 -s start
if ! bmi088 -G -R 29 -s start
then
iim42653 -s -b 2 -R 22 start
fi
bmi088 -G -R 29 -s start
if ! ist8310 -I -R 18 start
then
iis2mdc -I -R 37 start
fi
ist8310 -I -R 18 start
bmp581 -s start
icp201xx -I start
-1
View File
@@ -42,7 +42,6 @@ constexpr px4_spi_bus_t px4_spi_buses[SPI_BUS_MAX_BUS_ITEMS] = {
initSPIBus(SPI::Bus::SPI2, {
initSPIDevice(DRV_GYR_DEVTYPE_BMI088, SPI::CS{GPIO::PortG, GPIO::Pin2}, SPI::DRDY{GPIO::PortG, GPIO::Pin3}),
initSPIDevice(DRV_ACC_DEVTYPE_BMI088, SPI::CS{GPIO::PortH, GPIO::Pin5}, SPI::DRDY{GPIO::PortA, GPIO::Pin10}),
initSPIDevice(DRV_IMU_DEVTYPE_IIM42653, SPI::CS{GPIO::PortD, GPIO::Pin12}, SPI::DRDY{GPIO::PortA, GPIO::Pin10}),
}, {GPIO::PortI, GPIO::Pin11}),
// initSPIBus(SPI::Bus::SPI3,{
// // no devices
@@ -5,7 +5,6 @@ CONFIG_BOARD_SERIAL_GPS2="/dev/ttyS1"
CONFIG_BOARD_SERIAL_TEL1="/dev/ttyS2"
CONFIG_BOARD_SERIAL_TEL2="/dev/ttyS3"
CONFIG_BOARD_SERIAL_TEL3="/dev/ttyS5"
CONFIG_BOARD_SERIAL_RC="/dev/ttyS4"
CONFIG_DRIVERS_ADC_BOARD_ADC=y
CONFIG_DRIVERS_BAROMETER_BMP280=y
CONFIG_DRIVERS_BAROMETER_GOERTEK_SPA06=y
+1 -1
View File
@@ -74,7 +74,7 @@
#define BOARD_TYPE 1105
#define BOARD_FLASH_SECTORS (14)
#define BOARD_FLASH_SIZE (16 * 128 * 1024)
#define APP_RESERVATION_SIZE (2 * 128 * 1024)
#define APP_RESERVATION_SIZE (1 * 128 * 1024)
#define OSC_FREQ 16
-1
View File
@@ -64,7 +64,6 @@ CONFIG_MODULES_FW_LATERAL_LONGITUDINAL_CONTROL=y
CONFIG_MODULES_FW_RATE_CONTROL=y
CONFIG_MODULES_GIMBAL=y
CONFIG_MODULES_GYRO_CALIBRATION=y
CONFIG_MODULES_HARDFAULT_STREAM=y
CONFIG_MODULES_LAND_DETECTOR=y
CONFIG_MODULES_LANDING_TARGET_ESTIMATOR=y
CONFIG_MODULES_LOAD_MON=y
-1
View File
@@ -62,7 +62,6 @@ CONFIG_MODULES_FW_LATERAL_LONGITUDINAL_CONTROL=y
CONFIG_MODULES_FW_RATE_CONTROL=y
CONFIG_MODULES_GIMBAL=y
CONFIG_MODULES_GYRO_CALIBRATION=y
CONFIG_MODULES_HARDFAULT_STREAM=y
CONFIG_MODULES_LAND_DETECTOR=y
CONFIG_MODULES_LANDING_TARGET_ESTIMATOR=y
CONFIG_MODULES_LOAD_MON=y
-1
View File
@@ -63,7 +63,6 @@ CONFIG_MODULES_FW_RATE_CONTROL=y
CONFIG_MODULES_GIMBAL=y
CONFIG_MODULES_GYRO_CALIBRATION=y
CONFIG_MODULES_GYRO_FFT=y
CONFIG_MODULES_HARDFAULT_STREAM=y
CONFIG_MODULES_LAND_DETECTOR=y
CONFIG_MODULES_LANDING_TARGET_ESTIMATOR=y
CONFIG_MODULES_LOAD_MON=y
-1
View File
@@ -23,7 +23,6 @@ CONFIG_MODULES_FW_MODE_MANAGER=y
CONFIG_MODULES_FW_LATERAL_LONGITUDINAL_CONTROL=y
CONFIG_FIGURE_OF_EIGHT=y
CONFIG_MODULES_FW_RATE_CONTROL=y
CONFIG_MODULES_FW_INDI_POS_CONTROL=y
CONFIG_MODULES_GIMBAL=y
CONFIG_MODULES_GYRO_CALIBRATION=y
CONFIG_MODULES_GYRO_FFT=y
+8
View File
@@ -116,10 +116,18 @@ add_custom_target(metadata_extract_events
USES_TERMINAL
)
add_custom_target(metadata_msg_documentation
COMMAND ${CMAKE_COMMAND} -E make_directory ${PX4_BINARY_DIR}/msg_docs
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/generate_msg_docs.py --dds_topics -d ${PX4_BINARY_DIR}/msg_docs
COMMENT "Generating uORB message documentation"
USES_TERMINAL
)
add_custom_target(all_metadata
DEPENDS
metadata_airframes
metadata_parameters
metadata_module_documentation
metadata_extract_events
metadata_msg_documentation
)
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 KiB

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 104 KiB

Before

Width:  |  Height:  |  Size: 474 KiB

After

Width:  |  Height:  |  Size: 474 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 MiB

+11 -12
View File
@@ -408,17 +408,16 @@
- [Helicopter (experimental)](frames_helicopter/index.md)
- [Helicopter Config/Tuning](config_heli/index.md)
- [Rovers (experimental)](frames_rover/index.md)
- [Drive Modes](flight_modes_rover/index.md)
- [Manual](flight_modes_rover/manual.md)
- [Auto](flight_modes_rover/auto.md)
- [Configuration/Tuning](config_rover/index.md)
- [Basic Setup](config_rover/basic_setup.md)
- [Rate Tuning](config_rover/rate_tuning.md)
- [Attitude Tuning](config_rover/attitude_tuning.md)
- [Velocity Tuning](config_rover/velocity_tuning.md)
- [Position Tuning](config_rover/position_tuning.md)
- [Complete Vehicles](complete_vehicles_rover/index.md)
- [Aion Robotics R1](complete_vehicles_rover/aion_r1.md)
- [Ackermann Rovers](frames_rover/ackermann.md)
- [Drive Modes](flight_modes_rover/ackermann.md)
- [Configuration/Tuning](config_rover/ackermann.md)
- [Differential Rovers](frames_rover/differential.md)
- [Drive Modes](flight_modes_rover/differential.md)
- [Configuration/Tuning](config_rover/differential.md)
- [Aion Robotics R1](frames_rover/aion_r1.md)
- [Mecanum Rovers](frames_rover/mecanum.md)
- [Drive Modes](flight_modes_rover/mecanum.md)
- [Configuration/Tuning](config_rover/mecanum.md)
- [(Deprecated) Rover Position Control](frames_rover/rover_position_control.md)
- [Submarines (experimental)](frames_sub/index.md)
- [BlueROV2](frames_sub/bluerov2.md)
@@ -731,7 +730,7 @@
- [Protocols/Microservices](mavlink/protocols.md)
- [Standard Modes Protocol](mavlink/standard_modes.md)
- [uXRCE-DDS (PX4-ROS 2/DDS Bridge)](middleware/uxrce_dds.md)
- [UORB Bridged to ROS 2](middleware/dds_topics.md)
- [DDS Topic List](middleware/dds_topics.md)
- [Modules & Commands](modules/modules_main.md)
- [Autotune](modules/modules_autotune.md)
- [Commands](modules/modules_command.md)
+8 -18
View File
@@ -490,17 +490,12 @@
- [Versioned](/msg_docs/versioned_messages.md)
- [ActuatorMotors](/msg_docs/ActuatorMotors.md)
- [ActuatorServos](/msg_docs/ActuatorServos.md)
- [AirspeedValidated](/msg_docs/AirspeedValidated.md)
- [ArmingCheckReply](/msg_docs/ArmingCheckReply.md)
- [ArmingCheckRequest](/msg_docs/ArmingCheckRequest.md)
- [BatteryStatus](/msg_docs/BatteryStatus.md)
- [ConfigOverrides](/msg_docs/ConfigOverrides.md)
- [FixedWingLateralSetpoint](/msg_docs/FixedWingLateralSetpoint.md)
- [FixedWingLongitudinalSetpoint](/msg_docs/FixedWingLongitudinalSetpoint.md)
- [GotoSetpoint](/msg_docs/GotoSetpoint.md)
- [HomePosition](/msg_docs/HomePosition.md)
- [LateralControlConfiguration](/msg_docs/LateralControlConfiguration.md)
- [LongitudinalControlConfiguration](/msg_docs/LongitudinalControlConfiguration.md)
- [ManualControlSetpoint](/msg_docs/ManualControlSetpoint.md)
- [ModeCompleted](/msg_docs/ModeCompleted.md)
- [RegisterExtComponentReply](/msg_docs/RegisterExtComponentReply.md)
@@ -529,8 +524,10 @@
- [ActuatorTest](/msg_docs/ActuatorTest.md)
- [AdcReport](/msg_docs/AdcReport.md)
- [Airspeed](/msg_docs/Airspeed.md)
- [AirspeedValidated](/msg_docs/AirspeedValidated.md)
- [AirspeedWind](/msg_docs/AirspeedWind.md)
- [AutotuneAttitudeControlStatus](/msg_docs/AutotuneAttitudeControlStatus.md)
- [Buffer128](/msg_docs/Buffer128.md)
- [ButtonEvent](/msg_docs/ButtonEvent.md)
- [CameraCapture](/msg_docs/CameraCapture.md)
- [CameraStatus](/msg_docs/CameraStatus.md)
@@ -569,9 +566,6 @@
- [FailsafeFlags](/msg_docs/FailsafeFlags.md)
- [FailureDetectorStatus](/msg_docs/FailureDetectorStatus.md)
- [FigureEightStatus](/msg_docs/FigureEightStatus.md)
- [FixedWingLateralGuidanceStatus](/msg_docs/FixedWingLateralGuidanceStatus.md)
- [FixedWingLateralStatus](/msg_docs/FixedWingLateralStatus.md)
- [FixedWingRunwayControl](/msg_docs/FixedWingRunwayControl.md)
- [FlightPhaseEstimation](/msg_docs/FlightPhaseEstimation.md)
- [FollowTarget](/msg_docs/FollowTarget.md)
- [FollowTargetEstimator](/msg_docs/FollowTargetEstimator.md)
@@ -624,6 +618,7 @@
- [NavigatorMissionItem](/msg_docs/NavigatorMissionItem.md)
- [NavigatorStatus](/msg_docs/NavigatorStatus.md)
- [NormalizedUnsignedSetpoint](/msg_docs/NormalizedUnsignedSetpoint.md)
- [NpfgStatus](/msg_docs/NpfgStatus.md)
- [ObstacleDistance](/msg_docs/ObstacleDistance.md)
- [OffboardControlMode](/msg_docs/OffboardControlMode.md)
- [OnboardComputerStatus](/msg_docs/OnboardComputerStatus.md)
@@ -659,12 +654,13 @@
- [RcParameterMap](/msg_docs/RcParameterMap.md)
- [RoverAttitudeSetpoint](/msg_docs/RoverAttitudeSetpoint.md)
- [RoverAttitudeStatus](/msg_docs/RoverAttitudeStatus.md)
- [RoverPositionSetpoint](/msg_docs/RoverPositionSetpoint.md)
- [RoverMecanumGuidanceStatus](/msg_docs/RoverMecanumGuidanceStatus.md)
- [RoverMecanumSetpoint](/msg_docs/RoverMecanumSetpoint.md)
- [RoverMecanumStatus](/msg_docs/RoverMecanumStatus.md)
- [RoverRateSetpoint](/msg_docs/RoverRateSetpoint.md)
- [RoverRateStatus](/msg_docs/RoverRateStatus.md)
- [RoverSteeringSetpoint](/msg_docs/RoverSteeringSetpoint.md)
- [RoverThrottleSetpoint](/msg_docs/RoverThrottleSetpoint.md)
- [RoverVelocitySetpoint](/msg_docs/RoverVelocitySetpoint.md)
- [RoverVelocityStatus](/msg_docs/RoverVelocityStatus.md)
- [Rpm](/msg_docs/Rpm.md)
- [RtlStatus](/msg_docs/RtlStatus.md)
@@ -696,7 +692,6 @@
- [TelemetryStatus](/msg_docs/TelemetryStatus.md)
- [TiltrotorExtraControls](/msg_docs/TiltrotorExtraControls.md)
- [TimesyncStatus](/msg_docs/TimesyncStatus.md)
- [TrajectorySetpoint6dof](/msg_docs/TrajectorySetpoint6dof.md)
- [TransponderReport](/msg_docs/TransponderReport.md)
- [TuneControl](/msg_docs/TuneControl.md)
- [UavcanParameterRequest](/msg_docs/UavcanParameterRequest.md)
@@ -720,18 +715,14 @@
- [WheelEncoders](/msg_docs/WheelEncoders.md)
- [Wind](/msg_docs/Wind.md)
- [YawEstimatorStatus](/msg_docs/YawEstimatorStatus.md)
- [AirspeedValidatedV0](/msg_docs/AirspeedValidatedV0.md)
- [VehicleAttitudeSetpointV0](/msg_docs/VehicleAttitudeSetpointV0.md)
- [VehicleStatusV0](/msg_docs/VehicleStatusV0.md)
- [MAVLink Messaging](/mavlink/index.md)
- [MAVLink Messaging](/middleware/mavlink.md)
- [Adding Messages](/mavlink/adding_messages.md)
- [Streaming Messages](/mavlink/streaming_messages.md)
- [Receiving Messages](/mavlink/receiving_messages.md)
- [Custom MAVLink Messages](/mavlink/custom_messages.md)
- [Protocols/Microservices](/mavlink/protocols.md)
- [Standard Modes Protocol](/mavlink/standard_modes.md)
- [Standard Modes Protocol](/mavlink/standard_modes.md)
- [uXRCE-DDS (PX4-ROS 2/DDS Bridge)](/middleware/uxrce_dds.md)
- [UORB Bridged to ROS 2](/middleware/dds_topics.md)
- [Modules & Commands](/modules/modules_main.md)
- [Autotune](/modules/modules_autotune.md)
- [Commands](/modules/modules_command.md)
@@ -857,7 +848,6 @@
- [Licenses](/contribute/licenses.md)
- [Releases](/releases/index.md)
- [main (alpha)](/releases/main.md)
- [1.16 (release candidate)](/releases/1.16.md)
- [1.15 (stable)](/releases/1.15.md)
- [1.14](/releases/1.14.md)
- [1.13](/releases/1.13.md)
+48 -51
View File
@@ -9,45 +9,11 @@ This topic explains how to build the PX4 bootloader, and several methods for fla
::: info
- You can use [QGC Bootloader Update](#qgc-bootloader-update-sys-bl-update) with firmware that includes the [`bl-update` module](../modules/modules_command.md#bl-update).
This is the easiest way to update the bootloader, provided the board is able to load firmware.
- You can also use the [Debug Probe](#debug-probe-bootloader-update) to update the bootloader.
This is useful for updating/fixing the bootloader when the board is bricked.
- Most boards will need to use the [Debug Probe](#debug-probe-bootloader-update) to update the bootloader.
- On [FMUv6X-RT](../flight_controller/pixhawk6x-rt.md) you can [install bootloader/unbrick boards via USB](bootloader_update_v6xrt.md).
This is useful if you don't have a debug probe.
:::
## QGC Bootloader Update (`SYS_BL_UPDATE`)
The easiest way to update the bootloader is to first use _QGroundControl_ to install firmware that contains the desired/latest bootloader.
You can then initiate bootloader update on next restart by setting the parameter: [SYS_BL_UPDATE](../advanced_config/parameter_reference.md#SYS_BL_UPDATE).
This approach can be used if the [`bl-update` module](../modules/modules_command.md#bl-update) is present in the firmware.
The easiest way to check this is just to see if the [SYS_BL_UPDATE](../advanced_config/parameter_reference.md#SYS_BL_UPDATE) parameter is [found in QGroundControl](../advanced_config/parameters.md#finding-a-parameter).
:::warning
Boards that include the module will have the line `CONFIG_SYSTEMCMDS_BL_UPDATE=y` in their `default.px4board` file (for examples [see this search](https://github.com/search?q=repo%3APX4%2FPX4-Autopilot+path%3A**%2Fdefault.px4board+CONFIG_SYSTEMCMDS_BL_UPDATE%3Dy&type=code)).
You can enable this key in your own custom firmware if needed.
:::
The steps are:
1. Insert an SD card (enables boot logging to debug any problems).
1. [Update the Firmware](../config/firmware.md#custom) with an image containing the new/desired bootloader.
::: info
The updated bootloader might be included the default firmware for your board or supplied in custom firmware.
:::
1. Wait for the vehicle to reboot.
1. [Find and enable](../advanced_config/parameters.md) the parameter [SYS_BL_UPDATE](../advanced_config/parameter_reference.md#SYS_BL_UPDATE).
1. Reboot (disconnect/reconnect the board).
The bootloader update will only take a few seconds.
Generally at this point you may then want to [update the firmware](../config/firmware.md) again using the correct/newly installed bootloader.
An specific example of this process for updating the [FMUv2 bootloader](#fmuv2-bootloader-update) is given below.
- On FMUv2 and some custom firmware (only) you can use [QGC Bootloader Update](#qgc-bootloader-update).
:::
## Building the PX4 Bootloader
@@ -83,9 +49,11 @@ The instructions in the repo README explain how to use it.
The following steps explain how you can "manually" update the bootloader using a [compatible Debug Probe](../debug/swd_debug.md#debug-probes-for-px4-hardware):
1. Get a binary containing the bootloader (either from dev team or [build it yourself](#building-the-px4-bootloader)).
2. Get a [Debug Probe](../debug/swd_debug.md#debug-probes-for-px4-hardware).
1. Get a [Debug Probe](../debug/swd_debug.md#debug-probes-for-px4-hardware).
Connect the probe your PC via USB and setup the `gdbserver`.
3. Go into the directory containing the binary and run the command for your target bootloader in the terminal:
1. Go into the directory containing the binary and run the command for your target bootloader in the terminal:
- FMUv6X
@@ -110,7 +78,7 @@ The following steps explain how you can "manually" update the bootloader using a
Bootloaders from [PX4/PX4-Bootloader](https://github.com/PX4/PX4-Bootloader) are named with the pattern `*_bl.elf`.
:::
4. The _gdb terminal_ appears and it should display the following output:
1. The _gdb terminal_ appears and it should display the following output:
```sh
GNU gdb (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 8.0.50.20171128-git
@@ -130,27 +98,28 @@ The following steps explain how you can "manually" update the bootloader using a
Reading symbols from px4fmuv5_bl.elf...done.
```
5. Find your `<dronecode-probe-id>` by running an `ls` command in the **/dev/serial/by-id** directory.
6. Now connect to the debug probe with the following command:
1. Find your `<dronecode-probe-id>` by running an `ls` command in the **/dev/serial/by-id** directory.
1. Now connect to the debug probe with the following command:
```sh
tar ext /dev/serial/by-id/<dronecode-probe-id>
```
7. Power on the Pixhawk with another USB cable and connect the probe to the `FMU-DEBUG` port.
1. Power on the Pixhawk with another USB cable and connect the probe to the `FMU-DEBUG` port.
::: info
If using a Dronecode probe you may need to remove the case in order to connect to the `FMU-DEBUG` port (e.g. on Pixhawk 4 you would do this using a T6 Torx screwdriver).
:::
8. Use the following command to scan for the Pixhawk`s SWD and connect to it:
1. Use the following command to scan for the Pixhawk`s SWD and connect to it:
```sh
(gdb) mon swdp_scan
(gdb) attach 1
```
9. Load the binary into the Pixhawk:
1. Load the binary into the Pixhawk:
```sh
(gdb) load
@@ -158,10 +127,38 @@ The following steps explain how you can "manually" update the bootloader using a
After the bootloader has updated you can [Load PX4 Firmware](../config/firmware.md) using _QGroundControl_.
## FMUv2 Bootloader Update
## QGC Bootloader Update
The easiest approach is to first use _QGroundControl_ to install firmware that contains the desired/latest bootloader.
You can then initiate bootloader update on next restart by setting the parameter: [SYS_BL_UPDATE](../advanced_config/parameter_reference.md#SYS_BL_UPDATE).
This approach can only be used if [SYS_BL_UPDATE](../advanced_config/parameter_reference.md#SYS_BL_UPDATE) is present in firmware.
:::warning
Currently only FMUv2 and some custom firmware includes the desired bootloader.
:::
The steps are:
1. Insert an SD card (enables boot logging to debug any problems).
1. [Update the Firmware](../config/firmware.md#custom) with an image containing the new/desired bootloader.
::: info
The updated bootloader might be supplied in custom firmware (i.e. from the dev team), or it or may be included in the latest main branch.
:::
1. Wait for the vehicle to reboot.
1. [Find and enable](../advanced_config/parameters.md) the parameter [SYS_BL_UPDATE](../advanced_config/parameter_reference.md#SYS_BL_UPDATE).
1. Reboot (disconnect/reconnect the board).
The bootloader update will only take a few seconds.
Generally at this point you may then want to [update the firmware](../config/firmware.md) again using the correct/newly installed bootloader.
An specific example of this process for updating the FMUv2 bootloader is given below.
### FMUv2 Bootloader Update
If _QGroundControl_ installs the FMUv2 target (see console during installation), and you have a newer board, you may need to update the bootloader in order to access all the memory on your flight controller.
This example explains how you can use [QGC Bootloader Update](qgc-bootloader-update-sys-bl-update) to update the bootloader.
::: info
Early FMUv2 [Pixhawk-series](../flight_controller/pixhawk_series.md#fmu_versions) flight controllers had a [hardware issue](../flight_controller/silicon_errata.md#fmuv2-pixhawk-silicon-errata) that restricted them to using 1MB of flash memory.
@@ -171,17 +168,17 @@ The problem is fixed on newer boards, but you may need to update the factory-pro
To update the bootloader:
1. Insert an SD card (enables boot logging to debug any problems).
2. [Update the Firmware](../config/firmware.md) to PX4 _master_ version (when updating the firmware, check **Advanced settings** and then select **Developer Build (master)** from the dropdown list).
1. [Update the Firmware](../config/firmware.md) to PX4 _master_ version (when updating the firmware, check **Advanced settings** and then select **Developer Build (master)** from the dropdown list).
_QGroundControl_ will automatically detect that the hardware supports FMUv2 and install the appropriate Firmware.
![FMUv2 update](../../assets/qgc/setup/firmware/bootloader_update.jpg)
Wait for the vehicle to reboot.
3. [Find and enable](../advanced_config/parameters.md) the parameter [SYS_BL_UPDATE](../advanced_config/parameter_reference.md#SYS_BL_UPDATE).
4. Reboot (disconnect/reconnect the board).
1. [Find and enable](../advanced_config/parameters.md) the parameter [SYS_BL_UPDATE](../advanced_config/parameter_reference.md#SYS_BL_UPDATE).
1. Reboot (disconnect/reconnect the board).
The bootloader update will only take a few seconds.
5. Then [Update the Firmware](../config/firmware.md) again.
1. Then [Update the Firmware](../config/firmware.md) again.
This time _QGroundControl_ should autodetect the hardware as FMUv3 and update the Firmware appropriately.
![FMUv3 update](../../assets/qgc/setup/firmware/bootloader_fmu_v3_update.jpg)
File diff suppressed because it is too large Load Diff
-5
View File
@@ -1,5 +0,0 @@
# Complete Vehicles (Rover)
This section contains information about fully assembled vehicles that use PX4:
1. [Aion Robotics R1 UGV (Differential Rover)](../complete_vehicles_rover/aion_r1.md)
@@ -3,7 +3,7 @@
_Collision Prevention_ may be used to automatically slow and stop a vehicle before it can crash into an obstacle.
It can be enabled for multicopter vehicles when using acceleration-based [Position mode](../flight_modes_mc/position.md) (or VTOL vehicles in MC mode).
It can be enabled for multicopter vehicles in [Position mode](../flight_modes_mc/position.md) (with [MPC_POS_MODE](#MPC_POS_MODE) set to `Acceleration based`), and can use sensor data from an offboard companion computer, offboard rangefinders over MAVLink, a rangefinder attached to the flight controller, or any combination of the above.
It can be enabled for multicopter vehicles in [Position mode](../flight_modes_mc/position.md), and can use sensor data from an offboard companion computer, offboard rangefinders over MAVLink, a rangefinder attached to the flight controller, or any combination of the above.
Collision prevention may restrict vehicle maximum speed if the sensor range isn't large enough!
It also prevents motion in directions where no sensor data is available (i.e. if you have no rear-sensor data, you will not be able to fly backwards).
@@ -26,14 +26,15 @@ Users are notified through _QGroundControl_ while _Collision Prevention_ is acti
PX4 software setup is covered in the next section.
If you are using a distance sensor attached to your flight controller for collision prevention, it will need to be attached and configured as described in [PX4 Distance Sensor](#rangefinder).
If you are using a companion computer to provide obstacle information see [companion setup](#companion) below.
If you are using a companion computer to provide obstacle information see [companion setup](#companion
## Supported Rangefinders {#rangefinder}
## Supported Rangefinders {#rangefinder}
### Lanbao PSK-CM8JL65-CC5 [Discontinued]
At time of writing PX4 allows you to use the [Lanbao PSK-CM8JL65-CC5](../sensor/cm8jl65_ir_distance_sensor.md) IR distance sensor for collision prevention “out of the box”, with minimal additional configuration:
- First [attach and configure the sensor](../sensor/cm8jl65_ir_distance_sensor.md), and enable collision prevention (as described above, using [CP_DIST](#CP_DIST)).
- Set the sensor orientation using [SENS_CM8JL65_R_0](../advanced_config/parameter_reference.md#SENS_CM8JL65_R_0).
@@ -50,6 +51,7 @@ Other sensors may be enabled, but this requires modification of driver code to s
This should be done by mimicking the `SENS_CM8JL65_R_0` parameter (though you might also hard-code the orientation in the sensor _module.yaml_ file to something like `sf0x start -d ${SERIAL_DEV} -R 25` - where 25 is equivalent to `ROTATION_DOWNWARD_FACING`).
- Modify the driver to set the _field of view_ in the distance sensor UORB topic (`distance_sensor_s.h_fov`).
## PX4 (Software) Setup
Configure collision prevention by [setting the following parameters](../advanced_config/parameters.md) in _QGroundControl_:
@@ -60,7 +62,7 @@ Configure collision prevention by [setting the following parameters](../advanced
| <a id="CP_DELAY"></a>[CP_DELAY](../advanced_config/parameter_reference.md#CP_DELAY) | Set the sensor and velocity setpoint tracking delay. See [Delay Tuning](#delay_tuning) below. |
| <a id="CP_GUIDE_ANG"></a>[CP_GUIDE_ANG](../advanced_config/parameter_reference.md#CP_GUIDE_ANG) | Set the angle (to both sides of the commanded direction) within which the vehicle may deviate if it finds fewer obstacles in that direction. See [Guidance Tuning](#angle_change_tuning) below. |
| <a id="CP_GO_NO_DATA"></a>[CP_GO_NO_DATA](../advanced_config/parameter_reference.md#CP_GO_NO_DATA) | Set to 1 to allow the vehicle to move in directions where there is no sensor coverage (default is 0/`False`). |
| <a id="MPC_POS_MODE"></a>[MPC_POS_MODE](../advanced_config/parameter_reference.md#MPC_POS_MODE) | Must be set to `Acceleration based`. |
| <a id="MPC_POS_MODE"></a>[MPC_POS_MODE](../advanced_config/parameter_reference.md#MPC_POS_MODE) | Set to `Direct velocity` or `Smoothed velocity` to enable Collision Prevention in Position Mode (default is `Acceleration based`). |
## Algorithm Description
@@ -129,6 +131,7 @@ The guidance feature will never direct the vehicle in a direction without sensor
If the vehicle feels stuck with only a single distance sensor pointing forwards, this is probably because the guidance cannot safely adapt the direction due to lack of information.
:::
## Algorithm Description
The data from all sensors are fused into an internal representation of 72 sectors around the vehicle, each containing either the sensor data and information about when it was last observed, or an indication that no data for the sector was available.
@@ -209,7 +212,7 @@ The steps are:
type: px4_msgs::msg::ObstacleDistance
```
For more information see [DDS Topics YAML](../middleware/uxrce_dds.md#dds-topics-yaml) in [uXRCE-DDS](../middleware/uxrce_dds.md) (PX4-ROS 2/DDS Bridge)\_.
For more information see [DDS Topics YAML](../middleware/uxrce_dds.md#dds-topics-yaml) in _uXRCE-DDS (PX4-ROS 2/DDS Bridge)_.
3. Open PlotJuggler and navigate to the **Tools > Reactive Script Editor** section.
In the **Script Editor** tab, add following scripts in the appropriate sections:
+2 -1
View File
@@ -18,7 +18,8 @@ Mode documentation for the PX4 internal modes are listed below:
- [Flight Modes (Multicopter)](../flight_modes_mc/index.md)
- [Flight Modes (Fixed-Wing)](../flight_modes_fw/index.md)
- [Flight Modes (VTOL)](../flight_modes_vtol/index.md)
- [Drive Modes (Rover)](../flight_modes_rover/index.md)
- [Drive Modes (Differential Rover)](../flight_modes_rover/differential.md)
- [Drive Modes (Ackermann Rover)](../flight_modes_rover/ackermann.md)
- [Basic Configuration > Flight Modes](../config/flight_mode.md)
## Internal vs External Modes
+433
View File
@@ -0,0 +1,433 @@
# Configuration/Tuning (Ackermann Rover)
This topic provides a step-by-step guide for setting up your [Ackermann rover](../frames_rover/ackermann.md).
Successive steps enable [drive modes](../flight_modes_rover/ackermann.md) with more autopilot support and features.
::: warning
Each step is dependent on the previous steps having been completed.
Modes will only work properly if the preceding modes have been configured.
:::
## Basic Setup
To configure the Ackermann rover frame and outputs:
1. Enable Rover support by flashing the [PX4 rover build](../frames_rover/index.md#flashing-the-rover-build) onto your flight controller.
Note that this is a special build that contains rover-specific modules.
2. In the [Airframe](../config/airframe.md) configuration select the _Generic Rover Ackermann_:
![QGC screenshot showing selection of the airframe 'Generic ackermann rover'](../../assets/config/airframe/airframe_generic_rover_ackermann.png)
Select the **Apply and Restart** button.
::: info
If this airframe is not displayed and you have checked that you are using rover firmware (not the default), you can alternatively enable this frame by setting the [SYS_AUTOSTART](../advanced_config/parameter_reference.md#SYS_AUTOSTART) parameter to `51000`.
:::
3. Open the [Actuators Configuration & Testing](../config/actuators.md) to map the steering and throttle functions to flight controller outputs.
## Manual Mode
::: warning
For this mode to work properly the [Basic Setup](#basic-setup) must've already been completed!
:::
The basic setup already covers the minimum setup required to use the rover in [Manual mode](../flight_modes_rover/ackermann.md#manual-mode).
This mode is also affected by (optional) acceleration/deceleration limits.
As configuration of these limits becomes mandatory for subsequent modes, we do this setup here.
Navigate to [Parameters](../advanced_config/parameters.md) in QGroundControl and set the following parameters:
1. [RA_WHEEL_BASE](#RA_WHEEL_BASE) [m]: Measure the distance from the back to the front wheels.
2. [RA_MAX_STR_ANG](#RA_MAX_STR_ANG) [deg]: Measure the maximum steering angle.
![Geometric parameters](../../assets/airframes/rover/rover_ackermann/geometric_parameters.png)
3. [RO_MAX_THR_SPEED](#RO_MAX_THR_SPEED) [m/s]: Drive the rover at full throttle and set this parameter to the observed value of the ground speed.
:::info
This parameter is also used for the feed-forward term of the speed control.
It will be further tuned in the configuration of [Position mode](#position-mode).
:::
4. (Optional) [RO_ACCEL_LIM](#RO_ACCEL_LIM) [m/s^2]: Maximum acceleration you want to allow for your rover.
<a id="RO_ACCEL_LIM_CONSIDERATIONS"></a>
:::tip
Your rover has a maximum possible acceleration which is determined by the maximum torque the motor can supply.
This may or may not be appropriate for your vehicle and use case.
One approach to determine an appropriate value is:
1. From a standstill, give the rover full throttle until it reaches the maximum speed.
1. Disarm the rover and plot the `measured_speed_body_x` from [RoverVelocityStatus](../msg_docs/RoverVelocityStatus.md).
1. Divide the maximum speed by the time it took to reach it and set this as the value for [RO_ACCEL_LIM](#RO_ACCEL_LIM).
Some RC rovers have enough torque to lift up if the maximum acceleration is not limited.
If that is the case:
1. Set [RO_ACCEL_LIM](#RO_ACCEL_LIM) to a low value, give the rover full throttle from a standstill and observe its behaviour.
1. Increase [RO_ACCEL_LIM](#RO_ACCEL_LIM) until the rover starts to lift up during the acceleration.
1. Set [RO_ACCEL_LIM](#RO_ACCEL_LIM) to the highest value that does not cause the rover to lift up.
:::
5. (Optional) [RO_DECEL_LIM](#RO_DECEL_LIM) [m/s^2]: Maximum deceleration you want to allow for your rover.
:::tip
The same [considerations](#RO_ACCEL_LIM_CONSIDERATIONS) as in the configuration of [RO_ACCEL_LIM](#RO_ACCEL_LIM) apply.
:::
:::info
This parameter is also used for the calculation of the speed setpoint during [Auto modes](#auto-modes).
:::
6. (Optional) [RA_STR_RATE_LIM](#RA_STR_RATE_LIM) [deg/s]: Maximum steering rate you want to allow for your rover.
:::tip
This value depends on your rover and use case.
For bigger rovers there might be a mechanical limit that is easy to identify by steering the rover at a standstill and increasing
[RA_STR_RATE_LIM](#RA_STR_RATE_LIM) until you observe the steering rate to no longer be limited by the parameter.
For smaller rovers you might observe the steering to be too aggressive. Set [RA_STR_RATE_LIM](#RA_STR_RATE_LIM) to a low value and steer the rover at a standstill.
Increase the parameter until you reach the maximum steering rate you are comfortable with.
:::
:::warning
A low maximum steering rate makes the rover worse at tracking steering setpoints, which can lead to a poor performance in the subsequent modes.
:::
## Acro Mode
::: warning
For this mode to work properly [Manual mode](#acro-mode) must've already been configured!
:::
To set up [Acro mode](../flight_modes_rover/ackermann.md#acro-mode) configure the following [parameters](../advanced_config/parameters.md) in QGroundControl:
1. [RO_YAW_RATE_LIM](#RO_YAW_RATE_LIM): Maximum yaw rate you want to allow for your rover.
:::tip
Limiting the yaw rate is necessary if the rover is prone rolling over, loosing traction at high speeds or if passenger comfort is important.
Small rovers especially can be prone to rolling over when steering aggressively at high speeds.
If this is the case:
1. In [Acro mode](../flight_modes_rover/ackermann.md#acro-mode), set [RO_YAW_RATE_LIM](#RO_YAW_RATE_LIM) to a small value and drive the rover at full throttle and with the right stick all the way to the left or right.
1. Increase [RO_YAW_RATE_LIM](#RO_YAW_RATE_LIM) until the wheels of the rover start to lift up.
1. Set [RO_YAW_RATE_LIM](#RO_YAW_RATE_LIM) to the highest value that does not cause the rover to lift up.
If you see no need to limit the yaw rate, set this parameter to the maximum yaw rate the rover can achieve:
1. In [Manual mode](#manual-mode) drive the rover at full throttle and with the maximum steering angle.
2. Plot the `measured_yaw_rate` from [RoverRateStatus](../msg_docs/RoverRateStatus.md) and enter the highest observed value for [RO_YAW_RATE_LIM](#RO_YAW_RATE_LIM).
:::
2. [RO_YAW_RATE_P](#RO_YAW_RATE_P) [-]: Proportional gain of the closed loop yaw rate controller.
The closed loop acceleration control will compare the yaw rate setpoint with the measured yaw rate and adapt the motor commands based on the error between them.
The proportional gain is multiplied with this error and that value is added to the motor command.
This compensates for disturbances such as uneven ground and external forces.
:::tip
To tune this parameter:
1. Put the rover in [Acro mode](../flight_modes_rover/ackermann.md#acro-mode) and hold the throttle stick and the right stick at a few different levels for a couple of seconds each.
2. Disarm the rover and from the flight log plot the `adjusted_yaw_rate_setpoint` from [RoverRateStatus](../msg_docs/RoverRateStatus.md) and the `measured_yaw_rate` from [RoverRateStatus](../msg_docs/RoverRateStatus.md) over each other.
3. Increase [RO_YAW_RATE_P](#RO_YAW_RATE_P) if the measured value does not track the setpoint fast enough or decrease it if the measurement overshoots the setpoint by too much.
4. Repeat until you are satisfied with the behaviour.
:::
3. [RO_YAW_RATE_I](#RO_YAW_RATE_I) [-]: Integral gain of the closed loop yaw rate controller.
The integral gain accumulates the error between the desired and actual yaw rate scaled by the integral gain over time and that value is added to the motor command.
::: tip
An integrator might not be necessary at this stage, but it will become important for subsequent modes.
:::
The rover is now ready to drive in [Acro mode](../flight_modes_rover/ackermann.md#acro-mode).
## Stabilized Mode
::: warning
For this mode to work properly [Acro mode](#acro-mode) must've already been configured!
:::
For [Stabilized mode](../flight_modes_rover/differential.md#stabilized-mode) the controller utilizes a closed loop yaw controller, which creates a yaw rate setpoint to control the yaw when it is active:
![Cascaded PID for yaw control](../../assets/airframes/rover/rover_differential/cascaded_pid_for_yaw.png)
Unlike the closed loop yaw rate, this controller has no feed-forward term.
Therefore you only need to tune the closed loop gains:
1. [RO_YAW_P](#RO_YAW_P) [-]: Proportional gain for the closed loop yaw controller.
::: tip
In stabilized mode the closed loop yaw control is only active when driving a straight line (no yaw rate input).
To tune it start with a value of 1 for [RO_YAW_P](#RO_YAW_P).
Put the rover into stabilized mode and move the left stick of your controller up to drive forwards.
Disarm the rover and from the flight log plot the `measured_yaw` and the `adjusted_yaw_setpoint` from the [RoverAttitudeStatus](../msg_docs/RoverAttitudeStatus.md) message over each other.
Increase/Decrease the parameter until you are satisfied with the setpoint tracking.
:::
::: info
For the closed loop yaw control an integrator gain is useful because this setpoint is often constant for a while and an integrator eliminates steady state errors that can cause the rover to never reach the setpoint.
Since the yaw and yaw rate controllers are cascaded, there only needs to be one integrator which is in the yaw rate controller. If you observe a steady state error in the yaw setpoint increase the [RO_YAW_RATE_I](#RO_YAW_RATE_I) parameter.
:::
The rover is now ready to drive in [Stabilized mode](../flight_modes_rover/ackermann.md#stabilized-mode).
## Position Mode
:::warning
For this mode to work properly [Stabilized mode](#stabilized-mode) must already be configured!
:::
[Position mode](../flight_modes_rover/ackermann.md#position-mode) is the most advanced manual mode, utilizing closed loop yaw rate and speed control and leveraging position estimates.
To configure set the following parameters:
1. [RO_SPEED_LIM](#RO_SPEED_LIM) [m/s]: This is the maximum speed you want to allow for your rover.
This will define the stick-to-speed mapping for position mode and set an upper limit for the speed setpoint for all [auto modes](#auto-modes).
2. [RO_MAX_THR_SPEED](#RO_MAX_THR_SPEED) [m/s]: This parameter is used to calculate the feed-forward term of the closed loop speed control which linearly maps desired speeds to normalized motor commands.
As mentioned in the [Manual mode](../flight_modes_rover/ackermann.md#manual-mode) configuration , a good starting point is the observed ground speed when the rover drives at maximum throttle in [Manual mode](../flight_modes_rover/ackermann.md#manual-mode).
<a id="RA_SPEED_TUNING"></a>
::: tip
To further tune this parameter:
1. Set [RO_SPEED_P](#RO_SPEED_P) and [RO_SPEED_I](#RO_SPEED_I) to zero.
This way the speed is only controlled by the feed-forward term, which makes it easier to tune.
1. Put the rover in [Position mode](../flight_modes_rover/ackermann.md#position-mode) and then move the left stick of your controller up and/or down and hold it at a few different levels for a couple of seconds each.
1. Disarm the rover and from the flight log plot the `adjusted_speed_body_x_setpoint` and the `measured_speed_body_x` from the [RoverVelocityStatus](../msg_docs/RoverVelocityStatus.md) message over each other.
1. If the actual speed of the rover is higher than the speed setpoint, increase [RO_MAX_THR_SPEED](#RO_MAX_THR_SPEED).
If it is the other way around decrease the parameter and repeat until you are satisfied with the setpoint tracking.
:::
::: info
If your rover oscillates when driving a straight line in [Position mode](../flight_modes_rover/ackermann.md#position-mode), set this parameter to the observed ground speed at maximum throttle in [Manual mode](../flight_modes_rover/ackermann.md#manual-mode) and complete steps 5-7 first before continuing the tuning of the closed loop speed control (Steps 2-4).
:::
3. [RO_SPEED_P](#RO_SPEED_P) [-]: Proportional gain of the closed loop speed controller.
::: tip
This parameter can be tuned the same way as [RO_MAX_THR_SPEED](#RA_SPEED_TUNING).
If you tuned [RO_MAX_THR_SPEED](#RO_MAX_THR_SPEED) well, you might only need a very small value.
:::
4. [RO_SPEED_I](#RO_SPEED_I) [-]: Integral gain for the closed loop speed controller.
::: tip
For the closed loop speed control an integrator gain is useful because this setpoint is often constant for a while and an integrator eliminates steady state errors that can cause the rover to never reach the setpoint.
:::
5. [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN): When driving in a straight line (right stick centered) position mode leverages the same path following algorithm used in [auto modes](#auto-modes) called [pure pursuit](#pure-pursuit-guidance-logic) to achieve the best possible straight line driving behaviour ([Illustration of control architecture](#pure_pursuit_controller)).
This parameter determines how aggressive the controller will steer towards the path.
::: tip
Decreasing the parameter makes it more aggressive but can lead to oscillations.
To tune this:
1. Start with a value of 1 for [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN)
2. Put the rover in [Position mode](../flight_modes_rover/ackermann.md#position-mode) and while driving a straight line at approximately half the maximum speed observe its behaviour.
3. If the rover does not drive in a straight line, reduce the value of the parameter, if it oscillates around the path increase the value.
4. Repeat until you are satisfied with the behaviour.
:::
6. [PP_LOOKAHD_MIN](#PP_LOOKAHD_MIN): Minimum threshold for the lookahead distance used by the [pure pursuit algorithm](#pure-pursuit-guidance-logic).
::: tip
Put the rover in [Position mode](../flight_modes_rover/ackermann.md#position-mode) and drive at very low speeds, if the rover starts to oscillate even though the tuning of [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN) was good for medium speeds, then increase the value of [PP_LOOKAHD_MIN](#PP_LOOKAHD_MIN).
:::
7. [PP_LOOKAHD_MAX](#PP_LOOKAHD_MAX): Maximum threshold for the lookahead distance used by [pure pursuit](#pure-pursuit-guidance-logic).
::: tip
Put the rover in [Position mode](../flight_modes_rover/ackermann.md#position-mode) and drive at very high speeds, if the rover does not drive in a straight line even though the tuning of [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN) was good for medium speeds, then decrease the value of [PP_LOOKAHD_MAX](#PP_LOOKAHD_MAX).
:::
The rover is now ready to drive in [Position mode](../flight_modes_rover/ackermann.md#position-mode).
## Auto Modes
::: warning
For auto modes to work properly [Manual Mode](#manual-mode), [Acro mode](#acro-mode)and [Position mode](#position-mode) must already be configured!
:::
<a id="pure_pursuit_controller"></a>
In [auto modes](../flight_modes_rover/ackermann.md#auto-modes) the autopilot takes over navigation tasks using the following control architecture:
![Pure Pursuit Controller](../../assets/airframes/rover/rover_ackermann/ackermann_rover_guidance_structure.png)
The required parameter configuration is discussed in the following sections.
### Speed
1. [RO_DECEL_LIM](#RO_DECEL_LIM) [m/s^2] and [RO_JERK_LIM](#RO_JERK_LIM) [m/s^3] are used to calculate a speed trajectory such that the rover reaches the next waypoint with the correct [cornering speed](#cornering-speed).
::: tip
Plan a mission for the rover to drive a square and observe how it slows down when approaching a waypoint:
- If the rover decelerates too quickly decrease the [RO_DECEL_LIM](#RO_DECEL_LIM) parameter, if it starts slowing down too early increase the parameter.
- If you observe a jerking motion as the rover slows down, decrease the [RO_JERK_LIM](#RO_JERK_LIM) parameter otherwise increase it as much as possible as it can interfere with the tuning of [RO_DECEL_LIM](#RO_DECEL_LIM).
These two parameters have to be tuned as a pair, repeat until you are satisfied with the behaviour.
:::
2. Plot the `adjusted_speed_body_x_setpoint` and `measured_speed_body_x` from the [RoverVelocityStatus](../msg_docs/RoverVelocityStatus.md) message over each other.
If the tracking of these setpoints is not satisfactory adjust the values for [RO_SPEED_P](#RO_SPEED_P) and [RO_SPEED_I](#RO_SPEED_I).
### Corner Cutting
The module employs a special cornering logic causing the rover to "cut corners" to achieve a smooth trajectory.
This is done by scaling the acceptance radius based on the corner the rover has to drive (for geometric explanation see [Cornering logic](#mission-cornering-logic-info-only)).
![Cornering Logic](../../assets/airframes/rover/rover_ackermann/cornering_comparison.png)
The degree to which corner cutting is allowed can be tuned, or disabled, with the following parameters:
::: info
The corner cutting effect is a tradeoff between how close you get to the waypoint and the smoothness of the trajectory.
:::
1. [NAV_ACC_RAD](#NAV_ACC_RAD) [m]: Default acceptance radius
This is also used as a lower bound for the acceptance radius scaling.
2. [RA_ACC_RAD_MAX](#RA_ACC_RAD_MAX) [m]: The maximum the acceptance radius can be scaled to.
Set equal to [NAV_ACC_RAD](#NAV_ACC_RAD) to disable the corner cutting effect.
3. [RA_ACC_RAD_GAIN](#RA_ACC_RAD_GAIN) [-]: This tuning parameter is a multiplicand on the [calculated ideal acceptance radius](#corner-cutting-logic) to account for dynamic effects.
:::tip
Initially set this parameter to `1`.
If you observe the rover overshooting the corner, increase this parameter until you are satisfied with the behaviour.
Note that the scaling of the acceptance radius is limited by [RA_ACC_RAD_MAX](#RA_ACC_RAD_MAX).
:::
### Path Following
The [pure pursuit](#pure-pursuit-guidance-logic) algorithm is used to calculate a yaw rate setpoint for the vehicle that is then close loop controlled.
The close loop yaw rate was tuned in the configuration of the [Acro mode](#acro-mode), and the pure pursuit was tuned when setting up the [Position mode](#position-mode).
During any auto navigation task observe the behaviour of the rover.
If you are unsatisfied with the path following, there are 2 steps to take:
1. Plot the `adjusted_yaw_rate_setpoint` and the `measured_yaw_rate` from the [RoverRateStatus](../msg_docs/RoverRateStatus.md) over each other.
If the tracking of these setpoints is not satisfactory adjust the values for [RO_YAW_RATE_P](#RO_YAW_RATE_P) and [RO_YAW_RATE_I](#RO_YAW_RATE_I).
2. Plot the `adjusted_yaw_setpoint` and the `measured_yaw` from the [RoverAttitudeStatus](../msg_docs/RoverAttitudeStatus.md) over each other.
If the tracking of these setpoints is not satisfactory adjust the value for [RO_YAW_P](#RO_YAW_RATE_P) and potentially further tune [RO_YAW_RATE_I](#RO_YAW_RATE_I).
3. Steps 1 and 2 ensures accurate setpoint tracking, if the path following is still unsatisfactory you need to further tune the [pure pursuit](#pure-pursuit-guidance-logic) parameters.
## Pure Pursuit Guidance Logic
The desired yaw setpoints are generated using a pure pursuit algorithm.
The controller takes the intersection point between a circle around the vehicle and a line segment.
In mission mode this line is usually constructed by connecting the previous and current waypoint.
![Pure Pursuit Algorithm](../../assets/airframes/rover/flight_modes/pure_pursuit_algorithm.png)
The radius of the circle around the vehicle is used to tune the controller and is often referred to as look-ahead distance.
The look-ahead distance sets how aggressive the controller behaves and is defined as $l_d = v \cdot k$.
It depends on the velocity $v$ of the rover and a tuning parameter $k$ that can be set with the parameter [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN).
::: info
A lower value of [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN) makes the controller more aggressive but can lead to oscillations!
:::
The lookahead is constrained between [PP_LOOKAHD_MAX](#PP_LOOKAHD_MAX) and [PP_LOOKAHD_MIN](#PP_LOOKAHD_MIN).
If the distance from the path to the rover is bigger than the lookahead distance, the rover will target the point on the path that is closest to the rover.
To summarize, the following parameters can be used to tune the controller:
| Parameter | Description | Unit |
| -------------------------------------------------------------------------------------------------------- | --------------------------------------- | ---- |
| <a id="PP_LOOKAHD_GAIN"></a>[PP_LOOKAHD_GAIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_GAIN) | Main tuning parameter | - |
| <a id="PP_LOOKAHD_MAX"></a>[PP_LOOKAHD_MAX](../advanced_config/parameter_reference.md#PP_LOOKAHD_MAX) | Maximum value for the look ahead radius | m |
| <a id="PP_LOOKAHD_MIN"></a>[PP_LOOKAHD_MIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_MIN) | Minimum value for the look ahead radius | m |
## Mission Cornering Logic (Info only)
### Corner Cutting Logic
To enable a smooth trajectory, the acceptance radius of waypoints is scaled based on the angle between a line segment from the current-to-previous and current-to-next waypoints.
The ideal trajectory would be to arrive at the next line segment with the heading pointing towards the next waypoint.
For this purpose the minimum turning circle of the rover is inscribed tangentially to both line segments.
![Cornering Logic](../../assets/airframes/rover/rover_ackermann/cornering_logic.png)
The acceptance radius of the waypoint is set to the distance from the waypoint to the tangential points between the circle and the line segments:
$$
\begin{align*}
r_{min} &= \frac{L}{\sin\left( \delta_{max}\right) } \\
\theta &= \frac{1}{2}\arccos\left( \frac{\vec{a}*\vec{b}}{|\vec{a}||\vec{b}|}\right) \\
r_{acc} &= \frac{r_{min}}{\tan\left( \theta\right) }
\end{align*}
$$
| Symbol | Description | Unit |
| -------------- | ---------------------------------- | ---- |
| $\vec{a}$ | Vector from current to previous WP | m |
| $\vec{b}$ | Vector from current to next WP | m |
| $r_{min}$ | Minimum turn radius | m |
| $\delta_{max}$ | Maximum steer angle | m |
| $r_{acc}$ | Acceptance radius | m |
### Cornering Speed
To smoothen the trajectory further and reduce the risk of the rover rolling over, the rover speed is regulated as follows:
1. During cornering the rover drives at the following speed:
<!-- prettier-ignore -->
$$ v_{cor, max} = \dot{\psi}_{max} \cdot r $$
with $r:$ Turning radius for the upcoming corner and $\dot{\psi}_{max}:$ Maximum yaw rate ([RO_YAW_RATE_LIM](#RO_YAW_RATE_LIM)).
2. In between waypoints (straight line) the rover speed is regulated such that it will arrive at the acceptance radius of the waypoint with the desired cornering speed.
The rover is constrained between the maximum speed [RO_SPEED_LIM](#RO_SPEED_LIM) and the speed where the maximum steering angle does not cause the rover to exceed the yaw rate limit:
<!-- prettier-ignore -->
$$ v_{min} = \frac{w_b \cdot \dot{\psi}_{max}}{tan(\delta_{max})} $$
with $w_b:$ Wheel base ([RA_WHEEL_BASE](#RA_WHEEL_BASE)), $\dot{\psi}_{max}:$ Maximum yaw rate ([RO_YAW_RATE_LIM](#RO_YAW_RATE_LIM)) and $\delta_{max}:$ Maximum steering angle ([RA_MAX_STR_ANG](#RA_MAX_STR_ANG)).
## Parameter Overview
List of all parameters of the ackermann rover module:
| Parameter | Description | Unit |
| ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ------- |
| <a id="RA_WHEEL_BASE"></a>[RA_WHEEL_BASE](../advanced_config/parameter_reference.md#RA_WHEEL_BASE) | Wheel base | m |
| <a id="RA_MAX_STR_ANG"></a>[RA_MAX_STR_ANG](../advanced_config/parameter_reference.md#RA_MAX_STR_ANG) | Maximum steering angle | deg |
| <a id="RO_MAX_THR_SPEED"></a>[RO_MAX_THR_SPEED](../advanced_config/parameter_reference.md#RO_MAX_THR_SPEED) | Speed the rover drives at maximum throttle | m/s |
| <a id="RO_YAW_RATE_LIM"></a>[RO_YAW_RATE_LIM](../advanced_config/parameter_reference.md#RO_YAW_RATE_LIM) | Maximum allowed yaw rate | m/s^2 |
| <a id="RO_YAW_RATE_P"></a>[RO_YAW_RATE_P](../advanced_config/parameter_reference.md#RO_YAW_RATE_P) | Proportional gain for yaw rate controller | - |
| <a id="RO_YAW_RATE_I"></a>[RO_YAW_RATE_I](../advanced_config/parameter_reference.md#RO_YAW_RATE_I) | Integral gain for yaw rate controller | - |
| <a id="RO_YAW_P"></a>[RO_YAW_P](../advanced_config/parameter_reference.md#RO_YAW_P) | Proportional gain for yaw controller | - |
| <a id="RO_SPEED_LIM"></a>[RO_SPEED_LIM](../advanced_config/parameter_reference.md#RO_SPEED_LIM) | Maximum allowed speed | m/s |
| <a id="RO_SPEED_P"></a>[RO_SPEED_P](../advanced_config/parameter_reference.md#RO_SPEED_P) | Proportional gain for speed controller | - |
| <a id="RO_SPEED_I"></a>[RO_SPEED_I](../advanced_config/parameter_reference.md#RO_SPEED_I) | Integral gain for speed controller | - |
| <a id="PP_LOOKAHD_GAIN"></a>[PP_LOOKAHD_GAIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_GAIN) | Main tuning parameter for pure pursuit | - |
| <a id="PP_LOOKAHD_MAX"></a>[PP_LOOKAHD_MAX](../advanced_config/parameter_reference.md#PP_LOOKAHD_MAX) | Maximum value for the look ahead radius of the pure pursuit algorithm | m |
| <a id="PP_LOOKAHD_MIN"></a>[PP_LOOKAHD_MIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_MIN) | Minimum value for the look ahead radius of the pure pursuit algorithm | m |
| <a id="NAV_ACC_RAD"></a>[NAV_ACC_RAD](../advanced_config/parameter_reference.md#NAV_ACC_RAD) | Default acceptance radius | m |
| <a id="RA_STR_RATE_LIM"></a>[RA_STR_RATE_LIM](../advanced_config/parameter_reference.md#RA_STR_RATE_LIM) | (Optional) Maximum allowed steering rate | deg/s |
| <a id="RO_ACCEL_LIM"></a>[RO_ACCEL_LIM](../advanced_config/parameter_reference.md#RO_ACCEL_LIM) | (Optional) Maximum allowed acceleration | m/s^2 |
| <a id="RO_DECEL_LIM"></a>[RO_DECEL_LIM](../advanced_config/parameter_reference.md#RO_DECEL_LIM) | (Optional) Maximum allowed deceleration | m/s^2 |
| <a id="RO_JERK_LIM"></a>[RO_JERK_LIM](../advanced_config/parameter_reference.md#RO_JERK_LIM) | (Optional) Maximum allowed jerk | $m/s^3$ |
| <a id="RA_ACC_RAD_MAX"></a>[RA_ACC_RAD_MAX](../advanced_config/parameter_reference.md#RA_ACC_RAD_MAX) | (Optional) Maximum radius the acceptance radius can be scaled to | m |
| <a id="RA_ACC_RAD_GAIN"></a>[RA_ACC_RAD_GAIN](../advanced_config/parameter_reference.md#RA_ACC_RAD_GAIN) | (Optional) Tuning parameter for the acceptance radius scaling | - |
## See Also
- [Drive Modes (Ackermann Rover)](../flight_modes_rover/ackermann.md).
-39
View File
@@ -1,39 +0,0 @@
# Attitude Tuning
Attitude tuning is required to use [Stabilized mode](../flight_modes_rover/manual.md#stabilized-mode) and all later modes.
::: warning
The [rate tuning](rate_tuning.md) must've already been completed before this step!
:::
Configure the following [parameters](../advanced_config/parameters.md) in QGroundControl:
1. [RO_YAW_P](#RO_YAW_P) [-]: Proportional gain for the closed loop yaw controller.
::: tip
In stabilized mode the closed loop yaw control is only active when driving a straight line (no yaw rate input).
To tune it start with a value of 1 for [RO_YAW_P](#RO_YAW_P).
Put the rover into stabilized mode and move the left stick of your controller up to drive forwards.
Disarm the rover and from the flight log plot the `measured_yaw` and the `adjusted_yaw_setpoint` from the [RoverAttitudeStatus](../msg_docs/RoverAttitudeStatus.md) message over each other.
Increase/Decrease the parameter until you are satisfied with the setpoint tracking.
If you observe a steady state error in the yaw setpoint increase the the integrator of the rate controller: [RO_YAW_RATE_I](../advanced_config/parameter_reference.md#RO_YAW_RATE_I) .
:::
The rover is now ready to drive in [Stabilized mode](../flight_modes_rover/manual.md#stabilized-mode) and the configuration can be continued with [velocity tuning](velocity_tuning.md).
## Attitude Controller Structure (Info Only)
This section provides additional information for developers and people with experience in control system design.
The attitude controller uses the following structure:
![Rover Attitude Controller](../../assets/config/rover/rover_attitude_controller.png)
The rate and attitude controllers are cascaded, therefor we only require one integrator in the structure to eliminate steady state errors.
We placed the integrator in the rate controller since it can run without the attitude controller but not the other way around.
## Parameter Overview
| Parameter | Description | Unit |
| ----------------------------------------------------------------------------------- | ------------------------------------ | ---- |
| <a id="RO_YAW_P"></a>[RO_YAW_P](../advanced_config/parameter_reference.md#RO_YAW_P) | Proportional gain for yaw controller | - |
-133
View File
@@ -1,133 +0,0 @@
# Basic Setup
## Configure the rover frame and outputs
1. Enable Rover support by flashing the [PX4 rover build](../config_rover/index.md#flashing-the-rover-build) onto your flight controller.
Note that this is a special build that contains rover-specific modules.
2. In the [Airframe](../config/airframe.md) configuration select the your rover type: _Generic Rover Ackermann_/_Generic Rover Differential_/_Generic Rover Mecanum_:
![QGC screenshot showing selection of the airframe 'Generic ackermann rover'](../../assets/config/airframe/airframe_generic_rover_ackermann.png)
Select the **Apply and Restart** button.
::: info
If this airframe is not displayed and you have checked that you are using rover firmware (not the default), you can alternatively enable this frame by setting the [SYS_AUTOSTART](../advanced_config/parameter_reference.md#SYS_AUTOSTART) parameter directly to the following value:
| Rover Type | Value |
| ------------ | ------- |
| Ackermann | `51000` |
| Differential | `50000` |
| Mecanum | `52000` |
:::
3. Open the [Actuators Configuration & Testing](../config/actuators.md) to map the motor/servo functions to flight controller outputs.
That is the minimum setup to use the rover in [Manual mode](../flight_modes_rover/manual.md#manual-mode).
## Geometric Parameters
Manual mode is also affected by (optional) acceleration/deceleration limits set using the geometric described below.
These limits are mandatory for all other modes.
![Geometric parameters](../../assets/config/rover/geometric_parameters.png)
Navigate to [Parameters](../advanced_config/parameters.md) in QGroundControl and set the parameters in the group for your frame type.
### Ackermann
1. [RA_WHEEL_BASE](#RA_WHEEL_BASE) [m]: Measure the distance from the back to the front wheels.
2. [RA_MAX_STR_ANG](#RA_MAX_STR_ANG) [deg]: Measure the maximum steering angle.
3. (Optional) [RA_STR_RATE_LIM](#RA_STR_RATE_LIM) [deg/s]: Maximum steering rate you want to allow for your rover.
:::tip
This value depends on your rover and use case.
For bigger rovers there might be a mechanical limit that is easy to identify by steering the rover at a standstill and increasing
[RA_STR_RATE_LIM](#RA_STR_RATE_LIM) until you observe the steering rate to no longer be limited by the parameter.
For smaller rovers you might observe the steering to be too aggressive. Set [RA_STR_RATE_LIM](#RA_STR_RATE_LIM) to a low value and steer the rover at a standstill.
Increase the parameter until you reach the maximum steering rate you are comfortable with.
:::
:::warning
A low maximum steering rate makes the rover worse at tracking steering setpoints, which can lead to a poor performance in the subsequent modes.
:::
### Differential
1. [RD_WHEEL_TRACK](#RD_WHEEL_TRACK) [m]: Measure the distance from the centre of the right wheel to the centre of the left wheel.
### Mecanum
1. [RM_WHEEL_TRACK](#RM_WHEEL_TRACK) [m]: Measure the distance from the centre of the right wheel to the centre of the left wheel.
## Speed Parameters
1. [RO_MAX_THR_SPEED](#RO_MAX_THR_SPEED) [m/s]: Drive the rover at full throttle and set this parameter to the observed value of the ground speed.
:::info
This parameter is also used for the feed-forward term of the closed loop speed control.
It will be further adjusted in the [velocity tuning](velocity_tuning.md) step.
:::
2. (Optional) [RO_ACCEL_LIM](#RO_ACCEL_LIM) [m/s^2]: Maximum acceleration you want to allow for your rover.
<a id="RO_ACCEL_LIM_CONSIDERATIONS"></a>
:::tip
Your rover has a maximum possible acceleration which is determined by the maximum torque the motor can supply.
This may or may not be appropriate for your vehicle and use case.
One approach to determine an appropriate value is:
1. From a standstill, give the rover full throttle until it reaches the maximum speed.
2. Disarm the rover and plot the `measured_speed_body_x` from [RoverVelocityStatus](../msg_docs/RoverVelocityStatus.md).
3. Divide the maximum speed by the time it took to reach it and set this as the value for [RO_ACCEL_LIM](#RO_ACCEL_LIM).
Some RC rovers have enough torque to lift up if the maximum acceleration is not limited.
If that is the case:
1. Set [RO_ACCEL_LIM](#RO_ACCEL_LIM) to a low value, give the rover full throttle from a standstill and observe its behaviour.
2. Increase [RO_ACCEL_LIM](#RO_ACCEL_LIM) until the rover starts to lift up during the acceleration.
3. Set [RO_ACCEL_LIM](#RO_ACCEL_LIM) to the highest value that does not cause the rover to lift up.
:::
3. (Optional) [RO_DECEL_LIM](#RO_DECEL_LIM) [m/s^2]: Maximum deceleration you want to allow for your rover.
:::tip
The same [considerations](#RO_ACCEL_LIM_CONSIDERATIONS) as in the configuration of [RO_ACCEL_LIM](#RO_ACCEL_LIM) apply.
:::
:::info
This parameter is also used for the calculation of the speed setpoint in modes that are [position controlled](position_tuning.md).
:::
You can now continue the configuration process with [rate tuning](rate_tuning.md).
## Parameter Overview
| Parameter | Description | Unit |
| ----------------------------------------------------------------------------------------------------------- | ------------------------------------------ | ------- |
| <a id="RO_MAX_THR_SPEED"></a>[RO_MAX_THR_SPEED](../advanced_config/parameter_reference.md#RO_MAX_THR_SPEED) | Speed the rover drives at maximum throttle | $m/s$ |
| <a id="RO_ACCEL_LIM"></a>[RO_ACCEL_LIM](../advanced_config/parameter_reference.md#RO_ACCEL_LIM) | (Optional) Maximum allowed acceleration | $m/s^2$ |
| <a id="RO_DECEL_LIM"></a>[RO_DECEL_LIM](../advanced_config/parameter_reference.md#RO_DECEL_LIM) | (Optional) Maximum allowed deceleration | $m/s^2$ |
### Ackermann Specific
| Parameter | Description | Unit |
| -------------------------------------------------------------------------------------------------------- | ---------------------------------------- | ----- |
| <a id="RA_WHEEL_BASE"></a>[RA_WHEEL_BASE](../advanced_config/parameter_reference.md#RA_WHEEL_BASE) | Wheel base | $m$ |
| <a id="RA_MAX_STR_ANG"></a>[RA_MAX_STR_ANG](../advanced_config/parameter_reference.md#RA_MAX_STR_ANG) | Maximum steering angle | $deg$ |
| <a id="RA_STR_RATE_LIM"></a>[RA_STR_RATE_LIM](../advanced_config/parameter_reference.md#RA_STR_RATE_LIM) | (Optional) Maximum allowed steering rate | deg/s |
### Differential Specific
| Parameter | Description | Unit |
| ----------------------------------------------------------------------------------------------------- | ----------- | ---- |
| <a id="RD_WHEEL_TRACK"></a>[RD_WHEEL_TRACK](../advanced_config/parameter_reference.md#RD_WHEEL_TRACK) | Wheel track | m |
### Mecanum Specific
| Parameter | Description | Unit |
| ----------------------------------------------------------------------------------------------------- | ----------- | ---- |
| <a id="RM_WHEEL_TRACK"></a>[RM_WHEEL_TRACK](../advanced_config/parameter_reference.md#RM_WHEEL_TRACK) | Wheel track | m |
+376
View File
@@ -0,0 +1,376 @@
# Configuration/Tuning (Differential Rover)
This topic provides a step-by-step guide for setting up your [Differential rover](../frames_rover/differential.md).
Successive steps enable [drive modes](../flight_modes_rover/differential.md) with more autopilot support and features.
::: warning
Each step is dependent on the previous steps having been completed.
Modes will only work properly if the preceding modes have been configured.
:::
## Basic Setup
To configure the differential rover frame and outputs:
1. Enable Rover support by flashing the [PX4 rover build](../frames_rover/index.md#flashing-the-rover-build) onto your flight controller.
Note that this is a special build that contains rover-specific modules.
2. In the [Airframe](../config/airframe.md) configuration select _Generic Rover Differential_ frame:
![QGC screenshot showing selection of the airframe 'Generic Rover Differential'](../../assets/config/airframe/airframe_generic_rover_differential.png)
Select the **Apply and Restart** button.
::: info
If this airframe is not displayed and you have checked that you are using rover firmware (not the default), you can alternatively enable this frame by setting the [SYS_AUTOSTART](../advanced_config/parameter_reference.md#SYS_AUTOSTART) parameter to `50000`.
:::
3. Use [Actuators Configuration & Testing](../config/actuators.md) to map the motor functions to flight controller outputs.
## Manual Mode
::: warning
For this mode to work properly the [Basic Setup](#basic-setup) must've already been completed!
:::
The basic setup already covers the minimum setup required to use the rover in [Manual mode](../flight_modes_rover/differential.md#manual-mode).
This mode is also affected by (optional) acceleration/deceleration limits.
As configuration of these limits becomes mandatory for subsequent modes, we do this setup here.
Navigate to [Parameters](../advanced_config/parameters.md) in QGroundControl and set the following parameters:
1. [RD_WHEEL_TRACK](#RD_WHEEL_TRACK) [m]: Measure the distance from the centre of the right wheel to the centre of the left wheel.
![Wheel track](../../assets/airframes/rover/rover_differential/wheel_track.png)
2. [RO_MAX_THR_SPEED](#RO_MAX_THR_SPEED) [m/s]: Drive the rover at full throttle and set this parameter to the observed value of the ground speed.
:::info
This parameter is also used for the feed-forward term of the speed control.
It will be further tuned in the configuration of [Position mode](#position-mode).
:::
3. (Optional) [RO_ACCEL_LIM](#RO_ACCEL_LIM) [m/s^2]: Maximum acceleration you want to allow for your rover.
<a id="RO_ACCEL_LIM_CONSIDERATIONS"></a>
:::tip
Your rover has a maximum possible acceleration which is determined by the maximum torque the motor can supply.
This may or may not be appropriate for your vehicle and use case.
One approach to determine an appropriate value is:
1. From a standstill, give the rover full throttle until it reaches the maximum speed.
2. Disarm the rover and plot the `measured_speed_body_x` from [RoverVelocityStatus](../msg_docs/RoverVelocityStatus.md).
3. Divide the maximum speed by the time it took to reach it and set this as the value for [RO_ACCEL_LIM](#RO_ACCEL_LIM).
Some RC rovers have enough torque to lift up if the maximum acceleration is not limited.
If that is the case:
4. Set [RO_ACCEL_LIM](#RO_ACCEL_LIM) to a low value, give the rover full throttle from a standstill and observe its behaviour.
5. Increase [RO_ACCEL_LIM](#RO_ACCEL_LIM) until the rover starts to lift up during the acceleration.
6. Set [RO_ACCEL_LIM](#RO_ACCEL_LIM) to the highest value that does not cause the rover to lift up.
:::
4. (Optional) [RO_DECEL_LIM](#RO_DECEL_LIM) [m/s^2]: Maximum deceleration you want to allow for your rover.
:::tip
The same [considerations](#RO_ACCEL_LIM_CONSIDERATIONS) as in the configuration of [RO_ACCEL_LIM](#RO_ACCEL_LIM) apply.
:::
:::info
This parameter is also used for the calculation of the speed setpoint during [Auto modes](#auto-modes).
:::
## Acro Mode
::: warning
For this mode to work properly [Manual mode](#manual-mode) must've already been configured!
:::
To set up [Acro mode](../flight_modes_rover/differential.md#acro-mode), navigate to [Parameters](../advanced_config/parameters.md) in QGroundControl and set the following parameters:
1. [RO_YAW_RATE_LIM](#RO_YAW_RATE_LIM) [deg/s]: This is the maximum yaw rate you want to allow for your rover.
This will define the stick-to-yaw-rate mapping for all manual modes using closed loop yaw control and set an upper limit for the yaw rate setpoint for all [auto modes](#auto-modes).
1. [RD_MAX_THR_YAW_R](#RD_MAX_THR_YAW_R) [m/s]: This parameter is used to calculate the feed-forward term of the closed loop yaw rate control.
The controller calculates the required speed difference between the left and right motor to achieve the desired yaw rate.
This desired speed difference is then linearly mapped to normalized motor commands.
To get a good starting value for this parameter drive the rover in manual mode forwards at full throttle and note the ground speed of the vehicle.
Then enter _half_ this value for the parameter.
<a id="RD_YAW_RATE_P_TUNING"></a>
::: tip
To further tune this parameter, first make sure you set [RO_YAW_RATE_P](#RO_YAW_RATE_P) and [RO_YAW_RATE_I](#RO_YAW_RATE_I) to zero.
This way the yaw rate is only controlled by the feed-forward term, which makes it easier to tune.
Now put the rover in [Acro mode](../flight_modes_rover/differential.md#acro-mode) and then move the right-stick of your controller to the right and/or left and hold it at a few different levels for a couple of seconds each.
Disarm the rover and from the flight log plot the `adjusted_yaw_rate_setpoint` from [RoverRateStatus](../msg_docs/RoverRateStatus.md) and the `measured_yaw_rate` from [RoverRateStatus](../msg_docs/RoverRateStatus.md) over each other.
If the actual yaw rate of the rover is higher than the yaw rate setpoint, increase [RD_MAX_THR_YAW_R](#RD_MAX_THR_YAW_R).
If it is the other way around decrease the parameter and repeat until you are satisfied with the setpoint tracking.
:::
1. [RO_YAW_RATE_P](#RO_YAW_RATE_P) [-]: Proportional gain of the closed loop yaw rate controller.
Unlike the feed-forward part of the controller, the closed loop yaw rate control will compare the yaw rate setpoint with the measured yaw rate and adapt to motor commands based on the error between them.
The proportional gain is multiplied with this error and that value is added to the motor command.
This compensates for disturbances such as uneven ground and external forces.
::: tip
This parameter can be tuned the same way as [RD_MAX_THR_YAW_R](#RD_YAW_RATE_P_TUNING).
If you tuned [RD_MAX_THR_YAW_R](#RD_MAX_THR_YAW_R) well, you might only need a very small value.
:::
1. [RO_YAW_RATE_I](#RO_YAW_RATE_I) [-]: Integral gain of the closed loop yaw controller.
The integral gain accumulates the error between the desired and actual yaw rate scaled by the integral gain over time and that value is added to the motor command.
::: tip
An integrator might not be neccessary at this stage, but it will become important for subsequent modes.
:::
1. (Optional) [RO_YAW_ACCEL_LIM](#RO_YAW_ACCEL_LIM) and [RO_YAW_DECEL_LIM](#RO_YAW_DECEL_LIM) [deg/s^2]:
This is the maximum yaw acceleration and deceleration you want to allow for your rover.
This can be used to smooth the `yaw_rate` setpoints and make their trajectory feasible based on the physical limitations of the rover.
It also improves tracking and avoid integrator build up.
::: tip
Your rover has a maximum possible yaw acceleration/deceleration which is determined by the maximum torque the motor can supply.
This may or may not be appropriate for your vehicle and use case.
One approach to determine an appropriate value is:
1. Put the rover into [Manual mode](../flight_modes_rover/differential.md#manual-mode).
2. From a standstill, move the right stick all the way to the right or left until the rover reaches the maximum yaw rate then return the right stick to the middle.
3. Disarm the rover and plot the `measured_yaw_rate` from [RoverRateStatus](../msg_docs/RoverRateStatus.md).
4. Divide the maximum yaw rate by the time it took to reach it and set this as the value for [RO_YAW_ACCEL_LIM](#RO_YAW_ACCEL_LIM).
5. Divide the maximum yaw rate by the time it took to return to a standstill and set this as the value for [RO_YAW_ACCEL_LIM](#RO_YAW_ACCEL_LIM).
:::
The rover is now ready to drive in [Acro mode](../flight_modes_rover/differential.md#acro-mode).
## Stabilized Mode
::: warning
For this mode to work properly [Acro mode](#acro-mode) must've already been configured!
:::
For [Stabilized mode](../flight_modes_rover/differential.md#stabilized-mode) the controller utilizes a closed loop yaw controller, which creates a yaw rate setpoint to control the yaw when it is active:
![Cascaded PID for yaw control](../../assets/airframes/rover/rover_differential/cascaded_pid_for_yaw.png)
Unlike the closed loop yaw rate, this controller has no feed-forward term.
Therefore you only need to tune the closed loop gains:
1. [RO_YAW_P](#RO_YAW_P) [-]: Proportional gain for the closed loop yaw controller.
::: tip
In stabilized mode the closed loop yaw control is only active when driving a straight line (no yaw rate input).
1. Start with a value of 1 for [RO_YAW_P](#RO_YAW_P).
2. Put the rover into stabilized mode and move the left stick of your controller up and/or down to drive forwards/backwards.
3. Disarm the rover and from the flight log plot the `measured_yaw` and the `adjusted_yaw_setpoint` from the [RoverAttitudeStatus](../msg_docs/RoverAttitudeStatus.md) message over each other.
4. Increase/Decrease the parameter until you are satisfied with the setpoint tracking.
:::
::: info
For the closed loop yaw control an integrator gain is useful because this setpoint is often constant for a while and an integrator eliminates steady state errors that can cause the rover to never reach the setpoint.
Since the yaw and yaw rate controllers are cascaded, there only needs to be one integrator which is in the yaw rate controller.
If you observe a steady state error in the yaw setpoint increase the [RO_YAW_RATE_I](#RO_YAW_RATE_I) parameter.
:::
The rover is now ready to drive in [Stabilized mode](../flight_modes_rover/differential.md#stabilized-mode).
## Position Mode
:::warning
For this mode to work properly [Stabilized mode](#stabilized-mode) must already be configured!
:::
[Position mode](../flight_modes_rover/differential.md#position-mode) is the most advanced manual mode, utilizing closed loop yaw rate, yaw and speed control and leveraging position estimates.
To configure set the following parameters:
1. [RO_SPEED_LIM](#RO_SPEED_LIM) [m/s]: This is the maximum speed you want to allow for your rover.
This will define the stick-to-speed mapping for position mode and set an upper limit for the speed setpoint for all [auto modes](#auto-modes).
2. [RO_MAX_THR_SPEED](#RO_MAX_THR_SPEED) [m/s]: This parameter is used to calculate the feed-forward term of the closed loop speed control which linearly maps desired speeds to normalized motor commands.
A good starting point is the observed ground speed when the rover drives at maximum throttle in [Manual mode](../flight_modes_rover/differential.md#manual-mode).
<a id="RD_SPEED_P_TUNING"></a>
::: tip
To further tune this parameter:
1. Set [RO_SPEED_P](#RO_SPEED_P) and [RO_SPEED_I](#RO_SPEED_I) to zero.
This way the speed is only controlled by the feed-forward term, which makes it easier to tune.
2. Put the rover in [Position mode](../flight_modes_rover/differential.md#position-mode) and then move the left stick of your controller up and/or down and hold it at a few different levels for a couple of seconds each.
3. Disarm the rover and from the flight log plot the `adjusted_speed_body_x_setpoint` and the `measured_speed_body_x` from the [RoverVelocityStatus](../msg_docs/RoverVelocityStatus.md) message over each other.
4. If the actual speed of the rover is higher than the speed setpoint, increase [RO_MAX_THR_SPEED](#RO_MAX_THR_SPEED).
If it is the other way around decrease the parameter and repeat until you are satisfied with the setpoint tracking.
:::
::: info
If your rover oscillates when driving a straight line in [Position mode](../flight_modes_rover/differential.md#position-mode) just set this parameter to the observed ground speed at maximum throttle in [Manual mode](../flight_modes_rover/differential.md#manual-mode) and complete steps 5-7 first before continuing the tuning of the closed loop speed control (Steps 2-4).
:::
3. [RO_SPEED_P](#RO_SPEED_P) [-]: Proportional gain of the closed loop speed controller.
::: tip
This parameter can be tuned the same way as [RO_MAX_THR_SPEED](#RD_SPEED_P_TUNING).
If you tuned [RO_MAX_THR_SPEED](#RO_MAX_THR_SPEED) well, you might only need a very small value.
:::
4. [RO_SPEED_I](#RO_SPEED_I) [-]: Integral gain for the closed loop speed controller.
::: tip
For the closed loop speed control an integrator gain is useful because this setpoint is often constant for a while and an integrator eliminates steady state errors that can cause the rover to never reach the setpoint.
:::
5. [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN): When driving in a straight line (no yaw rate input) position mode leverages the same path following algorithm used in [auto modes](#auto-modes) called [pure pursuit](#pure-pursuit-guidance-logic) to achieve the best possible straight line driving behaviour ([Illustration of control architecture](#pure_pursuit_controller)).
This parameter determines how aggressive the controller will steer towards the path.
::: tip
Decreasing the parameter makes it more aggressive but can lead to oscillations.
To tune this:
1. Start with a value of 1 for [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN)
2. Put the rover in [Position mode](../flight_modes_rover/differential.md#position-mode) and while driving a straight line at approximately half the maximum speed observe its behaviour.
3. If the rover does not drive in a straight line, reduce the value of the parameter, if it oscillates around the path increase the value.
4. Repeat until you are satisfied with the behaviour.
:::
6. [PP_LOOKAHD_MIN](#PP_LOOKAHD_MIN): Minimum threshold for the lookahead distance used by the [pure pursuit algorithm](#pure-pursuit-guidance-logic).
::: tip
Put the rover in [Position mode](../flight_modes_rover/differential.md#position-mode) and drive at very low speeds, if the rover starts to oscillate even though the tuning of [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN) was good for medium speeds, then increase the value of [PP_LOOKAHD_MIN](#PP_LOOKAHD_MIN).
:::
7. [PP_LOOKAHD_MAX](#PP_LOOKAHD_MAX): Maximum threshold for the lookahead distance used by [pure pursuit](#pure-pursuit-guidance-logic).
::: tip
Put the rover in [Position mode](../flight_modes_rover/differential.md#position-mode) and drive at very high speeds, if the rover does not drive in a straight line even though the tuning of [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN) was good for medium speeds, then decrease the value of [PP_LOOKAHD_MAX](#PP_LOOKAHD_MAX).
:::
The rover is now ready to drive in [Position mode](../flight_modes_rover/differential.md#position-mode).
## Auto Modes
::: warning
For this mode to work properly [Position mode](#position-mode) must already be configured!
:::
<a id="pure_pursuit_controller"></a>
In [auto modes](../flight_modes_rover/differential.md#auto-modes) the autopilot takes over navigation tasks using the following control architecture:
![Pure Pursuit Controller](../../assets/airframes/rover/rover_differential/pure_pursuit_controller.png)
The required parameters are separated into the following sections:
### Speed
These parameters are used to calculate the speed setpoint in auto modes:
1. [RO_DECEL_LIM](#RO_DECEL_LIM) ($m/s^2$) and [RO_JERK_LIM](#RO_JERK_LIM) ($m/s^3$) are used to calculate a velocity trajectory such that the rover comes to a smooth stop as it reaches a waypoint.
::: tip
Plan a mission for the rover to drive a square and observe how it slows down when approaching a waypoint:
- If the rover decelerates too quickly decrease the [RO_DECEL_LIM](#RO_DECEL_LIM) parameter, if it starts slowing down too early increase the parameter.
- If you observe a jerking motion as the rover slows down, decrease the [RO_JERK_LIM](#RO_JERK_LIM) parameter otherwise increase it as much as possible as it can interfere with the tuning of [RO_DECEL_LIM](#RO_DECEL_LIM).
These two parameters have to be tuned as a pair, repeat until you are satisfied with the behaviour.
:::
2. Plot the `adjusted_speed_body_x_setpoint` and `measured_speed_body_x` from the [RoverVelocityStatus](../msg_docs/RoverVelocityStatus.md) message over each other.
If the tracking of these setpoints is not satisfactory adjust the values for [RO_SPEED_P](#RO_SPEED_P) and [RO_SPEED_I](#RO_SPEED_I).
The rover only slows down when approaching the waypoint if the angle between the line segment between the previous/current waypoint and current/next waypoint is smaller than 180° - [RD_TRANS_DRV_TRN](#RD_TRANS_DRV_TRN).
In other words: The rover slows down only if the expected heading error towards the next waypoint when arriving at the current waypoint is below [RD_TRANS_DRV_TRN](#RD_TRANS_DRV_TRN).
![Illustration of the activation threshold of the slow down effect](../../assets/airframes/rover/rover_differential/differential_slow_down_effect.png)
For more information on the [RD_TRANS_DRV_TRN](#RD_TRANS_DRV_TRN) parameter see [State Machine](#state-machine).
### State Machine
The module employs the following state machine to make full use of a differential rovers ability to turn on the spot:
![Differential state machine](../../assets/airframes/rover/rover_differential/differential_state_machine.png)
These transition thresholds can be set with [RD_TRANS_DRV_TRN](#RD_TRANS_DRV_TRN) and [RD_TRANS_TRN_DRV](#RD_TRANS_TRN_DRV).
### Path Following
The [pure pursuit](#pure-pursuit-guidance-logic) algorithm is used to calculate a desired yaw for the vehicle that is then close loop controlled.
The close loop yaw rate was tuned in the configuration of the [Stabilized mode](#stabilized-mode) and the pure pursuit was tuned when setting up the [Position mode](#position-mode).
During any auto navigation task observe the behaviour of the rover.
If you are unsatisfied with the path following, there are 3 steps to take:
1. Plot the `adjusted_yaw_rate_setpoint` and the `measured_yaw_rate` from the [RoverRateStatus](../msg_docs/RoverRateStatus.md) over each other.
If the tracking of these setpoints is not satisfactory adjust the values for [RO_YAW_RATE_P](#RO_YAW_RATE_P) and [RO_YAW_RATE_I](#RO_YAW_RATE_I).
2. Plot the `adjusted_yaw_setpoint` and the `measured_yaw` from the [RoverAttitudeStatus](../msg_docs/RoverAttitudeStatus.md) over each other.
If the tracking of these setpoints is not satisfactory adjust the value for [RO_YAW_P](#RO_YAW_RATE_P) and potentially further tune [RO_YAW_RATE_I](#RO_YAW_RATE_I).
3. Steps 1 and 2 ensures accurate setpoint tracking, if the path following is still unsatisfactory you need to further tune the [pure pursuit](#pure-pursuit-guidance-logic) parameters.
## Pure Pursuit Guidance Logic
The desired yaw setpoints are generated using a pure pursuit algorithm:
The controller takes the intersection point between a circle around the vehicle and a line segment.
In mission mode this line is usually constructed by connecting the previous and current waypoint:
![Pure Pursuit Algorithm](../../assets/airframes/rover/flight_modes/pure_pursuit_algorithm.png)
The radius of the circle around the vehicle is used to tune the controller and is often referred to as look-ahead distance.
The look ahead distance sets how aggressive the controller behaves and is defined as $l_d = v \cdot k$.
It depends on the velocity $v$ of the rover and a tuning parameter $k$ that can be set with the parameter [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN).
::: info
A lower value of [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN) makes the controller more aggressive but can lead to oscillations!
:::
The lookahead is constrained between [PP_LOOKAHD_MAX](#PP_LOOKAHD_MAX) and [PP_LOOKAHD_MIN](#PP_LOOKAHD_MIN).
If the distance from the path to the rover is bigger than the lookahead distance, the rover will target the point on the path that is closest to the rover.
To summarize, the following parameters can be used to tune the controller:
| Parameter | Description | Unit |
| -------------------------------------------------------------------------------------------------------- | --------------------------------------- | ---- |
| <a id="PP_LOOKAHD_GAIN"></a>[PP_LOOKAHD_GAIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_GAIN) | Main tuning parameter | - |
| <a id="PP_LOOKAHD_MAX"></a>[PP_LOOKAHD_MAX](../advanced_config/parameter_reference.md#PP_LOOKAHD_MAX) | Maximum value for the look ahead radius | m |
| <a id="PP_LOOKAHD_MIN"></a>[PP_LOOKAHD_MIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_MIN) | Minimum value for the look ahead radius | m |
## Parameter Overview
List of all parameters of the differential rover module:
| Parameter | Description | Unit |
| ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | ------- |
| <a id="RD_WHEEL_TRACK"></a>[RD_WHEEL_TRACK](../advanced_config/parameter_reference.md#RD_WHEEL_TRACK) | Wheel track | m |
| <a id="RD_MAX_THR_YAW_R"></a>[RD_MAX_THR_YAW_R](../advanced_config/parameter_reference.md#RD_MAX_THR_YAW_R) | Yaw rate turning left/right wheels at max speed in opposite directions | m/s |
| <a id="RD_TRANS_DRV_TRN"></a>[RD_TRANS_DRV_TRN](../advanced_config/parameter_reference.md#RD_TRANS_DRV_TRN) | Heading error threshold to switch from driving to spot turning | deg |
| <a id="RD_TRANS_TRN_DRV"></a>[RD_TRANS_TRN_DRV](../advanced_config/parameter_reference.md#RD_TRANS_TRN_DRV) | Heading error threshold to switch from spot turning to driving | deg |
| <a id="RD_MISS_SPD_GAIN"></a>[RD_MISS_SPD_GAIN](../advanced_config/parameter_reference.md#RD_MISS_SPD_GAIN) | Tuning parameter for the speed reduction during waypoint transition | m/s |
| <a id="RO_YAW_RATE_LIM"></a>[RO_YAW_RATE_LIM](../advanced_config/parameter_reference.md#RO_YAW_RATE_LIM) | Maximum allowed yaw rate for the rover | deg/s |
| <a id="RO_YAW_RATE_P"></a>[RO_YAW_RATE_P](../advanced_config/parameter_reference.md#RO_YAW_RATE_P) | Proportional gain for yaw rate controller | - |
| <a id="RO_YAW_RATE_I"></a>[RO_YAW_RATE_I](../advanced_config/parameter_reference.md#RO_YAW_RATE_I) | Integral gain for yaw rate controller | - |
| <a id="RO_YAW_P"></a>[RO_YAW_P](../advanced_config/parameter_reference.md#RO_YAW_P) | Proportional gain for yaw controller | - |
| <a id="RO_MAX_THR_SPEED"></a>[RO_MAX_THR_SPEED](../advanced_config/parameter_reference.md#RO_MAX_THR_SPEED) | Speed the rover drives at maximum throttle | m/s |
| <a id="RO_SPEED_P"></a>[RO_SPEED_P](../advanced_config/parameter_reference.md#RO_SPEED_P) | Proportional gain for speed controller | - |
| <a id="RO_SPEED_I"></a>[RO_SPEED_I](../advanced_config/parameter_reference.md#RO_SPEED_I) | Integral gain for speed controller | - |
| <a id="RO_SPEED_LIM"></a>[RO_SPEED_LIM](../advanced_config/parameter_reference.md#RO_SPEED_LIM) | Maximum allowed speed for the rover (and default mission speed). | m/s |
| <a id="PP_LOOKAHD_GAIN"></a>[PP_LOOKAHD_GAIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_GAIN) | Main tuning parameter for pure pursuit | - |
| <a id="PP_LOOKAHD_MAX"></a>[PP_LOOKAHD_MAX](../advanced_config/parameter_reference.md#PP_LOOKAHD_MAX) | Maximum value for the look ahead radius of the pure pursuit algorithm | m |
| <a id="PP_LOOKAHD_MIN"></a>[PP_LOOKAHD_MIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_MIN) | Minimum value for the look ahead radius of the pure pursuit algorithm | m |
| <a id="RO_ACCEL_LIM"></a>[RO_ACCEL_LIM](../advanced_config/parameter_reference.md#RO_ACCEL_LIM) | (Optional) Maximum allowed acceleration | m/s^2 |
| <a id="RO_DECEL_LIM"></a>[RO_DECEL_LIM](../advanced_config/parameter_reference.md#RO_DECEL_LIM) | (Optional) Maximum allowed deceleration | m/s^2 |
| <a id="RO_JERK_LIM"></a>[RO_JERK_LIM](../advanced_config/parameter_reference.md#RO_JERK_LIM) | (Optional) Maximum allowed jerk | $m/s^3$ |
| <a id="RO_YAW_ACCEL_LIM"></a>[RO_YAW_ACCEL_LIM](../advanced_config/parameter_reference.md#RO_YAW_ACCEL_LIM) | (Optional) Maximum allowed yaw acceleration | m/s^2 |
| <a id="RO_YAW_DECEL_LIM"></a>[RO_YAW_DECEL_LIM](../advanced_config/parameter_reference.md#RO_YAW_DECEL_LIM) | (Optional) Maximum allowed yaw deceleration | m/s^2 |
## See Also
- [Drive Modes (Differential Rover)](../flight_modes_rover/differential.md).
-44
View File
@@ -1,44 +0,0 @@
# Rover Configuration/Tuning
This topic provides a step-by-step guide for setting up your rover.
Successive steps enable [drive modes](../flight_modes_rover/index.md) with more autopilot support and features:
| Step | Configuration | Unlocked PX4 Drive Mode |
| ---- | ------------------------------------- | ------------------------------------------------------------------------- |
| 1 | [Basic Setup](basic_setup.md) | [Full manual mode](../flight_modes_rover/manual.md#manual-mode) |
| 2 | [Rate Tuning](rate_tuning.md) | [Manual acro mode](../flight_modes_rover/manual.md#acro-mode) |
| 3 | [Attitude Tuning](attitude_tuning.md) | [Manual stabilized mode](../flight_modes_rover/manual.md#stabilized-mode) |
| 4 | [Velocity Tuning](velocity_tuning.md) | [Manual position mode](../flight_modes_rover/manual.md#manual-mode) |
| 5 | [Position Tuning](position_tuning.md) | [Auto modes](../flight_modes_rover/auto.md) |
::: warning
A drive mode will only work properly if all the configuration for the preceding modes has been completed.
:::
## Flashing the Rover Build
Rovers use a custom build that must be flashed onto your flight controller instead of the default PX4 build:
1. First build the rover firmware for your flight controller from the `main` branch (there is no release build, so you can't just select this build from QGroundControl).
To build for rover with the `make` command, replace the `_default` suffix with `_rover`.
For example, to build rover for px4_fmu-v6x boards, you would use the command:
```sh
make px4_fmu-v6x_rover
```
::: info
You can also enable the modules in default builds by adding these lines to your [board configuration](../hardware/porting_guide_config.md) (e.g. for fmu-v6x you might add them to [`main/boards/px4/fmu-v6x/default.px4board`](https://github.com/PX4/PX4-Autopilot/blob/main/boards/px4/fmu-v6x/default.px4board)):
```sh
CONFIG_MODULES_ROVER_ACKERMANN=y
CONFIG_MODULES_ROVER_DIFFERENTIAL=y
CONFIG_MODULES_ROVER_MECANUM=y
```
Note that adding the rover modules may lead to flash overflow, in which case you will need to disable modules that you do not plan to use (such as those related to multicopter or fixed wing).
:::
2. Load the **custom firmware** that you just built onto your flight controller (see [Loading Firmware > Installing PX4 Main, Beta or Custom Firmware](../config/firmware.md#installing-px4-main-beta-or-custom-firmware)).
+376
View File
@@ -0,0 +1,376 @@
# Configuration/Tuning (Mecanum Rover)
This topic provides a step-by-step guide for setting up your [Mecanum rover](../frames_rover/mecanum.md).
Successive steps enable [drive modes](../flight_modes_rover/mecanum.md) with more autopilot support and features.
::: warning
Each step is dependent on the previous steps having been completed.
Modes will only work properly if the preceding modes have been configured.
:::
## Basic Setup
To start using the mecanum rover:
1. Enable Rover support by flashing the [PX4 rover build](../frames_rover/index.md#flashing-the-rover-build) onto your flight controller.
Note that this is a special build that contains rover-specific modules.
2. In the [Airframe](../config/airframe.md) configuration select _Generic Rover Mecanum_ frame:
![QGC screenshot showing selection of the airframe 'Generic Rover Mecanum'](../../assets/config/airframe/airframe_generic_rover_mecanum.png)
Select the **Apply and Restart** button.
::: info
If this airframe does not show up in the UI, it can alternatively be selected by setting the [SYS_AUTOSTART](../advanced_config/parameter_reference.md#SYS_AUTOSTART) parameter to `52000`.
:::
3. Use [Actuators Configuration & Testing](../config/actuators.md) to map the motor functions to flight controller outputs.
## Manual Mode
::: warning
For this mode to work properly the [Basic Setup](#basic-setup) must've already been completed!
:::
The basic setup already covers the minimum setup required to use the rover in [Manual mode](../flight_modes_rover/mecanum.md#manual-mode).
This mode is also affected by (optional) acceleration/deceleration limits.
As configuration of these limits becomes mandatory for subsequent modes, we do this setup here.
Navigate to [Parameters](../advanced_config/parameters.md) in QGroundControl and set the following parameters:
1. [RM_WHEEL_TRACK](#RM_WHEEL_TRACK) [m]: Measure the distance from the centre of the right wheel to the centre of the left wheel.
![Wheel track](../../assets/airframes/rover/rover_differential/wheel_track.png)
2. [RO_MAX_THR_SPEED](#RO_MAX_THR_SPEED) [m/s]: Drive the rover at full throttle and set this parameter to the observed value of the ground speed.
:::info
This parameter is also used for the feed-forward term of the speed control.
It will be further tuned in the configuration of [Position mode](#position-mode).
:::
3. (Optional) [RO_ACCEL_LIM](#RO_ACCEL_LIM) [m/s^2]: Maximum acceleration you want to allow for your rover.
<a id="RO_ACCEL_LIM_CONSIDERATIONS"></a>
:::tip
Your rover has a maximum possible acceleration which is determined by the maximum torque the motor can supply.
This may or may not be appropriate for your vehicle and use case.
One approach to determine an appropriate value is:
1. From a standstill, give the rover full throttle until it reaches the maximum speed.
2. Disarm the rover and plot the `measured_speed_body_x` from [RoverVelocityStatus](../msg_docs/RoverVelocityStatus.md).
3. Divide the maximum speed by the time it took to reach it and set this as the value for [RO_ACCEL_LIM](#RO_ACCEL_LIM).
Some RC rovers have enough torque to lift up if the maximum acceleration is not limited.
If that is the case:
4. Set [RO_ACCEL_LIM](#RO_ACCEL_LIM) to a low value, give the rover full throttle from a standstill and observe its behaviour.
5. Increase [RO_ACCEL_LIM](#RO_ACCEL_LIM) until the rover starts to lift up during the acceleration.
6. Set [RO_ACCEL_LIM](#RO_ACCEL_LIM) to the highest value that does not cause the rover to lift up.
:::
4. (Optional) [RO_DECEL_LIM](#RO_DECEL_LIM) [m/s^2]: Maximum deceleration you want to allow for your rover.
:::tip
The same [considerations](#RO_ACCEL_LIM_CONSIDERATIONS) as in the configuration of [RO_ACCEL_LIM](#RO_ACCEL_LIM) apply.
:::
:::info
This parameter is also used for the calculation of the speed setpoint during [Auto modes](#auto-modes).
:::
## Acro Mode
::: warning
For this mode to work properly [Manual mode](#manual-mode) must've already been configured!
:::
To set up [Acro mode](../flight_modes_rover/mecanum.md#acro-mode) navigate to [Parameters](../advanced_config/parameters.md) in QGroundControl and set the following parameters:
1. [RO_YAW_RATE_LIM](#RO_YAW_RATE_LIM) [deg/s]: This is the maximum yaw rate you want to allow for your rover.
This will define the stick-to-yaw-rate mapping for all manual modes using closed loop yaw control and set an upper limit for the yaw rate setpoint for all [auto modes](#auto-modes).
1. [RM_MAX_THR_YAW_R](#RM_MAX_THR_YAW_R) [m/s]: This parameter is used to calculate the feed-forward term of the closed loop yaw rate control.
The controller calculates the required speed difference between the left and right motor to achieve the desired yaw rate.
This desired speed difference is then linearly mapped to normalized motor commands.
To get a good starting value for this parameter drive the rover in manual mode forwards at full throttle and note the ground speed of the vehicle.
Then enter _half_ this value for the parameter.
<a id="RM_YAW_RATE_P_TUNING"></a>
::: tip
To further tune this parameter, first make sure you set [RO_YAW_RATE_P](#RO_YAW_RATE_P) and [RO_YAW_RATE_I](#RO_YAW_RATE_I) to zero.
This way the yaw rate is only controlled by the feed-forward term, which makes it easier to tune.
Now put the rover in [Acro mode](../flight_modes_rover/mecanum.md#acro-mode) and then move the right-stick of your controller to the right and/or left and hold it at a few different levels for a couple of seconds each.
Disarm the rover and from the flight log plot the `adjusted_yaw_rate_setpoint` from [RoverRateStatus](../msg_docs/RoverRateStatus.md) and the `measured_yaw_rate` from [RoverRateStatus](../msg_docs/RoverRateStatus.md) over each other.
If the actual yaw rate of the rover is higher than the yaw rate setpoint, increase [RM_MAX_THR_YAW_R](#RM_MAX_THR_YAW_R).
If it is the other way around decrease the parameter and repeat until you are satisfied with the setpoint tracking.
:::
1. [RO_YAW_RATE_P](#RO_YAW_RATE_P) [-]: Proportional gain of the closed loop yaw rate controller.
Unlike the feed-forward part of the controller, the closed loop yaw rate control will compare the yaw rate setpoint with the measured yaw rate and adapt to motor commands based on the error between them.
The proportional gain is multiplied with this error and that value is added to the motor command.
This compensates for disturbances such as uneven ground and external forces.
::: tip
This parameter can be tuned the same way as [RM_MAX_THR_YAW_R](#RM_YAW_RATE_P_TUNING).
If you tuned [RM_MAX_THR_YAW_R](#RM_MAX_THR_YAW_R) well, you might only need a very small value.
:::
1. [RO_YAW_RATE_I](#RO_YAW_RATE_I) [-]: Integral gain of the closed loop yaw controller.
The integral gain accumulates the error between the desired and actual yaw rate scaled by the integral gain over time and that value is added to the motor command.
::: tip
An integrator might not be neccessary at this stage, but it will become important for subsequent modes.
:::
1. (Optional) [RO_YAW_ACCEL_LIM](#RO_YAW_ACCEL_LIM) and [RO_YAW_DECEL_LIM](#RO_YAW_DECEL_LIM) [deg/s^2]: This is the maximum yaw acceleration and deceleration you want to allow for your rover.
This can be used to smooth the `yaw_rate` setpoints and make their trajectory feasible based on the physical limitation on the rover to improve tracking and avoid integrator build up.
::: tip
Your rover has a maximum possible yaw acceleration/deceleration which is determined by the maximum torque the motor can supply.
This may or may not be appropriate for your vehicle and use case.
One approach to determine an appropriate value is:
1. Put the rover into [Manual mode](../flight_modes_rover/mecanum.md#manual-mode).
2. From a standstill, move the right stick all the way to the right or left until the rover reaches the maximum yaw rate then return the right stick to the middle.
3. Disarm the rover and plot the `measured_yaw_rate` from [RoverRateStatus](../msg_docs/RoverRateStatus.md).
4. Divide the maximum yaw rate by the time it took to reach it and set this as the value for [RO_YAW_ACCEL_LIM](#RO_YAW_ACCEL_LIM).
5. Divide the maximum yaw rate by the time it took to return to a standstill and set this as the value for [RO_YAW_ACCEL_LIM](#RO_YAW_ACCEL_LIM).
:::
The rover is now ready to drive in [Acro mode](../flight_modes_rover/mecanum.md#acro-mode).
## Stabilized Mode
::: warning
For this mode to work properly [Acro mode](#acro-mode) must've already been configured!
:::
For [Stabilized mode](../flight_modes_rover/mecanum.md#stabilized-mode) the controller utilizes a closed loop yaw controller, which creates a yaw rate setpoint to control the yaw when it is active:
![Cascaded PID for yaw control](../../assets/airframes/rover/rover_differential/cascaded_pid_for_yaw.png)
Unlike the closed loop yaw rate, this controller has no feed-forward term.
Therefore you only need to tune the closed loop gains:
1. [RO_YAW_P](#RO_YAW_P) [-]: Proportional gain for the closed loop yaw controller.
::: tip
In stabilized mode the closed loop yaw control is only active when driving a straight line (no yaw rate input).
Start with a value of 1 for [RO_YAW_P](#RO_YAW_P).
Put the rover into stabilized mode and move the left stick of your controller up and/or down to drive forwards/backwards.
Disarm the rover and from the flight log plot the `measured_yaw` and the `adjusted_yaw_setpoint` from the [RoverAttitudeStatus](../msg_docs/RoverAttitudeStatus.md) message over each other.
Increase/Decrease the parameter until you are satisfied with the setpoint tracking.
:::
::: info
For the closed loop yaw control an integrator gain is useful because this setpoint is often constant for a while and an integrator eliminates steady state errors that can cause the rover to never reach the setpoint.
Since the yaw and yaw rate controllers are cascaded, there only needs to be one integrator which is in the yaw rate controller.
If you observe a steady state error in the yaw setpoint increase the [RO_YAW_RATE_I](#RO_YAW_RATE_I) parameter.
:::
The rover is now ready to drive in [Stabilized mode](../flight_modes_rover/mecanum.md#stabilized-mode).
## Position Mode
:::warning
For this mode to work properly [Stabilized mode](#stabilized-mode) must already be configured!
:::
[Position mode](../flight_modes_rover/mecanum.md#position-mode) is the most advanced manual mode, utilizing closed loop yaw rate, yaw and speed control and leveraging position estimates.
To configure set the following parameters:
::: info
The speed control in longitudinal and lateral direction use the same tuning parameters.
:::
1. [RO_SPEED_LIM](#RO_SPEED_LIM) [m/s]: This is the maximum speed you want to allow for your rover.
This will define the stick-to-speed mapping for position mode and set an upper limit for the speed setpoint for all [auto modes](#auto-modes).
For mecanum rovers the speed is defined in the direction of travel (magnitude of the velocity vector consisting of the longitudinal and lateral speed).
2. [RO_MAX_THR_SPEED](#RO_MAX_THR_SPEED) [m/s]: This parameter is used to calculate the feed-forward term of the closed loop speed control which linearly maps desired speeds to normalized motor commands.
A good starting point is the observed ground speed when the rover drives at maximum throttle in [Manual mode](../flight_modes_rover/mecanum.md#manual-mode).
<a id="RD_SPEED_P_TUNING"></a>
::: tip
To further tune this parameter:
1. Set [RO_SPEED_P](#RO_SPEED_P) and [RO_SPEED_I](#RO_SPEED_I) to zero.
This way the speed is only controlled by the feed-forward term, which makes it easier to tune.
2. Put the rover in [Position mode](../flight_modes_rover/mecanum.md#position-mode) and then move the left stick of your controller up and/or down and hold it at a few different levels for a couple of seconds each.
3. Disarm the rover and from the flight log plot the `adjusted_speed_body_x_setpoint` and the `measured_speed_body_x` from the [RoverVelocityStatus](../msg_docs/RoverVelocityStatus.md) message over each other.
4. If the actual speed of the rover is higher than the speed setpoint, increase [RO_MAX_THR_SPEED](#RO_MAX_THR_SPEED).
If it is the other way around decrease the parameter and repeat until you are satisfied with the setpoint tracking.
:::
::: info
If your rover oscillates when driving a straight line in [Position mode](../flight_modes_rover/mecanum.md#position-mode) just set this parameter to the observed ground speed at maximum throttle in [Manual mode](../flight_modes_rover/mecanum.md#manual-mode) and complete steps 5-7 first before continuing the tuning of the closed loop speed control (Steps 2-4).
:::
3. [RO_SPEED_P](#RO_SPEED_P) [-]: Proportional gain of the closed loop speed controller.
::: tip
This parameter can be tuned the same way as [RO_MAX_THR_SPEED](#RD_SPEED_P_TUNING).
If you tuned [RO_MAX_THR_SPEED](#RO_MAX_THR_SPEED) well, you might only need a very small value.
:::
4. [RO_SPEED_I](#RO_SPEED_I) [-]: Integral gain for the closed loop speed controller.
::: tip
For the closed loop speed control an integrator gain is useful because this setpoint is often constant for a while and an integrator eliminates steady state errors that can cause the rover to never reach the setpoint.
:::
5. [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN): When driving in a straight line (no yaw rate input) position mode leverages the same path following algorithm used in [auto modes](#auto-modes) called [pure pursuit](#pure-pursuit-guidance-logic) to achieve the best possible straight line driving behaviour ([Illustration of control architecture](#pure_pursuit_controller)).
This parameter determines how aggressive the controller will steer towards the path.
::: tip
Decreasing the parameter makes it more aggressive but can lead to oscillations.
To tune this:
1. Start with a value of 1 for [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN)
2. Put the rover in [Position mode](../flight_modes_rover/mecanum.md#position-mode) and while driving a straight line at approximately half the maximum speed observe its behaviour.
3. If the rover does not drive in a straight line, reduce the value of the parameter, if it oscillates around the path increase the value.
4. Repeat until you are satisfied with the behaviour.
:::
6. [PP_LOOKAHD_MIN](#PP_LOOKAHD_MIN): Minimum threshold for the lookahead distance used by the [pure pursuit algorithm](#pure-pursuit-guidance-logic).
::: tip
Put the rover in [Position mode](../flight_modes_rover/mecanum.md#position-mode) and drive at very low speeds, if the rover starts to oscillate even though the tuning of [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN) was good for medium speeds, then increase the value of [PP_LOOKAHD_MIN](#PP_LOOKAHD_MIN).
:::
7. [PP_LOOKAHD_MAX](#PP_LOOKAHD_MAX): Maximum threshold for the lookahead distance used by [pure pursuit](#pure-pursuit-guidance-logic).
::: tip
Put the rover in [Position mode](../flight_modes_rover/mecanum.md#position-mode) and drive at very high speeds, if the rover does not drive in a straight line even though the tuning of [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN) was good for medium speeds, then decrease the value of [PP_LOOKAHD_MAX](#PP_LOOKAHD_MAX).
:::
The rover is now ready to drive in [Position mode](../flight_modes_rover/mecanum.md#position-mode).
## Auto Modes
::: warning
For this mode to work properly [Position mode](#position-mode) must already be configured!
:::
<a id="pure_pursuit_controller"></a>
In [auto modes](../flight_modes_rover/mecanum.md#auto-modes) the autopilot takes over navigation tasks using the following control architecture:
![Pure Pursuit Controller](../../assets/airframes/rover/rover_mecanum/auto_control_structure_mecanum.png)
The mecanum module fully leverages the omnidirectionality of this type of rover by maintaining the initial heading of the rover during the entire mission (see [Pure Pursuit Guidance Logic](#pure-pursuit-guidance-logic)).
The required parameters are separated into the following sections:
### Speed
These parameters are used to calculate the velocity setpoint in auto modes:
1. [RO_SPEED_LIM](#RO_SPEED_LIM): Sets the default speed ($m/s$) for the rover during the mission (as well as the maximum speed).
For mecanum rovers the speed is defined in the direction of travel (magnitude of the velocity vector consisting of the longitudinal and lateral speed).
2. [RO_DECEL_LIM](#RO_DECEL_LIM) ($m/s^2$) and [RO_JERK_LIM](#RO_JERK_LIM) ($m/s^3$) are used to calculate a velocity trajectory such that the rover comes to a smooth stop as it reaches a waypoint.
::: tip
Plan a mission for the rover to drive a square and observe how it slows down when approaching a waypoint:
- If the rover decelerates too quickly decrease the [RO_DECEL_LIM](#RO_DECEL_LIM) parameter, if it starts slowing down too early increase the parameter.
- If you observe a jerking motion as the rover slows down, decrease the [RO_JERK_LIM](#RO_JERK_LIM) parameter otherwise increase it as much as possible as it can interfere with the tuning of [RO_DECEL_LIM](#RO_DECEL_LIM).
These two parameters have to be tuned as a pair, repeat until you are satisfied with the behaviour.
:::
3. [RM_MISS_SPD_GAIN](#RM_MISS_SPD_GAIN): The rover slows down when approaching a waypoint based on the angle between the line segment from the previous to current waypoint and current to next waypoint.
How much the rover slows down can be tuned with this parameter:
$$
v_{transition} = v_{max} \cdot (1 - \theta_{normalized} * k)
$$
with:
- $v_{transition}:$ Transition speed
- $v_{max}:$ Maximum speed ([RO_SPEED_LIM](#RO_SPEED_LIM))
- $\theta_{normalized}:$ Angle between the line segment of the prev-current and current-next waypoints, normalized from $[0\degree, 180\degree]$ to $[0, 1]$
- $k:$ Tuning parameter ([RM_MISS_SPD_GAIN](#RM_MISS_SPD_GAIN)).
4. Plot the `adjusted_speed_body_x_setpoint` and `measured_speed_body_x` from the [RoverVelocityStatus](../msg_docs/RoverVelocityStatus.md) message over each other.
If the tracking of these setpoints is not satisfactory adjust the values for [RO_SPEED_P](#RO_SPEED_P) and [RO_SPEED_I](#RO_SPEED_I).
### Path Following
The [pure pursuit](#pure-pursuit-guidance-logic) algorithm is used to calculate a desired bearing for the vehicle that is then close loop controlled.
For mecanum rovers the path following is achieved by directly controlling the velocity of the rover in direction of the desired bearing.
During any auto navigation task observe the behaviour of the rover:
1. If you are unsatisfied with the path following you need to further tune the [pure pursuit](#pure-pursuit-guidance-logic) parameters.
2. If the rover does not maintain its initial heading well enough, adjust the value for [RO_YAW_P](#RO_YAW_RATE_P) and potentially further tune [RO_YAW_RATE_I](#RO_YAW_RATE_I).
## Pure Pursuit Guidance Logic
The desired bearing setpoints are generated using a pure pursuit algorithm:
The controller takes the intersection point between a circle around the vehicle and a line segment.
In mission mode this line is usually constructed by connecting the previous and current waypoint:
![Pure Pursuit Algorithm](../../assets/airframes/rover/rover_mecanum/mecanum_pure_pursuit.png)
The radius of the circle around the vehicle is used to tune the controller and is often referred to as look-ahead distance.
The look ahead distance sets how aggressive the controller behaves and is defined as $l_d = v \cdot k$.
It depends on the velocity $v$ of the rover and a tuning parameter $k$ that can be set with the parameter [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN).
::: info
A lower value of [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN) makes the controller more aggressive but can lead to oscillations!
:::
The lookahead is constrained between [PP_LOOKAHD_MAX](#PP_LOOKAHD_MAX) and [PP_LOOKAHD_MIN](#PP_LOOKAHD_MIN).
If the distance from the path to the rover is bigger than the lookahead distance, the rover will target the point on the path that is closest to the rover.
To summarize, the following parameters can be used to tune the controller:
| Parameter | Description | Unit |
| -------------------------------------------------------------------------------------------------------- | --------------------------------------- | ---- |
| <a id="PP_LOOKAHD_GAIN"></a>[PP_LOOKAHD_GAIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_GAIN) | Main tuning parameter | - |
| <a id="PP_LOOKAHD_MAX"></a>[PP_LOOKAHD_MAX](../advanced_config/parameter_reference.md#PP_LOOKAHD_MAX) | Maximum value for the look ahead radius | m |
| <a id="PP_LOOKAHD_MIN"></a>[PP_LOOKAHD_MIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_MIN) | Minimum value for the look ahead radius | m |
## Parameter Overview
List of all parameters of the mecanum rover module:
| Parameter | Description | Unit |
| ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | ------- |
| <a id="RM_WHEEL_TRACK"></a>[RM_WHEEL_TRACK](../advanced_config/parameter_reference.md#RM_WHEEL_TRACK) | Wheel track | m |
| <a id="RM_MAX_THR_YAW_R"></a>[RM_MAX_THR_YAW_R](../advanced_config/parameter_reference.md#RM_MAX_THR_YAW_R) | Yaw rate turning left/right wheels at max speed in opposite directions | m/s |
| <a id="RM_MISS_SPD_GAIN"></a>[RM_MISS_SPD_GAIN](../advanced_config/parameter_reference.md#RM_MISS_SPD_GAIN) | Tuning parameter for the velocity reduction during waypoint transition | - |
| <a id="RM_COURSE_CTL_TH"></a>[RM_COURSE_CTL_TH](../advanced_config/parameter_reference.md#RM_COURSE_CTL_TH) | Threshold to update course control in manual position mode | rad |
| <a id="RO_YAW_RATE_LIM"></a>[RO_YAW_RATE_LIM](../advanced_config/parameter_reference.md#RO_YAW_RATE_LIM) | Maximum allowed yaw rate for the rover | deg/s |
| <a id="RO_YAW_RATE_P"></a>[RO_YAW_RATE_P](../advanced_config/parameter_reference.md#RO_YAW_RATE_P) | Proportional gain for yaw rate controller | - |
| <a id="RO_YAW_RATE_I"></a>[RO_YAW_RATE_I](../advanced_config/parameter_reference.md#RO_YAW_RATE_I) | Integral gain for yaw rate controller | - |
| <a id="RO_YAW_P"></a>[RO_YAW_P](../advanced_config/parameter_reference.md#RO_YAW_P) | Proportional gain for yaw controller | - |
| <a id="RO_SPEED_LIM"></a>[RO_SPEED_LIM](../advanced_config/parameter_reference.md#RO_SPEED_LIM) | Maximum allowed speed for the rover (and default mission speed). | m/s |
| <a id="RO_MAX_THR_SPEED"></a>[RO_MAX_THR_SPEED](../advanced_config/parameter_reference.md#RO_MAX_THR_SPEED) | Speed the rover drives at maximum throttle | m/s |
| <a id="RO_SPEED_P"></a>[RO_SPEED_P](../advanced_config/parameter_reference.md#RO_SPEED_P) | Proportional gain for speed controller | - |
| <a id="RO_SPEED_I"></a>[RO_SPEED_I](../advanced_config/parameter_reference.md#RO_SPEED_I) | Integral gain for speed controller | - |
| <a id="PP_LOOKAHD_GAIN"></a>[PP_LOOKAHD_GAIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_GAIN) | Main tuning parameter for pure pursuit | - |
| <a id="PP_LOOKAHD_MAX"></a>[PP_LOOKAHD_MAX](../advanced_config/parameter_reference.md#PP_LOOKAHD_MAX) | Maximum value for the look ahead radius of the pure pursuit algorithm | m |
| <a id="PP_LOOKAHD_MIN"></a>[PP_LOOKAHD_MIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_MIN) | Minimum value for the look ahead radius of the pure pursuit algorithm | m |
| <a id="RO_ACCEL_LIM"></a>[RO_ACCEL_LIM](../advanced_config/parameter_reference.md#RO_ACCEL_LIM) | (Optional) Maximum allowed acceleration | m/s^2 |
| <a id="RO_DECEL_LIM"></a>[RO_DECEL_LIM](../advanced_config/parameter_reference.md#RO_DECEL_LIM) | (Optional) Maximum allowed deceleration | m/s^2 |
| <a id="RO_JERK_LIM"></a>[RO_JERK_LIM](../advanced_config/parameter_reference.md#RO_JERK_LIM) | (Optional) Maximum allowed jerk | $m/s^3$ |
| <a id="RO_YAW_ACCEL_LIM"></a>[RO_YAW_ACCEL_LIM](../advanced_config/parameter_reference.md#RO_YAW_ACCEL_LIM) | (Optional) Maximum allowed yaw acceleration | m/s^2 |
| <a id="RO_YAW_DECEL_LIM"></a>[RO_YAW_DECEL_LIM](../advanced_config/parameter_reference.md#RO_YAW_DECEL_LIM) | (Optional) Maximum allowed yaw deceleration | m/s^2 |
## See Also
- [Drive Modes (Mecanum Rover)](../flight_modes_rover/mecanum.md).
-199
View File
@@ -1,199 +0,0 @@
# Position Tuning
Position tuning is required in order to use [Auto modes](../flight_modes_rover/auto.md).
:::warning
The [velocity tuning](velocity_tuning.md) must've already been completed before this step!
:::
The position controller is responsible for autonomously guiding the vehicle to a position setpoint.
These position setpoints are automatically generated by the internal PX4 auto modes (Mission, Return, GoTo, ...) or can directly be sent to the rover through the `RoverPositionSetpoint.msg` (External Modes).
A path is generated for the rover to reach its destination, which tracked through a path following algorithm called [pure pursuit](#pure-pursuit-guidance-logic-info-only).
To tune the position controller configure the [parameters](../advanced_config/parameters.md) in the following sections (using QGroundControl).
## Speed
1. (Optional) [RO_SPEED_RED](#RO_SPEED_RED): Tuning parameter for the speed reduction based on the course error.
This can be used to limit the maximum allowed speed based on the difference between the current course and the bearing setpoint:
$v*{max} = v*{full throttle} \cdot (1 - \theta\_{normalized} \cdot k) $
with
- $v_{max}:$ Maximum speed
- $v_{full throttle}:$ Speed at maximum throttle [RO_MAX_THR_SPEED](../advanced_config/parameter_reference.md#RO_MAX_THR_SPEED).
- $\theta_{normalized}:$ Course error (Course - bearing setpoint) normalized from $[0\degree, 180\degree]$ to $[0, 1]$
- $k:$ Tuning parameter [RO_SPEED_RED](#RO_SPEED_RED)
::: info
This parameter is used to calculate the speed at which the vehicle arrives at a waypoint based on the upcoming corner.
Set to -1 to disable course error based speed reduction.
:::
2. (Optional) [RO_DECEL_LIM](../advanced_config/parameter_reference.md#RO_DECEL_LIM) [m/s^2] and [RO_JERK_LIM](../advanced_config/parameter_reference.md#RO_JERK_LIM) [m/s^3] are used to calculate a speed trajectory such that the rover reaches the next waypoint with the calculated cornering speed.
::: tip
Plan a mission for the rover to drive a square and observe how it slows down when approaching a waypoint:
- If the rover decelerates too quickly decrease the [RO_DECEL_LIM](../advanced_config/parameter_reference.md#RO_DECEL_LIM) parameter, if it starts slowing down too early increase the parameter.
- If you observe a jerking motion as the rover slows down, decrease the [RO_JERK_LIM](../advanced_config/parameter_reference.md#RO_JERK_LIM) parameter otherwise increase it as much as possible as it can interfere with the tuning of [RO_DECEL_LIM](../advanced_config/parameter_reference.md#RO_DECEL_LIM).
These two parameters have to be tuned as a pair, repeat until you are satisfied with the behaviour.
:::
3. Plot the `adjusted_speed_body_x_setpoint` and `measured_speed_body_x` from the [RoverVelocityStatus](../msg_docs/RoverVelocityStatus.md) message over each other.
If the tracking of these setpoints is not satisfactory adjust the values for [RO_SPEED_P](../advanced_config/parameter_reference.md#RO_SPEED_P) and [RO_SPEED_I](../advanced_config/parameter_reference.md#RO_SPEED_I).
## Path Following
The [pure pursuit](#pure-pursuit-guidance-logic-info-only) algorithm is used to calculate a bearing setpoint for the vehicle that is then close loop controlled.
The following parameters are used to tune the algorithm:
1. [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN): When driving in a straight line (right stick centered) position mode leverages the same path following algorithm used in [auto modes](../flight_modes_rover/auto.md) called [pure pursuit](#pure-pursuit-guidance-logic-info-only) to achieve the best possible straight line driving behaviour.
This parameter determines how aggressive the controller will steer towards the path.
::: tip
Decreasing the parameter makes it more aggressive but can lead to oscillations.
To tune this:
1. Start with a value of 1 for [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN)
2. Put the rover in [Position mode](../flight_modes_rover/manual.md#position-mode) and while driving a straight line at approximately half the maximum speed observe its behaviour.
3. If the rover does not drive in a straight line, reduce the value of the parameter, if it oscillates around the path increase the value.
4. Repeat until you are satisfied with the behaviour.
:::
2. [PP_LOOKAHD_MIN](#PP_LOOKAHD_MIN): Minimum threshold for the lookahead distance used by the [pure pursuit algorithm](#pure-pursuit-guidance-logic-info-only).
::: tip
Put the rover in [Position mode](../flight_modes_rover/manual.md#position-mode) and drive at very low speeds, if the rover starts to oscillate even though the tuning of [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN) was good for medium speeds, then increase the value of [PP_LOOKAHD_MIN](#PP_LOOKAHD_MIN).
:::
3. [PP_LOOKAHD_MAX](#PP_LOOKAHD_MAX): Maximum threshold for the lookahead distance used by [pure pursuit](#pure-pursuit-guidance-logic-info-only).
::: tip
Put the rover in [Position mode](../flight_modes_rover/manual.md#position-mode) and drive at very high speeds, if the rover does not drive in a straight line even though the tuning of [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN) was good for medium speeds, then decrease the value of [PP_LOOKAHD_MAX](#PP_LOOKAHD_MAX).
:::
During any auto navigation task observe the behaviour of the rover and if you are unsatisfied with the path following, there are 2 steps to take:
1. Check if all the setpoints ([rate](rate_tuning.md), [attitude](attitude_tuning.md) and [velocity](velocity_tuning.md)) are properly tracked.
2. Further tune the [path following algorithm](#path-following).
## Ackermann Rover Only
Ackermann rovers employ a special cornering logic causing the rover to "cut corners" to achieve a smooth trajectory.
This is done by scaling the acceptance radius based on the corner the rover has to drive (for geometric explanation see [Cornering logic](#corner-cutting-logic-info-only)).
![Cornering Comparison](../../assets/config/rover/ackermann_cornering_comparison.png)
The degree to which corner cutting is allowed can be tuned, or disabled, with the following parameters:
::: info
The corner cutting effect is a tradeoff between how close you get to the waypoint and the smoothness of the trajectory.
:::
1. [NAV_ACC_RAD](../advanced_config/parameter_reference.md#NAV_ACC_RAD) [m]: Default acceptance radius
This is also used as a lower bound for the acceptance radius scaling.
2. [RA_ACC_RAD_MAX](#RA_ACC_RAD_MAX) [m]: The maximum the acceptance radius can be scaled to.
Set equal to [NAV_ACC_RAD](../advanced_config/parameter_reference.md#NAV_ACC_RAD) to disable the corner cutting effect.
3. [RA_ACC_RAD_GAIN](#RA_ACC_RAD_GAIN) [-]: This tuning parameter is a multiplicand on the [calculated ideal acceptance radius](#corner-cutting-logic-info-only) to account for dynamic effects.
:::tip
Initially set this parameter to `1`.
If you observe the rover overshooting the corner, increase this parameter until you are satisfied with the behaviour.
Note that the scaling of the acceptance radius is limited by [RA_ACC_RAD_MAX](#RA_ACC_RAD_MAX).
:::
### Corner Cutting Logic (Info only)
To enable a smooth trajectory, the acceptance radius of waypoints is scaled based on the angle between a line segment from the current-to-previous and current-to-next waypoints.
The ideal trajectory would be to arrive at the next line segment with the heading pointing towards the next waypoint.
For this purpose the minimum turning circle of the rover is inscribed tangentially to both line segments.
![Cornering Logic](../../assets/config/rover/ackermann_cornering_logic.png)
The acceptance radius of the waypoint is set to the distance from the waypoint to the tangential points between the circle and the line segments:
$$
\begin{align*}
r_{min} &= \frac{L}{\sin\left( \delta_{max}\right) } \\
\theta &= \frac{1}{2}\arccos\left( \frac{\vec{a}*\vec{b}}{|\vec{a}||\vec{b}|}\right) \\
r_{acc} &= \frac{r_{min}}{\tan\left( \theta\right) }
\end{align*}
$$
| Symbol | Description | Unit |
| -------------- | ---------------------------------- | ---- |
| $\vec{a}$ | Vector from current to previous WP | m |
| $\vec{b}$ | Vector from current to next WP | m |
| $r_{min}$ | Minimum turn radius | m |
| $\delta_{max}$ | Maximum steer angle | m |
| $r_{acc}$ | Acceptance radius | m |
## Differential Rover Only
Differential rovers employ the following state machine to make full use of a differential rovers ability to turn on the spot:
![Differential state machine](../../assets/config/rover/differential_state_machine.png)
These transition thresholds can be set with [RD_TRANS_DRV_TRN](#RD_TRANS_DRV_TRN) and [RD_TRANS_TRN_DRV](#RD_TRANS_TRN_DRV).
In mission modes [RD_TRANS_DRV_TRN](#RD_TRANS_DRV_TRN) is also used to slow down the rover to a standstill, if the transition angle between the waypoints exceeds this threshold:
![Differential slow down effect](../../assets/config/rover/differential_slow_down_effect.png)
## Pure Pursuit Guidance Logic (Info Only)
The desired bearing setpoints are generated using the pure pursuit algorithm.
The controller takes the intersection point between a circle around the vehicle and a line segment.
When targeting a position setpoint this line is constructed from the current position to the destination or when executing a mission it is usually constructed by connecting the previous and current waypoint.
![Pure Pursuit Algorithm](../../assets/config/rover/pure_pursuit_algorithm.png)
The radius of the circle around the vehicle is used to tune the controller and is often referred to as look-ahead distance.
The look-ahead distance sets how aggressive the controller behaves and is defined as $l_d = v \cdot k$.
It depends on the velocity $v$ of the rover and a tuning parameter $k$ that can be set with the parameter [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN).
::: info
A lower value of [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN) makes the controller more aggressive but can lead to oscillations!
:::
The lookahead is constrained between [PP_LOOKAHD_MAX](#PP_LOOKAHD_MAX) and [PP_LOOKAHD_MIN](#PP_LOOKAHD_MIN).
If the distance from the path to the rover is bigger than the lookahead distance, the rover will target the point on the path that is closest to the rover.
## Position Controller Structure (Info Only)
This section provides additional information for developers and people with experience in control system design.
The position controller uses the following structure:
![Rover Position Controller](../../assets/config/rover/rover_position_controller.png)
## Parameter Overview
| Parameter | Description | Unit |
| -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ---- |
| <a id="RO_SPEED_RED"></a>[RO_SPEED_RED](../advanced_config/parameter_reference.md#RO_SPEED_RED) | (Optional) Tuning parameter for the speed reduction based on the course error | - |
| <a id="PP_LOOKAHD_GAIN"></a>[PP_LOOKAHD_GAIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_GAIN) | Pure pursuit: Main tuning parameter | - |
| <a id="PP_LOOKAHD_MAX"></a>[PP_LOOKAHD_MAX](../advanced_config/parameter_reference.md#PP_LOOKAHD_MAX) | Pure pursuit: Maximum value for the look ahead radius | m |
| <a id="PP_LOOKAHD_MIN"></a>[PP_LOOKAHD_MIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_MIN) | Pure pursuit: Minimum value for the look ahead radius | m |
## Ackermann Specific
| Parameter | Description | Unit |
| -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ---- |
| <a id="RA_ACC_RAD_MAX"></a>[RA_ACC_RAD_MAX](../advanced_config/parameter_reference.md#RA_ACC_RAD_MAX) | (Optional) Maximum radius the acceptance radius can be scaled to | m |
| <a id="RA_ACC_RAD_GAIN"></a>[RA_ACC_RAD_GAIN](../advanced_config/parameter_reference.md#RA_ACC_RAD_GAIN) | (Optional) Tuning parameter for the acceptance radius scaling | - |
## Differential Specific
| Parameter | Description | Unit |
| ----------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | ---- |
| <a id="RD_TRANS_DRV_TRN"></a>[RD_TRANS_DRV_TRN](../advanced_config/parameter_reference.md#RD_TRANS_DRV_TRN) | Heading error threshold to switch from driving to spot turning | deg |
| <a id="RD_TRANS_TRN_DRV"></a>[RD_TRANS_TRN_DRV](../advanced_config/parameter_reference.md#RD_TRANS_TRN_DRV) | Heading error threshold to switch from spot turning to driving | deg |
-140
View File
@@ -1,140 +0,0 @@
# Rate Tuning
Rate tuning is required to use [Acro mode](../flight_modes_rover/manual.md#acro-mode) and all later modes.
::: warning
The [Basic Setup](basic_setup.md) must've already been completed before this step!
:::
Configure the following [parameters](../advanced_config/parameters.md) in QGroundControl:
1. [RO_YAW_RATE_LIM](#RO_YAW_RATE_LIM): Maximum yaw rate you want to allow for your rover.
:::tip
Limiting the yaw rate is necessary if the rover is prone rolling over, loosing traction at high speeds or if passenger comfort is important.
Small rovers especially can be prone to rolling over when steering aggressively at high speeds.
If this is the case:
1. In [Acro mode](../flight_modes_rover/manual.md#acro-mode), set [RO_YAW_RATE_LIM](#RO_YAW_RATE_LIM) to a small value, drive the rover at full throttle and steer all the way to the left or right.
2. Increase [RO_YAW_RATE_LIM](#RO_YAW_RATE_LIM) until the wheels of the rover start to lift up.
3. Set [RO_YAW_RATE_LIM](#RO_YAW_RATE_LIM) to the highest value that does not cause the rover to lift up.
If you see no need to limit the yaw rate, set this parameter to the maximum yaw rate the rover can achieve:
1. In [Manual mode](../flight_modes_rover/manual.md#manual-mode) drive the rover at full throttle and with the maximum steering angle.
2. Plot the `measured_yaw_rate` from [RoverRateStatus](../msg_docs/RoverRateStatus.md) and enter the highest observed value for [RO_YAW_RATE_LIM](#RO_YAW_RATE_LIM).
:::
2. (Optional) [RO_YAW_RATE_CORR](#RO_YAW_RATE_CORR) [-]: Yaw rate correction factor.
This can be used to scale the mapping from the yaw rate setpoint to the steering effort if it is offset from the [idealized mapping](#kinematic-models) (This could be due to wheel misalignments, excessive friction etc.).
::: info
Skid/tank-steered and mecanum rovers will most likely require this adjustment.
:::
:::tip
To tune this parameter, first make sure you set [RO_YAW_RATE_P](#RO_YAW_RATE_P) and [RO_YAW_RATE_I](#RO_YAW_RATE_I) to zero.
This way the yaw rate is only controlled by the feed-forward term, which makes it easier to tune.
Now put the rover in [Acro mode](../flight_modes_rover/manual.md#acro-mode) and then move the right-stick of your controller to the right and/or left and hold it at a few different levels for a couple of seconds each while driving with a constant throttle (for differential/mecanum rovers this can also be done while standing still).
Disarm the rover and from the flight log plot the `adjusted_yaw_rate_setpoint` from [RoverRateStatus](../msg_docs/RoverRateStatus.md) and the `measured_yaw_rate` from [RoverRateStatus](../msg_docs/RoverRateStatus.md) over each other.
If the actual yaw rate of the rover is higher than the yaw rate setpoint, decrease [RO_YAW_RATE_CORR](#RO_YAW_RATE_CORR) (between [0, 1]).
If it is the other way around increase the parameter [1, inf] and repeat until you are satisfied with the setpoint tracking.
:::
3. [RO_YAW_RATE_P](#RO_YAW_RATE_P) [-]: Proportional gain of the closed loop yaw rate controller.
The closed loop acceleration control will compare the yaw rate setpoint with the measured yaw rate and adapt the motor commands based on the error between them.
The proportional gain is multiplied with this error and that value is added to the motor command.
This compensates for disturbances such as uneven ground and external forces.
:::tip
To tune this parameter:
1. Put the rover in [Acro mode](../flight_modes_rover/manual.md#acro-mode) and hold the throttle stick and the right stick at a few different levels for a couple of seconds each.
1. Disarm the rover and from the flight log plot the `adjusted_yaw_rate_setpoint` and the `measured_yaw_rate` from [RoverRateStatus](../msg_docs/RoverRateStatus.md) over each other.
1. Increase [RO_YAW_RATE_P](#RO_YAW_RATE_P) if the measured value does not track the setpoint fast enough or decrease it if the measurement overshoots the setpoint by too much.
1. Repeat until you are satisfied with the behaviour.
:::
4. [RO_YAW_RATE_I](#RO_YAW_RATE_I) [-]: Integral gain of the closed loop yaw rate controller.
The integral gain accumulates the error between the desired and actual yaw rate scaled by the integral gain over time and that value is added to the motor command.
::: tip
An integrator might not be necessary at this stage, but it will become important for subsequent modes.
:::
5. (Optional) [RO_YAW_ACCEL_LIM](#RO_YAW_ACCEL_LIM)/[RO_YAW_DECEL_LIM](#RO_YAW_DECEL_LIM) [deg/s^2]: Used to limit the yaw acceleration/deceleration.
This can be used to smoothen the yaw rate setpoint trajectory.
6. (Optional) [RO_YAW_STICK_DZ](#RO_YAW_STICK_DZ) [-]: Percentage of yaw stick input range that will be interpreted as zero around the stick centered value.
7. (Advanced) [RO_YAW_RATE_TH](#RO_YAW_RATE_TH) [deg/s]: The minimum threshold for the yaw rate measurement not to be interpreted as zero.
This can be used to cut off measurement noise when the rover is standing still.
The rover is now ready to drive in [Acro mode](../flight_modes_rover/manual.md#acro-mode) and the configuration can be continued with [attitude tuning](attitude_tuning.md).
## Rate Controller Structure (Info Only)
This section provides additional information for developers and people with experience in control system design.
The rate controller uses the following structure:
![Rover Rate Controller](../../assets/config/rover/rover_rate_controller.png)
::: info
For ackermann rovers the yaw rate is only close loop controlled when driving forwards.
When driving backwards the yaw rate setpoint is directly mapped to a steering angle using the equation above.
This is due to the fact that rear wheel steering (driving a car with front-wheel steering backwards) is non-minimum-phase w.r.t to the yaw rate which leads to instabilities when doing closed loop control.
:::
The feed forward mapping is done using the kinematic model of the rover to translate the yaw rate setpoint to a normalized steering setpoint.
### Kinematic Models
#### Ackermann
<!-- prettier-ignore -->
$$ \delta = \arctan(\frac{w_b \cdot \dot{\psi}}{v}) $$
with
- $w_b:$ Wheel base,
- $\delta:$ Steering angle,
- $\dot{\psi}:$ Yaw rate
- $v:$ Forward speed.
The steering setpoint is equal to $\delta$ interpolated from [-[RA_MAX_STR_ANG](../advanced_config/parameter_reference.md#RA_MAX_STR_ANG), [RA_MAX_STR_ANG](../advanced_config/parameter_reference.md#RA_MAX_STR_ANG)] to [-1, 1].
For driving this means that the same right hand stick input will cause a different steering angle based on how fast you are driving.
By limiting the maximum yaw rate, we can restrict the steering angle based on the speed, which can prevent the rover from rolling over.
This mode will feel more like "driving a car" than [Manual mode](../flight_modes_rover/manual.md#manual-mode).
#### Differential/Mecanum
<!-- prettier-ignore -->
$$ v_{diff} = \frac{w_t \cdot \dot{\psi}}{2} $$
with
- $v_{diff}:$ Speed difference between the right/left wheels,
- $w_t:$ Wheel track ([RD_WHEEL_TRACK](../advanced_config/parameter_reference.md#RD_WHEEL_TRACK)),
- $\dot{\psi}:$ Yaw rate setpoint
The steering setpoint is equal to $v_{diff}$ interpolated from [-[RO_MAX_THR_SPEED](../advanced_config/parameter_reference.md#RO_MAX_THR_SPEED), [RO_MAX_THR_SPEED](../advanced_config/parameter_reference.md#RO_MAX_THR_SPEED)] to [-1, 1].
These mappings based on the idealized kinematic models can be adjusted with the multiplicative factor [RO_YAW_RATE_CORR](../advanced_config/parameter_reference.md#RO_YAW_RATE_CORR) to tune the feed forward part of the yaw rate controller to account for wheel misalignments, high friction etc.
## Parameter Overview
| Parameter | Description | Unit |
| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------- | --------- |
| <a id="RO_YAW_RATE_LIM"></a>[RO_YAW_RATE_LIM](../advanced_config/parameter_reference.md#RO_YAW_RATE_LIM) | Maximum allowed yaw rate | $m/s^2$ |
| <a id="RO_YAW_RATE_P"></a>[RO_YAW_RATE_P](../advanced_config/parameter_reference.md#RO_YAW_RATE_P) | Proportional gain for yaw rate controller | - |
| <a id="RO_YAW_RATE_I"></a>[RO_YAW_RATE_I](../advanced_config/parameter_reference.md#RO_YAW_RATE_I) | Integral gain for yaw rate controller | - |
| <a id="RO_YAW_STICK_DZ"></a>[RO_YAW_STICK_DZ](../advanced_config/parameter_reference.md#RO_YAW_STICK_DZ) | Yaw stick deadzone | - |
| <a id="RO_YAW_ACCEL_LIM"></a>[RO_YAW_ACCEL_LIM](../advanced_config/parameter_reference.md#RO_YAW_ACCEL_LIM) | (Optional) Yaw acceleration limit | $deg/s^2$ |
| <a id="RO_YAW_DECEL_LIM"></a>[RO_YAW_DECEL_LIM](../advanced_config/parameter_reference.md#RO_YAW_DECEL_LIM) | (Optional) Yaw deceleration limit | $deg/s^2$ |
| <a id="RO_YAW_RATE_CORR"></a>[RO_YAW_RATE_CORR](../advanced_config/parameter_reference.md#RO_YAW_RATE_CORR) | (Optional) Yaw rate correction factor | - |
| <a id="RO_YAW_RATE_TH"></a>[RO_YAW_RATE_TH](../advanced_config/parameter_reference.md#RO_YAW_RATE_TH) | (Advanced) Yaw rate measurement threshold | $deg/s$ |
-125
View File
@@ -1,125 +0,0 @@
# Velocity Tuning
:::warning
The [attitude tuning](attitude_tuning.md) must've already been completed before this step!
:::
::: info
To tune we will be using the manual [Position mode](../flight_modes_rover/manual.md#position-mode).
This mode requires a global position estimate (GPS) and tuning of some parameters that go beyond the velocity controller.
If you use a custom external flight mode that controls velocity but does not require a global position estimate you can ignore the [manual position mode parameters](#manual-position-mode-parameters).
:::
## Speed Parameters
To tune the velocity controller configure the following [parameters](../advanced_config/parameters.md) in QGroundControl:
1. [RO_SPEED_LIM](#RO_SPEED_LIM) [m/s]: This is the maximum speed you want to allow for your rover.
This will define the stick-to-speed mapping for [Position mode](../flight_modes_rover/manual.md#position-mode) and set an upper limit for the speed setpoint.
2. [RO_MAX_THR_SPEED](#RO_MAX_THR_SPEED) [m/s]: This parameter is used to calculate the feed-forward term of the closed loop speed control which linearly maps desired speeds to normalized motor commands.
As mentioned in the [Manual mode](../flight_modes_rover/manual.md#manual-mode) configuration , a good starting point is the observed ground speed when the rover drives at maximum throttle in [Manual mode](../flight_modes_rover/manual.md#manual-mode).
<a id="RA_SPEED_TUNING"></a>
::: tip
To further tune this parameter:
1. Set [RO_SPEED_P](#RO_SPEED_P) and [RO_SPEED_I](#RO_SPEED_I) to zero.
This way the speed is only controlled by the feed-forward term, which makes it easier to tune.
2. Put the rover in [Position mode](../flight_modes_rover/manual.md#position-mode) and then move the left stick of your controller up and/or down and hold it at a few different levels for a couple of seconds each.
3. Disarm the rover and from the flight log plot the `adjusted_speed_body_x_setpoint` and the `measured_speed_body_x` from the [RoverVelocityStatus](../msg_docs/RoverVelocityStatus.md) message over each other.
4. If the actual speed of the rover is higher than the speed setpoint, increase [RO_MAX_THR_SPEED](#RO_MAX_THR_SPEED).
If it is the other way around decrease the parameter and repeat until you are satisfied with the setpoint tracking.
:::
::: info
If your rover oscillates when driving a straight line in [Position mode](../flight_modes_rover/manual.md#position-mode), set this parameter to the observed ground speed at maximum throttle in [Manual mode](../flight_modes_rover/manual.md#manual-mode) and complete the tuning of the [manual position mode parameters](#manual-position-mode-parameters) first before continuing the tuning of the closed loop speed control.
:::
3. [RO_SPEED_P](#RO_SPEED_P) [-]: Proportional gain of the closed loop speed controller.
::: tip
This parameter can be tuned the same way as [RO_MAX_THR_SPEED](#RA_SPEED_TUNING).
If you tuned [RO_MAX_THR_SPEED](#RO_MAX_THR_SPEED) well, you might only need a very small value.
:::
4. [RO_SPEED_I](#RO_SPEED_I) [-]: Integral gain for the closed loop speed controller.
::: tip
For the closed loop speed control an integrator gain is useful because this setpoint is often constant for a while and an integrator eliminates steady state errors that can cause the rover to never reach the setpoint.
:::
5. (Advanced) [RO_SPEED_TH](#RO_SPEED_TH) [m/s]: The minimum threshold for the speed measurement not to be interpreted as zero.
This can be used to cut off measurement noise when the rover is standing still.
## Manual Position Mode Parameters
These steps are only necessary if you are tuning/want to unlock the manual [Position mode](../flight_modes_rover/manual.md#position-mode). Othwerwise, you can continue with [position tuning](position_tuning.md) where these same parameters will also be configured.
1. [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN): When driving in a straight line (right stick centered) position mode leverages the same path following algorithm used in [auto modes](../flight_modes_rover/auto.md) called [pure pursuit](position_tuning.md#pure-pursuit-guidance-logic-info-only) to achieve the best possible straight line driving behaviour.
This parameter determines how aggressive the controller will steer towards the path.
::: tip
Decreasing the parameter makes it more aggressive but can lead to oscillations.
To tune this:
1. Start with a value of 1 for [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN)
2. Put the rover in [Position mode](../flight_modes_rover/manual.md#position-mode) and while driving a straight line at approximately half the maximum speed observe its behaviour.
3. If the rover does not drive in a straight line, reduce the value of the parameter, if it oscillates around the path increase the value.
4. Repeat until you are satisfied with the behaviour.
:::
2. [PP_LOOKAHD_MIN](#PP_LOOKAHD_MIN): Minimum threshold for the lookahead distance used by the [pure pursuit algorithm](position_tuning.md#pure-pursuit-guidance-logic-info-only).
::: tip
Put the rover in [Position mode](../flight_modes_rover/manual.md#position-mode) and drive at very low speeds, if the rover starts to oscillate even though the tuning of [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN) was good for medium speeds, then increase the value of [PP_LOOKAHD_MIN](#PP_LOOKAHD_MIN).
:::
3. [PP_LOOKAHD_MAX](#PP_LOOKAHD_MAX): Maximum threshold for the lookahead distance used by [pure pursuit](position_tuning.md#pure-pursuit-guidance-logic-info-only).
::: tip
Put the rover in [Position mode](../flight_modes_rover/manual.md#position-mode) and drive at very high speeds, if the rover does not drive in a straight line even though the tuning of [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN) was good for medium speeds, then decrease the value of [PP_LOOKAHD_MAX](#PP_LOOKAHD_MAX).
:::
The rover is now ready to drive in [Position mode](../flight_modes_rover/manual.md#position-mode) and the configuration can be continued with [position tuning](position_tuning.md).
## Attitude Controller Structure (Info Only)
This section provides additional information for developers and people with experience in control system design.
The velocity vector is defined by the following two values:
1. The absolute speed [$m/s$]
2. The direction (bearing) [$rad$]
The speed controller uses the following structure:
![Rover Speed Controller](../../assets/config/rover/rover_speed_controller.png)
The feed forward mapping is done by interpolating the speed setpoint from [-[RO_MAX_THR_SPEED](../advanced_config/parameter_reference.md#RO_MAX_THR_SPEED), [RO_MAX_THR_SPEED](../advanced_config/parameter_reference.md#RO_MAX_THR_SPEED)] to [-1, 1].
For ackermann and differential rovers the bearing is aligned with the vehicle yaw. Therefor the bearing is simply sent as a yaw setpoint to the [yaw controller](attitude_tuning.md#attitude-controller-structure-info-only) and the speed setpoint is always defined in body x direction.
For mecanum vehicles, the bearing and yaw are decoupled. The direction is controlled by splitting the velocity vector into one speed component in body x direction and one in body y direction.
Both these setpoint are then sent to their own closed loop speed controllers.
## Parameter Overview
| Parameter | Description | Unit |
| ----------------------------------------------------------------------------------------------------------- | ------------------------------------------ | ----- |
| <a id="RO_MAX_THR_SPEED"></a>[RO_MAX_THR_SPEED](../advanced_config/parameter_reference.md#RO_MAX_THR_SPEED) | Speed the rover drives at maximum throttle | $m/s$ |
| <a id="RO_SPEED_LIM"></a>[RO_SPEED_LIM](../advanced_config/parameter_reference.md#RO_SPEED_LIM) | Maximum allowed speed | $m/s$ |
| <a id="RO_SPEED_P"></a>[RO_SPEED_P](../advanced_config/parameter_reference.md#RO_SPEED_P) | Proportional gain for speed controller | - |
| <a id="RO_SPEED_I"></a>[RO_SPEED_I](../advanced_config/parameter_reference.md#RO_SPEED_I) | Integral gain for speed controller | - |
| <a id="RO_SPEED_TH"></a>[RO_SPEED_TH](../advanced_config/parameter_reference.md#RO_SPEED_TH) | (Advanced) Speed measurement threshold | $m/s$ |
### Pure Pursuit
| Parameter | Description | Unit |
| -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | ---- |
| <a id="PP_LOOKAHD_GAIN"></a>[PP_LOOKAHD_GAIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_GAIN) | Pure pursuit: Main tuning parameter | - |
| <a id="PP_LOOKAHD_MAX"></a>[PP_LOOKAHD_MAX](../advanced_config/parameter_reference.md#PP_LOOKAHD_MAX) | Pure pursuit: Maximum value for the look ahead radius | m |
| <a id="PP_LOOKAHD_MIN"></a>[PP_LOOKAHD_MIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_MIN) | Pure pursuit: Minimum value for the look ahead radius | m |
+3 -3
View File
@@ -94,13 +94,13 @@ Exporting the messages allows ROS 2 and the uXRCE-DDS agent to be independent of
While `px4_msgs` has messages for all uORB topics in PX4, not all messages in `px4_msgs` are available to ROS 2/PlotJuggler by default.
The set that are available must be built into the client running on PX4.
These are defined in [dds_topics.yaml](../middleware/dds_topics.md).
These are defined in [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml).
The instructions below explain the changes needed to monitor topics that are not available by default.
### Missing Topics
If a normal uORB topic is not available in PlotJuggler you will need to modify the [dds_topics.yaml](../middleware/dds_topics.md) ([source](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml)) to include the topic and rebuild PX4.
If a normal uORB topic is not available in PlotJuggler you will need to modify the [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml) to include the topic and rebuild PX4.
If working with real hardware you will need to build and [install](../config/firmware.md#installing-px4-main-beta-or-custom-firmware) custom firmware after changing the YAML file.
@@ -120,7 +120,7 @@ cd ~/ros2_ws/ && colcon build
### Custom Topics
After defining the topic, follow the instructions above to add the topic to [dds_topics.yaml](../middleware/dds_topics.md), and export the new message into your ROS 2 workspace.
After defining the topic, follow the instructions above to add the topic to [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml), and export the new message into your ROS 2 workspace.
## See also
+2 -1
View File
@@ -126,7 +126,8 @@ In EKF2 mode, the replay will automatically create the ORB publisher rules descr
To perform an EKF2 replay:
- Record the original log with `SDLOG_MODE` set to `1` to log from boot.
- Record the original log.
Optionally set `SDLOG_MODE` to `1` to log from boot.
- In addition to the `replay` environment variable, set `replay_mode` to `ekf2`:
+2 -1
View File
@@ -7,7 +7,8 @@ For information about flight modes available to specific frames see the followin
- [Flight Modes (Multicopter)](../flight_modes_mc/index.md)
- [Flight Modes (Fixed-Wing)](../flight_modes_fw/index.md)
- [Flight Modes (VTOL)](../flight_modes_vtol/index.md)
- [Drive Modes (Rover)](../flight_modes_rover/index.md)
- [Drive Modes (Differential Rover)](../flight_modes_rover/differential.md)
- [Drive Modes (Ackermann Rover)](../flight_modes_rover/ackermann.md)
::: info
The mode sub-topics in this section contain information that is common to all vehicles, but may not be relevant to the normal/default setup.

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