mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-24 16:01:53 +08:00
docs(flight_controller): address the mavlink-router review and wire up uXRCE-DDS on the MR-NavQ95
Only the imx-image-ros image ships mavlink-router, and its main.conf exposes a UDP server on port 10000 instead of pushing to a ground station, on purpose, so Wi-Fi is not flooded with broadcast traffic. Say so, tell the reader to add the board as a UDP server in QGroundControl or to add a Normal endpoint for a fixed ground station, and point at the router's own endpoint documentation. /dev/ttyros existed but no PX4 module could use it: it was not a board serial port, so UXRCE_DDS_CFG could not select it and nothing started the client. Registering it as TELEM 2 lets the generated rc.serial start uxrce_dds_client on it from the parameter, like a companion link on any other board, with nothing enabled by default. Tested on the board: with UXRCE_DDS_CFG set to 102 the client starts at boot on /dev/ttyros at 921600 baud and its session frames arrive on the Linux side. The page gets a ROS 2 section with the three steps, and the agent install points at the uXRCE-DDS page since the Linux images do not ship it. Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
This commit is contained in:
1 parent
db2a8ce3cb
commit
243f20a8a1
3 files changed
+35
-9
No files matched your search
@@ -4,6 +4,7 @@ CONFIG_BOARD_LINKER_PREFIX="flash"
|
||||
CONFIG_BOARD_MCUBOOT_IMGTOOL_ARGS="--header-size 0x800 --slot-size 0x700000 --align 2 --pad-header"
|
||||
CONFIG_BOARD_SERIAL_GPS1="/dev/ttyS4"
|
||||
CONFIG_BOARD_SERIAL_TEL1="/dev/ttyS6"
|
||||
CONFIG_BOARD_SERIAL_TEL2="/dev/ttyros"
|
||||
CONFIG_BOARD_SERIAL_RC="/dev/ttyS1"
|
||||
CONFIG_BOARD_ROOT_PATH="/fs/rpmsg"
|
||||
CONFIG_BOARD_PARAM_FILE="/fs/rpmsg/params"
|
||||
|
||||
@@ -8,6 +8,10 @@ param set-default BAT1_V_DIV 64.400000000
|
||||
# CRSF receivers on the RC port work without further configuration
|
||||
param set-default RC_CRSF_PRT_CFG 300
|
||||
|
||||
# uXRCE-DDS: the RPMsg link /dev/ttyros to Linux is registered as TELEM 2.
|
||||
# Set UXRCE_DDS_CFG to TELEM 2 and rc.serial starts the client on it; the
|
||||
# agent runs on the Linux side (MicroXRCEAgent serial --dev /dev/ttyros).
|
||||
|
||||
if param greater -s UAVCAN_ENABLE 0
|
||||
then
|
||||
ifup can0
|
||||
|
||||
@@ -232,12 +232,12 @@ The board brings up `can0` and `can1` only when [UAVCAN_ENABLE](../advanced_conf
|
||||
The Linux side must run the NavQ95 BSP built from [imx-manifest-navq95](https://github.com/NXP-Robotics/imx-manifest-navq95).
|
||||
It provides the RPMsg links PX4 depends on:
|
||||
|
||||
| Linux device | PX4 side | Purpose |
|
||||
| ---------------- | ------------------------- | ---------------------------------------------------------------- |
|
||||
| `/dev/ttynsh` | NSH console | PX4 shell (the system console) |
|
||||
| `/dev/ttyproxy` | `mavlink` in onboard mode | MAVLink at 921600 baud for the companion computer |
|
||||
| `/dev/ttymavmin` | `mavlink` in minimal mode | Second MAVLink link at 115200 baud (flags in `rc.board_mavlink`) |
|
||||
| `/dev/ttyros` | none | Reserved for a future ROS/uXRCE-DDS link, unused today |
|
||||
| Linux device | PX4 side | Purpose |
|
||||
| ---------------- | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
||||
| `/dev/ttynsh` | NSH console | PX4 shell (the system console) |
|
||||
| `/dev/ttyproxy` | `mavlink` in onboard mode | MAVLink at 921600 baud for the companion computer |
|
||||
| `/dev/ttymavmin` | `mavlink` in minimal mode | Second MAVLink link at 115200 baud (flags in `rc.board_mavlink`) |
|
||||
| `/dev/ttyros` | `uxrce_dds_client` (off by default) | [uXRCE-DDS](../middleware/uxrce_dds.md) link for ROS 2, registered as serial port `TELEM 2` (see [ROS 2](#ros_2)) |
|
||||
|
||||
PX4 has no local storage.
|
||||
`/fs/rpmsg` on the PX4 side is an RPMsg filesystem (rpmsgfs) served by Linux, and it holds the parameters, dataman and the flight logs.
|
||||
@@ -252,19 +252,40 @@ Keeping the parameters on the on-board octal NOR flash instead, so the M7 is sel
|
||||
There is no telemetry radio in the path by default: the MAVLink link leaves the board over the network.
|
||||
|
||||
The onboard-mode `mavlink` instance on PX4 shows up on Linux as `/dev/ttyproxy`.
|
||||
The BSP hands that device to [mavlink-router](https://github.com/mavlink-router/mavlink-router), which runs as a service and republishes the stream on the network, so several clients can use the same link at the same time:
|
||||
To on-board software it looks like an autopilot on a serial port: MAVSDK, MAVROS or any other MAVLink application from the [companion computer](../companion_computer/index.md#companion-computer-software) guide can open it directly.
|
||||
The `imx-image-ros` image instead runs [mavlink-router](https://github.com/mavlink-router/mavlink-router) as a service on that device (on `imx-image-mr` you have to install it yourself).
|
||||
It republishes the stream on the network, so several clients can use the same link at the same time:
|
||||
|
||||
```
|
||||
PX4 (M7) --RPMsg--> /dev/ttyproxy --> mavlink-router --> UDP/TCP on Wi-Fi or Ethernet
|
||||
```
|
||||
|
||||
[_QGroundControl_](../getting_started/px4_basic_concepts.md#qgc) connects to that endpoint over either the on-board Wi-Fi or the Ethernet port, and on-board software (MAVSDK, ROS 2 via the uXRCE-DDS bridge, or a camera or mission application) can attach to further endpoints in parallel.
|
||||
_mavlink-router_ reads its endpoints and ports from its configuration in `/etc/mavlink-router/` on the Linux image; add your ground station address there.
|
||||
The shipped configuration (`/etc/mavlink-router/main.conf`) listens for UDP on port 10000 and does not broadcast, so the Wi-Fi is not flooded with UDP traffic that access points tend to drop.
|
||||
The ground station therefore has to connect to the board: in [_QGroundControl_](../getting_started/px4_basic_concepts.md#qgc), add a UDP comm link with the board's IP address and port 10000 as its server.
|
||||
To push the stream to a fixed ground station instead, add a `UdpEndpoint` with `Mode = Normal` and the ground station's `Address` and `Port` (14550 for _QGroundControl_) to that file.
|
||||
The endpoint types and modes are described in the [mavlink-router README](https://github.com/mavlink-router/mavlink-router#endpoints).
|
||||
On-board software can attach to further endpoints of the router in parallel.
|
||||
|
||||
::: tip
|
||||
If _QGroundControl_ does not find the vehicle, check that the RPMsg links came up on Linux (`ls /dev/ttyproxy`) and that _mavlink-router_ is running (`systemctl status mavlink-router`) before looking at PX4.
|
||||
:::
|
||||
|
||||
### ROS 2 {#ros_2}
|
||||
|
||||
The RPMsg link `/dev/ttyros` is registered as the `TELEM 2` serial port of PX4, but nothing runs on it by default.
|
||||
To use [ROS 2](../ros2/user_guide.md) through the [uXRCE-DDS](../middleware/uxrce_dds.md) bridge:
|
||||
|
||||
1. Set [UXRCE_DDS_CFG](../advanced_config/parameter_reference.md#UXRCE_DDS_CFG) to `TELEM 2` and reboot PX4.
|
||||
The client then starts on `/dev/ttyros` at the `SER_TEL2_BAUD` rate (921600 by default, which only has to match the agent).
|
||||
2. [Install the Micro XRCE-DDS Agent](../middleware/uxrce_dds.md#micro-xrce-dds-agent-installation) on the Linux side; the images do not ship it.
|
||||
3. Start the agent on the same device:
|
||||
|
||||
```sh
|
||||
sudo MicroXRCEAgent serial --dev /dev/ttyros -b 921600
|
||||
```
|
||||
|
||||
The PX4 topics then appear in ROS 2 on the board, as described in the [ROS 2 User Guide](../ros2/user_guide.md).
|
||||
|
||||
## Building Firmware {#building_firmware}
|
||||
|
||||
To [build PX4](../dev_setup/building_px4.md) for this target:
|
||||
|
||||
Reference in new issue
Block a user