diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 034f46e2b8..8065709d86 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,22 +1,9 @@ - ### Solved Problem -When ... I found that ... - Fixes #{Github issue ID} ### Solution -- Add ... for ... -- Refactor ... ### Changelog Entry For release notes: @@ -27,11 +14,10 @@ Documentation: Need to clarify page ... / done, read docs.px4.io/... ``` ### Alternatives -We could also ... ### Test coverage -- Unit/integration test: ... -- Simulation/hardware testing logs: https://review.px4.io/ ### Context Related links, screenshot before/after, video + +--> diff --git a/boards/beaglebone/blue/default.px4board b/boards/beaglebone/blue/default.px4board index 155e2fb7d1..42148e5013 100644 --- a/boards/beaglebone/blue/default.px4board +++ b/boards/beaglebone/blue/default.px4board @@ -14,6 +14,7 @@ CONFIG_DRIVERS_GPS=y CONFIG_DRIVERS_IMU_ANALOG_DEVICES_ADIS16448=y CONFIG_DRIVERS_IMU_INVENSENSE_ICM20948=y CONFIG_DRIVERS_IMU_INVENSENSE_MPU9250=y +CONFIG_DRIVERS_LINUX_PWM_OUT=y CONFIG_DRIVERS_MAGNETOMETER_HMC5883=y CONFIG_DRIVERS_RC_INPUT=y CONFIG_DRIVERS_SMART_BATTERY_BATMON=y @@ -30,8 +31,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_MODE_MANAGER=y CONFIG_MODULES_FW_LATERAL_LONGITUDINAL_CONTROL=y +CONFIG_MODULES_FW_MODE_MANAGER=y CONFIG_MODULES_FW_RATE_CONTROL=y CONFIG_MODULES_GIMBAL=y CONFIG_MODULES_GYRO_CALIBRATION=y diff --git a/docs/en/flight_controller/pixhawk_series.md b/docs/en/flight_controller/pixhawk_series.md index 3091a4afd8..cc92192d48 100644 --- a/docs/en/flight_controller/pixhawk_series.md +++ b/docs/en/flight_controller/pixhawk_series.md @@ -100,6 +100,24 @@ At very high level, the main differences are: +### FMUv6 Comparison + +| Feature | **FMUv6X-RT** | **FMUv6X** | **FMUv6C** | +| ------------------ | --------------------- | ----------------- | ------------------ | +| **FMU MCU** | NXP i.MX RT1176 | STM32H753 | STM32H743V | +| **RAM** | 2 MB | 1 MB | 1 MB | +| **Flash** | 64 MB Octal SPI | 2 MB internal | 2 MB internal | +| **IO MCU** | STM32F103 | STM32F103 | STM32F103 | +| **Secure Element** | NXP SE051 | NXP SE051 | Not supported | +| **PAB Standard** | Supported | Supported | Not supported | +| **Ethernet** | Supported | Supported | Not supported | +| **IMUs** | 3× | 3× | 2× | +| **Barometers** | 2× | 2× | 1× | +| **Magnetometer** | 1× | 1× | 1× | +| **FMU PWM** | 12× | 8× | 8× | +| **IO PWM** | 8× | 8× | 8× | +| **CAN Bus** | 3× | 2× | 2× | + ### Licensing and Trademarks Pixhawk project schematics and reference designs are licensed under [CC BY-SA 3](https://creativecommons.org/licenses/by-sa/3.0/legalcode). diff --git a/docs/en/gps_compass/index.md b/docs/en/gps_compass/index.md index 6b965d2fea..578e018871 100644 --- a/docs/en/gps_compass/index.md +++ b/docs/en/gps_compass/index.md @@ -196,6 +196,14 @@ It is possible to have low DOP (good satellite geometry) but still have high EPH EPH/EPV values therefore provide a more immediate and practical estimate of the actual GPS accuracy you can expect under current conditions. +### GNSS Position Fusion + +GNSS position fusion will not begin until yaw alignment is established. +If a magnetometer is available, the EKF aligns yaw using the magnetic heading, allowing GPS position fusion to start soon after boot. +If no magnetometer is present, the system must rely on GPS yaw (from a dual-antenna setup) or movement-based yaw estimation. +Until one of these provides a valid heading, the EKF will not start GPS position fusion, and the vehicle will remain in a “no position” state even though attitude data is valid. +This behavior prevents large position errors that could occur when the yaw reference is uncertain. + ## Developer Information - GPS/RTK-GPS diff --git a/docs/en/middleware/uxrce_dds.md b/docs/en/middleware/uxrce_dds.md index e931cda1a9..e50b3131e6 100644 --- a/docs/en/middleware/uxrce_dds.md +++ b/docs/en/middleware/uxrce_dds.md @@ -503,6 +503,11 @@ publications: - topic: /fmu/out/vehicle_trajectory_waypoint_desired type: px4_msgs::msg::VehicleTrajectoryWaypoint + - topic: /fmu/out/vehicle_imu + type: px4_msgs::msg::VehicleImu + rate_limit: 50. + instance: 1 # OPTIONAL + subscriptions: - topic: /fmu/in/offboard_control_mode @@ -535,6 +540,9 @@ Each (`topic`,`type`) pairs defines: 4. The message type (`VehicleOdometry`, `VehicleStatus`, `OffboardControlMode`, etc.) and the ROS 2 package (`px4_msgs`) that is expected to provide the message definition. 5. **(Optional)**: An additional `rate_limit` field (only for publication entries), which specifies the maximum rate (Hz) at which messages will be published on this topic by PX4 to ROS 2. If left unspecified, the maximum publication rate limit is set to 100 Hz. +6. **(Optional)**: An additional `instance` field (only for publication entries), which lets you select which instance of a [multi-instance topic](./uorb.md#multi-instance) you want to be published to ROS 2. + If provided, this option changes the ROS 2 topic name of the advertised uORB topic appending the instance number: `fmu/out/[uorb topic name][instance]` (plus eventual namespace and message version). + In the example above the final topic name would be `/fmu/out/vehicle_imu1`. `subscriptions` and `subscriptions_multi` allow us to choose the uORB topic instance that ROS 2 topics are routed to: either a shared instance that may also be getting updates from internal PX4 uORB publishers, or a separate instance that is reserved for ROS2 publications, respectively. Without this mechanism all ROS 2 messages would be routed to the _same_ uORB topic instance (because ROS 2 does not have the concept of [multiple topic instances](../middleware/uorb.md#multi-instance)), and it would not be possible for PX4 subscribers to differentiate between streams from ROS 2 or PX4 publishers. diff --git a/docs/en/modules/hello_sky.md b/docs/en/modules/hello_sky.md index ad1d9e5bc9..fd43f9cd97 100644 --- a/docs/en/modules/hello_sky.md +++ b/docs/en/modules/hello_sky.md @@ -434,6 +434,7 @@ The [complete example code](https://github.com/PX4/PX4-Autopilot/blob/main/src/e */ #include +#include #include #include #include diff --git a/docs/ko/SUMMARY.md b/docs/ko/SUMMARY.md index fc556f5949..d89ca451f9 100644 --- a/docs/ko/SUMMARY.md +++ b/docs/ko/SUMMARY.md @@ -182,6 +182,7 @@ - [Wiring Quickstart](assembly/quick_start_durandal.md) - [Holybro Pix32 v5](flight_controller/holybro_pix32_v5.md) - [Wiring Quickstart](assembly/quick_start_holybro_pix32_v5.md) + - [MicoAir H743 Lite](flight_controller/micoair743-lite.md) - [ModalAI VOXL 2](flight_controller/modalai_voxl_2.md) - [mRo Control Zero F7](flight_controller/mro_control_zero_f7.md) - [Radiolink PIX6](flight_controller/radiolink_pix6.md) @@ -504,6 +505,7 @@ - [UART/Serial 포트](uart/index.md) - [포트 설정 가능 시리얼 드라이버](uart/user_configurable_serial_driver.md) - [RTK GPS (통합)](advanced/rtk_gps.md) + - [PPS Time Synchronization](advanced/pps_time_sync.md) - [미들웨어](middleware/index.md) - [uORB 메시지 전송](middleware/uorb.md) - [uORB 그라프](middleware/uorb_graph.md) diff --git a/docs/ko/advanced/pps_time_sync.md b/docs/ko/advanced/pps_time_sync.md new file mode 100644 index 0000000000..f0a67858b9 --- /dev/null +++ b/docs/ko/advanced/pps_time_sync.md @@ -0,0 +1,135 @@ +# PPS Time Synchronization (PX4 Integration) + +[Pulse Per Second](https://en.wikipedia.org/wiki/Pulse-per-second_signal) (PPS) time synchronization provides high-precision timing for GNSS receivers. +This page explains how PPS is integrated into PX4 and how to configure it. + +## 개요 + +PPS (Pulse Per Second) is a timing signal provided by GNSS receivers that outputs an electrical pulse once per second, synchronized to UTC time. +The PPS signal provides a highly accurate timing reference that PX4 can use to: + +- Refine GNSS time measurements and compensate for clock drift +- Provide precise UTC timestamps for camera capture events (for photogrammetry and mapping applications) +- Enable offline position refinement through accurate time correlation + +## 지원 하드웨어 + +PPS time synchronization can be supported on flight controllers that have a hardware timer input pin that can be configured for PPS capture, by [enabling the PPS capture driver](#enable-pps-driver-in-board-configuration) in the board configuration. + +Supported boards include (at time of writing): + +- [Ark FMUv6x](../flight_controller/ark_v6x.md) +- Auterion FMUv6x +- Auterion FMUv6s + +## 설정 + +### Enable PPS Driver in Board Configuration + +The [PPS capture driver](../modules/modules_driver.md#pps-capture) must be enabled in the board configuration. +This is done by adding the following to your board's configuration: + +```ini +CONFIG_DRIVERS_PPS_CAPTURE=y +``` + +### Configure PPS Parameters + +The configuration varies depending on your flight controller hardware. + +#### FMUv6X + +For FMUv6X-based flight controllers, configure PWM AUX Timer 3 and Function 9: + +```sh +param set PWM_AUX_TIM3 -2 +param set PWM_AUX_FUNC9 2064 +param set PPS_CAP_ENABLE 1 +``` + +#### FMUv6S + +For FMUv6S-based flight controllers, configure PWM MAIN Timer 3 and Function 10: + +```sh +param set PWM_MAIN_TIM3 -2 +param set PWM_MAIN_FUNC10 2064 +param set PPS_CAP_ENABLE 1 +``` + +### 배선 + +The wiring configuration depends on your specific flight controller. + +#### Skynode X (FMUv6x) + +Connect the PPS signal from your GNSS module to the flight controller using the 11-pin or 6-pin GPS connector: + +For detailed pinout information, refer to: + +- [Skynode GPS Peripherals - Pinouts](https://docs.auterion.com/hardware-integration/skynode/peripherals/gps#pinouts) + +#### Skynode S (FMUv6S) + +For FMUv6S, you need to route the PPS signal separately: + +1. Connect your GNSS module using the standard 6-pin GPS connector: [Skynode S GPS Interface](https://docs.auterion.com/hardware-integration/skynode-s/interfaces#gps) +2. Connect the PPS signal from your GNSS module to the **PPM_IN** pin: [Skynode S Extras 1 Interface](https://docs.auterion.com/hardware-integration/skynode-s/interfaces#extras-1) + +#### ARK Jetson Carrier Board (FMUv6x) + +For ARK FMUv6X on the Jetson carrier board: + +1. Connect your GNSS module using either the 10-pin or 6-pin GPS connector: [ARK PAB GPS1 Interface](../flight_controller/ark_pab#gps1) +2. Connect the PPS signal to the **FMU_CAP** pin: [ARK PAB ADIO Interface](../flight_controller/ark_pab.md#adio) + +## 검증 + +After configuring PPS, you can verify that it is working correctly: + +1. Connect to the [PX4 System Console](../debug/system_console.md) (via MAVLink shell or serial console). + +2. Wait for GNSS fix. + +3. Check the PPS capture status to confirm it is up and running: + + ```sh + pps_capture status + ``` + +4. You can also check the [PpsCapture](../msg_docs/PpsCapture.md) uORB topic + + ```sh + listener pps_capture + ``` + + Where you should see: `timestamp`, `rtc_timestamp`, and `pps_rate_exceeded_counter`. + +### PPS Capture Driver + +The PPS capture driver is located in `src/drivers/pps_capture` and uses hardware timer input capture to precisely measure the arrival time of each PPS pulse. + +주요 기능: + +- Sub-microsecond pulse capture precision (hardware-dependent) +- Automatic drift calculation and compensation +- Integration with the GNSS driver for refined time stamping + +See also: + +- [PPS Capture Driver Documentation](../modules/modules_driver.md#pps-capture) +- [PpsCapture Message](../msg_docs/PpsCapture.md) + +### Time Synchronization Flow + +1. GNSS module sends position/time data at ~1-20 Hz. +2. GNSS module outputs PPS pulse at 1 Hz, precisely aligned to UTC second boundary. +3. PPS capture driver measures the exact time of the PPS pulse arrival using hardware timer. +4. Driver calculates the offset between GNSS time (from UART data) and autopilot clock (from PPS measurement). +5. This offset is used to correct GNSS timestamps and improve sensor fusion accuracy. + +The PPS signal provides much higher temporal precision than the transmitted time data, which has latency and jitter from serial communication. + +:::warning +If the PPS driver does not sending any data for 5 seconds (despite having `PPS_CAP_ENABLE` set to 1), the `EKF2_GPS_DELAY` will be used instead for estimating the latency. +::: diff --git a/docs/ko/advanced_config/bootloader_update_from_betaflight.md b/docs/ko/advanced_config/bootloader_update_from_betaflight.md index 4498e65fa6..e1c4203c71 100644 --- a/docs/ko/advanced_config/bootloader_update_from_betaflight.md +++ b/docs/ko/advanced_config/bootloader_update_from_betaflight.md @@ -89,7 +89,7 @@ Flight controllers that have bootloader PX4-Autopilot `make` targets, can build The list of controllers for which this applies can be obtained by running the following `make` command, and noting the `make` targets that end in `_bootloader` ``` -$make list_config_targets +$ make list_config_targets ... cuav_nora_bootloader diff --git a/docs/ko/flight_controller/autopilot_manufacturer_supported.md b/docs/ko/flight_controller/autopilot_manufacturer_supported.md index a1b565877e..177c99d284 100644 --- a/docs/ko/flight_controller/autopilot_manufacturer_supported.md +++ b/docs/ko/flight_controller/autopilot_manufacturer_supported.md @@ -30,6 +30,7 @@ This category includes boards that are not fully compliant with the pixhawk stan - [Holybro Kakute H7](../flight_controller/kakuteh7.md) - [Holybro Durandal](../flight_controller/durandal.md) - [Holybro Pix32 v5](../flight_controller/holybro_pix32_v5.md) +- [MicoAir H743 Lite](../flight_controller/micoair743-lite.md) - [ModalAI VOXL 2](../flight_controller/modalai_voxl_2.md) - [mRo Control Zero](../flight_controller/mro_control_zero_f7.md) - [Radiolink PIX6](../flight_controller/radiolink_pix6.md) diff --git a/docs/ko/flight_controller/micoair743-lite.md b/docs/ko/flight_controller/micoair743-lite.md new file mode 100644 index 0000000000..af6032f040 --- /dev/null +++ b/docs/ko/flight_controller/micoair743-lite.md @@ -0,0 +1,153 @@ +# MicoAir743-Lite + + + +:::warning +PX4 does not manufacture this (or any) autopilot. +Contact the [manufacturer](https://micoair.com/) for hardware support or compliance issues. +::: + +MicoAir743-Lite is an ultra-high performance H743 flight controller with an unbeatable price, featuring the ICM45686 IMU sensor and integrated Bluetooth telemetry. + +![MicoAir743-Lite Front View](../../assets/flight_controller/micoair743_lite/front_view.png) + +Equipped with a high-performance H7 processor, the MicoAir743-Lite features a compact form factor with SH1.0 connectors (which are more suitable than Pixhawk-standard GH1.25 for this board size). +When paired with with Bluetooth telemetry, the board can be debugged with a phone or PC. + +:::info +This flight controller is [manufacturer supported](../flight_controller/autopilot_manufacturer_supported.md). +::: + +## MicoAir743-Lite (v1.1) + +![MicoAir743-Lite Back View](../../assets/flight_controller/micoair743_lite/back_view.png) + +## 요약 + +### Processors & Sensors + +- FMU Processor: STM32H743 + - 32 Bit Arm® Cortex®-M7, 480MHz, 2MB flash memory, 1MB RAM +- 내장 센서 : + - Accel/Gyro: ICM-45686 (with BalancedGyro™ Technology) + - Barometer: SPA06 +- On-board Bluetooth Telemetry + - Connected to UART8 internally, baudrate 115200 + - Connecting to QGC (PC or Android phone) via Bluetooth +- 기타 특성: + - Operating & storage temperature: -20 ~ 85°c + +### 인터페이스 + +- 8 UART (TELEM / GPS / RC) +- 14 PWM outputs (10 supports DShot) +- Support multiple RC inputs (SBUS / CRSF / DSM) +- 1 GPS port +- 1 I2C port +- 2 ADC port2 (VBAT, Current) +- 1 DJI O3/O4 VTX connector +- 1 MicroSD Card Slot +- 1 USB Type-C + +### Electrical data + +- VBAT Input: + - 2\~6S (6\~27V) +- USB Power Input: + - 4.75\~5.25V +- BEC Output: + - 5V 2A (for controller, receiver, GPS, optical flow or other devices) + - 9V 2A (for video transmitter, camera) + +### Mechanical data + +- Mounting: 30.5 x 30.5mm, Φ4mm +- Dimensions: 36 x 36 x 8 mm +- Weight: 10g + +![MicoAir743-Lite Size](../../assets/flight_controller/micoair743_lite/size.png) + +## 구매처 + +Order from [MicoAir Tech Store](https://store.micoair.com/product/micoair743-lite/). + +## 핀배열 + +Pinouts definition can be found in the [MicoAir743-Lite_pinout.xlsx](https://raw.githubusercontent.com/PX4/PX4-Autopilot/refs/heads/main/docs/assets/flight_controller/micoair743_lite/micoair743_lite_pinout.xlsx) file. + +## 시리얼 포트 매핑 + +| UART | 장치 | 포트 | +| ------ | ---------- | ------ | +| USART1 | /dev/ttyS0 | TELEM1 | +| USART2 | /dev/ttyS1 | GPS2 | +| USART3 | /dev/ttyS2 | GPS1 | +| UART4 | /dev/ttyS3 | TELEM2 | +| UART5 | /dev/ttyS4 | TELEM3 | +| USART6 | /dev/ttyS5 | RC | +| UART7 | /dev/ttyS6 | URT6 | +| UART8 | /dev/ttyS7 | TELEM4 | + +## Interfaces Diagram + +:::note +All the connectors used on the board are SH1.0 +::: + +![MicoAir743-Lite Interface Diagram](../../assets/flight_controller/micoair743_lite/interfaces_diagram.png) + +## Sample Wiring Diagram + +![MicoAir743-Lite Wiring Diagram](../../assets/flight_controller/micoair743_lite/wiring_diagram.png) + +## 펌웨어 빌드 + +To [build PX4](../dev_setup/building_px4.md) for this target: + +```sh +make micoair_h743-lite_default +``` + +## 펌웨어 설치 + +펌웨어는 일반적인 방법으로 설치할 수 있습니다. + +- 소스 빌드 및 업로드 + + ```sh + make micoair_h743-lite_default upload + ``` + +- [Load the firmware](../config/firmware.md) using _QGroundControl_. + 미리 빌드된 펌웨어나 사용자 지정 펌웨어를 사용할 수 있습니다. + + ::: info + At time of writing the only pre-built software is `PX4 main` (see [Installing PX4 Main, Beta or Custom Firmware](../config/firmware.md#installing-px4-main-beta-or-custom-firmware)). + Release builds will be supported for PX4 v1.17 and later. + +::: + +## 무선 조종 + +A [Radio Control (RC) system](../getting_started/rc_transmitter_receiver.md) is required if you want to manually control your vehicle (PX4 does not require a radio system for autonomous flight modes). + +The RC port is connected to the FMU and you can attach a receiver that uses the protocols `DSM`, `SBUS`, `CSRF`, `GHST`, or other protocol listed in [Radio Control modules](../modules/modules_driver_radio_control.md). +You will need to enable the protocol by setting the corresponding parameter `RC_xxxx_PRT_CFG`, such as [RC_CRSF_PRT_CFG](../advanced_config/parameter_reference.md#RC_CRSF_PRT_CFG) for a [CRSF receiver](../telemetry/crsf_telemetry.md). + +## 지원 플랫폼 및 기체 + +일반 RC 서보 또는 Futaba S-Bus 서보로 제어 가능한 모든 멀티콥터/비행기/로버 또는 보트. +The complete set of supported configurations can be seen in the [Airframes Reference](../airframes/airframe_reference.md). + +## 주변 장치 + +- [MicoAir Telemetry Radio Modules](https://micoair.com/radio_telemetry/) +- [MicoAir Optical & Range Sensor](https://micoair.com/optical_range_sensor/) +- [MicoAir GPS](https://micoair.com/gps/) +- [MicoAir ESC Modules](https://micoair.com/esc/) + +## 추가 정보 + +- [MicoAir Tech.](https://micoair.com/) +- [Details about MicoAir743-Lite](https://micoair.com/flightcontroller_micoair743lite/) +- [QGroundControl Download and Install](https://docs.qgroundcontrol.com/Stable_V5.0/en/qgc-user-guide/getting_started/download_and_install.html) diff --git a/docs/ko/flight_modes_fw/return.md b/docs/ko/flight_modes_fw/return.md index 3643254996..92119f1ed5 100644 --- a/docs/ko/flight_modes_fw/return.md +++ b/docs/ko/flight_modes_fw/return.md @@ -25,11 +25,6 @@ The default type is recommended. ::: -:::warning -There is a known issue ([PX4-Autopilot#25436](https://github.com/PX4/PX4-Autopilot/issues/25436)) with fixed-wing approaches and landings while in RTL mode. -Please review the issue and verify in simulation that the behavior you get is safe in an RTL landing scenario (if not, consider using rally points). -::: - ## Technical Summary Fixed-wing vehicles use the _mission landing/rally point_ return type by default. diff --git a/docs/ko/gps_compass/index.md b/docs/ko/gps_compass/index.md index 13aa607cc1..e7a59ec00b 100644 --- a/docs/ko/gps_compass/index.md +++ b/docs/ko/gps_compass/index.md @@ -145,21 +145,21 @@ To ensure the port is set up correctly perform a [Serial Port Configuration](../ The following steps show how to configure a secondary GPS on the `GPS 2` port in _QGroundControl_: 1. [Find and set](../advanced_config/parameters.md) the parameter [GPS_2_CONFIG](../advanced_config/parameter_reference.md#GPS_2_CONFIG) to **GPS 2**. - - Open _QGroundControl_ and navigate to the **Vehicle Setup > Parameters** section. - - Select the **GPS** tab, then open the [GPS_2_CONFIG](../advanced_config/parameter_reference.md#GPS_2_CONFIG) parameter and select `GPS 2` from the dropdown list. + - Open _QGroundControl_ and navigate to the **Vehicle Setup > Parameters** section. + - Select the **GPS** tab, then open the [GPS_2_CONFIG](../advanced_config/parameter_reference.md#GPS_2_CONFIG) parameter and select `GPS 2` from the dropdown list. - ![QGC Serial Example](../../assets/peripherals/qgc_serial_config_example.png) + ![QGC Serial Example](../../assets/peripherals/qgc_serial_config_example.png) 2. 다른 매개변수를 표시하려면 기체를 재부팅하십시오. 3. Select the **Serial** tab, and open the [SER_GPS2_BAUD](../advanced_config/parameter_reference.md#SER_GPS2_BAUD) parameter (`GPS 2` port baud rate): set it to _Auto_ (or 115200 for the Trimble). - ![QGC Serial Baudrate Example](../../assets/peripherals/qgc_serial_baudrate_example.png) + ![QGC Serial Baudrate Example](../../assets/peripherals/qgc_serial_baudrate_example.png) 보조 GPS 포트를 설정 후 : 1. 두 GPS 시스템의 데이터를 혼합하도록 ECL/EKF2 추정기를 설정합니다. - For detailed instructions see: [Using the ECL EKF > Dual Receivers](../advanced_config/tuning_the_ecl_ekf.md#dual-receivers). + For detailed instructions see: [Using the ECL EKF > Dual Receivers](../advanced_config/tuning_the_ecl_ekf.md#dual-receivers). ### DroneCAN GNSS Configuration @@ -201,7 +201,9 @@ EPH/EPV values therefore provide a more immediate and practical estimate of the - GPS/RTK-GPS - [RTK-GPS](../advanced/rtk_gps.md) + - [PPS Time Synchronization](../advanced/pps_time_sync.md) - [GPS driver](../modules/modules_driver.md#gps) + - [PPS driver](../modules/modules_driver.md#pps-capture) - [DroneCAN Example](../dronecan/index.md) - 나침반 - [Driver source code](https://github.com/PX4/PX4-Autopilot/tree/main/src/drivers/magnetometer) (Compasses) diff --git a/docs/ko/gps_compass/magnetometer.md b/docs/ko/gps_compass/magnetometer.md index a6c238c478..5474b68bbd 100644 --- a/docs/ko/gps_compass/magnetometer.md +++ b/docs/ko/gps_compass/magnetometer.md @@ -40,6 +40,7 @@ This list contains stand-alone magnetometer modules (without GNSS). | 장치 | 나침반 | DroneCan | | :--------------------------------------------------------------------------------------------------------------- | :----: | :------: | +| [ARK MAG](https://arkelectron.com/product/ark-mag/) | RM3100 | ✓ | | [Avionics Anonymous UAVCAN Magnetometer](https://www.tindie.com/products/avionicsanonymous/uavcan-magnetometer/) | ? | | | [Holybro DroneCAN RM3100 Compass/Magnetometer](https://holybro.com/products/dronecan-rm3100-compass) | RM3100 | ✓ | | [RaccoonLab DroneCAN/Cyphal Magnetometer RM3100](https://holybro.com/products/dronecan-rm3100-compass) | RM3100 | ✓ | diff --git a/docs/ko/middleware/uxrce_dds.md b/docs/ko/middleware/uxrce_dds.md index 844574bbcb..6024d45d65 100644 --- a/docs/ko/middleware/uxrce_dds.md +++ b/docs/ko/middleware/uxrce_dds.md @@ -454,6 +454,7 @@ uxrce_dds_client start -n fancy_uav ``` This can be included in `etc/extras.txt` as part of a custom [System Startup](../concept/system_startup.md). +::: ## PX4 ROS 2 QoS Settings @@ -588,7 +589,7 @@ For a list of services, details and examples see the [service documentation](../ These guidelines explain how to migrate from using PX4 v1.13 [Fast-RTPS](../middleware/micrortps.md) middleware to PX4 v1.14 `uXRCE-DDS` middleware. These are useful if you have [ROS 2 applications written for PX4 v1.13](https://docs.px4.io/v1.13/en/ros/ros2_comm.html), or you have used Fast-RTPS to interface your applications to PX4 [directly](https://docs.px4.io/v1.13/en/middleware/micrortps.html#agent-in-an-offboard-fast-dds-interface-ros-independent). -::: info +:::info This section contains migration-specific information. You should also read the rest of this page to properly understand uXRCE-DDS. ::: diff --git a/docs/uk/SUMMARY.md b/docs/uk/SUMMARY.md index 4066b1dece..f8c37f188b 100644 --- a/docs/uk/SUMMARY.md +++ b/docs/uk/SUMMARY.md @@ -182,6 +182,7 @@ - [Wiring Quickstart](assembly/quick_start_durandal.md) - [Holybro Pix32 v5](flight_controller/holybro_pix32_v5.md) - [Wiring Quickstart](assembly/quick_start_holybro_pix32_v5.md) + - [MicoAir H743 Lite](flight_controller/micoair743-lite.md) - [ModalAI VOXL 2](flight_controller/modalai_voxl_2.md) - [mRo Control Zero F7](flight_controller/mro_control_zero_f7.md) - [Radiolink PIX6](flight_controller/radiolink_pix6.md) @@ -504,6 +505,7 @@ - [UART/Послідовний порт](uart/index.md) - [Драйвери послідовного порту і їх налаштування](uart/user_configurable_serial_driver.md) - [RTK GPS (Інтеграція)](advanced/rtk_gps.md) + - [PPS Time Synchronization](advanced/pps_time_sync.md) - [Проміжне програмне забезпечення](middleware/index.md) - [Повідомлення uORB](middleware/uorb.md) - [Граф uORB](middleware/uorb_graph.md) diff --git a/docs/uk/advanced/pps_time_sync.md b/docs/uk/advanced/pps_time_sync.md new file mode 100644 index 0000000000..67456cc75d --- /dev/null +++ b/docs/uk/advanced/pps_time_sync.md @@ -0,0 +1,135 @@ +# PPS Time Synchronization (PX4 Integration) + +[Pulse Per Second](https://en.wikipedia.org/wiki/Pulse-per-second_signal) (PPS) time synchronization provides high-precision timing for GNSS receivers. +This page explains how PPS is integrated into PX4 and how to configure it. + +## Загальний огляд + +PPS (Pulse Per Second) is a timing signal provided by GNSS receivers that outputs an electrical pulse once per second, synchronized to UTC time. +The PPS signal provides a highly accurate timing reference that PX4 can use to: + +- Refine GNSS time measurements and compensate for clock drift +- Provide precise UTC timestamps for camera capture events (for photogrammetry and mapping applications) +- Enable offline position refinement through accurate time correlation + +## Підтримуване обладнання + +PPS time synchronization can be supported on flight controllers that have a hardware timer input pin that can be configured for PPS capture, by [enabling the PPS capture driver](#enable-pps-driver-in-board-configuration) in the board configuration. + +Supported boards include (at time of writing): + +- [Ark FMUv6x](../flight_controller/ark_v6x.md) +- Auterion FMUv6x +- Auterion FMUv6s + +## Установка + +### Enable PPS Driver in Board Configuration + +The [PPS capture driver](../modules/modules_driver.md#pps-capture) must be enabled in the board configuration. +This is done by adding the following to your board's configuration: + +```ini +CONFIG_DRIVERS_PPS_CAPTURE=y +``` + +### Configure PPS Parameters + +The configuration varies depending on your flight controller hardware. + +#### FMUv6X + +For FMUv6X-based flight controllers, configure PWM AUX Timer 3 and Function 9: + +```sh +param set PWM_AUX_TIM3 -2 +param set PWM_AUX_FUNC9 2064 +param set PPS_CAP_ENABLE 1 +``` + +#### FMUv6S + +For FMUv6S-based flight controllers, configure PWM MAIN Timer 3 and Function 10: + +```sh +param set PWM_MAIN_TIM3 -2 +param set PWM_MAIN_FUNC10 2064 +param set PPS_CAP_ENABLE 1 +``` + +### Підключення + +The wiring configuration depends on your specific flight controller. + +#### Skynode X (FMUv6x) + +Connect the PPS signal from your GNSS module to the flight controller using the 11-pin or 6-pin GPS connector: + +For detailed pinout information, refer to: + +- [Skynode GPS Peripherals - Pinouts](https://docs.auterion.com/hardware-integration/skynode/peripherals/gps#pinouts) + +#### Skynode S (FMUv6S) + +For FMUv6S, you need to route the PPS signal separately: + +1. Connect your GNSS module using the standard 6-pin GPS connector: [Skynode S GPS Interface](https://docs.auterion.com/hardware-integration/skynode-s/interfaces#gps) +2. Connect the PPS signal from your GNSS module to the **PPM_IN** pin: [Skynode S Extras 1 Interface](https://docs.auterion.com/hardware-integration/skynode-s/interfaces#extras-1) + +#### ARK Jetson Carrier Board (FMUv6x) + +For ARK FMUv6X on the Jetson carrier board: + +1. Connect your GNSS module using either the 10-pin or 6-pin GPS connector: [ARK PAB GPS1 Interface](../flight_controller/ark_pab#gps1) +2. Connect the PPS signal to the **FMU_CAP** pin: [ARK PAB ADIO Interface](../flight_controller/ark_pab.md#adio) + +## Перевірка + +After configuring PPS, you can verify that it is working correctly: + +1. Connect to the [PX4 System Console](../debug/system_console.md) (via MAVLink shell or serial console). + +2. Wait for GNSS fix. + +3. Check the PPS capture status to confirm it is up and running: + + ```sh + pps_capture status + ``` + +4. You can also check the [PpsCapture](../msg_docs/PpsCapture.md) uORB topic + + ```sh + listener pps_capture + ``` + + Where you should see: `timestamp`, `rtc_timestamp`, and `pps_rate_exceeded_counter`. + +### PPS Capture Driver + +The PPS capture driver is located in `src/drivers/pps_capture` and uses hardware timer input capture to precisely measure the arrival time of each PPS pulse. + +Основні функції: + +- Sub-microsecond pulse capture precision (hardware-dependent) +- Automatic drift calculation and compensation +- Integration with the GNSS driver for refined time stamping + +See also: + +- [PPS Capture Driver Documentation](../modules/modules_driver.md#pps-capture) +- [PpsCapture Message](../msg_docs/PpsCapture.md) + +### Time Synchronization Flow + +1. GNSS module sends position/time data at ~1-20 Hz. +2. GNSS module outputs PPS pulse at 1 Hz, precisely aligned to UTC second boundary. +3. PPS capture driver measures the exact time of the PPS pulse arrival using hardware timer. +4. Driver calculates the offset between GNSS time (from UART data) and autopilot clock (from PPS measurement). +5. This offset is used to correct GNSS timestamps and improve sensor fusion accuracy. + +The PPS signal provides much higher temporal precision than the transmitted time data, which has latency and jitter from serial communication. + +:::warning +If the PPS driver does not sending any data for 5 seconds (despite having `PPS_CAP_ENABLE` set to 1), the `EKF2_GPS_DELAY` will be used instead for estimating the latency. +::: diff --git a/docs/uk/advanced_config/bootloader_update_from_betaflight.md b/docs/uk/advanced_config/bootloader_update_from_betaflight.md index 803e8511bc..236e06f4eb 100644 --- a/docs/uk/advanced_config/bootloader_update_from_betaflight.md +++ b/docs/uk/advanced_config/bootloader_update_from_betaflight.md @@ -89,7 +89,7 @@ dfu-util -a 0 --dfuse-address 0x08000000 -D build//.bin Список контролерів, яких це стосується, можна отримати, виконавши наступну команду `make` і зазначивши цілі `make`, які закінчуються на `_bootloader` ``` -$make list_config_targets +$ make list_config_targets ... cuav_nora_bootloader diff --git a/docs/uk/flight_controller/autopilot_manufacturer_supported.md b/docs/uk/flight_controller/autopilot_manufacturer_supported.md index 7945545734..30cd5d538f 100644 --- a/docs/uk/flight_controller/autopilot_manufacturer_supported.md +++ b/docs/uk/flight_controller/autopilot_manufacturer_supported.md @@ -30,6 +30,7 @@ This category includes boards that are not fully compliant with the pixhawk stan - [Holybro Kakute H7](../flight_controller/kakuteh7.md) - [Holybro Durandal](../flight_controller/durandal.md) - [Holybro Pix32 v5](../flight_controller/holybro_pix32_v5.md) +- [MicoAir H743 Lite](../flight_controller/micoair743-lite.md) - [ModalAI VOXL 2](../flight_controller/modalai_voxl_2.md) - [mRo Control Zero](../flight_controller/mro_control_zero_f7.md) - [Radiolink PIX6](../flight_controller/radiolink_pix6.md) diff --git a/docs/uk/flight_controller/micoair743-lite.md b/docs/uk/flight_controller/micoair743-lite.md new file mode 100644 index 0000000000..3d0f443d5f --- /dev/null +++ b/docs/uk/flight_controller/micoair743-lite.md @@ -0,0 +1,153 @@ +# MicoAir743-Lite + + + +:::warning +PX4 не розробляє цей (або будь-який інший) автопілот. +Contact the [manufacturer](https://micoair.com/) for hardware support or compliance issues. +::: + +MicoAir743-Lite is an ultra-high performance H743 flight controller with an unbeatable price, featuring the ICM45686 IMU sensor and integrated Bluetooth telemetry. + +![MicoAir743-Lite Front View](../../assets/flight_controller/micoair743_lite/front_view.png) + +Equipped with a high-performance H7 processor, the MicoAir743-Lite features a compact form factor with SH1.0 connectors (which are more suitable than Pixhawk-standard GH1.25 for this board size). +When paired with with Bluetooth telemetry, the board can be debugged with a phone or PC. + +:::info +This flight controller is [manufacturer supported](../flight_controller/autopilot_manufacturer_supported.md). +::: + +## MicoAir743-Lite (v1.1) + +![MicoAir743-Lite Back View](../../assets/flight_controller/micoair743_lite/back_view.png) + +## Короткий опис + +### Processors & Sensors + +- FMU Processor: STM32H743 + - 32 Bit Arm® Cortex®-M7, 480MHz, 2MB flash memory, 1MB RAM +- Сенсори на платі + - Accel/Gyro: ICM-45686 (with BalancedGyro™ Technology) + - Barometer: SPA06 +- On-board Bluetooth Telemetry + - Connected to UART8 internally, baudrate 115200 + - Connecting to QGC (PC or Android phone) via Bluetooth +- Інші характеристики: + - Operating & storage temperature: -20 ~ 85°c + +### Інтерфейси + +- 8 UART (TELEM / GPS / RC) +- 14 PWM outputs (10 supports DShot) +- Support multiple RC inputs (SBUS / CRSF / DSM) +- 1 GPS port +- 1 I2C порт +- 2 ADC port2 (VBAT, Current) +- 1 DJI O3/O4 VTX connector +- 1 MicroSD Card Slot +- 1 USB Type-C + +### Електричні дані + +- VBAT Input: + - 2\~6S (6\~27V) +- USB Power Input: + - 4.75\~5.25V +- BEC Output: + - 5V 2A (for controller, receiver, GPS, optical flow or other devices) + - 9V 2A (for video transmitter, camera) + +### Механічні характеристики + +- Mounting: 30.5 x 30.5mm, Φ4mm +- Dimensions: 36 x 36 x 8 mm +- Weight: 10g + +![MicoAir743-Lite Size](../../assets/flight_controller/micoair743_lite/size.png) + +## Де купити + +Order from [MicoAir Tech Store](https://store.micoair.com/product/micoair743-lite/). + +## Схема розташування виводів + +Pinouts definition can be found in the [MicoAir743-Lite_pinout.xlsx](https://raw.githubusercontent.com/PX4/PX4-Autopilot/refs/heads/main/docs/assets/flight_controller/micoair743_lite/micoair743_lite_pinout.xlsx) file. + +## Налаштування послідовного порту + +| UART | Пристрій | Порт | +| ------ | ---------- | ------ | +| USART1 | /dev/ttyS0 | TELEM1 | +| USART2 | /dev/ttyS1 | GPS2 | +| USART3 | /dev/ttyS2 | GPS1 | +| UART4 | /dev/ttyS3 | TELEM2 | +| UART5 | /dev/ttyS4 | TELEM3 | +| USART6 | /dev/ttyS5 | RC | +| UART7 | /dev/ttyS6 | URT6 | +| UART8 | /dev/ttyS7 | TELEM4 | + +## Interfaces Diagram + +:::note +All the connectors used on the board are SH1.0 +::: + +![MicoAir743-Lite Interface Diagram](../../assets/flight_controller/micoair743_lite/interfaces_diagram.png) + +## Зразок схеми з'єднань + +![MicoAir743-Lite Wiring Diagram](../../assets/flight_controller/micoair743_lite/wiring_diagram.png) + +## Збірка прошивки + +To [build PX4](../dev_setup/building_px4.md) for this target: + +```sh +make micoair_h743-lite_default +``` + +## Встановлення прошивки PX4 + +Прошивку можна встановити будь-якими звичайними способами: + +- Збудуйте та завантажте джерело + + ```sh + make micoair_h743-lite_default upload + ``` + +- [Load the firmware](../config/firmware.md) using _QGroundControl_. + Ви можете використовувати або готове вбудоване програмне забезпечення, або власне користувацьке програмне забезпечення. + + ::: info + At time of writing the only pre-built software is `PX4 main` (see [Installing PX4 Main, Beta or Custom Firmware](../config/firmware.md#installing-px4-main-beta-or-custom-firmware)). + Release builds will be supported for PX4 v1.17 and later. + +::: + +## Радіоуправління + +A [Radio Control (RC) system](../getting_started/rc_transmitter_receiver.md) is required if you want to manually control your vehicle (PX4 does not require a radio system for autonomous flight modes). + +The RC port is connected to the FMU and you can attach a receiver that uses the protocols `DSM`, `SBUS`, `CSRF`, `GHST`, or other protocol listed in [Radio Control modules](../modules/modules_driver_radio_control.md). +You will need to enable the protocol by setting the corresponding parameter `RC_xxxx_PRT_CFG`, such as [RC_CRSF_PRT_CFG](../advanced_config/parameter_reference.md#RC_CRSF_PRT_CFG) for a [CRSF receiver](../telemetry/crsf_telemetry.md). + +## Підтримувані платформи / Конструкції + +Будь-який мультикоптер / літак / наземна платформа / човен, який може керуватися звичайними RC сервоприводами або сервоприводами Futaba S-Bus. +The complete set of supported configurations can be seen in the [Airframes Reference](../airframes/airframe_reference.md). + +## Периферійні пристрої + +- [MicoAir Telemetry Radio Modules](https://micoair.com/radio_telemetry/) +- [MicoAir Optical & Range Sensor](https://micoair.com/optical_range_sensor/) +- [MicoAir GPS](https://micoair.com/gps/) +- [MicoAir ESC Modules](https://micoair.com/esc/) + +## Подальша інформація + +- [MicoAir Tech.](https://micoair.com/) +- [Details about MicoAir743-Lite](https://micoair.com/flightcontroller_micoair743lite/) +- [QGroundControl Download and Install](https://docs.qgroundcontrol.com/Stable_V5.0/en/qgc-user-guide/getting_started/download_and_install.html) diff --git a/docs/uk/flight_modes_fw/return.md b/docs/uk/flight_modes_fw/return.md index 6a7e62d0af..3296524af6 100644 --- a/docs/uk/flight_modes_fw/return.md +++ b/docs/uk/flight_modes_fw/return.md @@ -25,11 +25,6 @@ ::: -:::warning -There is a known issue ([PX4-Autopilot#25436](https://github.com/PX4/PX4-Autopilot/issues/25436)) with fixed-wing approaches and landings while in RTL mode. -Please review the issue and verify in simulation that the behavior you get is safe in an RTL landing scenario (if not, consider using rally points). -::: - ## Технічний підсумок Літальні апарати з фіксованим крилом за замовчуванням використовують тип повернення до призначення _місії посадки/точка збору_. diff --git a/docs/uk/gps_compass/index.md b/docs/uk/gps_compass/index.md index 96ab9ae8a4..f44e79a66c 100644 --- a/docs/uk/gps_compass/index.md +++ b/docs/uk/gps_compass/index.md @@ -201,7 +201,9 @@ EPH/EPV values therefore provide a more immediate and practical estimate of the - GPS/RTK-GPS - [RTK-GPS](../advanced/rtk_gps.md) + - [PPS Time Synchronization](../advanced/pps_time_sync.md) - [GPS driver](../modules/modules_driver.md#gps) + - [PPS driver](../modules/modules_driver.md#pps-capture) - [DroneCAN Example](../dronecan/index.md) - Компас - [Driver source code](https://github.com/PX4/PX4-Autopilot/tree/main/src/drivers/magnetometer) (Compasses) diff --git a/docs/uk/gps_compass/magnetometer.md b/docs/uk/gps_compass/magnetometer.md index f7f12e2026..42d0d72b4e 100644 --- a/docs/uk/gps_compass/magnetometer.md +++ b/docs/uk/gps_compass/magnetometer.md @@ -40,6 +40,7 @@ PX4 можна використовувати з багатьма деталям | Пристрій | Компас | DroneCan | | :-------------------------------------------------------------------------------------------------------------- | :----: | :------: | +| [ARK MAG](https://arkelectron.com/product/ark-mag/) | RM3100 | ✓ | | [Магнітометр UAVCAN Avionics Anonymous](https://www.tindie.com/products/avionicsanonymous/uavcan-magnetometer/) | ? | | | [Компас/Магнітометр Holybro DroneCAN RM3100](https://holybro.com/products/dronecan-rm3100-compass) | RM3100 | ✓ | | [RaccoonLab DroneCAN/Cyphal Magnetometer RM3100](https://holybro.com/products/dronecan-rm3100-compass) | RM3100 | ✓ | diff --git a/docs/uk/middleware/uxrce_dds.md b/docs/uk/middleware/uxrce_dds.md index 8d21539d78..8a9d2e2ec3 100644 --- a/docs/uk/middleware/uxrce_dds.md +++ b/docs/uk/middleware/uxrce_dds.md @@ -454,6 +454,7 @@ uxrce_dds_client start -n fancy_uav ``` This can be included in `etc/extras.txt` as part of a custom [System Startup](../concept/system_startup.md). +::: ## PX4 ROS 2 QoS Settings @@ -588,7 +589,7 @@ For a list of services, details and examples see the [service documentation](../ These guidelines explain how to migrate from using PX4 v1.13 [Fast-RTPS](../middleware/micrortps.md) middleware to PX4 v1.14 `uXRCE-DDS` middleware. These are useful if you have [ROS 2 applications written for PX4 v1.13](https://docs.px4.io/v1.13/en/ros/ros2_comm.html), or you have used Fast-RTPS to interface your applications to PX4 [directly](https://docs.px4.io/v1.13/en/middleware/micrortps.html#agent-in-an-offboard-fast-dds-interface-ros-independent). -::: info +:::info This section contains migration-specific information. You should also read the rest of this page to properly understand uXRCE-DDS. ::: diff --git a/docs/zh/SUMMARY.md b/docs/zh/SUMMARY.md index 570c6aa5db..deab8841c3 100644 --- a/docs/zh/SUMMARY.md +++ b/docs/zh/SUMMARY.md @@ -182,6 +182,7 @@ - [Wiring Quickstart](assembly/quick_start_durandal.md) - [Holybro Pix32 v5](flight_controller/holybro_pix32_v5.md) - [Wiring Quickstart](assembly/quick_start_holybro_pix32_v5.md) + - [MicoAir H743 Lite](flight_controller/micoair743-lite.md) - [ModalAI VOXL 2](flight_controller/modalai_voxl_2.md) - [mRo Control Zero F7](flight_controller/mro_control_zero_f7.md) - [Radiolink PIX6](flight_controller/radiolink_pix6.md) @@ -504,6 +505,7 @@ - [UART/串口](uart/index.md) - [可配置的串口驱动](uart/user_configurable_serial_driver.md) - [RTK GPS (集成)](advanced/rtk_gps.md) + - [PPS Time Synchronization](advanced/pps_time_sync.md) - [中间件](middleware/index.md) - [uORB 通讯](middleware/uorb.md) - [uORB 图](middleware/uorb_graph.md) diff --git a/docs/zh/advanced/pps_time_sync.md b/docs/zh/advanced/pps_time_sync.md new file mode 100644 index 0000000000..6679279b60 --- /dev/null +++ b/docs/zh/advanced/pps_time_sync.md @@ -0,0 +1,135 @@ +# PPS Time Synchronization (PX4 Integration) + +[Pulse Per Second](https://en.wikipedia.org/wiki/Pulse-per-second_signal) (PPS) time synchronization provides high-precision timing for GNSS receivers. +This page explains how PPS is integrated into PX4 and how to configure it. + +## 综述 + +PPS (Pulse Per Second) is a timing signal provided by GNSS receivers that outputs an electrical pulse once per second, synchronized to UTC time. +The PPS signal provides a highly accurate timing reference that PX4 can use to: + +- Refine GNSS time measurements and compensate for clock drift +- Provide precise UTC timestamps for camera capture events (for photogrammetry and mapping applications) +- Enable offline position refinement through accurate time correlation + +## 支持的硬件 + +PPS time synchronization can be supported on flight controllers that have a hardware timer input pin that can be configured for PPS capture, by [enabling the PPS capture driver](#enable-pps-driver-in-board-configuration) in the board configuration. + +Supported boards include (at time of writing): + +- [Ark FMUv6x](../flight_controller/ark_v6x.md) +- Auterion FMUv6x +- Auterion FMUv6s + +## 设置 + +### Enable PPS Driver in Board Configuration + +The [PPS capture driver](../modules/modules_driver.md#pps-capture) must be enabled in the board configuration. +This is done by adding the following to your board's configuration: + +```ini +CONFIG_DRIVERS_PPS_CAPTURE=y +``` + +### Configure PPS Parameters + +The configuration varies depending on your flight controller hardware. + +#### FMUv6X + +For FMUv6X-based flight controllers, configure PWM AUX Timer 3 and Function 9: + +```sh +param set PWM_AUX_TIM3 -2 +param set PWM_AUX_FUNC9 2064 +param set PPS_CAP_ENABLE 1 +``` + +#### FMUv6S + +For FMUv6S-based flight controllers, configure PWM MAIN Timer 3 and Function 10: + +```sh +param set PWM_MAIN_TIM3 -2 +param set PWM_MAIN_FUNC10 2064 +param set PPS_CAP_ENABLE 1 +``` + +### 布线 + +The wiring configuration depends on your specific flight controller. + +#### Skynode X (FMUv6x) + +Connect the PPS signal from your GNSS module to the flight controller using the 11-pin or 6-pin GPS connector: + +For detailed pinout information, refer to: + +- [Skynode GPS Peripherals - Pinouts](https://docs.auterion.com/hardware-integration/skynode/peripherals/gps#pinouts) + +#### Skynode S (FMUv6S) + +For FMUv6S, you need to route the PPS signal separately: + +1. Connect your GNSS module using the standard 6-pin GPS connector: [Skynode S GPS Interface](https://docs.auterion.com/hardware-integration/skynode-s/interfaces#gps) +2. Connect the PPS signal from your GNSS module to the **PPM_IN** pin: [Skynode S Extras 1 Interface](https://docs.auterion.com/hardware-integration/skynode-s/interfaces#extras-1) + +#### ARK Jetson Carrier Board (FMUv6x) + +For ARK FMUv6X on the Jetson carrier board: + +1. Connect your GNSS module using either the 10-pin or 6-pin GPS connector: [ARK PAB GPS1 Interface](../flight_controller/ark_pab#gps1) +2. Connect the PPS signal to the **FMU_CAP** pin: [ARK PAB ADIO Interface](../flight_controller/ark_pab.md#adio) + +## 验证 + +After configuring PPS, you can verify that it is working correctly: + +1. Connect to the [PX4 System Console](../debug/system_console.md) (via MAVLink shell or serial console). + +2. Wait for GNSS fix. + +3. Check the PPS capture status to confirm it is up and running: + + ```sh + pps_capture status + ``` + +4. You can also check the [PpsCapture](../msg_docs/PpsCapture.md) uORB topic + + ```sh + listener pps_capture + ``` + + Where you should see: `timestamp`, `rtc_timestamp`, and `pps_rate_exceeded_counter`. + +### PPS Capture Driver + +The PPS capture driver is located in `src/drivers/pps_capture` and uses hardware timer input capture to precisely measure the arrival time of each PPS pulse. + +主要特性: + +- Sub-microsecond pulse capture precision (hardware-dependent) +- Automatic drift calculation and compensation +- Integration with the GNSS driver for refined time stamping + +See also: + +- [PPS Capture Driver Documentation](../modules/modules_driver.md#pps-capture) +- [PpsCapture Message](../msg_docs/PpsCapture.md) + +### Time Synchronization Flow + +1. GNSS module sends position/time data at ~1-20 Hz. +2. GNSS module outputs PPS pulse at 1 Hz, precisely aligned to UTC second boundary. +3. PPS capture driver measures the exact time of the PPS pulse arrival using hardware timer. +4. Driver calculates the offset between GNSS time (from UART data) and autopilot clock (from PPS measurement). +5. This offset is used to correct GNSS timestamps and improve sensor fusion accuracy. + +The PPS signal provides much higher temporal precision than the transmitted time data, which has latency and jitter from serial communication. + +:::warning +If the PPS driver does not sending any data for 5 seconds (despite having `PPS_CAP_ENABLE` set to 1), the `EKF2_GPS_DELAY` will be used instead for estimating the latency. +::: diff --git a/docs/zh/advanced_config/bootloader_update_from_betaflight.md b/docs/zh/advanced_config/bootloader_update_from_betaflight.md index 3094cc3830..4d37bdbfe0 100644 --- a/docs/zh/advanced_config/bootloader_update_from_betaflight.md +++ b/docs/zh/advanced_config/bootloader_update_from_betaflight.md @@ -89,7 +89,7 @@ Flight controllers that have bootloader PX4-Autopilot `make` targets, can build The list of controllers for which this applies can be obtained by running the following `make` command, and noting the `make` targets that end in `_bootloader` ``` -$make list_config_targets +$ make list_config_targets ... cuav_nora_bootloader diff --git a/docs/zh/flight_controller/autopilot_manufacturer_supported.md b/docs/zh/flight_controller/autopilot_manufacturer_supported.md index d6f07a44fb..e72970e0d0 100644 --- a/docs/zh/flight_controller/autopilot_manufacturer_supported.md +++ b/docs/zh/flight_controller/autopilot_manufacturer_supported.md @@ -30,6 +30,7 @@ The boards in this category are: - [Holybro Kakute H7](../flight_controller/kakuteh7.md) - [Holybro Durandal](../flight_controller/durandal.md) - [Holybro Pix32 v5](../flight_controller/holybro_pix32_v5.md) +- [MicoAir H743 Lite](../flight_controller/micoair743-lite.md) - [ModalAI VOXL 2](../flight_controller/modalai_voxl_2.md) - [mRo Control Zero](../flight_controller/mro_control_zero_f7.md) - [Radiolink PIX6](../flight_controller/radiolink_pix6.md) diff --git a/docs/zh/flight_controller/micoair743-lite.md b/docs/zh/flight_controller/micoair743-lite.md new file mode 100644 index 0000000000..b3a76a0065 --- /dev/null +++ b/docs/zh/flight_controller/micoair743-lite.md @@ -0,0 +1,153 @@ +# MicoAir743-Lite + + + +:::warning +PX4 does not manufacture this (or any) autopilot. +Contact the [manufacturer](https://micoair.com/) for hardware support or compliance issues. +::: + +MicoAir743-Lite is an ultra-high performance H743 flight controller with an unbeatable price, featuring the ICM45686 IMU sensor and integrated Bluetooth telemetry. + +![MicoAir743-Lite Front View](../../assets/flight_controller/micoair743_lite/front_view.png) + +Equipped with a high-performance H7 processor, the MicoAir743-Lite features a compact form factor with SH1.0 connectors (which are more suitable than Pixhawk-standard GH1.25 for this board size). +When paired with with Bluetooth telemetry, the board can be debugged with a phone or PC. + +:::info +This flight controller is [manufacturer supported](../flight_controller/autopilot_manufacturer_supported.md). +::: + +## MicoAir743-Lite (v1.1) + +![MicoAir743-Lite Back View](../../assets/flight_controller/micoair743_lite/back_view.png) + +## 总览 + +### Processors & Sensors + +- FMU Processor: STM32H743 + - 32 Bit Arm® Cortex®-M7, 480MHz, 2MB flash memory, 1MB RAM +- On-board sensors + - Accel/Gyro: ICM-45686 (with BalancedGyro™ Technology) + - Barometer: SPA06 +- On-board Bluetooth Telemetry + - Connected to UART8 internally, baudrate 115200 + - Connecting to QGC (PC or Android phone) via Bluetooth +- 其它特性: + - Operating & storage temperature: -20 ~ 85°c + +### 接口 + +- 8 UART (TELEM / GPS / RC) +- 14 PWM outputs (10 supports DShot) +- Support multiple RC inputs (SBUS / CRSF / DSM) +- 1 GPS port +- 1 I2C port +- 2 ADC port2 (VBAT, Current) +- 1 DJI O3/O4 VTX connector +- 1 MicroSD Card Slot +- 1 USB Type-C + +### Electrical data + +- VBAT Input: + - 2\~6S (6\~27V) +- USB Power Input: + - 4.75\~5.25V +- BEC Output: + - 5V 2A (for controller, receiver, GPS, optical flow or other devices) + - 9V 2A (for video transmitter, camera) + +### Mechanical data + +- Mounting: 30.5 x 30.5mm, Φ4mm +- Dimensions: 36 x 36 x 8 mm +- Weight: 10g + +![MicoAir743-Lite Size](../../assets/flight_controller/micoair743_lite/size.png) + +## 购买渠道 + +Order from [MicoAir Tech Store](https://store.micoair.com/product/micoair743-lite/). + +## 针脚定义 + +Pinouts definition can be found in the [MicoAir743-Lite_pinout.xlsx](https://raw.githubusercontent.com/PX4/PX4-Autopilot/refs/heads/main/docs/assets/flight_controller/micoair743_lite/micoair743_lite_pinout.xlsx) file. + +## 串口映射 + +| UART | 设备 | Port | +| ------ | ---------- | ------ | +| USART1 | /dev/ttyS0 | TELEM1 | +| USART2 | /dev/ttyS1 | GPS2 | +| USART3 | /dev/ttyS2 | GPS1 | +| UART4 | /dev/ttyS3 | TELEM2 | +| UART5 | /dev/ttyS4 | TELEM3 | +| USART6 | /dev/ttyS5 | RC | +| UART7 | /dev/ttyS6 | URT6 | +| UART8 | /dev/ttyS7 | TELEM4 | + +## Interfaces Diagram + +:::note +All the connectors used on the board are SH1.0 +::: + +![MicoAir743-Lite Interface Diagram](../../assets/flight_controller/micoair743_lite/interfaces_diagram.png) + +## Sample Wiring Diagram + +![MicoAir743-Lite Wiring Diagram](../../assets/flight_controller/micoair743_lite/wiring_diagram.png) + +## 编译固件 + +To [build PX4](../dev_setup/building_px4.md) for this target: + +```sh +make micoair_h743-lite_default +``` + +## Installing PX4 Firmware + +The firmware can be installed in any of the normal ways: + +- Build and upload the source + + ```sh + make micoair_h743-lite_default upload + ``` + +- [Load the firmware](../config/firmware.md) using _QGroundControl_. + You can use either pre-built firmware or your own custom firmware. + + ::: info + At time of writing the only pre-built software is `PX4 main` (see [Installing PX4 Main, Beta or Custom Firmware](../config/firmware.md#installing-px4-main-beta-or-custom-firmware)). + Release builds will be supported for PX4 v1.17 and later. + +::: + +## 遥控器 + +A [Radio Control (RC) system](../getting_started/rc_transmitter_receiver.md) is required if you want to manually control your vehicle (PX4 does not require a radio system for autonomous flight modes). + +The RC port is connected to the FMU and you can attach a receiver that uses the protocols `DSM`, `SBUS`, `CSRF`, `GHST`, or other protocol listed in [Radio Control modules](../modules/modules_driver_radio_control.md). +You will need to enable the protocol by setting the corresponding parameter `RC_xxxx_PRT_CFG`, such as [RC_CRSF_PRT_CFG](../advanced_config/parameter_reference.md#RC_CRSF_PRT_CFG) for a [CRSF receiver](../telemetry/crsf_telemetry.md). + +## 支持的平台/机身 + +Any multicopter / airplane / rover or boat that can be controlled with normal RC servos or Futaba S-Bus servos. +The complete set of supported configurations can be seen in the [Airframes Reference](../airframes/airframe_reference.md). + +## 外部设备 + +- [MicoAir Telemetry Radio Modules](https://micoair.com/radio_telemetry/) +- [MicoAir Optical & Range Sensor](https://micoair.com/optical_range_sensor/) +- [MicoAir GPS](https://micoair.com/gps/) +- [MicoAir ESC Modules](https://micoair.com/esc/) + +## 更多信息 + +- [MicoAir Tech.](https://micoair.com/) +- [Details about MicoAir743-Lite](https://micoair.com/flightcontroller_micoair743lite/) +- [QGroundControl Download and Install](https://docs.qgroundcontrol.com/Stable_V5.0/en/qgc-user-guide/getting_started/download_and_install.html) diff --git a/docs/zh/flight_modes_fw/return.md b/docs/zh/flight_modes_fw/return.md index c04e7619f1..62eefc6e2d 100644 --- a/docs/zh/flight_modes_fw/return.md +++ b/docs/zh/flight_modes_fw/return.md @@ -25,11 +25,6 @@ The default type is recommended. ::: -:::warning -There is a known issue ([PX4-Autopilot#25436](https://github.com/PX4/PX4-Autopilot/issues/25436)) with fixed-wing approaches and landings while in RTL mode. -Please review the issue and verify in simulation that the behavior you get is safe in an RTL landing scenario (if not, consider using rally points). -::: - ## 技术总结 Fixed-wing vehicles use the _mission landing/rally point_ return type by default. diff --git a/docs/zh/gps_compass/index.md b/docs/zh/gps_compass/index.md index 660cf102b3..db0a4584d9 100644 --- a/docs/zh/gps_compass/index.md +++ b/docs/zh/gps_compass/index.md @@ -201,7 +201,9 @@ EPH/EPV values therefore provide a more immediate and practical estimate of the - GPS/RTK-GPS - [RTK-GPS](../advanced/rtk_gps.md) + - [PPS Time Synchronization](../advanced/pps_time_sync.md) - [GPS driver](../modules/modules_driver.md#gps) + - [PPS driver](../modules/modules_driver.md#pps-capture) - [DroneCAN Example](../dronecan/index.md) - 罗盘 - [Driver source code](https://github.com/PX4/PX4-Autopilot/tree/main/src/drivers/magnetometer) (Compasses) diff --git a/docs/zh/gps_compass/magnetometer.md b/docs/zh/gps_compass/magnetometer.md index 4fd06a5cc1..0435210bec 100644 --- a/docs/zh/gps_compass/magnetometer.md +++ b/docs/zh/gps_compass/magnetometer.md @@ -40,6 +40,7 @@ This list contains stand-alone magnetometer modules (without GNSS). | 设备 | 罗盘 | DroneCan | | :--------------------------------------------------------------------------------------------------------------- | :----: | :-------------------------: | +| [ARK MAG](https://arkelectron.com/product/ark-mag/) | RM3100 | ✓ | | [Avionics Anonymous UAVCAN Magnetometer](https://www.tindie.com/products/avionicsanonymous/uavcan-magnetometer/) | ? | | | [Holybro DroneCAN RM3100 Compass/Magnetometer](https://holybro.com/products/dronecan-rm3100-compass) | RM3100 | ✓ | | [RaccoonLab DroneCAN/Cyphal Magnetometer RM3100](https://holybro.com/products/dronecan-rm3100-compass) | RM3100 | ✓ | diff --git a/docs/zh/middleware/uxrce_dds.md b/docs/zh/middleware/uxrce_dds.md index 65b014b0c1..91e1a4c87a 100644 --- a/docs/zh/middleware/uxrce_dds.md +++ b/docs/zh/middleware/uxrce_dds.md @@ -454,6 +454,7 @@ uxrce_dds_client start -n fancy_uav ``` This can be included in `etc/extras.txt` as part of a custom [System Startup](../concept/system_startup.md). +::: ## PX4 ROS 2 QoS Settings @@ -588,7 +589,7 @@ For a list of services, details and examples see the [service documentation](../ These guidelines explain how to migrate from using PX4 v1.13 [Fast-RTPS](../middleware/micrortps.md) middleware to PX4 v1.14 `uXRCE-DDS` middleware. These are useful if you have [ROS 2 applications written for PX4 v1.13](https://docs.px4.io/v1.13/en/ros/ros2_comm.html), or you have used Fast-RTPS to interface your applications to PX4 [directly](https://docs.px4.io/v1.13/en/middleware/micrortps.html#agent-in-an-offboard-fast-dds-interface-ros-independent). -::: info +:::info This section contains migration-specific information. You should also read the rest of this page to properly understand uXRCE-DDS. ::: diff --git a/msg/EscReport.msg b/msg/EscReport.msg index 9a75c3d7cc..ca80753f14 100644 --- a/msg/EscReport.msg +++ b/msg/EscReport.msg @@ -11,6 +11,19 @@ uint8 esc_state # State of ESC - depend on Vendor uint8 actuator_function # actuator output function (one of Motor1...MotorN) +uint8 ACTUATOR_FUNCTION_MOTOR1 = 101 +uint8 ACTUATOR_FUNCTION_MOTOR2 = 102 +uint8 ACTUATOR_FUNCTION_MOTOR3 = 103 +uint8 ACTUATOR_FUNCTION_MOTOR4 = 104 +uint8 ACTUATOR_FUNCTION_MOTOR5 = 105 +uint8 ACTUATOR_FUNCTION_MOTOR6 = 106 +uint8 ACTUATOR_FUNCTION_MOTOR7 = 107 +uint8 ACTUATOR_FUNCTION_MOTOR8 = 108 +uint8 ACTUATOR_FUNCTION_MOTOR9 = 109 +uint8 ACTUATOR_FUNCTION_MOTOR10 = 110 +uint8 ACTUATOR_FUNCTION_MOTOR11 = 111 +uint8 ACTUATOR_FUNCTION_MOTOR12 = 112 + uint16 failures # Bitmask to indicate the internal ESC faults int8 esc_power # Applied power 0-100 in % (negative values reserved) diff --git a/src/drivers/bootloaders/CMakeLists.txt b/src/drivers/bootloaders/CMakeLists.txt index 0972160fdf..3123ea9d54 100644 --- a/src/drivers/bootloaders/CMakeLists.txt +++ b/src/drivers/bootloaders/CMakeLists.txt @@ -43,6 +43,17 @@ target_link_libraries(drivers_bootloaders PRIVATE crc) # generate bootloader_app_shared_t if(NOT "${PX4_BOARD_LABEL}" MATCHES "canbootloader") + # Check if UAVCAN board identity variables are defined + # These are only set for UAVCAN node boards (CAN peripherals like can-gps, cannode, etc.) + if(NOT DEFINED uavcanblid_hw_version_major OR NOT DEFINED uavcanblid_hw_version_minor OR + NOT DEFINED uavcanblid_sw_version_major OR NOT DEFINED uavcanblid_sw_version_minor) + message(FATAL_ERROR + "CONFIG_DRIVERS_BOOTLOADERS is only supported on UAVCAN node boards.\n" + "This board (${PX4_BOARD}) does not have UAVCAN board identity defined.\n" + "Please disable CONFIG_DRIVERS_BOOTLOADERS in boardconfig (make ${PX4_CONFIG} boardconfig).\n" + "Note: This option is only needed for CAN peripheral boards (e.g., can-gps, cannode, can-flow).") + endif() + set(HW_MAJOR ${uavcanblid_hw_version_major}) set(HW_MINOR ${uavcanblid_hw_version_minor}) set(SW_MAJOR ${uavcanblid_sw_version_major}) diff --git a/src/drivers/bootloaders/Kconfig b/src/drivers/bootloaders/Kconfig index a630d51277..4d75c553e4 100644 --- a/src/drivers/bootloaders/Kconfig +++ b/src/drivers/bootloaders/Kconfig @@ -1,5 +1,7 @@ menuconfig DRIVERS_BOOTLOADERS bool "bootloaders" default n + depends on BOARD_ROMFSROOT = "cannode" || BOARD_ROMFSROOT = "" ---help--- Enable support for bootloaders + Note: This is only supported on UAVCAN node boards (CAN peripherals) diff --git a/src/drivers/uavcannode/Publishers/BatteryInfo.hpp b/src/drivers/uavcannode/Publishers/BatteryInfo.hpp index 7cd45d6f2a..00b409400a 100644 --- a/src/drivers/uavcannode/Publishers/BatteryInfo.hpp +++ b/src/drivers/uavcannode/Publishers/BatteryInfo.hpp @@ -86,7 +86,7 @@ public: battery_info_aux.timestamp.usec = battery.timestamp; - for (uint8_t i = 0; i < battery.cell_count && i < battery.voltage_cell_v.size(); i++) { + for (uint8_t i = 0; i < battery.cell_count && i < arraySize(battery_status_s::voltage_cell_v); i++) { battery_info_aux.voltage_cell.push_back(battery.voltage_cell_v[i]); } diff --git a/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp b/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp index 3a77075f11..e2ebb11bd0 100644 --- a/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp +++ b/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp @@ -44,15 +44,12 @@ bool FlightTaskAuto::activate(const trajectory_setpoint_s &last_setpoint) { bool ret = FlightTask::activate(last_setpoint); + // Set setpoints equal current state. _position_setpoint = _position; _velocity_setpoint = _velocity; _yaw_setpoint = _yaw; _yawspeed_setpoint = 0.0f; - // Set setpoints equal current state. - _velocity_setpoint = _velocity; - _position_setpoint = _position; - Vector3f vel_prev{last_setpoint.velocity}; Vector3f pos_prev{last_setpoint.position}; Vector3f accel_prev{last_setpoint.acceleration}; diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index 479fa5a0a9..b81b1af9d5 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -1813,9 +1813,8 @@ Mavlink::configure_streams_to_default(const char *configure_single_stream) configure_stream_local("GIMBAL_DEVICE_ATTITUDE_STATUS", 1.0f); configure_stream_local("GIMBAL_MANAGER_STATUS", 0.5f); configure_stream_local("GIMBAL_DEVICE_SET_ATTITUDE", 2.0f); - configure_stream_local("ESC_INFO", 0.2f); - configure_stream_local("ESC_STATUS", 0.5f); - + configure_stream_local("ESC_INFO", 1.0f); + configure_stream_local("ESC_STATUS", 2.0f); configure_stream_local("ADSB_VEHICLE", 1.0f); configure_stream_local("ATTITUDE_TARGET", 0.5f); configure_stream_local("AVAILABLE_MODES", 0.3f); diff --git a/src/modules/mavlink/mavlink_timesync.cpp b/src/modules/mavlink/mavlink_timesync.cpp index c9df0a4126..18746283dc 100644 --- a/src/modules/mavlink/mavlink_timesync.cpp +++ b/src/modules/mavlink/mavlink_timesync.cpp @@ -65,6 +65,8 @@ MavlinkTimesync::handle_message(const mavlink_message_t *msg) rsync.tc1 = now * 1000ULL; rsync.ts1 = tsync.ts1; + rsync.target_component = msg->compid; + rsync.target_system = msg->sysid; mavlink_msg_timesync_send_struct(_mavlink.get_channel(), &rsync); diff --git a/src/modules/mavlink/streams/ESC_INFO.hpp b/src/modules/mavlink/streams/ESC_INFO.hpp index 609112ed0a..d4066a2332 100644 --- a/src/modules/mavlink/streams/ESC_INFO.hpp +++ b/src/modules/mavlink/streams/ESC_INFO.hpp @@ -34,7 +34,9 @@ #ifndef ESC_INFO_HPP #define ESC_INFO_HPP +#include #include +#include class MavlinkStreamESCInfo : public MavlinkStream { @@ -49,50 +51,121 @@ public: unsigned get_size() override { - static constexpr unsigned size_per_batch = MAVLINK_MSG_ID_ESC_INFO_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES; - return _esc_status_sub.advertised() ? size_per_batch * _number_of_batches : 0; + static constexpr unsigned message_size = MAVLINK_MSG_ID_ESC_INFO_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES; + return _esc_status_subs.advertised_count() * message_size; } private: explicit MavlinkStreamESCInfo(Mavlink *mavlink) : MavlinkStream(mavlink) {} - uORB::Subscription _esc_status_sub{ORB_ID(esc_status)}; - uint8_t _number_of_batches{0}; + uORB::SubscriptionMultiArray _esc_status_subs{ORB_ID::esc_status}; + + static constexpr uint8_t MAX_ESC_OUTPUTS = 12; // See output_functions.hpp + static constexpr uint8_t ESCS_PER_MSG = MAVLINK_MSG_ESC_INFO_FIELD_TEMPERATURE_LEN; + static constexpr uint8_t MAX_NUM_MSGS = MAX_ESC_OUTPUTS / ESCS_PER_MSG; + + static constexpr hrt_abstime ESC_TIMEOUT = 100000; + + struct EscOutputInterfaceInfo { + uint16_t counter; + uint8_t esc_count; + uint8_t esc_connectiontype; + uint8_t esc_online_flags; + }; + + struct EscInfo { + hrt_abstime timestamp; + uint16_t failure_flags; + uint32_t error_count; + int16_t temperature; + bool online; + }; + + int _total_esc_count = {}; + EscOutputInterfaceInfo _interface[MAX_NUM_MSGS] = {}; + EscInfo _escs[MAX_ESC_OUTPUTS] = {}; + + void update_data() override + { + int subscriber_count = math::min(_esc_status_subs.size(), MAX_NUM_MSGS); + + for (int i = 0; i < subscriber_count; i++) { + esc_status_s esc = {}; + + if (_esc_status_subs[i].update(&esc)) { + _interface[i].counter = esc.counter; + _interface[i].esc_count = esc.esc_count; + _interface[i].esc_connectiontype = esc.esc_connectiontype; + + // Capture online_flags, we will map from index to motor number + uint8_t online_flags = esc.esc_online_flags; + _interface[i].esc_online_flags = 0; + + for (int j = 0; j < esc_status_s::CONNECTED_ESC_MAX; j++) { + bool is_motor = ((int)esc.esc[j].actuator_function >= esc_report_s::ACTUATOR_FUNCTION_MOTOR1) && + ((int)esc.esc[j].actuator_function <= esc_report_s::ACTUATOR_FUNCTION_MOTOR12); + + if (is_motor) { + // Map OutputFunction number to index + int index = (int)esc.esc[j].actuator_function - esc_report_s::ACTUATOR_FUNCTION_MOTOR1; + _escs[index].online = online_flags & (1 << j); + _escs[index].failure_flags = esc.esc[j].failures; + _escs[index].error_count = esc.esc[j].esc_errorcount; + _escs[index].timestamp = esc.esc[j].timestamp; + _escs[index].temperature = esc.esc[j].esc_temperature * 100.f; + } + } + } + } + + int count = 0; + + for (int i = 0; i < MAX_NUM_MSGS; i++) { + count += _interface[i].esc_count; + } + + _total_esc_count = count; + } bool send() override { - static constexpr uint8_t batch_size = MAVLINK_MSG_ESC_INFO_FIELD_TEMPERATURE_LEN; - esc_status_s esc_status; + bool updated = false; - if (_esc_status_sub.update(&esc_status)) { - mavlink_esc_info_t msg{}; + for (int i = 0; i < MAX_NUM_MSGS; i++) { - msg.time_usec = esc_status.timestamp; - msg.counter = esc_status.counter; - msg.count = esc_status.esc_count; - msg.connection_type = esc_status.esc_connectiontype; - msg.info = esc_status.esc_online_flags; + hrt_abstime now = hrt_absolute_time(); - // Ceil value of integer division. For 1-4 esc => 1 batch, 5-8 esc => 2 batches etc - _number_of_batches = ceilf((float)esc_status.esc_count / batch_size); + mavlink_esc_info_t msg = {}; + msg.index = i * ESCS_PER_MSG; + msg.time_usec = now; + msg.counter = _interface[i].counter; + msg.count = _total_esc_count; + msg.connection_type = _interface[i].esc_connectiontype; + msg.info = _interface[i].esc_online_flags; - for (int batch_number = 0; batch_number < _number_of_batches; batch_number++) { - msg.index = batch_number * batch_size; + bool atleast_one_esc_updated = false; - for (int esc_index = 0; esc_index < batch_size ; esc_index++) { - msg.failure_flags[esc_index] = esc_status.esc[esc_index].failures; - msg.error_count[esc_index] = esc_status.esc[esc_index].esc_errorcount; - msg.temperature[esc_index] = static_cast(esc_status.esc[esc_index].esc_temperature * - 100.f); // convert to centiDegrees + for (int j = 0; j < ESCS_PER_MSG; j++) { + + EscInfo &esc = _escs[i * ESCS_PER_MSG + j]; + + msg.info |= (esc.online << j); + + if ((esc.timestamp != 0) && (esc.timestamp + ESC_TIMEOUT) > now) { + msg.failure_flags[j] = esc.failure_flags; + msg.error_count[j] = esc.error_count; + msg.temperature[j] = esc.temperature; + atleast_one_esc_updated = true; } - - mavlink_msg_esc_info_send_struct(_mavlink->get_channel(), &msg); } - return true; + if (atleast_one_esc_updated) { + mavlink_msg_esc_info_send_struct(_mavlink->get_channel(), &msg); + updated = true; + } } - return false; + return updated; } }; diff --git a/src/modules/mavlink/streams/ESC_STATUS.hpp b/src/modules/mavlink/streams/ESC_STATUS.hpp index 54c11cbd8e..925f77ab81 100644 --- a/src/modules/mavlink/streams/ESC_STATUS.hpp +++ b/src/modules/mavlink/streams/ESC_STATUS.hpp @@ -34,7 +34,9 @@ #ifndef ESC_STATUS_HPP #define ESC_STATUS_HPP +#include #include +#include class MavlinkStreamESCStatus : public MavlinkStream { @@ -49,46 +51,88 @@ public: unsigned get_size() override { - static constexpr unsigned size_per_batch = MAVLINK_MSG_ID_ESC_STATUS_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES; - return _esc_status_sub.advertised() ? size_per_batch * _number_of_batches : 0; + static constexpr unsigned message_size = MAVLINK_MSG_ID_ESC_STATUS_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES; + return _esc_status_subs.advertised_count() * message_size; } private: explicit MavlinkStreamESCStatus(Mavlink *mavlink) : MavlinkStream(mavlink) {} - uORB::Subscription _esc_status_sub{ORB_ID(esc_status)}; - uint8_t _number_of_batches{0}; + uORB::SubscriptionMultiArray _esc_status_subs{ORB_ID::esc_status}; + + static constexpr uint8_t MAX_ESC_OUTPUTS = 12; // See output_functions.hpp + static constexpr uint8_t ESCS_PER_MSG = MAVLINK_MSG_ESC_STATUS_FIELD_RPM_LEN; + static constexpr uint8_t MAX_NUM_MSGS = MAX_ESC_OUTPUTS / ESCS_PER_MSG; + static constexpr hrt_abstime ESC_TIMEOUT = 100000; + + struct EscStatus { + hrt_abstime timestamp; + int32_t rpm; + float voltage; + float current; + }; + + EscStatus _escs[MAX_ESC_OUTPUTS] = {}; + + void update_data() override + { + int subscriber_count = math::min(_esc_status_subs.size(), MAX_NUM_MSGS); + + for (int i = 0; i < subscriber_count; i++) { + esc_status_s esc = {}; + + if (_esc_status_subs[i].update(&esc)) { + for (int j = 0; j < esc_status_s::CONNECTED_ESC_MAX; j++) { + + bool is_motor = ((int)esc.esc[j].actuator_function >= esc_report_s::ACTUATOR_FUNCTION_MOTOR1) && + ((int)esc.esc[j].actuator_function <= esc_report_s::ACTUATOR_FUNCTION_MOTOR12); + + if (is_motor) { + // Map OutputFunction number to index + int index = (int)esc.esc[j].actuator_function - esc_report_s::ACTUATOR_FUNCTION_MOTOR1; + _escs[index].timestamp = esc.esc[j].timestamp; + _escs[index].rpm = esc.esc[j].esc_rpm; + _escs[index].voltage = esc.esc[j].esc_voltage; + _escs[index].current = esc.esc[j].esc_current; + } + } + } + } + } bool send() override { - static constexpr uint8_t batch_size = MAVLINK_MSG_ESC_STATUS_FIELD_RPM_LEN; - esc_status_s esc_status; + bool updated = false; - if (_esc_status_sub.update(&esc_status)) { - mavlink_esc_status_t msg{}; + for (int i = 0; i < MAX_NUM_MSGS; i++) { - msg.time_usec = esc_status.timestamp; + hrt_abstime now = hrt_absolute_time(); - // Ceil value of integer division. For 1-4 esc => 1 batch, 5-8 esc => 2 batches etc - _number_of_batches = ceilf((float)esc_status.esc_count / batch_size); + mavlink_esc_status_t msg = {}; + msg.index = i * ESCS_PER_MSG; + msg.time_usec = now; - for (int batch_number = 0; batch_number < _number_of_batches; batch_number++) { - msg.index = batch_number * batch_size; + bool atleast_one_esc_updated = false; - for (int esc_index = 0; esc_index < batch_size - && msg.index + esc_index < esc_status_s::CONNECTED_ESC_MAX; esc_index++) { - msg.rpm[esc_index] = esc_status.esc[msg.index + esc_index].esc_rpm; - msg.voltage[esc_index] = esc_status.esc[msg.index + esc_index].esc_voltage; - msg.current[esc_index] = esc_status.esc[msg.index + esc_index].esc_current; + for (int j = 0; j < ESCS_PER_MSG; j++) { + + EscStatus &esc = _escs[i * ESCS_PER_MSG + j]; + + if ((esc.timestamp != 0) && (esc.timestamp + ESC_TIMEOUT) > now) { + msg.rpm[j] = esc.rpm; + msg.voltage[j] = esc.voltage; + msg.current[j] = esc.current; + atleast_one_esc_updated = true; } - - mavlink_msg_esc_status_send_struct(_mavlink->get_channel(), &msg); } - return true; + if (atleast_one_esc_updated) { + mavlink_msg_esc_status_send_struct(_mavlink->get_channel(), &msg); + updated = true; + } } - return false; + return updated; } }; diff --git a/src/modules/uxrce_dds_client/dds_topics.h.em b/src/modules/uxrce_dds_client/dds_topics.h.em index 7ff7605ccd..30ba6053ea 100644 --- a/src/modules/uxrce_dds_client/dds_topics.h.em +++ b/src/modules/uxrce_dds_client/dds_topics.h.em @@ -67,6 +67,7 @@ struct SendSubscription { uint32_t topic_size; UcdrSerializeMethod ucdr_serialize_method; uint64_t publish_interval_ms; + uint8_t orb_instance; }; // Subscribers for messages to send @@ -81,6 +82,7 @@ struct SendTopicsSubs { ucdr_topic_size_@(pub['simple_base_type'])(), &ucdr_serialize_@(pub['simple_base_type']), static_cast((@(pub.get('rate_limit', 0)) > 0) ? (1e3 / @(pub.get('rate_limit', 1e3))) : UXRCE_DEFAULT_POLL_INTERVAL_MS), + @(pub['instance']) }, @[ end for]@ }; @@ -98,13 +100,13 @@ bool SendTopicsSubs::init(uxrSession *session, uxrStreamId reliable_out_stream_i bool ret = true; for (unsigned idx = 0; idx < sizeof(send_subscriptions)/sizeof(send_subscriptions[0]); ++idx) { if (fds[idx].events == 0) { - fds[idx].fd = orb_subscribe(send_subscriptions[idx].orb_meta); + fds[idx].fd = orb_subscribe_multi(send_subscriptions[idx].orb_meta, send_subscriptions[idx].orb_instance); fds[idx].events = POLLIN; orb_set_interval(fds[idx].fd, send_subscriptions[idx].publish_interval_ms); } if (!create_data_writer(session, reliable_out_stream_id, participant_id, static_cast(send_subscriptions[idx].orb_meta->o_id), client_namespace, send_subscriptions[idx].topic, - send_subscriptions[idx].message_version, + send_subscriptions[idx].message_version, send_subscriptions[idx].orb_instance, send_subscriptions[idx].dds_type_name, send_subscriptions[idx].data_writer)) { ret = false; } diff --git a/src/modules/uxrce_dds_client/generate_dds_topics.py b/src/modules/uxrce_dds_client/generate_dds_topics.py index 3698c71e9e..957ff4b578 100644 --- a/src/modules/uxrce_dds_client/generate_dds_topics.py +++ b/src/modules/uxrce_dds_client/generate_dds_topics.py @@ -102,12 +102,24 @@ def process_message_type(msg_type): # topic_simple: eg vehicle_status msg_type['topic_simple'] = msg_type['topic'].split('/')[-1] +def process_message_instance(msg_type): + if 'instance' in msg_type: + # if instance is given, check if it is a non negative integer + if not (type(msg_type['instance']) is int and msg_type['instance'] >= 0) : + raise TypeError("`instance` must be a non negative integer") + # add trailing instance to topic name + msg_type['topic'] = f"{msg_type['topic']}{msg_type['instance']}" + else: + # if instance is not given, + msg_type['instance'] = 0 + merged_em_globals['namespace'] = namespace pubs_not_empty = msg_map['publications'] is not None if pubs_not_empty: for p in msg_map['publications']: process_message_type(p) + process_message_instance(p) merged_em_globals['publications'] = msg_map['publications'] if pubs_not_empty else [] diff --git a/src/modules/uxrce_dds_client/utilities.hpp b/src/modules/uxrce_dds_client/utilities.hpp index c2d038b3ed..346dc28455 100644 --- a/src/modules/uxrce_dds_client/utilities.hpp +++ b/src/modules/uxrce_dds_client/utilities.hpp @@ -50,7 +50,7 @@ static bool generate_topic_name(char *topic_name, const char *client_namespace, } static bool create_data_writer(uxrSession *session, uxrStreamId reliable_out_stream_id, uxrObjectId participant_id, - ORB_ID orb_id, const char *client_namespace, const char *topic, uint32_t message_version, const char *type_name, + ORB_ID orb_id, const char *client_namespace, const char *topic, uint32_t message_version, uint8_t instance, const char *type_name, uxrObjectId &datawriter_id) { // topic @@ -61,7 +61,7 @@ static bool create_data_writer(uxrSession *session, uxrStreamId reliable_out_str return false; } - uxrObjectId topic_id = topic_id_from_orb(orb_id); + uxrObjectId topic_id = topic_id_from_orb(orb_id, instance); uint16_t topic_req = uxr_buffer_create_topic_bin(session, reliable_out_stream_id, topic_id, participant_id, topic_name, type_name, UXR_REPLACE);