mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
New Crowdin translations - zh-CN (#25590)
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
- [位置模式(多旋翼)](flight_modes_mc/position.md)
|
- [位置模式(多旋翼)](flight_modes_mc/position.md)
|
||||||
- [Position Slow Mode (MC)](flight_modes_mc/position_slow.md)
|
- [Position Slow Mode (MC)](flight_modes_mc/position_slow.md)
|
||||||
- [高度模式(多旋翼)](flight_modes_mc/altitude.md)
|
- [高度模式(多旋翼)](flight_modes_mc/altitude.md)
|
||||||
|
- [Altitude Cruise Mode (MC)](flight_modes_mc/altitude_cruise.md)
|
||||||
- [Stabilized Mode (MC)](flight_modes_mc/manual_stabilized.md)
|
- [Stabilized Mode (MC)](flight_modes_mc/manual_stabilized.md)
|
||||||
- [特技模式(多旋翼)](flight_modes_mc/acro.md)
|
- [特技模式(多旋翼)](flight_modes_mc/acro.md)
|
||||||
- [环绕模式(多旋翼)](flight_modes_mc/orbit.md)
|
- [环绕模式(多旋翼)](flight_modes_mc/orbit.md)
|
||||||
|
|||||||
@@ -481,11 +481,11 @@ Position, velocity or orientation measurements from an external vision system, e
|
|||||||
|
|
||||||
The measurements that are fused are configured by setting the appropriate bits of [EKF2_EV_CTRL](../advanced_config/parameter_reference.md#EKF2_EV_CTRL) to `true`:
|
The measurements that are fused are configured by setting the appropriate bits of [EKF2_EV_CTRL](../advanced_config/parameter_reference.md#EKF2_EV_CTRL) to `true`:
|
||||||
|
|
||||||
- `0`: Horizontal position data
|
- `0`: 水平位置数据
|
||||||
- `1`: Vertical position data.
|
- `1`: Vertical position data.
|
||||||
Height sources may additionally be configured using [EKF2_HGT_REF](../advanced_config/parameter_reference.md#EKF2_HGT_REF) (see section [Height](#height)).
|
Height sources may additionally be configured using [EKF2_HGT_REF](../advanced_config/parameter_reference.md#EKF2_HGT_REF) (see section [Height](#height)).
|
||||||
- `2`: Velocity data
|
- `2`:速度数据
|
||||||
- `3`: Yaw data
|
- `3`:偏航角数据
|
||||||
|
|
||||||
Note that if yaw data is used (bit 3) the heading is with respect to the external vision frame; otherwise the heading is relative to North.
|
Note that if yaw data is used (bit 3) the heading is with respect to the external vision frame; otherwise the heading is relative to North.
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ The FCs have much the same ports with similar names, and core peripherals are co
|
|||||||
| Full GPS plus Safety Switch | GPS1 | GPS&SAFETY | Primary GNSS module (GPS, compass, safety switch, buzzer, LED) |
|
| Full GPS plus Safety Switch | GPS1 | GPS&SAFETY | Primary GNSS module (GPS, compass, safety switch, buzzer, LED) |
|
||||||
| Basic GPS | GPS2 | GPS2 | Secondary GNSS module (GNSS/compass) |
|
| Basic GPS | GPS2 | GPS2 | Secondary GNSS module (GNSS/compass) |
|
||||||
| CAN | CAN1/CAN2 | CAN1/CAN2 | DroneCAN devices, such as GNSS modules, motors, etc |
|
| CAN | CAN1/CAN2 | CAN1/CAN2 | DroneCAN devices, such as GNSS modules, motors, etc |
|
||||||
| Telemetry | TELEM (1,2,3) | TELEM (1,2,3) | Telemetry radios, companion computers, MAVLink cameras, etc. |
|
| 数传 | TELEM (1,2,3) | TELEM (1,2,3) | Telemetry radios, companion computers, MAVLink cameras, etc. |
|
||||||
| Analog Power | POWER (1,2) | POWER (1,2) | SMbus (I2C) power modules |
|
| Analog Power | POWER (1,2) | POWER (1,2) | SMbus (I2C) power modules |
|
||||||
| I2C | I2C | None | Other I2C peripherals |
|
| I2C | I2C | None | Other I2C peripherals |
|
||||||
| SPI | SPI | SPI6 | SPI devices (note: 11 pin, not 6 as in standard) |
|
| SPI | SPI | SPI6 | SPI devices (note: 11 pin, not 6 as in standard) |
|
||||||
|
|||||||
@@ -97,8 +97,8 @@ For more information see [Finding/Updating Parameters > Parameters Not In Firmwa
|
|||||||
|
|
||||||
Four different modes are supported, controlled by the [TRIG_MODE](../advanced_config/parameter_reference.md#TRIG_MODE) parameter:
|
Four different modes are supported, controlled by the [TRIG_MODE](../advanced_config/parameter_reference.md#TRIG_MODE) parameter:
|
||||||
|
|
||||||
| Mode | 描述 |
|
| 模式 | 描述 |
|
||||||
| ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| -- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| 0 | Camera triggering is disabled. |
|
| 0 | Camera triggering is disabled. |
|
||||||
| 1 | Works like a basic intervalometer that can be enabled and disabled by using the MAVLink command `MAV_CMD_DO_TRIGGER_CONTROL`. See [command interface](#mavlink-command-interface) for more details. |
|
| 1 | Works like a basic intervalometer that can be enabled and disabled by using the MAVLink command `MAV_CMD_DO_TRIGGER_CONTROL`. See [command interface](#mavlink-command-interface) for more details. |
|
||||||
| 2 | Switches the intervalometer constantly on. |
|
| 2 | Switches the intervalometer constantly on. |
|
||||||
|
|||||||
@@ -95,9 +95,9 @@ mode_req_other # other requirements, not covered above (for external
|
|||||||
|
|
||||||
If the condition of restriction is not met:
|
If the condition of restriction is not met:
|
||||||
|
|
||||||
- arming is not allowed, while the mode is selected
|
- 在选定模式时不允许进行解锁操作
|
||||||
- when already armed, the mode cannot be selected
|
- 当已处于武装状态时,该模式无法被选择。
|
||||||
- when armed and the mode is selected, the relevant failsafe is triggered (e.g. RC loss for the manual control requirement).
|
- 当载具已解锁且该模式被选中时,相关的故障保护机制会被触发(例如,针对手动控制需求的遥控器信号丢失故障保护)。
|
||||||
Check [Safety (Failsafe) Configuration](../config/safety.md) for how to configure failsafe behaviour.
|
Check [Safety (Failsafe) Configuration](../config/safety.md) for how to configure failsafe behaviour.
|
||||||
|
|
||||||
This is the corresponding flow diagram for the manual control flag (`mode_req_manual_control`):
|
This is the corresponding flow diagram for the manual control flag (`mode_req_manual_control`):
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ With _VScode_, configuration is stored in the PX4/PX4-Autopilot tree ([PX4-Autop
|
|||||||
|
|
||||||
You must already have installed the command line [PX4 developer environment](../dev_setup/dev_env.md) for your platform and downloaded the _Firmware_ source code repo.
|
You must already have installed the command line [PX4 developer environment](../dev_setup/dev_env.md) for your platform and downloaded the _Firmware_ source code repo.
|
||||||
|
|
||||||
## Installation & Setup
|
## 安装与设置
|
||||||
|
|
||||||
1. [Download and install VSCode](https://code.visualstudio.com/) (you will be offered the correct version for your OS).
|
1. [Download and install VSCode](https://code.visualstudio.com/) (you will be offered the correct version for your OS).
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ Order this module from:
|
|||||||
- Safety Button
|
- Safety Button
|
||||||
- 蜂鸣器
|
- 蜂鸣器
|
||||||
- Two Pixhawk Standard CAN Connectors (4 Pin JST GH)
|
- Two Pixhawk Standard CAN Connectors (4 Pin JST GH)
|
||||||
- F9P “UART 2” Connector
|
- F9P `UART 2` Connector
|
||||||
- 3 Pin JST GH
|
- 3 Pin JST GH
|
||||||
- TX, RX, GND
|
- TX, RX, GND
|
||||||
- Pixhawk Standard Debug Connector (6 Pin JST SH)
|
- Pixhawk Standard Debug Connector (6 Pin JST SH)
|
||||||
@@ -87,6 +87,25 @@ You need to set necessary [DroneCAN](index.md) parameters and define offsets if
|
|||||||
- The parameters [EKF2_GPS_POS_X](../advanced_config/parameter_reference.md#EKF2_GPS_POS_X), [EKF2_GPS_POS_Y](../advanced_config/parameter_reference.md#EKF2_GPS_POS_Y) and [EKF2_GPS_POS_Z](../advanced_config/parameter_reference.md#EKF2_GPS_POS_Z) can be set to account for the offset of the ARK RTK GPS from the vehicles centre of gravity.
|
- The parameters [EKF2_GPS_POS_X](../advanced_config/parameter_reference.md#EKF2_GPS_POS_X), [EKF2_GPS_POS_Y](../advanced_config/parameter_reference.md#EKF2_GPS_POS_Y) and [EKF2_GPS_POS_Z](../advanced_config/parameter_reference.md#EKF2_GPS_POS_Z) can be set to account for the offset of the ARK RTK GPS from the vehicles centre of gravity.
|
||||||
- Set [CANNODE_TERM](../advanced_config/parameter_reference.md#CANNODE_TERM) to `1` on the GPS if this it that last node on the CAN bus.
|
- Set [CANNODE_TERM](../advanced_config/parameter_reference.md#CANNODE_TERM) to `1` on the GPS if this it that last node on the CAN bus.
|
||||||
|
|
||||||
|
### Setting Up Rover and Fixed Base
|
||||||
|
|
||||||
|
Position of the rover is established using RTCM messages from the RTK base module (the base module is connected to QGC, which sends the RTCM information to PX4 via MAVLink).
|
||||||
|
|
||||||
|
PX4 DroneCAN parameters:
|
||||||
|
|
||||||
|
- [UAVCAN_PUB_RTCM](../advanced_config/parameter_reference.md#UAVCAN_PUB_RTCM):
|
||||||
|
- Makes PX4 publish RTCM messages ([RTCMStream](https://dronecan.github.io/Specification/7._List_of_standard_data_types/#rtcmstream)) to the bus (which it gets from the RTK base module via QGC).
|
||||||
|
|
||||||
|
Rover module parameters (also [set using QGC](../dronecan/index.md#qgc-cannode-parameter-configuration)):
|
||||||
|
|
||||||
|
- [CANNODE_SUB_RTCM](../advanced_config/parameter_reference.md#CANNODE_SUB_RTCM) tells the rover that it should subscribe to [RTCMStream](https://dronecan.github.io/Specification/7._List_of_standard_data_types/#rtcmstream) RTCM messages on the bus (from the moving base).
|
||||||
|
|
||||||
|
:::info
|
||||||
|
Use [UAVCAN_PUB_MBD](../advanced_config/parameter_reference.md#UAVCAN_PUB_MBD) and [CANNODE_SUB_MBD](../advanced_config/parameter_reference.md#CANNODE_SUB_MBD) instead if you want to implement moving base (see below) at the same time.
|
||||||
|
:::
|
||||||
|
|
||||||
|
For more information see [Rover and Fixed Base](../dronecan/index.md#rover-and-fixed-base) in the DroneCAN guide.
|
||||||
|
|
||||||
### Setting Up Moving Baseline & GPS Heading
|
### Setting Up Moving Baseline & GPS Heading
|
||||||
|
|
||||||
The simplest way to set up moving baseline and GPS heading with two ARK RTK GPS modules is via CAN, though it can be done via UART to reduce traffic on the CAN bus if desired.
|
The simplest way to set up moving baseline and GPS heading with two ARK RTK GPS modules is via CAN, though it can be done via UART to reduce traffic on the CAN bus if desired.
|
||||||
@@ -128,10 +147,11 @@ Setup via UART:
|
|||||||
- On the _Moving Base_, set the following:
|
- On the _Moving Base_, set the following:
|
||||||
- [GPS_UBX_MODE](../advanced_config/parameter_reference.md#GPS_UBX_MODE) to `2`.
|
- [GPS_UBX_MODE](../advanced_config/parameter_reference.md#GPS_UBX_MODE) to `2`.
|
||||||
|
|
||||||
|
For more information see [Rover and Moving Base](../dronecan/index.md#rover-and-moving-base) in the DroneCAN guide.
|
||||||
|
|
||||||
## LED含义
|
## LED含义
|
||||||
|
|
||||||
- The GPS status lights are located to the right of the connectors
|
- The GPS status lights are located to the right of the connectors
|
||||||
|
|
||||||
- Blinking green is GPS fix
|
- Blinking green is GPS fix
|
||||||
- Blinking blue is received corrections and RTK Float
|
- Blinking blue is received corrections and RTK Float
|
||||||
- Solid blue is RTK Fixed
|
- Solid blue is RTK Fixed
|
||||||
|
|||||||
@@ -9,3 +9,18 @@ For more information, see the following articles for specific hardware/firmware:
|
|||||||
- [Vertiq](../peripherals/vertiq.md) (larger modules)
|
- [Vertiq](../peripherals/vertiq.md) (larger modules)
|
||||||
- [VESC Project](../peripherals/vesc.md)
|
- [VESC Project](../peripherals/vesc.md)
|
||||||
- [RaccoonLab Cyphal and DroneCAN PWM nodes](raccoonlab_nodes.md)
|
- [RaccoonLab Cyphal and DroneCAN PWM nodes](raccoonlab_nodes.md)
|
||||||
|
|
||||||
|
## 硬件配置
|
||||||
|
|
||||||
|
General DroneCAN hardware configuration is covered in [DroneCAN > Hardware Setup](../dronecan/index.md#hardware-setup).
|
||||||
|
|
||||||
|
DroneCAN ESCs should be on their own dedicated CAN interface(s) because ESC messages can saturate the bus and starve other nodes of bandwidth.
|
||||||
|
|
||||||
|
## PX4 配置
|
||||||
|
|
||||||
|
DroneCAN peripherals are configured by following the procedure outlined in [DroneCAN](../dronecan/index.md).
|
||||||
|
|
||||||
|
In addition to the general setup, such as setting `UAVCAN_ENABLE` to `3`:
|
||||||
|
|
||||||
|
- Select the specific CAN interface(s) used for ESC data output using the [UAVCAN_ESC_IFACE](../advanced_config/parameter_reference.md#UAVCAN_ESC_IFACE) parameter (all that all interfaces are selected by default).
|
||||||
|
- Configure the [motor order and servo outputs](../config/actuators.md).
|
||||||
|
|||||||
@@ -276,6 +276,9 @@ PX4 DroneCAN parameters:
|
|||||||
|
|
||||||
[DroneCAN ESCs and servos](../dronecan/escs.md) require the [motor order and servo outputs](../config/actuators.md) to be configured.
|
[DroneCAN ESCs and servos](../dronecan/escs.md) require the [motor order and servo outputs](../config/actuators.md) to be configured.
|
||||||
|
|
||||||
|
Select the specific CAN interface(s) used for ESC data output using the [UAVCAN_ESC_IFACE](../advanced_config/parameter_reference.md#UAVCAN_ESC_IFACE) parameter (all that all interfaces are selected by default).
|
||||||
|
Note that DroneCAN ESCs should be on their own dedicated CAN interface(s) because ESC messages can saturate the bus and starve other nodes of bandwidth.
|
||||||
|
|
||||||
## QGC CANNODE Parameter Configuration
|
## QGC CANNODE Parameter Configuration
|
||||||
|
|
||||||
QGroundControl can inspect and modify parameters belonging to CAN devices attached to the flight controller, provided the device are connected to the flight controller before QGC is started.
|
QGroundControl can inspect and modify parameters belonging to CAN devices attached to the flight controller, provided the device are connected to the flight controller before QGC is started.
|
||||||
@@ -313,7 +316,10 @@ If successful, the firmware binary will be removed from the root directory and t
|
|||||||
|
|
||||||
**Q**: The motors aren't spinning when armed.
|
**Q**: The motors aren't spinning when armed.
|
||||||
|
|
||||||
**A**: Make sure `UAVCAN_ENABLE` is set to `3` to enable DroneCAN ESC output.
|
**A**:
|
||||||
|
|
||||||
|
- Make sure `UAVCAN_ENABLE` is set to `3` to enable DroneCAN ESC output.
|
||||||
|
- Make sure `UAVCAN_ESC_IFACE` is set to enable the CAN interface(s) used for ESCs.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ The main hardware documentation is [here](http://mindpx.net/assets/accessories/m
|
|||||||
| IMU | 10DOF |
|
| IMU | 10DOF |
|
||||||
| IMU isolation | YES/Optional |
|
| IMU isolation | YES/Optional |
|
||||||
| Radio Receiver | S.BUS/PPM/DSM/DSM2/DSMX/SUMD |
|
| Radio Receiver | S.BUS/PPM/DSM/DSM2/DSMX/SUMD |
|
||||||
| Telemetry | FrSky<sup>®</sup> D.Port, S.Port, Wifi, 3DR radio |
|
| 数传 | FrSky<sup>®</sup> D.Port, S.Port, Wifi, 3DR radio |
|
||||||
| On board TF card for flight data recording | YES |
|
| On board TF card for flight data recording | YES |
|
||||||
| OneShot ESC Support | YES |
|
| OneShot ESC Support | YES |
|
||||||
| Expansion Slots | 2x7(pin)x2 |
|
| Expansion Slots | 2x7(pin)x2 |
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ This flight controller is [manufacturer supported](../flight_controller/autopilo
|
|||||||
| microSD Card | [Information on supported cards](../dev_log/logging.md#sd-cards) |
|
| microSD Card | [Information on supported cards](../dev_log/logging.md#sd-cards) |
|
||||||
| 输入 | GPS/Mag |
|
| 输入 | GPS/Mag |
|
||||||
| | Spektrum |
|
| | Spektrum |
|
||||||
| | Telemetry |
|
| | 数传 |
|
||||||
| | CAN bus |
|
| | CAN bus |
|
||||||
| | PPM |
|
| | PPM |
|
||||||
| Outputs | 6 LEDs (2xRGB) |
|
| Outputs | 6 LEDs (2xRGB) |
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ This flight controller is [manufacturer supported](../flight_controller/autopilo
|
|||||||
| microSD Card | [Information on supported cards](../dev_log/logging.md#sd-cards) |
|
| microSD Card | [Information on supported cards](../dev_log/logging.md#sd-cards) |
|
||||||
| 输入 | GPS/Mag |
|
| 输入 | GPS/Mag |
|
||||||
| | Spektrum |
|
| | Spektrum |
|
||||||
| | Telemetry |
|
| | 数传 |
|
||||||
| | CAN bus |
|
| | CAN bus |
|
||||||
| | PPM |
|
| | PPM |
|
||||||
| Outputs | 6 LEDs (2xRGB) |
|
| Outputs | 6 LEDs (2xRGB) |
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ Manual-Easy:
|
|||||||
Airspeed is actively controlled if an airspeed sensor is installed.
|
Airspeed is actively controlled if an airspeed sensor is installed.
|
||||||
- [Altitude](../flight_modes_fw/altitude.md) — Easiest and safest _non-GPS_ manual mode.
|
- [Altitude](../flight_modes_fw/altitude.md) — Easiest and safest _non-GPS_ manual mode.
|
||||||
The only difference compared to _Position mode_ is that the pilot always directly controls the roll angle of the plane and there is no automatic course holding.
|
The only difference compared to _Position mode_ is that the pilot always directly controls the roll angle of the plane and there is no automatic course holding.
|
||||||
|
- Altitude Cruise mode — It behaves exactly like _Altitude mode_, with the only difference being that the manual control failsafe can be disabled. This is done by setting the corresponding flag in [COM_RCL_EXCEPT](../advanced_config/parameter_reference.md#COM_RCL_EXCEPT). In that case the current altitude, airspeed and heading (by leveling out the roll angle) are kept until the manual control link is regained or the mode is exited.
|
||||||
|
It is highly recommended to only disable the manual control loss failsafe for this mode if there is a stable data link connection to the vehicle at all times, or to enable the data link loss failsafe through [NAV_DLL_ACT](../advanced_config/parameter_reference.md#NAV_DLL_ACT).
|
||||||
- [Stabilized mode](../flight_modes_fw/stabilized.md) — The pilot directly commands the roll and pitch angle and the vehicle keeps the setpoint until the sticks are moved again.
|
- [Stabilized mode](../flight_modes_fw/stabilized.md) — The pilot directly commands the roll and pitch angle and the vehicle keeps the setpoint until the sticks are moved again.
|
||||||
Thrust is directly set by the pilot.
|
Thrust is directly set by the pilot.
|
||||||
Turn coordination is still handled by the controller.
|
Turn coordination is still handled by the controller.
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ The diagram below shows the mode behaviour visually (for a [mode 2 transmitter](
|
|||||||
RC/manual mode like [Stabilized mode](../flight_modes_mc/manual_stabilized.md) but with _altitude stabilization_ (centred sticks level vehicle and hold it to fixed altitude).
|
RC/manual mode like [Stabilized mode](../flight_modes_mc/manual_stabilized.md) but with _altitude stabilization_ (centred sticks level vehicle and hold it to fixed altitude).
|
||||||
The horizontal position of the vehicle can move due to wind (or pre-existing momentum).
|
The horizontal position of the vehicle can move due to wind (or pre-existing momentum).
|
||||||
|
|
||||||
- 回正摇杆(内带死区):
|
- Centered sticks:
|
||||||
- RPY摇杆使飞机水平。
|
- RPY摇杆使飞机水平。
|
||||||
- 油门(~50%)抗风保持当前姿态。
|
- 油门(~50%)抗风保持当前姿态。
|
||||||
- 外部中心:
|
- 外部中心:
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# Altitude Cruise Mode (Multicopter)
|
||||||
|
|
||||||
|
<img src="../../assets/site/difficulty_easy.png" title="Easy to fly" width="30px" /> <img src="../../assets/site/remote_control.svg" title="Manual/Remote control required" width="30px" /> <img src="../../assets/site/altitude_icon.svg" title="Altitude required (e.g. Baro, Rangefinder)" width="30px" />
|
||||||
|
|
||||||
|
_Altitude Cruise mode_ is a _relatively_ easy-to-fly manual control mode in which roll and pitch sticks control vehicle movement in the left-right and forward-back directions (relative to the "front" of the vehicle), yaw stick controls rate of rotation over the horizontal plane, and throttle controls speed of ascent-descent.
|
||||||
|
|
||||||
|
When the sticks are released/centered the vehicle will keep the current tilt and heading angle and maintain the current _altitude_.
|
||||||
|
If moving in the horizontal plane the vehicle will accelerate until the wind resistance equals the acceleration caused by the set tilt angle.
|
||||||
|
The vehicle will then continue to move with a constant velocity (unlike for Altitude mode, in which the vehicle will eventually slow down and stop).
|
||||||
|
If the wind blows the aircraft will drift in the direction of the wind even if flying perfectly level.
|
||||||
|
|
||||||
|
:::tip
|
||||||
|
_Altitude Cruise mode_ is intended for long distance flights where the same tilt angle is kept for a long period of time. It is just like [Altitude](../flight_modes_mc/altitude.md) mode but does not go back to level tilt when the sticks are released.
|
||||||
|
:::
|
||||||
|
|
||||||
|
The diagram below shows the mode behaviour visually (for a [mode 2 transmitter](../getting_started/rc_transmitter_receiver.md#transmitter_modes)).
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 技术总结
|
||||||
|
|
||||||
|
A manual mode that is similar to [Altitude mode](../flight_modes_mc/altitude.md) but with different interpretation of roll and pitch sticks.
|
||||||
|
|
||||||
|
- Centered sticks:
|
||||||
|
- Roll/Pitch sticks: the current tilt is kept.
|
||||||
|
- Yaw: the current heading is kept.
|
||||||
|
- Throttle (~50%) holds current altitude.
|
||||||
|
- 外部中心:
|
||||||
|
- Roll/Pitch sticks control the rate of change of the tilt angle, resulting in corresponding left-right and forward-back movement. A maximum stick deflection results in a tilting rate setpoint to go from level to max tilt within 0.5 seconds.
|
||||||
|
- Yaw stick deflection rotates the tilt angle either left or right, causing the vehicle to change course. It is _not_ causing a direct rotation around the body yaw axis like in [Acro mode](../flight_modes_mc/acro.md).
|
||||||
|
- 油门摇杆以预定的最大速率(和其他轴上的移动速度)控制上升速度。
|
||||||
|
- 起飞:
|
||||||
|
- 降落时,如果将油门杆抬高至 62.5%(从油门杆最低开始的整个范围),无人机将起飞。
|
||||||
|
- Manual control input is required (such as RC control, joystick) to enter this mode. Other than in all other manual modes, it's though possible to disable the manual control loss failsafe by setting the corresponding flag in [COM_RCL_EXCEPT](../advanced_config/parameter_reference.md#COM_RCL_EXCEPT). In that case the current altitude, tilt and heading are kept until the manual control link is regained or the mode is exited.
|
||||||
|
It is highly recommended to only disable the manual control loss failsafe for this mode if there is a stable data link connection to the vehicle at all times, and to enable the data link loss failsafe through [NAV_DLL_ACT](../advanced_config/parameter_reference.md#NAV_DLL_ACT).
|
||||||
|
|
||||||
|
## 参数
|
||||||
|
|
||||||
|
Most of the relevant parameters are already covered in the corresponding section in the [Altitude mode](../flight_modes_mc/altitude.md). Here a list of parameters of particular importance for Altitude Cruise.
|
||||||
|
|
||||||
|
| 参数 | 描述 |
|
||||||
|
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| <a id="COM_RCL_EXCEPT"></a>[COM_RCL_EXCEPT](../advanced_config/parameter_reference.md#COM_RCL_EXCEPT) | The manual control failsafe can be disabled for Altitude Cruise by setting the corresponding bit in this parameter. |
|
||||||
|
| <a id="NAV_DLL_ACT"></a>[NAV_DLL_ACT](../advanced_config/parameter_reference.md#NAV_DLL_ACT) | Data link lost failsafe action. Recommended to set if the manual control failsafe is disabled to avoid fly-aways. |
|
||||||
|
| <a id="MPC_MAN_TILT_MAX"></a>[MPC_MAN_TILT_MAX](../advanced_config/parameter_reference.md#MPC_MAN_TILT_MAX) | The maximum tilt angle the vehicle will go to. At max stick deflection, it will take 0.5 seconds from level flight to this tilt angle. |
|
||||||
@@ -21,10 +21,12 @@ Manual-Easy:
|
|||||||
- [Stabilized mode](../flight_modes_mc/manual_stabilized.md) — Releasing the sticks levels and maintains the vehicle horizontal posture (but not altitude or position).
|
- [Stabilized mode](../flight_modes_mc/manual_stabilized.md) — Releasing the sticks levels and maintains the vehicle horizontal posture (but not altitude or position).
|
||||||
The vehicle will continue to move with momentum, and both altitude and horizontal position may be affected by wind.
|
The vehicle will continue to move with momentum, and both altitude and horizontal position may be affected by wind.
|
||||||
This mode is also used if "Manual mode" is selected in a ground station.
|
This mode is also used if "Manual mode" is selected in a ground station.
|
||||||
|
- [Altitude Cruise mode](../flight_modes_mc/altitude_cruise.md) — Very similar to _Altitude mode_, with the difference that when the roll and pitch sticks are released the vehicle does not level out but keeps the tilt until further inputs are given.
|
||||||
|
Additionally it is possible to disable the manual control failsafe for this mode, having the vehicle continue on it's set path even if there are no new control inputs.
|
||||||
|
|
||||||
Manual-Acrobatic
|
Manual-Acrobatic
|
||||||
|
|
||||||
- [Acro](../flight_modes_mc/acro.md) — Manual mode for performing acrobatic maneuvers, such as rolls and loops.
|
- [Acro](../flight_modes_mc/acro.md) — Manual mode for performing acrobatic manoeuvrers, such as rolls and loops.
|
||||||
Releasing the sticks stops the vehicle rotating in the roll, pitch, yaw axes, but does not otherwise stabilise the vehicle.
|
Releasing the sticks stops the vehicle rotating in the roll, pitch, yaw axes, but does not otherwise stabilise the vehicle.
|
||||||
|
|
||||||
Autonomous:
|
Autonomous:
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ Throttle is rescaled (see [below](#params)) and passed directly to control alloc
|
|||||||
自动驾驶仪控制着飞机的姿态角,这意味着当 RC 摇杆居中时自驾仪调整飞机的滚转和俯仰角为零(从而实现飞机姿态的改平)。
|
自动驾驶仪控制着飞机的姿态角,这意味着当 RC 摇杆居中时自驾仪调整飞机的滚转和俯仰角为零(从而实现飞机姿态的改平)。
|
||||||
自动驾驶仪不能补偿由于风(或其他来源)引起的漂移。
|
自动驾驶仪不能补偿由于风(或其他来源)引起的漂移。
|
||||||
|
|
||||||
- 回正摇杆(内带死区):
|
- Centered sticks:
|
||||||
- Roll/Pitch sticks level vehicle.
|
- Roll/Pitch sticks level vehicle.
|
||||||
- 外部中心:
|
- 外部中心:
|
||||||
- Roll/Pitch sticks control tilt angle in those orientations, resulting in corresponding left-right and forward-back movement.
|
- Roll/Pitch sticks control tilt angle in those orientations, resulting in corresponding left-right and forward-back movement.
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ While very rare on a well calibrated vehicle, sometimes there may be problems wi
|
|||||||
遥控模式下,横滚、俯仰、油门 (RPT) 杆控制相应轴/方向的运动。
|
遥控模式下,横滚、俯仰、油门 (RPT) 杆控制相应轴/方向的运动。
|
||||||
摇杆居中使机体水平并将其保持在固定的高度和位置并抗风。
|
摇杆居中使机体水平并将其保持在固定的高度和位置并抗风。
|
||||||
|
|
||||||
- Centered roll, pitch, throttle sticks (within RC deadzone [MPC_HOLD_DZ](../advanced_config/parameter_reference.md#MPC_HOLD_DZ)) hold x, y, z position steady against any disturbance like wind.
|
- Centered roll, pitch, throttle sticks (within RC deadzone [MAN_DEADZONE](#MAN_DEADZONE)) hold x, y, z position steady against any disturbance like wind.
|
||||||
- 外部中心:
|
- 外部中心:
|
||||||
- Roll/Pitch sticks control horizontal acceleration over ground in the vehicle's left-right and forward-back directions (respectively).
|
- Roll/Pitch sticks control horizontal acceleration over ground in the vehicle's left-right and forward-back directions (respectively).
|
||||||
- Throttle stick controls speed of ascent-descent.
|
- Throttle stick controls speed of ascent-descent.
|
||||||
@@ -62,7 +62,7 @@ All the parameters in the [Multicopter Position Control](../advanced_config/para
|
|||||||
|
|
||||||
| 参数 | 描述 |
|
| 参数 | 描述 |
|
||||||
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| <a id="MPC_HOLD_DZ"></a>[MPC_HOLD_DZ](../advanced_config/parameter_reference.md#MPC_HOLD_DZ) | 启用位置保持的摇杆死区。 默认值:0.1(摇杆全行程的 10%)。 |
|
| <a id="MAN_DEADZONE"></a>[MAN_DEADZONE](../advanced_config/parameter_reference.md#MAN_DEADZONE) | 启用位置保持的摇杆死区。 默认值:0.1(摇杆全行程的 10%)。 |
|
||||||
| <a id="MPC_Z_VEL_MAX_UP"></a>[MPC_Z_VEL_MAX_UP](../advanced_config/parameter_reference.md#MPC_Z_VEL_MAX_UP) | 最大垂直上升速度。 默认:3m/s。 |
|
| <a id="MPC_Z_VEL_MAX_UP"></a>[MPC_Z_VEL_MAX_UP](../advanced_config/parameter_reference.md#MPC_Z_VEL_MAX_UP) | 最大垂直上升速度。 默认:3m/s。 |
|
||||||
| <a id="MPC_Z_VEL_MAX_DN"></a>[MPC_Z_VEL_MAX_DN](../advanced_config/parameter_reference.md#MPC_Z_VEL_MAX_DN) | 最大垂直下降速度。 默认:1m/s。 |
|
| <a id="MPC_Z_VEL_MAX_DN"></a>[MPC_Z_VEL_MAX_DN](../advanced_config/parameter_reference.md#MPC_Z_VEL_MAX_DN) | 最大垂直下降速度。 默认:1m/s。 |
|
||||||
| <a id="MPC_LAND_ALT1"></a>[MPC_LAND_ALT1](../advanced_config/parameter_reference.md#MPC_LAND_ALT1) | 触发第一阶段降速的高度。 Below this altitude descending velocity gets limited to a value between [MPC_Z_VEL_MAX_DN](#MPC_Z_VEL_MAX_DN) (or `MPC_Z_V_AUTO_DN`) and [MPC_LAND_SPEED](#MPC_LAND_SPEED). Value needs to be higher than [MPC_LAND_ALT2](#MPC_LAND_ALT2). Default 10m. |
|
| <a id="MPC_LAND_ALT1"></a>[MPC_LAND_ALT1](../advanced_config/parameter_reference.md#MPC_LAND_ALT1) | 触发第一阶段降速的高度。 Below this altitude descending velocity gets limited to a value between [MPC_Z_VEL_MAX_DN](#MPC_Z_VEL_MAX_DN) (or `MPC_Z_V_AUTO_DN`) and [MPC_LAND_SPEED](#MPC_LAND_SPEED). Value needs to be higher than [MPC_LAND_ALT2](#MPC_LAND_ALT2). Default 10m. |
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Selecting any other mode than those listed below will either stop the rover or c
|
|||||||
|
|
||||||
## Manual Modes
|
## Manual Modes
|
||||||
|
|
||||||
| Mode | 描述 |
|
| 模式 | 描述 |
|
||||||
| --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| [Manual](manual.md#manual-mode) | No autopilot support. User is responsible for keeping the rover on the desired course and maintaining speed and rate of turn. |
|
| [Manual](manual.md#manual-mode) | No autopilot support. User is responsible for keeping the rover on the desired course and maintaining speed and rate of turn. |
|
||||||
| [Acro](manual.md#acro-mode) | + Maintains the yaw rate (feels more like driving a car than manual mode). <br>+ Allows maximum yaw rate to be limited (protects against roll over). |
|
| [Acro](manual.md#acro-mode) | + Maintains the yaw rate (feels more like driving a car than manual mode). <br>+ Allows maximum yaw rate to be limited (protects against roll over). |
|
||||||
@@ -21,7 +21,7 @@ Selecting any other mode than those listed below will either stop the rover or c
|
|||||||
|
|
||||||
## Auto Modes
|
## Auto Modes
|
||||||
|
|
||||||
| Mode | 描述 |
|
| 模式 | 描述 |
|
||||||
| ------------------------------- | --------------------------------------------------------------------------------------- |
|
| ------------------------------- | --------------------------------------------------------------------------------------- |
|
||||||
| [Mission](auto.md#mission-mode) | Automatic mode that causes the vehicle to execute a predefined mission. |
|
| [Mission](auto.md#mission-mode) | Automatic mode that causes the vehicle to execute a predefined mission. |
|
||||||
| [Return](auto.md#return-mode) | Automatic mode that returns the vehicle to the launch position. |
|
| [Return](auto.md#return-mode) | Automatic mode that returns the vehicle to the launch position. |
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ The sticks provide the same "high level" control effects over direction and rate
|
|||||||
|
|
||||||
The manual modes provide progressively increasing levels of autopilot support for maintaining a course, speed, and rate of turn, compensating for external factors such as slopes or uneven terrain.
|
The manual modes provide progressively increasing levels of autopilot support for maintaining a course, speed, and rate of turn, compensating for external factors such as slopes or uneven terrain.
|
||||||
|
|
||||||
| Mode | 描述 |
|
| 模式 | 描述 |
|
||||||
| --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| [Manual](manual.md#manual-mode) | No autopilot support. User is responsible for keeping the rover on the desired course and maintaining speed and rate of turn. |
|
| [Manual](manual.md#manual-mode) | No autopilot support. User is responsible for keeping the rover on the desired course and maintaining speed and rate of turn. |
|
||||||
| [Acro](manual.md#acro-mode) | + Maintains the yaw rate (feels more like driving a car than manual mode). <br>+ Allows maximum yaw rate to be limited (protects against roll over). |
|
| [Acro](manual.md#acro-mode) | + Maintains the yaw rate (feels more like driving a car than manual mode). <br>+ Allows maximum yaw rate to be limited (protects against roll over). |
|
||||||
@@ -24,7 +24,7 @@ The manual modes provide progressively increasing levels of autopilot support fo
|
|||||||
:::details
|
:::details
|
||||||
Overview mode mapping to control effect
|
Overview mode mapping to control effect
|
||||||
|
|
||||||
| Mode | Speed | Turning | Required measurements |
|
| 模式 | Speed | Turning | Required measurements |
|
||||||
| ------------------------------ | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
| ------------------------------ | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
||||||
| [Manual](#manual-mode) | Directly map stick input to motor command. | Directly map stick input to steering angle/speed difference. | None. |
|
| [Manual](#manual-mode) | Directly map stick input to motor command. | Directly map stick input to steering angle/speed difference. | None. |
|
||||||
| [Acro](#acro-mode) | Directly map stick input to motor command. | Stick input creates a yaw rate setpoint for the control system to regulate. | yaw rate. |
|
| [Acro](#acro-mode) | Directly map stick input to motor command. | Stick input creates a yaw rate setpoint for the control system to regulate. | yaw rate. |
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ The supported frames can be seen in [Airframes Reference > Rover](../airframes/a
|
|||||||
|
|
||||||
## Ackermann
|
## Ackermann
|
||||||
|
|
||||||
<Badge type="tip" text="PX4 v1.16" /> <Badge type="warning" text="Experimental" />
|
<0/> <1/>
|
||||||
|
|
||||||
An Ackermann rover controls its direction by pointing the front wheels in the direction of travel — the [Ackermann steering geometry](https://en.wikipedia.org/wiki/Ackermann_steering_geometry) compensates for the fact that wheels on the inside and outside of the turn move at different rates.
|
An Ackermann rover controls its direction by pointing the front wheels in the direction of travel — the [Ackermann steering geometry](https://en.wikipedia.org/wiki/Ackermann_steering_geometry) compensates for the fact that wheels on the inside and outside of the turn move at different rates.
|
||||||
This kind of steering is used on most commercial vehicles, including cars, trucks etc.
|
This kind of steering is used on most commercial vehicles, including cars, trucks etc.
|
||||||
@@ -34,7 +34,7 @@ PX4 does not require that the vehicle uses the Ackermann geometry and will work
|
|||||||
|
|
||||||
## Differential
|
## Differential
|
||||||
|
|
||||||
<Badge type="tip" text="PX4 v1.16" /> <Badge type="warning" text="Experimental" />
|
<0/> <1/>
|
||||||
|
|
||||||
A differential rover's motion is controlled using a differential drive mechanism, where the left and right wheel speeds are adjusted independently to achieve the desired forward speed and yaw rate.
|
A differential rover's motion is controlled using a differential drive mechanism, where the left and right wheel speeds are adjusted independently to achieve the desired forward speed and yaw rate.
|
||||||
Forward motion is achieved by driving both wheels at the same speed in the same direction.
|
Forward motion is achieved by driving both wheels at the same speed in the same direction.
|
||||||
@@ -48,7 +48,7 @@ The differential setup also work for rovers with skid or tank steering.
|
|||||||
|
|
||||||
## Mecanum
|
## Mecanum
|
||||||
|
|
||||||
<Badge type="tip" text="PX4 v1.16" /> <Badge type="warning" text="Experimental" />
|
<0/> <1/>
|
||||||
|
|
||||||
A Mecanum rover is a type of mobile robot that uses Mecanum wheels to achieve omnidirectional movement. These wheels are unique because they have rollers mounted at a 45-degree angle around their circumference, allowing the rover to move not only forward and backward but also side-to-side and diagonally without needing to rotate first.
|
A Mecanum rover is a type of mobile robot that uses Mecanum wheels to achieve omnidirectional movement. These wheels are unique because they have rollers mounted at a 45-degree angle around their circumference, allowing the rover to move not only forward and backward but also side-to-side and diagonally without needing to rotate first.
|
||||||
Each wheel is driven by its own motor, and by controlling the speed and direction of each motor, the rover can move in any direction or spin in place.
|
Each wheel is driven by its own motor, and by controlling the speed and direction of each motor, the rover can move in any direction or spin in place.
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ PX4 Micro XRCE-DDS Client is based on version `v2.x` which is not compatible wit
|
|||||||
On Ubuntu you can build from source and install the Agent standalone using the following commands:
|
On Ubuntu you can build from source and install the Agent standalone using the following commands:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone -b v2.4.2 https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
|
git clone -b v2.4.3 https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
|
||||||
cd Micro-XRCE-DDS-Agent
|
cd Micro-XRCE-DDS-Agent
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
@@ -126,7 +126,7 @@ To build the agent within ROS:
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd ~/px4_ros_uxrce_dds_ws/src
|
cd ~/px4_ros_uxrce_dds_ws/src
|
||||||
git clone -b v2.4.2 https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
|
git clone -b v2.4.3 https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Source the ROS 2 development environment, and compile the workspace using `colcon`:
|
3. Source the ROS 2 development environment, and compile the workspace using `colcon`:
|
||||||
@@ -279,6 +279,9 @@ The configuration can be done using the [UXRCE-DDS parameters](../advanced_confi
|
|||||||
- [UXRCE_DDS_SYNCT](../advanced_config/parameter_reference.md#UXRCE_DDS_SYNCT): Bridge time synchronization enable.
|
- [UXRCE_DDS_SYNCT](../advanced_config/parameter_reference.md#UXRCE_DDS_SYNCT): Bridge time synchronization enable.
|
||||||
The uXRCE-DDS client module can synchronize the timestamp of the messages exchanged over the bridge.
|
The uXRCE-DDS client module can synchronize the timestamp of the messages exchanged over the bridge.
|
||||||
This is the default configuration. In certain situations, for example during [simulations](../ros2/user_guide.md#ros-gazebo-and-px4-time-synchronization), this feature may be disabled.
|
This is the default configuration. In certain situations, for example during [simulations](../ros2/user_guide.md#ros-gazebo-and-px4-time-synchronization), this feature may be disabled.
|
||||||
|
- [`UXRCE_DDS_NS_IDX`](../advanced_config/parameter_reference.md#UXRCE_DDS_NS_IDX): Index-based namespace definition
|
||||||
|
Setting this parameter to any value other than `-1` creates a namespace with the prefix `uav_` and the specified value, e.g. `uav_0`, `uav_1`, etc.
|
||||||
|
See [namespace](#customizing-the-namespace) for methods to define richer or arbitrary namespaces.
|
||||||
|
|
||||||
:::info
|
:::info
|
||||||
Many ports are already have a default configuration.
|
Many ports are already have a default configuration.
|
||||||
@@ -354,7 +357,7 @@ Therefore,
|
|||||||
|
|
||||||
## Customizing the Namespace
|
## Customizing the Namespace
|
||||||
|
|
||||||
Custom topic and service namespaces can be applied at build time (changing [dds_topics.yaml](../middleware/dds_topics.md)) or at runtime (which is useful for multi vehicle operations):
|
Custom topic and service namespaces can be applied at build time (changing [dds_topics.yaml](../middleware/dds_topics.md)), at runtime, or through a parameter (which is useful for multi vehicle operations):
|
||||||
|
|
||||||
- One possibility is to use the `-n` option when starting the [uxrce_dds_client](../modules/modules_system.md#uxrce-dds-client) from command line.
|
- One possibility is to use the `-n` option when starting the [uxrce_dds_client](../modules/modules_system.md#uxrce-dds-client) from command line.
|
||||||
This technique can be used both in simulation and real vehicles.
|
This technique can be used both in simulation and real vehicles.
|
||||||
@@ -383,6 +386,22 @@ will generate topics under the namespaces:
|
|||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
- A simple index-based namespace can be applied by setting the parameter [`UXRCE_DDS_NS_IDX`](../advanced_config/parameter_reference.md#UXRCE_DDS_NS_IDX) to a value between 0 and 9999.
|
||||||
|
This will generate a namespace such as `/uav_0`, `/uav_1`, and so on.
|
||||||
|
This technique is ideal if vehicles must be persistently associated with namespaces because their clients are automatically started through PX4.
|
||||||
|
|
||||||
|
:::info
|
||||||
|
PX4 parameters cannot carry rich text strings.
|
||||||
|
Therefore, you cannot use [`UXRCE_DDS_NS_IDX`](../advanced_config/parameter_reference.md#UXRCE_DDS_NS_IDX) to automatically start a client with an arbitrary message namespace through PX4.
|
||||||
|
You can however specify a namespace when starting the client, using the `-n` argument:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# In etc/extras.txt on the MicroSD card
|
||||||
|
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
|
## PX4 ROS 2 QoS Settings
|
||||||
|
|
||||||
PX4 QoS settings for publishers are incompatible with the default QoS settings for ROS 2 subscribers.
|
PX4 QoS settings for publishers are incompatible with the default QoS settings for ROS 2 subscribers.
|
||||||
@@ -516,7 +535,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 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).
|
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.
|
This section contains migration-specific information.
|
||||||
You should also read the rest of this page to properly understand uXRCE-DDS.
|
You should also read the rest of this page to properly understand uXRCE-DDS.
|
||||||
:::
|
:::
|
||||||
|
|||||||
@@ -125,6 +125,31 @@ ilabs <command> [arguments...]
|
|||||||
status Print driver status
|
status Print driver status
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## sbgecom
|
||||||
|
|
||||||
|
Source: [drivers/ins/sbgecom](https://github.com/PX4/PX4-Autopilot/tree/main/src/drivers/ins/sbgecom)
|
||||||
|
|
||||||
|
Description du module
|
||||||
|
|
||||||
|
### Usage {#sbgecom_usage}
|
||||||
|
|
||||||
|
```
|
||||||
|
sbgecom <command> [arguments...]
|
||||||
|
Commands:
|
||||||
|
start Start driver
|
||||||
|
[-d <val>] Serial device
|
||||||
|
default: /dev/ttyS0
|
||||||
|
[-b <val>] Baudrate device
|
||||||
|
default: 921600
|
||||||
|
[-f <val>] Config JSON file path
|
||||||
|
default: /etc/extras/sbg_settings\.json
|
||||||
|
[-s <val>] Config JSON string
|
||||||
|
|
||||||
|
status Driver status
|
||||||
|
|
||||||
|
stop Stop driver
|
||||||
|
```
|
||||||
|
|
||||||
## vectornav
|
## vectornav
|
||||||
|
|
||||||
Source: [drivers/ins/vectornav](https://github.com/PX4/PX4-Autopilot/tree/main/src/drivers/ins/vectornav)
|
Source: [drivers/ins/vectornav](https://github.com/PX4/PX4-Autopilot/tree/main/src/drivers/ins/vectornav)
|
||||||
|
|||||||
@@ -140,9 +140,9 @@ commander <command> [arguments...]
|
|||||||
transition VTOL transition
|
transition VTOL transition
|
||||||
|
|
||||||
mode Change flight mode
|
mode Change flight mode
|
||||||
manual|acro|offboard|stabilized|altctl|posctl|position:slow|auto:mission|au
|
manual|acro|offboard|stabilized|altctl|posctl|altitude_cruise|position:slow
|
||||||
to:loiter|auto:rtl|auto:takeoff|auto:land|auto:precland|ext1
|
|auto:mission|auto:loiter|auto:rtl|auto:takeoff|auto:land|auto:
|
||||||
Flight mode
|
precland|ext1 Flight mode
|
||||||
|
|
||||||
pair
|
pair
|
||||||
|
|
||||||
@@ -154,6 +154,9 @@ commander <command> [arguments...]
|
|||||||
|
|
||||||
lat|lon|alt Origin latitude longitude altitude
|
lat|lon|alt Origin latitude longitude altitude
|
||||||
|
|
||||||
|
set_heading Set current heading
|
||||||
|
heading degrees from True North [0 360]
|
||||||
|
|
||||||
poweroff Power off board (if supported)
|
poweroff Power off board (if supported)
|
||||||
|
|
||||||
stop
|
stop
|
||||||
@@ -1062,7 +1065,9 @@ uxrce_dds_client <command> [arguments...]
|
|||||||
values: <IP>
|
values: <IP>
|
||||||
[-p <val>] Agent listening port. If not provided, defaults to
|
[-p <val>] Agent listening port. If not provided, defaults to
|
||||||
UXRCE_DDS_PRT
|
UXRCE_DDS_PRT
|
||||||
[-n <val>] Client DDS namespace
|
[-n <val>] Client DDS namespace. If not provided but UXRCE_DDS_NS_IDX is
|
||||||
|
between 0 and 9999 inclusive, then uav_ + UXRCE_DDS_NS_IDX will
|
||||||
|
be used
|
||||||
|
|
||||||
stop
|
stop
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ uint32 MESSAGE_VERSION = 0
|
|||||||
uint64 timestamp # [us] Time since system start
|
uint64 timestamp # [us] Time since system start
|
||||||
uint64 timestamp_sample # [us] Sampling timestamp of the data this control response is based on
|
uint64 timestamp_sample # [us] Sampling timestamp of the data this control response is based on
|
||||||
|
|
||||||
uint16 reversible_flags # Bitset indicating which motors are configured to be reversible
|
uint16 reversible_flags # [-] Bitset indicating which motors are configured to be reversible
|
||||||
|
|
||||||
uint8 ACTUATOR_FUNCTION_MOTOR1 = 101 #
|
uint8 ACTUATOR_FUNCTION_MOTOR1 = 101 #
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,6 @@ uint64 timestamp # [us] Time since system start
|
|||||||
uint64 timestamp_sample # [us] Sampling timestamp of the data this control response is based on
|
uint64 timestamp_sample # [us] Sampling timestamp of the data this control response is based on
|
||||||
|
|
||||||
uint8 NUM_CONTROLS = 8 #
|
uint8 NUM_CONTROLS = 8 #
|
||||||
float32[8] control # [@range -1, 1] Normalized output. 1 means maximum positive position. -1 maximum negative position (if not supported by the output, <0 maps to NaN). NaN maps to disarmed.
|
float32[8] control # [-] [@range -1, 1] Normalized output. 1 means maximum positive position. -1 maximum negative position (if not supported by the output, <0 maps to NaN). NaN maps to disarmed.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# ArmingCheckReply (UORB message)
|
# ArmingCheckReply (UORB message)
|
||||||
|
|
||||||
Arming check reply.
|
Arming check reply
|
||||||
|
|
||||||
This is a response to an ArmingCheckRequest message sent by the FMU to an external component, such as a ROS 2 navigation mode.
|
This is a response to an ArmingCheckRequest message sent by the FMU to an external component, such as a ROS 2 navigation mode.
|
||||||
The response contains the current set of external mode requirements, and a queue of events indicating recent failures to set the mode (which the FMU may then forward to a ground station).
|
The response contains the current set of external mode requirements, and a queue of events indicating recent failures to set the mode (which the FMU may then forward to a ground station).
|
||||||
@@ -12,7 +12,7 @@ The message is not used by internal/FMU components, as their mode requirements a
|
|||||||
[source file](https://github.com/PX4/PX4-Autopilot/blob/main/msg/versioned/ArmingCheckReply.msg)
|
[source file](https://github.com/PX4/PX4-Autopilot/blob/main/msg/versioned/ArmingCheckReply.msg)
|
||||||
|
|
||||||
```c
|
```c
|
||||||
# Arming check reply.
|
# Arming check reply
|
||||||
#
|
#
|
||||||
# This is a response to an ArmingCheckRequest message sent by the FMU to an external component, such as a ROS 2 navigation mode.
|
# This is a response to an ArmingCheckRequest message sent by the FMU to an external component, such as a ROS 2 navigation mode.
|
||||||
# The response contains the current set of external mode requirements, and a queue of events indicating recent failures to set the mode (which the FMU may then forward to a ground station).
|
# The response contains the current set of external mode requirements, and a queue of events indicating recent failures to set the mode (which the FMU may then forward to a ground station).
|
||||||
@@ -25,33 +25,33 @@ uint32 MESSAGE_VERSION = 1
|
|||||||
|
|
||||||
uint64 timestamp # [us] Time since system start.
|
uint64 timestamp # [us] Time since system start.
|
||||||
|
|
||||||
uint8 request_id # Id of ArmingCheckRequest for which this is a response.
|
uint8 request_id # [-] Id of ArmingCheckRequest for which this is a response
|
||||||
uint8 registration_id # Id of external component emitting this response.
|
uint8 registration_id # [-] Id of external component emitting this response
|
||||||
|
|
||||||
uint8 HEALTH_COMPONENT_INDEX_NONE = 0 # Index of health component for which this response applies.
|
uint8 HEALTH_COMPONENT_INDEX_NONE = 0 # Index of health component for which this response applies
|
||||||
|
|
||||||
uint8 health_component_index # [@enum HEALTH_COMPONENT_INDEX]
|
uint8 health_component_index # [@enum HEALTH_COMPONENT_INDEX]
|
||||||
bool health_component_is_present # Unused. Intended for use with health events interface (health_component_t in events.json).
|
bool health_component_is_present # Unused. Intended for use with health events interface (health_component_t in events.json)
|
||||||
bool health_component_warning # Unused. Intended for use with health events interface (health_component_t in events.json).
|
bool health_component_warning # Unused. Intended for use with health events interface (health_component_t in events.json)
|
||||||
bool health_component_error # Unused. Intended for use with health events interface (health_component_t in events.json).
|
bool health_component_error # Unused. Intended for use with health events interface (health_component_t in events.json)
|
||||||
|
|
||||||
bool can_arm_and_run # True if the component can arm. For navigation mode components, true if the component can arm in the mode or switch to the mode when already armed.
|
bool can_arm_and_run # True if the component can arm. For navigation mode components, true if the component can arm in the mode or switch to the mode when already armed
|
||||||
|
|
||||||
uint8 num_events # Number of queued failure messages (Event) in the events field.
|
uint8 num_events # Number of queued failure messages (Event) in the events field
|
||||||
|
|
||||||
Event[5] events # Arming failure reasons (Queue of events to report to GCS).
|
Event[5] events # Arming failure reasons (Queue of events to report to GCS)
|
||||||
|
|
||||||
# Mode requirements
|
# Mode requirements
|
||||||
bool mode_req_angular_velocity # Requires angular velocity estimate (e.g. from gyroscope).
|
bool mode_req_angular_velocity # Requires angular velocity estimate (e.g. from gyroscope)
|
||||||
bool mode_req_attitude # Requires an attitude estimate.
|
bool mode_req_attitude # Requires an attitude estimate
|
||||||
bool mode_req_local_alt # Requires a local altitude estimate.
|
bool mode_req_local_alt # Requires a local altitude estimate
|
||||||
bool mode_req_local_position # Requires a local position estimate.
|
bool mode_req_local_position # Requires a local position estimate
|
||||||
bool mode_req_local_position_relaxed # Requires a more relaxed global position estimate.
|
bool mode_req_local_position_relaxed # Requires a more relaxed global position estimate
|
||||||
bool mode_req_global_position # Requires a global position estimate.
|
bool mode_req_global_position # Requires a global position estimate
|
||||||
bool mode_req_global_position_relaxed # Requires a relaxed global position estimate.
|
bool mode_req_global_position_relaxed # Requires a relaxed global position estimate
|
||||||
bool mode_req_mission # Requires an uploaded mission.
|
bool mode_req_mission # Requires an uploaded mission
|
||||||
bool mode_req_home_position # Requires a home position (such as RTL/Return mode).
|
bool mode_req_home_position # Requires a home position (such as RTL/Return mode)
|
||||||
bool mode_req_prevent_arming # Prevent arming (such as in Land mode).
|
bool mode_req_prevent_arming # Prevent arming (such as in Land mode)
|
||||||
bool mode_req_manual_control # Requires a manual controller
|
bool mode_req_manual_control # Requires a manual controller
|
||||||
|
|
||||||
uint8 ORB_QUEUE_LENGTH = 4
|
uint8 ORB_QUEUE_LENGTH = 4
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# ArmingCheckRequest (UORB message)
|
# ArmingCheckRequest (UORB message)
|
||||||
|
|
||||||
Arming check request.
|
Arming check request
|
||||||
|
|
||||||
Broadcast message to request arming checks be reported by all registered components, such as external ROS 2 navigation modes.
|
Broadcast message to request arming checks be reported by all registered components, such as external ROS 2 navigation modes.
|
||||||
All registered components should respond with an ArmingCheckReply message that indicates their current mode requirements, and any arming failure information.
|
All registered components should respond with an ArmingCheckReply message that indicates their current mode requirements, and any arming failure information.
|
||||||
@@ -12,7 +12,7 @@ The reply will also include the registration_id for each external component, pro
|
|||||||
[source file](https://github.com/PX4/PX4-Autopilot/blob/main/msg/versioned/ArmingCheckRequest.msg)
|
[source file](https://github.com/PX4/PX4-Autopilot/blob/main/msg/versioned/ArmingCheckRequest.msg)
|
||||||
|
|
||||||
```c
|
```c
|
||||||
# Arming check request.
|
# Arming check request
|
||||||
#
|
#
|
||||||
# Broadcast message to request arming checks be reported by all registered components, such as external ROS 2 navigation modes.
|
# Broadcast message to request arming checks be reported by all registered components, such as external ROS 2 navigation modes.
|
||||||
# All registered components should respond with an ArmingCheckReply message that indicates their current mode requirements, and any arming failure information.
|
# All registered components should respond with an ArmingCheckReply message that indicates their current mode requirements, and any arming failure information.
|
||||||
@@ -23,10 +23,10 @@ The reply will also include the registration_id for each external component, pro
|
|||||||
|
|
||||||
uint32 MESSAGE_VERSION = 1
|
uint32 MESSAGE_VERSION = 1
|
||||||
|
|
||||||
uint64 timestamp # [us] Time since system start.
|
uint64 timestamp # [us] Time since system start
|
||||||
|
|
||||||
uint8 request_id # Id of this request. Allows correlation with associated ArmingCheckReply messages.
|
uint8 request_id # [-] Id of this request. Allows correlation with associated ArmingCheckReply messages.
|
||||||
|
|
||||||
uint32 valid_registrations_mask # Bitmask of valid registration ID's (the bit is also cleared if flagged as unresponsive)
|
uint32 valid_registrations_mask # [-] Bitmask of valid registration ID's (the bit is also cleared if flagged as unresponsive)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -16,19 +16,20 @@ Battery instance information is also logged and streamed in MAVLink telemetry.
|
|||||||
# Battery instance information is also logged and streamed in MAVLink telemetry.
|
# Battery instance information is also logged and streamed in MAVLink telemetry.
|
||||||
|
|
||||||
uint32 MESSAGE_VERSION = 1
|
uint32 MESSAGE_VERSION = 1
|
||||||
uint8 MAX_INSTANCES = 4
|
uint8 MAX_INSTANCES = 3
|
||||||
|
|
||||||
uint64 timestamp # [us] Time since system start
|
uint64 timestamp # [us] Time since system start
|
||||||
|
|
||||||
bool connected # Whether or not a battery is connected. For power modules this is based on a voltage threshold.
|
bool connected # Whether or not a battery is connected. For power modules this is based on a voltage threshold.
|
||||||
float32 voltage_v # [V] [@invalid 0] Battery voltage
|
float32 voltage_v # [V] [@invalid 0] Battery voltage
|
||||||
float32 current_a # [A] [@invalid -1] Battery current
|
float32 current_a # [A] [@invalid -1] Battery current
|
||||||
float32 current_average_a # [A] [@invalid -1] Battery current average (for FW average in level flight)
|
float32 current_average_a # [A] [@invalid -1] Battery current average (for FW average in level flight)
|
||||||
float32 discharged_mah # [mAh] [@invalid -1] Discharged amount
|
float32 discharged_mah # [mAh] [@invalid -1] Discharged amount
|
||||||
float32 remaining # [@range 0,1] [@invalid -1] Remaining capacity
|
float32 remaining # [@range 0,1] [@invalid -1] Remaining capacity
|
||||||
float32 scale # [@range 1,] [@invalid -1] Scaling factor to compensate for lower actuation power caused by voltage sag
|
float32 scale # [-] [@range 1,] [@invalid -1] Scaling factor to compensate for lower actuation power caused by voltage sag
|
||||||
float32 time_remaining_s # [s] [@invalid NaN] Predicted time remaining until battery is empty under previous averaged load
|
float32 time_remaining_s # [s] [@invalid NaN] Predicted time remaining until battery is empty under previous averaged load
|
||||||
float32 temperature # [°C] [@invalid NaN] Temperature of the battery
|
float32 temperature # [°C] [@invalid NaN] Temperature of the battery
|
||||||
uint8 cell_count # [@invalid 0] Number of cells
|
uint8 cell_count # [-] [@invalid 0] Number of cells
|
||||||
|
|
||||||
|
|
||||||
uint8 source # [@enum SOURCE] Battery source
|
uint8 source # [@enum SOURCE] Battery source
|
||||||
@@ -36,18 +37,18 @@ uint8 SOURCE_POWER_MODULE = 0 # Power module
|
|||||||
uint8 SOURCE_EXTERNAL = 1 # External
|
uint8 SOURCE_EXTERNAL = 1 # External
|
||||||
uint8 SOURCE_ESCS = 2 # ESCs
|
uint8 SOURCE_ESCS = 2 # ESCs
|
||||||
|
|
||||||
uint8 priority # Zero based priority is the connection on the Power Controller V1..Vn AKA BrickN-1
|
uint8 priority # [-] Zero based priority is the connection on the Power Controller V1..Vn AKA BrickN-1
|
||||||
uint16 capacity # [mAh] Capacity of the battery when fully charged
|
uint16 capacity # [mAh] Capacity of the battery when fully charged
|
||||||
uint16 cycle_count # Number of discharge cycles the battery has experienced
|
uint16 cycle_count # [-] Number of discharge cycles the battery has experienced
|
||||||
uint16 average_time_to_empty # [minutes] Predicted remaining battery capacity based on the average rate of discharge
|
uint16 average_time_to_empty # [minutes] Predicted remaining battery capacity based on the average rate of discharge
|
||||||
uint16 manufacture_date # Manufacture date, part of serial number of the battery pack. Formatted as: Day + Month×32 + (Year–1980)×512
|
uint16 manufacture_date # [-] Manufacture date, part of serial number of the battery pack. Formatted as: Day + Month×32 + (Year–1980)×512
|
||||||
uint16 state_of_health # [%] [@range 0, 100] State of health. FullChargeCapacity/DesignCapacity
|
uint16 state_of_health # [%] [@range 0, 100] State of health. FullChargeCapacity/DesignCapacity
|
||||||
uint16 max_error # [%] [@range 1, 100] Max error, expected margin of error in the state-of-charge calculation
|
uint16 max_error # [%] [@range 1, 100] Max error, expected margin of error in the state-of-charge calculation
|
||||||
uint8 id # ID number of a battery. Should be unique and consistent for the lifetime of a vehicle. 1-indexed
|
uint8 id # [-] ID number of a battery. Should be unique and consistent for the lifetime of a vehicle. 1-indexed
|
||||||
uint16 interface_error # Interface error counter
|
uint16 interface_error # [-] Interface error counter
|
||||||
|
|
||||||
float32[14] voltage_cell_v # [V] [@invalid 0] Battery individual cell voltages
|
float32[14] voltage_cell_v # [V] [@invalid 0] Battery individual cell voltages
|
||||||
float32 max_cell_voltage_delta # Max difference between individual cell voltages
|
float32 max_cell_voltage_delta # [V] Max difference between individual cell voltages
|
||||||
|
|
||||||
bool is_powering_off # Power off event imminent indication, false if unknown
|
bool is_powering_off # Power off event imminent indication, false if unknown
|
||||||
bool is_required # Set if the battery is explicitly required before arming
|
bool is_required # Set if the battery is explicitly required before arming
|
||||||
@@ -77,15 +78,15 @@ uint8 FAULT_COUNT = 11 # Counter. Keep this as last element
|
|||||||
|
|
||||||
float32 full_charge_capacity_wh # [Wh] Compensated battery capacity
|
float32 full_charge_capacity_wh # [Wh] Compensated battery capacity
|
||||||
float32 remaining_capacity_wh # [Wh] Compensated battery capacity remaining
|
float32 remaining_capacity_wh # [Wh] Compensated battery capacity remaining
|
||||||
uint16 over_discharge_count # Number of battery overdischarge
|
uint16 over_discharge_count # [-] Number of battery overdischarge
|
||||||
float32 nominal_voltage # [V] Nominal voltage of the battery pack
|
float32 nominal_voltage # [V] Nominal voltage of the battery pack
|
||||||
|
|
||||||
float32 internal_resistance_estimate # [Ohm] Internal resistance per cell estimate
|
float32 internal_resistance_estimate # [Ohm] Internal resistance per cell estimate
|
||||||
float32 ocv_estimate # [V] Open circuit voltage estimate
|
float32 ocv_estimate # [V] Open circuit voltage estimate
|
||||||
float32 ocv_estimate_filtered # [V] Filtered open circuit voltage estimate
|
float32 ocv_estimate_filtered # [V] Filtered open circuit voltage estimate
|
||||||
float32 volt_based_soc_estimate # [@range 0, 1] Normalized volt based state of charge estimate
|
float32 volt_based_soc_estimate # [-] [@range 0, 1] Normalized volt based state of charge estimate
|
||||||
float32 voltage_prediction # [V] Predicted voltage
|
float32 voltage_prediction # [V] Predicted voltage
|
||||||
float32 prediction_error # [V] Prediction error
|
float32 prediction_error # [V] Prediction error
|
||||||
float32 estimation_covariance_norm # Norm of the covariance matrix
|
float32 estimation_covariance_norm # [-] Norm of the covariance matrix
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -52,7 +52,9 @@ uint8 CS_SYNTHETIC_MAG_Z = 25 # 25 - true when we are using a synthesized measur
|
|||||||
uint8 CS_VEHICLE_AT_REST = 26 # 26 - true when the vehicle is at rest
|
uint8 CS_VEHICLE_AT_REST = 26 # 26 - true when the vehicle is at rest
|
||||||
uint8 CS_GPS_YAW_FAULT = 27 # 27 - true when the GNSS heading has been declared faulty and is no longer being used
|
uint8 CS_GPS_YAW_FAULT = 27 # 27 - true when the GNSS heading has been declared faulty and is no longer being used
|
||||||
uint8 CS_RNG_FAULT = 28 # 28 - true when the range finder has been declared faulty and is no longer being used
|
uint8 CS_RNG_FAULT = 28 # 28 - true when the range finder has been declared faulty and is no longer being used
|
||||||
uint8 CS_GNSS_VEL = 44 # 44 - true if GNSS velocity measurements are being fused
|
uint8 CS_GNSS_VEL = 44 # 44 - true if GNSS velocity measurement fusion is intended
|
||||||
|
uint8 CS_GNSS_FAULT = 45 # 45 - true if GNSS measurements have been declared faulty and are no longer used
|
||||||
|
uint8 CS_YAW_MANUAL = 46 # 46 - true if yaw has been set manually
|
||||||
|
|
||||||
uint32 filter_fault_flags # Bitmask to indicate EKF internal faults
|
uint32 filter_fault_flags # Bitmask to indicate EKF internal faults
|
||||||
# 0 - true if the fusion of the magnetometer X-axis has encountered a numerical error
|
# 0 - true if the fusion of the magnetometer X-axis has encountered a numerical error
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ bool cs_valid_fake_pos # 41 - true if a valid constant position is bein
|
|||||||
bool cs_constant_pos # 42 - true if the vehicle is at a constant position
|
bool cs_constant_pos # 42 - true if the vehicle is at a constant position
|
||||||
bool cs_baro_fault # 43 - true when the current baro has been declared faulty and is no longer being used
|
bool cs_baro_fault # 43 - true when the current baro has been declared faulty and is no longer being used
|
||||||
bool cs_gnss_vel # 44 - true if GNSS velocity measurement fusion is intended
|
bool cs_gnss_vel # 44 - true if GNSS velocity measurement fusion is intended
|
||||||
bool cs_yaw_manual # 45 - true if yaw has been set manually
|
bool cs_gnss_fault # 45 - true if GNSS measurements have been declared faulty and are no longer used
|
||||||
|
bool cs_yaw_manual # 46 - true if yaw has been set manually
|
||||||
|
|
||||||
# fault status
|
# fault status
|
||||||
uint32 fault_status_changes # number of filter fault status (fs) changes
|
uint32 fault_status_changes # number of filter fault status (fs) changes
|
||||||
|
|||||||
@@ -10,6 +10,6 @@ Rover Rate Status
|
|||||||
uint64 timestamp # [us] Time since system start
|
uint64 timestamp # [us] Time since system start
|
||||||
float32 measured_yaw_rate # [rad/s] [@range -inf, inf] [@frame NED] Measured yaw rate
|
float32 measured_yaw_rate # [rad/s] [@range -inf, inf] [@frame NED] Measured yaw rate
|
||||||
float32 adjusted_yaw_rate_setpoint # [rad/s] [@range -inf, inf] [@frame NED] Yaw rate setpoint that is being tracked (Applied slew rates)
|
float32 adjusted_yaw_rate_setpoint # [rad/s] [@range -inf, inf] [@frame NED] Yaw rate setpoint that is being tracked (Applied slew rates)
|
||||||
float32 pid_yaw_rate_integral # [] [@range -1, 1] Integral of the PID for the closed loop yaw rate controller
|
float32 pid_yaw_rate_integral # [-] [@range -1, 1] Integral of the PID for the closed loop yaw rate controller
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ Rover Velocity Status
|
|||||||
uint64 timestamp # [us] Time since system start
|
uint64 timestamp # [us] Time since system start
|
||||||
float32 measured_speed_body_x # [m/s] [@range -inf (Backwards), inf (Forwards)] [@frame Body] Measured speed in body x direction
|
float32 measured_speed_body_x # [m/s] [@range -inf (Backwards), inf (Forwards)] [@frame Body] Measured speed in body x direction
|
||||||
float32 adjusted_speed_body_x_setpoint # [m/s] [@range -inf (Backwards), inf (Forwards)] [@frame Body] Speed setpoint in body x direction that is being tracked (Applied slew rates)
|
float32 adjusted_speed_body_x_setpoint # [m/s] [@range -inf (Backwards), inf (Forwards)] [@frame Body] Speed setpoint in body x direction that is being tracked (Applied slew rates)
|
||||||
float32 pid_throttle_body_x_integral # [] [@range -1, 1] Integral of the PID for the closed loop controller of the speed in body x direction
|
float32 pid_throttle_body_x_integral # [-] [@range -1, 1] Integral of the PID for the closed loop controller of the speed in body x direction
|
||||||
float32 measured_speed_body_y # [m/s] [@range -inf (Left), inf (Right)] [@frame Body] [@invalid NaN If not mecanum] Mecanum only: Measured speed in body y direction
|
float32 measured_speed_body_y # [m/s] [@range -inf (Left), inf (Right)] [@frame Body] [@invalid NaN If not mecanum] Mecanum only: Measured speed in body y direction
|
||||||
float32 adjusted_speed_body_y_setpoint # [m/s] [@range -inf (Left), inf (Right)] [@frame Body] [@invalid NaN If not mecanum] Mecanum only: Speed setpoint in body y direction that is being tracked (Applied slew rates)
|
float32 adjusted_speed_body_y_setpoint # [m/s] [@range -inf (Left), inf (Right)] [@frame Body] [@invalid NaN If not mecanum] Mecanum only: Speed setpoint in body y direction that is being tracked (Applied slew rates)
|
||||||
float32 pid_throttle_body_y_integral # [] [@range -1, 1] [@invalid NaN If not mecanum] Mecanum only: Integral of the PID for the closed loop controller of the speed in body y direction
|
float32 pid_throttle_body_y_integral # [-] [@range -1, 1] [@invalid NaN If not mecanum] Mecanum only: Integral of the PID for the closed loop controller of the speed in body y direction
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ Rover Steering setpoint
|
|||||||
# Rover Steering setpoint
|
# Rover Steering setpoint
|
||||||
|
|
||||||
uint64 timestamp # [us] Time since system start
|
uint64 timestamp # [us] Time since system start
|
||||||
float32 normalized_steering_setpoint # [@range -1 (Left), 1 (Right)] [@frame Body] Ackermann: Normalized steering angle, Differential/Mecanum: Normalized speed difference between the left and right wheels
|
float32 normalized_steering_setpoint # [-] [@range -1 (Left), 1 (Right)] [@frame Body] Ackermann: Normalized steering angle, Differential/Mecanum: Normalized speed difference between the left and right wheels
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ Rover Throttle setpoint
|
|||||||
# Rover Throttle setpoint
|
# Rover Throttle setpoint
|
||||||
|
|
||||||
uint64 timestamp # [us] Time since system start
|
uint64 timestamp # [us] Time since system start
|
||||||
float32 throttle_body_x # [] [@range -1 (Backwards), 1 (Forwards)] [@frame Body] Throttle setpoint along body X axis
|
float32 throttle_body_x # [-] [@range -1 (Backwards), 1 (Forwards)] [@frame Body] Throttle setpoint along body X axis
|
||||||
float32 throttle_body_y # [] [@range -1 (Left), 1 (Right)] [@frame Body] [@invalid NaN If not mecanum] Mecanum only: Throttle setpoint along body Y axis
|
float32 throttle_body_y # [-] [@range -1 (Left), 1 (Right)] [@frame Body] [@invalid NaN If not mecanum] Mecanum only: Throttle setpoint along body Y axis
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ uint16 VEHICLE_CMD_REQUEST_CAMERA_INFORMATION = 521 # Request camera information
|
|||||||
uint16 VEHICLE_CMD_SET_CAMERA_MODE = 530 # Set camera capture mode (photo, video, etc.).
|
uint16 VEHICLE_CMD_SET_CAMERA_MODE = 530 # Set camera capture mode (photo, video, etc.).
|
||||||
uint16 VEHICLE_CMD_SET_CAMERA_ZOOM = 531 # Set camera zoom.
|
uint16 VEHICLE_CMD_SET_CAMERA_ZOOM = 531 # Set camera zoom.
|
||||||
uint16 VEHICLE_CMD_SET_CAMERA_FOCUS = 532
|
uint16 VEHICLE_CMD_SET_CAMERA_FOCUS = 532
|
||||||
|
uint16 VEHICLE_CMD_EXTERNAL_ATTITUDE_ESTIMATE = 620 # Set an external estimate of vehicle attitude in degrees.
|
||||||
uint16 VEHICLE_CMD_DO_GIMBAL_MANAGER_PITCHYAW = 1000 # Setpoint to be sent to a gimbal manager to set a gimbal pitch and yaw.
|
uint16 VEHICLE_CMD_DO_GIMBAL_MANAGER_PITCHYAW = 1000 # Setpoint to be sent to a gimbal manager to set a gimbal pitch and yaw.
|
||||||
uint16 VEHICLE_CMD_DO_GIMBAL_MANAGER_CONFIGURE = 1001 # Gimbal configuration to set which sysid/compid is in primary and secondary control.
|
uint16 VEHICLE_CMD_DO_GIMBAL_MANAGER_CONFIGURE = 1001 # Gimbal configuration to set which sysid/compid is in primary and secondary control.
|
||||||
uint16 VEHICLE_CMD_IMAGE_START_CAPTURE = 2000 # Start image capture sequence.
|
uint16 VEHICLE_CMD_IMAGE_START_CAPTURE = 2000 # Start image capture sequence.
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ uint8 NAVIGATION_STATE_AUTO_LOITER = 4 # Auto loiter mode
|
|||||||
uint8 NAVIGATION_STATE_AUTO_RTL = 5 # Auto return to launch mode
|
uint8 NAVIGATION_STATE_AUTO_RTL = 5 # Auto return to launch mode
|
||||||
uint8 NAVIGATION_STATE_POSITION_SLOW = 6
|
uint8 NAVIGATION_STATE_POSITION_SLOW = 6
|
||||||
uint8 NAVIGATION_STATE_FREE5 = 7
|
uint8 NAVIGATION_STATE_FREE5 = 7
|
||||||
uint8 NAVIGATION_STATE_FREE4 = 8
|
uint8 NAVIGATION_STATE_ALTITUDE_CRUISE = 8 # Altitude with Cruise mode
|
||||||
uint8 NAVIGATION_STATE_FREE3 = 9
|
uint8 NAVIGATION_STATE_FREE3 = 9
|
||||||
uint8 NAVIGATION_STATE_ACRO = 10 # Acro mode
|
uint8 NAVIGATION_STATE_ACRO = 10 # Acro mode
|
||||||
uint8 NAVIGATION_STATE_FREE2 = 11
|
uint8 NAVIGATION_STATE_FREE2 = 11
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ Graphs showing how these are used [can be found here](../middleware/uorb_graph.m
|
|||||||
- [ActuatorMotors](ActuatorMotors.md) — Motor control message
|
- [ActuatorMotors](ActuatorMotors.md) — Motor control message
|
||||||
- [ActuatorServos](ActuatorServos.md) — Servo control message
|
- [ActuatorServos](ActuatorServos.md) — Servo control message
|
||||||
- [AirspeedValidated](AirspeedValidated.md)
|
- [AirspeedValidated](AirspeedValidated.md)
|
||||||
- [ArmingCheckReply](ArmingCheckReply.md) — Arming check reply.
|
- [ArmingCheckReply](ArmingCheckReply.md) — Arming check reply
|
||||||
- [ArmingCheckRequest](ArmingCheckRequest.md) — Arming check request.
|
- [ArmingCheckRequest](ArmingCheckRequest.md) — Arming check request
|
||||||
- [BatteryStatus](BatteryStatus.md) — Battery status
|
- [BatteryStatus](BatteryStatus.md) — Battery status
|
||||||
- [ConfigOverrides](ConfigOverrides.md) — Configurable overrides by (external) modes or mode executors
|
- [ConfigOverrides](ConfigOverrides.md) — Configurable overrides by (external) modes or mode executors
|
||||||
- [Event](Event.md) — Events interface
|
- [Event](Event.md) — Events interface
|
||||||
|
|||||||
@@ -44,7 +44,9 @@ Please continue reading for [upgrade instructions](#upgrade-guide).
|
|||||||
|
|
||||||
### Control
|
### Control
|
||||||
|
|
||||||
- TBD
|
- Added new flight mode(s): [Altitude Cruise (MC)](../flight_modes_mc/altitude_cruise.md), Altitude Cruise (FW).
|
||||||
|
For fixed-wing the mode behaves the same as Altitude mode but you can disable the manual control loss failsafe. (PX4-Autopilot#25435: Add new flight mode: Altitude Cruise
|
||||||
|
).
|
||||||
|
|
||||||
### Estimation
|
### Estimation
|
||||||
|
|
||||||
@@ -72,7 +74,8 @@ Please continue reading for [upgrade instructions](#upgrade-guide).
|
|||||||
|
|
||||||
### Multi-Rotor
|
### Multi-Rotor
|
||||||
|
|
||||||
- TBD
|
- Removed parameters `MPC_{XY/Z/YAW}_MAN_EXPO` and use default value instead, as they were not deemed necessary anymore. ([PX4-Autopilot#25435: Add new flight mode: Altitude Cruise](https://github.com/PX4/PX4-Autopilot/pull/25435)).
|
||||||
|
- Renamed `MPC_HOLD_DZ` to `MAN_DEADZONE` to have it globally available in modes that allow for a dead zone. ([PX4-Autopilot#25435: Add new flight mode: Altitude Cruise](https://github.com/PX4/PX4-Autopilot/pull/25435)).
|
||||||
|
|
||||||
### 垂直起降
|
### 垂直起降
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ ROS 2 是ROS (机器人操作系统)最新版本 , 一个通用的机器人库
|
|||||||
PX4开发团队强烈建议您使用/迁移到此版本的 ROS!
|
PX4开发团队强烈建议您使用/迁移到此版本的 ROS!
|
||||||
|
|
||||||
这是最新版本的 [ROS](https://www.ros.org/) (机器人操作系统)。
|
这是最新版本的 [ROS](https://www.ros.org/) (机器人操作系统)。
|
||||||
它大大改进了外空军备竞赛“1”,尤其是允许与PX4更深、更低的延迟结合。
|
它大大改进了ROS1,特别是允许与PX4更深、更低的延迟结合。
|
||||||
:::
|
:::
|
||||||
|
|
||||||
ROS得益于一个活跃的生态系统,在这个生态系统里,开发者会解决常见的机器人问题,他们也有权使用为Linux编写的其他软件库。
|
ROS得益于一个活跃的生态系统,在这个生态系统里,开发者会解决常见的机器人问题,他们也为Linux编写软件库。
|
||||||
例如,它可以用于[计算机视图](../computer_vision/index.md)解决方案。
|
例如,它可以用于[计算机视觉](../computer_vision/index.md)解决方案。
|
||||||
|
|
||||||
ROS 2能够非常深入地与 PX4 集成 只要你可以在交战规则2中创建无法与内部的 PX4 模式区分的飞行模式, 并以高费率直接读取内部uORB主题。
|
ROS 2深度与 PX4 集成, 在某种程度上,您能够在 ROS 2 中创建与内部 PX4 模式无法区分的飞行模式, 并高效率的直接订阅uORB内部的话题。
|
||||||
建议(尤其是)从同伴计算机进行控制和通信,因为这种计算机的延迟率很低。 当利用来自Linux的现有库时,或在编写新的高层飞行模式时。
|
建议(尤其是)从同伴计算机进行控制和通信,因为这种计算机的延迟率很低。 当利用来自Linux的现有库时,或在编写新的高层飞行模式时。
|
||||||
|
|
||||||
ROS 2 和 PX4 之间的通信使用中间件实现[XRCE-DDS] (../middleware/uxrce_dds.md)。
|
ROS 2 和 PX4 之间的通信使用中间件实现[XRCE-DDS] (../middleware/uxrce_dds.md)。
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# 使用 ROS 2 进行多车辆仿真
|
# 使用 ROS 2 进行多车辆模拟
|
||||||
|
|
||||||
[XRCE-DDS](../middleware/uxrce_dds.md) 支持多个客户端通过 UDP 协议连接到同一个代理。
|
[XRCE-DDS](../middleware/uxrce_dds.md) 支持多个客户端通过 UDP 协议连接到同一个代理。
|
||||||
这在模拟中特别有用,因为只有一个代理需要启动。
|
这在模拟中特别有用,因为只有一个代理需要启动。
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
唯一的要求是
|
唯一的要求是
|
||||||
|
|
||||||
- 能够在不依赖 ROS 2 的情况下,使用所需的仿真器([Gazebo](../sim_gazebo_gz/multi_vehicle_simulation.md), [Gazebo Classic](../sim_gazebo_classic/multi_vehicle_simulation.md#multiple-vehicle-with-gazebo-classic), [FlightGear](../sim_flightgear/multi_vehicle.md) 和 [JMAVSim](../sim_jmavsim/multi_vehicle.md))运行多车辆仿真[multi-vehicle simulation](../simulation/multi-vehicle-simulation.md)。
|
- 能够在不依赖 ROS 2 的情况下,使用所需的仿真器([Gazebo](../sim_gazebo_gz/multi_vehicle_simulation.md), [Gazebo Classic](../sim_gazebo_classic/multi_vehicle_simulation.md#multiple-vehicle-with-gazebo-classic), [FlightGear](../sim_flightgear/multi_vehicle.md) 和 [JMAVSim](../sim_jmavsim/multi_vehicle.md))运行多车辆仿真[multi-vehicle simulation](../simulation/multi-vehicle-simulation.md)。
|
||||||
- 能够在单车辆仿真中使用ROS 2(机器人操作系统 2)
|
- 能够在单一车辆仿真中使用ROS 2(机器人操作系统 2)
|
||||||
|
|
||||||
## 工作原理
|
## 工作原理
|
||||||
|
|
||||||
@@ -51,4 +51,4 @@ PX4 只在他们的 `target_system` 字段为 0 (路由通信) 或与 `MAV_SYS_I
|
|||||||
在所有其他情况下,信息都被忽视。
|
在所有其他情况下,信息都被忽视。
|
||||||
因此,当 ROS 2 节点需向 PX4 发送 VehicleCommand(载具指令)消息时,必须确保消息中填写了合适的 target_system(目标系统)字段值。
|
因此,当 ROS 2 节点需向 PX4 发送 VehicleCommand(载具指令)消息时,必须确保消息中填写了合适的 target_system(目标系统)字段值。
|
||||||
|
|
||||||
For example, if you want to send a command to your third vehicle, which has `px4_instance=2`, you need to set `target_system=3` in all your `VehicleCommand` messages.
|
例如,若你想向 px4_instance=2 的第三台飞行器发送指令,则需要在所有 VehicleCommand消息中设置 target_system=3。
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
示例将首先发送设置点、进入offboard模式、解锁、起飞至5米,并悬停等待。
|
示例将首先发送设置点、进入offboard模式、解锁、起飞至5米,并悬停等待。
|
||||||
虽然简单,但它显示了如何使用offboard控制以及如何向无人机发送指令。
|
虽然简单,但它显示了如何使用offboard控制以及如何向无人机发送指令。
|
||||||
|
|
||||||
It has been tested on Ubuntu 20.04 with ROS 2 Foxy and PX4 v1.14.
|
该内容已在搭载 ROS 2 Foxy 与 PX4 v1.14 的 Ubuntu 20.04 系统上完成测试。
|
||||||
|
|
||||||
:::warning
|
:::warning
|
||||||
_Offboard_ control is dangerous.
|
_Offboard_ control is dangerous.
|
||||||
@@ -13,22 +13,22 @@ _Offboard_ control is dangerous.
|
|||||||
:::
|
:::
|
||||||
|
|
||||||
:::info
|
:::info
|
||||||
ROS and PX4 make a number of different assumptions, in particular with respect to [frame conventions](../ros/external_position_estimation.md#reference-frames-and-ros).
|
ROS 与 PX4 存在若干不同的预设(假设),尤其是在坐标系约定([frame conventions])方面../ros/external_position_estimation.md#reference-frames-and-ros
|
||||||
当主题发布或订阅时,坐标系类型之间没有隐含转换!
|
当主题发布或订阅时,坐标系类型之间没有隐含转换!
|
||||||
|
|
||||||
这个例子按照PX4的定义在NED坐标系下发布位置。
|
这个例子按照PX4的预期在NED坐标系下发布位置。
|
||||||
To subscribe to data coming from nodes that publish in a different frame (for example the ENU, which is the standard frame of reference in ROS/ROS 2), use the helper functions in the [frame_transforms](https://github.com/PX4/px4_ros_com/blob/main/src/lib/frame_transforms.cpp) library.
|
若要订阅来自在不同框架内发布的节点的数据(例如ENU, 这是ROS/ROS 2中的标准参考框架,使用 [frame_transforms](https://github.com/PX4/px4_ros_com/blob/main/src/lib/frame_transforms.cpp)库中的辅助函数。
|
||||||
:::
|
:::
|
||||||
|
|
||||||
## 尝试一下
|
## 小試身手
|
||||||
|
|
||||||
Follow the instructions in [ROS 2 User Guide](../ros2/user_guide.md) to install PX and run the simulator, install ROS 2, and start the XRCE-DDS Agent.
|
请遵循 ROS 2 用户指南 (../ros2/user_guide.md)中的说明,完成安装 PX4和运行模拟器,安装 ROS 2和启动 XRCE-DDS 代理(Agent)。
|
||||||
|
|
||||||
After that we can follow a similar set of steps to those in [ROS 2 User Guide > Build ROS 2 Workspace](../ros2/user_guide.md#build-ros-2-workspace) to run the example.
|
之后,我们可参照 ROS 2 用户指南 > 构建 ROS 2 工作空间 (../ros2/user_guide.md#build-ros-2-workspace)中的相似的步骤来运行这个例子。
|
||||||
|
|
||||||
:::tip
|
:::tip
|
||||||
Make sure that QGC is connected to PX4 before running the ROS 2 node.
|
运行 ROS 2 节点前,请确保 QGC已连接到 PX4。
|
||||||
This is needed because, by default, you cannot arm a vehicle without a connection to ground station (QGC) or an established RC connection (this ensures there is always the option to regain manual control).
|
之所以需要这样做,是因为默认情况下,若未连接地面控制站(QGC)或已建立的RC连接,飞行器无法解锁(这一机制可确保始终存在重新获得手动控制权的途径)。
|
||||||
:::
|
:::
|
||||||
|
|
||||||
构建并运行示例:
|
构建并运行示例:
|
||||||
@@ -42,14 +42,14 @@ This is needed because, by default, you cannot arm a vehicle without a connectio
|
|||||||
cd ~/ws_offboard_control/src/
|
cd ~/ws_offboard_control/src/
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Clone the [px4_msgs](https://github.com/PX4/px4_msgs) repo to the `/src` directory (this repo is needed in every ROS 2 PX4 workspace!):
|
3. 将 px4_msgs 代码仓库克隆到 /src 目录下(每个 ROS 2 PX4 工作空间都需要该仓库!):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://github.com/PX4/px4_msgs.git
|
git clone https://github.com/PX4/px4_msgs.git
|
||||||
# checkout the matching release branch if not using PX4 main.
|
#若未使用 PX4 的 main 分支,请切换到对应的发布分支
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Clone the example repository [px4_ros_com](https://github.com/PX4/px4_ros_com) to the `/src` directory:
|
4. 将示例代码仓库 px4_ros_com (https://github.com/PX4/px4_ros_com)克隆到 /src 目录下:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://github.com/PX4/px4_ros_com.git
|
git clone https://github.com/PX4/px4_ros_com.git
|
||||||
@@ -83,7 +83,7 @@ This is needed because, by default, you cannot arm a vehicle without a connectio
|
|||||||
|
|
||||||
::::
|
::::
|
||||||
|
|
||||||
6. Source the `local_setup.bash`:
|
6. 来源 `local_setup.bash`:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
source install/local_setup.bash
|
source install/local_setup.bash
|
||||||
@@ -99,25 +99,25 @@ This is needed because, by default, you cannot arm a vehicle without a connectio
|
|||||||
|
|
||||||
## 实现
|
## 实现
|
||||||
|
|
||||||
The source code of the offboard control example can be found in [PX4/px4_ros_com](https://github.com/PX4/px4_ros_com) in the directory [/src/examples/offboard/offboard_control.cpp](https://github.com/PX4/px4_ros_com/blob/main/src/examples/offboard/offboard_control.cpp).
|
离板控制示例的源代码可以在[ PX4/px4_ros_com ]目录里 [/src/examples/offboard/offboard_control.cpp](https://github.com/PX4/px4_ros_com/blob/main/src/examples/offboard/offboard_control.cpp)中找到 [X4/px4_ros_com](https://github.com/PX4/px4_ros_com)。
|
||||||
|
|
||||||
:::info
|
:::info
|
||||||
PX4 publishes all the messages used in this example as ROS topics by default (see [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml)).
|
PX4 默认情况下将此示例中使用的所有消息以ROS为话题发布(详见 [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml))。
|
||||||
:::
|
:::
|
||||||
|
|
||||||
PX4 requires that the vehicle is already receiving `OffboardControlMode` messages before it will arm in offboard mode, or before it will switch to offboard mode when flying.
|
PX4 要求,飞行器需先持续接收 OffboardControlMode(离板控制模式)消息,之后才能在离板模式下解锁(arm),或在飞行过程中切换至离板模式。
|
||||||
In addition, PX4 will switch out of offboard mode if the stream rate of `OffboardControlMode` messages drops below approximately 2Hz.
|
此外,若 OffboardControlMode(离板控制模式)消息的数据流速率降至约 2Hz 以下,PX4 将会退出离板模式。
|
||||||
该行为在ROS 2 节点的主循环中实现的,如下所示:
|
该行为在ROS 2 节点的主循环中实现的,如下所示:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
auto timer_callback = [this]() -> void {
|
auto timer_callback = [this]() -> void {
|
||||||
|
|
||||||
if (offboard_setpoint_counter_ == 10) {
|
if (offboard_setpoint_counter_ == 10) {
|
||||||
// Change to Offboard mode after 10 setpoints
|
// Change to Offboard mode after 10 setpoints
|
||||||
this->publish_vehicle_command(VehicleCommand::VEHICLE_CMD_DO_SET_MODE, 1, 6);
|
this->publish_vehicle_command(VehicleCommand::VEHICLE_CMD_DO_SET_MODE, 1, 6);
|
||||||
|
|
||||||
// Arm the vehicle
|
// Arm the vehicle
|
||||||
this->arm();
|
this->arm();
|
||||||
}
|
}
|
||||||
|
|
||||||
// OffboardControlMode needs to be paired with TrajectorySetpoint
|
// OffboardControlMode needs to be paired with TrajectorySetpoint
|
||||||
@@ -125,55 +125,55 @@ auto timer_callback = [this]() -> void {
|
|||||||
publish_trajectory_setpoint();
|
publish_trajectory_setpoint();
|
||||||
|
|
||||||
// stop the counter after reaching 11
|
// stop the counter after reaching 11
|
||||||
if (offboard_setpoint_counter_ < 11) {
|
if (offboard_setpoint_counter_ < 11) {
|
||||||
offboard_setpoint_counter_++;
|
offboard_setpoint_counter_++;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
timer_ = this->create_wall_timer(100ms, timer_callback);
|
timer_ = this->create_wall_timer(100ms, timer_callback);
|
||||||
```
|
```
|
||||||
|
|
||||||
循环运行在一个100毫秒计时器。
|
循环运行在一个100毫秒计时器。
|
||||||
For the first 10 cycles it calls `publish_offboard_control_mode()` and `publish_trajectory_setpoint()` to send [OffboardControlMode](../msg_docs/OffboardControlMode.md) and [TrajectorySetpoint](../msg_docs/TrajectorySetpoint.md) messages to PX4.
|
在最初的 10 个循环中,它会调用 publish_offboard_control_mode() 和 publish_trajectory_setpoint() 这两个函数,向 PX4 发送 OffboardControlMode(离板控制模式)(../msg_docs/OffboardControlMode.md) 和 TrajectorySetpoint(轨迹设定点)(../msg_docs/TrajectorySetpoint.md) 消息。
|
||||||
The `OffboardControlMode` messages are streamed so that PX4 will allow arming once it switches to offboard mode, while the `TrajectorySetpoint` messages are ignored (until the vehicle is in offboard mode).
|
OffboardControlMode消息会持续发送,以便 PX4 切换到离板模式后允许解锁;而 TrajectorySetpoint消息会被忽略(直到载具处于离板模式)
|
||||||
|
|
||||||
After 10 cycles `publish_vehicle_command()` is called to change to offboard mode, and `arm()` is called to arm the vehicle.
|
10 个循环后,会调用 publish_vehicle_command() 函数切换至离板模式,并调用 arm() 函数对载具进行解锁。
|
||||||
在飞行器解锁并和切换模式后,它将开始跟踪位置设定值。
|
在载具解锁并和切换模式后,它将开始跟踪位置设定值。
|
||||||
在每个周期内仍然发送设定值,确保飞行器不会切换出offboard模式。
|
在每个周期内仍然发送设定值,确保载具不会切换出offboard模式。
|
||||||
|
|
||||||
The implementations of the `publish_offboard_control_mode()` and `publish_trajectory_setpoint()` methods are shown below.
|
publish_offboard_control_mode() 和 publish_trajectory_setpoint() 这两个方法的实现代码如下所示。
|
||||||
These publish the [OffboardControlMode](../msg_docs/OffboardControlMode.md) and [TrajectorySetpoint](../msg_docs/TrajectorySetpoint.md) messages to PX4 (respectively).
|
这些方法会分别发布到 PX4 的 [OffboardControlMode](../msg_docs/OffboardControlMode.md和 [TrajectorySetpoint](../msg_docs/TrajectorySetpoint.md) 消息。
|
||||||
|
|
||||||
The `OffboardControlMode` is required in order to inform PX4 of the _type_ of offboard control behing used.
|
OffboardControlMode(离板控制模式)消息是必需的,其作用是告知 PX4 当前所使用的离板控制类型。
|
||||||
Here we're only using _position control_, so the `position` field is set to `true` and all the other fields are set to `false`.
|
此处我们仅使用位置控制,因此将 `position` 字段设为`true`,而所有其他字段均设为 `false`。
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
/**
|
/**
|
||||||
* @brief Publish the offboard control mode.
|
* @short 发布离板控制模式。
|
||||||
* For this example, only position and altitude controls are active.
|
*在本示例中,仅位置控制和高度控制处于激活状态
|
||||||
*/
|
*/
|
||||||
void OffboardControl::publish_offboard_control_mode()
|
无效的离板控制::publish_offboard_control_mode()
|
||||||
{
|
Power
|
||||||
OffboardControlMode msg{};
|
OffboardControlModel msg{};
|
||||||
msg.position = true;
|
msg.position = true;
|
||||||
msg.velocity = false;
|
msg.veocity = false;
|
||||||
msg.acceleration = false;
|
msg. cceleration = false;
|
||||||
msg.attitude = false;
|
msg.attitude = false;
|
||||||
msg.body_rate = false;
|
msg.body_rate = false;
|
||||||
msg.thrust_and_torque = false;
|
msg.subust_and_torque = false;
|
||||||
msg.direct_actuator = false;
|
msg. irect_actuator = false;
|
||||||
msg.timestamp = this->get_clock()->now().nanoseconds() / 1000;
|
msg.timestamp = this->get_clock()->now ().nanoseconds() / 1000;
|
||||||
offboard_control_mode_publisher_->publish(msg);
|
offboard_control_mode_publisher_->publish(msg);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
`TrajectorySetpoint` provides the position setpoint.
|
`TrattorySettpoint` 提供了位置设定点。
|
||||||
In this case, the `x`, `y`, `z` and `yaw` fields are hardcoded to certain values, but they can be updated dynamically according to an algorithm or even by a subscription callback for messages coming from another node.
|
在这种情况下,`x`、`y`、`z`和`yaw`字段的值是硬编码为特定数值的。 但它们可以根据算法动态更新,甚至可以通过订阅回调函数来从另一个节点进行更新。
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
/**
|
/**
|
||||||
* @brief Publish a trajectory setpoint
|
*@brief 发布轨迹设定点
|
||||||
* For this example, it sends a trajectory setpoint to make the
|
|
||||||
* vehicle hover at 5 meters with a yaw angle of 180 degrees.
|
在本示例中,该函数会发送一个轨迹设定点,使载具在 5 米高度悬停,并保持 180 度的偏航角。
|
||||||
*/
|
*/
|
||||||
void OffboardControl::publish_trajectory_setpoint()
|
void OffboardControl::publish_trajectory_setpoint()
|
||||||
{
|
{
|
||||||
@@ -185,9 +185,9 @@ void OffboardControl::publish_trajectory_setpoint()
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The `publish_vehicle_command()` sends [VehicleCommand](../msg_docs/VehicleCommand.md) messages with commands to the flight controller.
|
`publish_vehicle_command()` 将带有命令的 [VehicleCommand](../msg_docs/VehicleCommand.md)消息发送给载具。
|
||||||
We use it above to change the mode to offboard mode, and also in `arm()` to arm the vehicle.
|
我们使用上面的方法将模式切换为 offboard 模式,同时也在 arm() 函数中用它来对载具进行解锁。
|
||||||
While we don't call `disarm()` in this example, it is also used in the implementation of that function.
|
我们在此示例中不调用 `disarm()` ,但它也用于执行此功能。
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
/**
|
/**
|
||||||
@@ -207,14 +207,14 @@ void OffboardControl::publish_vehicle_command(uint16_t command, float param1, fl
|
|||||||
msg.source_system = 1;
|
msg.source_system = 1;
|
||||||
msg.source_component = 1;
|
msg.source_component = 1;
|
||||||
msg.from_external = true;
|
msg.from_external = true;
|
||||||
msg.timestamp = this->get_clock()->now().nanoseconds() / 1000;
|
msg.timestamp = this->get_clock()->now().nanoseconds() / 1000;
|
||||||
vehicle_command_publisher_->publish(msg);
|
vehicle_command_publisher_->publish(msg);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
:::info
|
:::info
|
||||||
[VehicleCommand](../msg_docs/VehicleCommand.md) is one of the simplest and most powerful ways to command PX4, and by subscribing to [VehicleCommandAck](../msg_docs/VehicleCommandAck.md) you can also confirm that setting a particular command was successful.
|
[VehicleCommand](../msg_docs/VehicleCommand.md是命令PX4的最简单和最高效的方式之一。 通过订阅 [VehicleCommandAck](../msg_docs/VehicleCommandAck.md),您也可以确认设置特定命令是否成功。
|
||||||
The param and command fields map to [MAVLink commands](https://mavlink.io/en/messages/common.html#mav_commands) and their parameter values.
|
参数字段和 指令字段对应于 [MAVLink commands](https://mavlink.io/en/messages/common.html#mav_commands)以及他们的参数值
|
||||||
:::
|
:::
|
||||||
|
|
||||||
## See Also
|
## See Also
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,81 +1,82 @@
|
|||||||
# PX4 ROS 2 Message Translation Node
|
# PX4 ROS 2 消息翻译节点
|
||||||
|
|
||||||
<Badge type="tip" text="PX4 v1.16" /> <Badge type="warning" text="Experimental" />
|
<0/> <1/>
|
||||||
|
|
||||||
The message translation node allows ROS 2 applications that were compiled against different versions of the PX4 messages to interwork with newer versions of PX4, and vice versa, without having to change either the application or the PX4 side.
|
消息翻译节点允许针对不同版本的 PX4 消息编译的 ROS 2 应用程序与更新版本的 PX4 交互。 反之亦然,而不必更改应用程序或PX4一侧。
|
||||||
|
|
||||||
## 综述
|
## 综述
|
||||||
|
|
||||||
The translation of messages from one definition version to another is possible thanks to the introduction of [message versioning](../middleware/uorb.md#message-versioning).
|
由于引入了[消息版本](../middleware/uorb.md#message-versioning),将消息从一个定义版本翻译成另一个定义版本是可能的。
|
||||||
|
|
||||||
The translation node has access to all message versions previously defined by PX4.
|
翻译节点可以访问之前由 PX4 定义的所有消息版本。
|
||||||
It dynamically observes the DDS data space, monitoring the publications, subscriptions and services originating from either PX4 via the [uXRCE-DDS Bridge](../middleware/uxrce_dds.md), or ROS 2 applications.
|
它积极观察了光盘系统的数据空间,监测出版物。 通过[uXRCE-DDS桥](../middleware/uxrce_dds.md)或外空委2应用源于PX4的订阅和服务。
|
||||||
When necessary, it converts messages to the current versions expected by both applications and PX4, ensuring compatibility.
|
必要时,它会将消息转换到应用程序和PX4预期的当前版本,确保兼容性。
|
||||||
|
|
||||||

|
![概述ROS 2消息转换节点]
|
||||||
|
(../../assets/middleware/ros2/px4_ros2_interface_lib/translation_node.svg)
|
||||||
|
|
||||||
<!-- doc source: ../../assets/middleware/ros2/px4_ros2_interface_lib/translation_node.drawio -->
|
<!-- doc source: ../../assets/middleware/ros2/px4_ros2_interface_lib/translation_node.drawio -->
|
||||||
|
|
||||||
To support the coexistence of different versions of the same messages within the ROS 2 domain, the ROS 2 topic-names for publications, subscriptions, and services include their respective message version as a suffix.
|
支持不同版本的同一消息在交战规则2域内共存, 出版、订阅和服务的ROS 2主题名称包括各自的信息版本的后缀。
|
||||||
This naming convention takes the form `<topic_name>_v<version>`, as shown in the diagram above.
|
这个命名协议的形式为`<topic_name>_v<version>`。
|
||||||
|
|
||||||
## 用法
|
## 用法
|
||||||
|
|
||||||
### 安装
|
### 安装
|
||||||
|
|
||||||
The following steps describe how to install and run the translation node on your machine.
|
以下步骤描述如何在您的机器上安装和运行翻译节点。
|
||||||
|
|
||||||
1. (Optional) Create a new ROS 2 workspace in which to build the message translation node and its dependencies:
|
1. (可选) 创建一个新的 ROS2 工作空间,用于构建消息翻译节点及其依赖:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mkdir -p /path/to/ros_ws/src
|
mkdir -p /path/to/ros_ws/src
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Run the following helper script to copy the message definitions and translation node into your ROS workspace directory.
|
2. 运行下面的帮助脚本来复制消息定义并将节点翻译到您的ROS工作区目录。
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd /path/to/ros_ws
|
cd /path/to/ros_ws
|
||||||
/path/to/PX4-Autopilot/Tools/copy_to_ros_ws.sh .
|
/path/to/PX4-Autopilot/Tools/copy_to_ros_ws.sh .
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Build and source the workspace.
|
3. 构建并源自工作区。
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
colcon build
|
colcon build
|
||||||
source /path/to/ros_ws/install/setup.bash
|
source /path/to/ros_ws/install/setup.bash
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Finally, run the translation node.
|
4. 最后,运行翻译节点。
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
ros2 run translation_node translation_node_bin
|
ros2 run translation_node translation_node_bin
|
||||||
```
|
```
|
||||||
|
|
||||||
You should see an output similar to:
|
您应该看到一个相似的输出:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
[INFO] [1734525720.729530513] [translation_node]: Registered pub/sub topics and versions:
|
[INFO] [1734525720.729530513] [translation_node]: 注册的 pub/子主题和版本:
|
||||||
[INFO] [1734525720.729594413] [translation_node]: Registered services and versions:
|
[INFO] [1734525720.729594413] [translation_node]: 注册的服务和版本:
|
||||||
```
|
```
|
||||||
|
|
||||||
With the translation node running, any simultaneously running ROS 2 application designed to communicate with PX4 can do so, as long as it uses message versions recognized by the node.
|
在正在运行翻译节点时,任何同时运行旨在与 PX4 通信的 ROS 2 应用程序都可以这样做。 只要它使用节点承认的消息版本。
|
||||||
The translation node will print a warning if it encounters an unknown topic version.
|
翻译节点如果遇到未知的主题版本,将打印警告。
|
||||||
|
|
||||||
:::info
|
:::info
|
||||||
After making a modification in PX4 to the message definitions and/or translation node code, you will need to rerun the steps above from point 2 to update your ROS workspace accordingly.
|
在 PX4 修改消息定义和/或翻译节点代码后, 您需要从点2重新运行以上步骤来相应更新您的ROS工作区。
|
||||||
:::
|
:::
|
||||||
|
|
||||||
### 在ROS 应用中
|
### 在ROS 应用中
|
||||||
|
|
||||||
While developing a ROS 2 application that communicates with PX4, it is not necessary to know the specific version of a message being used.
|
开发与 PX4 通信的 ROS 2 应用程序时,不必知道正在使用的消息的特定版本。
|
||||||
The message version can be added generically to a topic name like this:
|
消息版本可以以如以下方式一般添加到主题名称中:
|
||||||
|
|
||||||
:::: tabs
|
:::: tabs
|
||||||
|
|
||||||
:::tab C++
|
:::tab C++
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
topic_name + "_v" + std::to_string(T::MESSAGE_VERSION)
|
主题名称+ "_v" + std::to_string(T::MESSAGE_VERSION)
|
||||||
```
|
```
|
||||||
|
|
||||||
:::
|
:::
|
||||||
@@ -83,30 +84,30 @@ topic_name + "_v" + std::to_string(T::MESSAGE_VERSION)
|
|||||||
:::tab Python
|
:::tab Python
|
||||||
|
|
||||||
```python
|
```python
|
||||||
topic_name + "_v" + VehicleAttitude.MESSAGE_VERSION
|
主题名称 + "_v" + VehicleAttitude.MESSAGE_VERSION
|
||||||
```
|
```
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
::::
|
::::
|
||||||
|
|
||||||
where `T` is the message type, e.g. `px4_msgs::msg::VehicleAttitude`.
|
其中‘T’消息类型,例如`px4_msgs::msg::VehicleAttitude`.
|
||||||
|
|
||||||
For example, the following implements a minimal subscriber and publisher node that uses two versioned PX4 messages and topics:
|
例如,以下是一个实现最小化订阅者和发布者节点的示例,该节点使用两个带版本的 PX4 消息和主题:
|
||||||
|
|
||||||
:::: tabs
|
:::: tabs
|
||||||
|
|
||||||
:::tab C++
|
:::tab C++
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
#include <string>
|
#include <0>
|
||||||
#include <rclcpp/rclcpp.hpp>
|
#include <1>
|
||||||
#include <px4_msgs/msg/vehicle_command.hpp>
|
#include <2>
|
||||||
#include <px4_msgs/msg/vehicle_attitude.hpp>
|
#include <3>
|
||||||
|
|
||||||
// Template function to get the message version suffix
|
// Template function to get the message version suffix
|
||||||
// The correct message version is directly inferred from the message defintion
|
// The correct message version is directly inferred from the message defintion
|
||||||
template <typename T>
|
template <4>
|
||||||
std::string getMessageNameVersion() {
|
std::string getMessageNameVersion() {
|
||||||
if (T::MESSAGE_VERSION == 0) return "";
|
if (T::MESSAGE_VERSION == 0) return "";
|
||||||
return "_v" + std::to_string(T::MESSAGE_VERSION);
|
return "_v" + std::to_string(T::MESSAGE_VERSION);
|
||||||
@@ -116,13 +117,13 @@ class MinimalPubSub : public rclcpp::Node {
|
|||||||
public:
|
public:
|
||||||
MinimalPubSub() : Node("minimal_pub_sub") {
|
MinimalPubSub() : Node("minimal_pub_sub") {
|
||||||
// Use template function to define the correct topics automatically
|
// Use template function to define the correct topics automatically
|
||||||
const std::string sub_topic = "/fmu/out/vehicle_attitude" + getMessageNameVersion<px4_msgs::msg::VehicleAttitude>();
|
const std::string sub_topic = "/fmu/out/vehicle_attitude" + getMessageNameVersion<5>();
|
||||||
const std::string pub_topic = "/fmu/in/vehicle_command" + getMessageNameVersion<px4_msgs::msg::VehicleCommand>();
|
const std::string pub_topic = "/fmu/in/vehicle_command" + getMessageNameVersion<6>();
|
||||||
|
|
||||||
_subscription = this->create_subscription<px4_msgs::msg::VehicleAttitude>(
|
_subscription = this->create_subscription<5>(
|
||||||
sub_topic, 10,
|
sub_topic, 10,
|
||||||
std::bind(&MinimalPubSub::attitude_callback, this, std::placeholders::_1));
|
std::bind(&MinimalPubSub::attitude_callback, this, std::placeholders::_1));
|
||||||
_publisher = this->create_publisher<px4_msgs::msg::VehicleCommand>(pub_topic, 10);
|
_publisher = this->create_publisher<6>(pub_topic, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -130,8 +131,8 @@ class MinimalPubSub : public rclcpp::Node {
|
|||||||
RCLCPP_INFO(this->get_logger(), "Received attitude message.");
|
RCLCPP_INFO(this->get_logger(), "Received attitude message.");
|
||||||
}
|
}
|
||||||
|
|
||||||
rclcpp::Publisher<px4_msgs::msg::VehicleCommand>::SharedPtr _publisher;
|
rclcpp::Publisher<6>::SharedPtr _publisher;
|
||||||
rclcpp::Subscription<px4_msgs::msg::VehicleAttitude>::SharedPtr _subscription;
|
rclcpp::Subscription<5>::SharedPtr _subscription;
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -180,34 +181,34 @@ class MinimalPubSub(Node):
|
|||||||
|
|
||||||
::::
|
::::
|
||||||
|
|
||||||
On the PX4 side, the DDS client automatically adds the version suffix if a message definition contains the field `uint32 MESSAGE_VERSION = x`.
|
在 PX4 侧,如果消息定义包含字段`uint32 MESSAGE_VERSION = x`,DDS客户端自动添加版本后缀。
|
||||||
|
|
||||||
:::info
|
:::info
|
||||||
主题版本0意味着不应添加`_v<version>`后缀。
|
主题版本0意味着不应添加`_v<version>`后缀。
|
||||||
:::
|
:::
|
||||||
|
|
||||||
## Development
|
## 开发
|
||||||
|
|
||||||
### Definitions
|
### 定义
|
||||||
|
|
||||||
A **message** defines the data format used for communication, whether over a topic or a service.
|
**消息** 定义了用于通信的数据格式,无论是主题还是服务。
|
||||||
Therefore a message can be either a _topic_ message defined by a `.msg` file, or a _service_ message defined by a `.srv` file.
|
因此,消息可以是 ".msg" 文件定义的 _topic_ 消息,也可以是 ".srv" 文件定义的 _service_ 消息。
|
||||||
|
|
||||||
A **versioned message** is a message for which changes are tracked and each change results in a version bump, with the previous state of the definition being stored in history.
|
**版本信息** 是指跟踪更改的消息,每次变更都会导致版本号递增,且定义的历史状态会被保存下来。
|
||||||
The latest version of every message is stored in `msg/versioned/` for topics (or `srv/versioned` for services), and all older versions are stored in `msg/px4_msgs_old/msg/` (or `msg/px4_msgs_old/srv/`).
|
每个消息的最新版本都存储在 `msg/versioned/` 中,用于主题(或`srv/versioned` 用于服务), 所有旧版本都存储在`msg/px4_msgs_old/msg/`(或`msg/px4_msgs_old/srv/`)中。
|
||||||
|
|
||||||
A **version translation** defines a bidirectional mapping of the contents of one or more message definition across different versions.
|
**版本翻译**定义了一个或多个消息定义的内容在不同版本之间的双向映射。
|
||||||
Each translation is stored as a separate `.h` header file under `msg/translation_node/translations/`.
|
每个翻译以单独的 .h 头文件形式存储在 msg/translation_node/translations/ 目录下。
|
||||||
Message translations can be either _direct_ or _generic_.
|
消息翻译可以是 _direct_或 _generic_。
|
||||||
|
|
||||||
- A **direct translation** defines a bidirectional mapping of the contents of a _single_ message between two of its versions.
|
- **直接翻译** 定义一个双向映射其两个版本之间消息的内容。
|
||||||
This is the simpler case and should be preferred if possible.
|
这是更简单的情况,在可能的情况下应优先选择。
|
||||||
- A **generic translation** defines a bidirectional mapping of the contents of `n` input messages to `m` output messages across different versions.
|
- **通用翻译** 定义了双向映射`n`输入消息的内容到不同版本的`m`输出消息。
|
||||||
This can be used for merging or splitting a message, or when moving a field from one message to another.
|
这可用于合并或拆分消息,也可用于将某个字段从一个消息迁移至另一个消息。
|
||||||
|
|
||||||
### File Structure
|
### File Structure
|
||||||
|
|
||||||
Starting from PX4 v1.16, the PX4-Autopilot `msg/` and `srv/` directories are structured as follows:
|
从 PX4 v1.16 版本开始,PX4-Autopilot(PX4 自动驾驶系统)的 msg/ 和 srv/ 目录结构如下:
|
||||||
|
|
||||||
```
|
```
|
||||||
PX4-Autopilot
|
PX4-Autopilot
|
||||||
@@ -222,15 +223,15 @@ PX4-Autopilot
|
|||||||
└── versioned/ # Latest versioned service message files
|
└── versioned/ # Latest versioned service message files
|
||||||
```
|
```
|
||||||
|
|
||||||
This structure introduces new directories: `versioned/`, `px4_msgs_old/`, and `translation_node/`.
|
这个结构引入了新的目录:“versioned/`,`px4_msgs_old/`,以及`translation_node/\`。
|
||||||
|
|
||||||
#### Directories `msg/versioned/` and `srv/versioned/`
|
#### 目录`msg/versioned/` 和 `srv/versioned/`
|
||||||
|
|
||||||
- Contain the current latest version of each message.
|
- 包含每条消息当前的最新版本。
|
||||||
- Files in these directories must include a `MESSAGE_VERSION` field to indicate that they are versioned.
|
- 这些目录中的文件必须包含 `MESSAGE_VERSION` 字段以表明它们是版本控制。
|
||||||
- File names follow the conventional naming scheme (without a version suffix).
|
- 文件名遵循常规命名规则(不带版本后缀)。
|
||||||
|
|
||||||
Example directory structure:
|
示例目录结构:
|
||||||
|
|
||||||
```
|
```
|
||||||
PX4-Autopilot
|
PX4-Autopilot
|
||||||
@@ -244,13 +245,13 @@ PX4-Autopilot
|
|||||||
└── VehicleCommand.srv # e.g. MESSAGE_VERSION = 2
|
└── VehicleCommand.srv # e.g. MESSAGE_VERSION = 2
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Directory `px4_msgs_old/`
|
#### 目录`px4_msgs_old/`
|
||||||
|
|
||||||
- Archives the history of all versioned messages, including both topic and service messages (resp. under `msg/` and `srv/` subdirectories).
|
- 将所有版本信息的历史记录存档,包括主题和服务信息(resp. under `msg/`和`srv/`子目录)。
|
||||||
- Each file includes a `MESSAGE_VERSION` field.
|
- 每个文件都包含一个 MESSAGE_VERSION 字段。
|
||||||
- File names reflect the message's version with a suffix (e.g., `V1`, `V2`).
|
- 文件名反映了带有后缀的消息版本(如:`V1`、`V2`)。
|
||||||
|
|
||||||
Example directory structure (matching the example above):
|
示例目录结构(匹配上面的示例):
|
||||||
|
|
||||||
```
|
```
|
||||||
...
|
...
|
||||||
@@ -264,13 +265,13 @@ Example directory structure (matching the example above):
|
|||||||
└── VehicleCommandV1.srv
|
└── VehicleCommandV1.srv
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Directory `translation_node/`
|
#### 目录`translation_node/`
|
||||||
|
|
||||||
- Contains headers for translating between all different versions of messages.
|
- 包含用于在所有不同版本的消息之间进行翻译的标题。
|
||||||
- Each translation (direct or generic) is a single `.h` header file.
|
- 每个翻译 (直接或通用) 都是单个的 `.h` 标题文件。
|
||||||
- The header `all_translation.h` acts as the main header, and includes all subsequent translation headers.
|
- 标题`all_translation.h`是主标题,包含所有其后的翻译标题。
|
||||||
|
|
||||||
Example directory structure (matching the example above):
|
示例目录结构(匹配上面的示例):
|
||||||
|
|
||||||
```
|
```
|
||||||
...
|
...
|
||||||
@@ -287,36 +288,36 @@ Example directory structure (matching the example above):
|
|||||||
└── translation_vehicle_command_v2.h # Direct translation v1 <-> latest (v2)
|
└── translation_vehicle_command_v2.h # Direct translation v1 <-> latest (v2)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Updating a Versioned Message
|
### 正在更新版本信息...
|
||||||
|
|
||||||
This section provides a step-by-step walkthrough and a basic working example of what the process of changing a versioned message looks like.
|
本节提供了分步操作指南以及一个基础的可运行示例,以展示修改版本化消息的流程具体是怎样的。
|
||||||
|
|
||||||
The example describes the process of updating the `VehicleAttitude` message definition to contain an additional `new_field` entry, incrementing the message version from `3` to `4`, and creating a new direct translation in the process.
|
该示例描述了更新VehicleAttitude消息定义的流程,具体包括:为其添加一个额外的new_field字段、将消息版本从3递增至4,并在此过程中创建一个新的直接转换。
|
||||||
|
|
||||||
1. **Create an Archived Definition of the Current Versioned Message**
|
1. **创建当前版本信息的存档定义**
|
||||||
|
|
||||||
Copy the versioned `.msg` topic message file (or `.srv` service message file) to `px4_msgs_old/msg/` (or `px4_msgs_old/srv/`), and append its message version to the file name.
|
将版本号的`.msg`主题消息文件(或`.srv`服务消息文件)复制到`px4_msgs_old/msg/`(或`px4_msgs_old/srv/`),并将其消息版本附加到文件名。
|
||||||
|
|
||||||
For example:<br>
|
例如:<br>
|
||||||
Copy `msg/versioned/VehicleAttitude.msg` → `msg/versioned/px4_msgs_old/msg/VehicleAttitudeV3.msg`
|
复制 `msg/versioned/VehicleAttitude.msg` → `msg/versioned/px4_msgs_old/msg/VehicleAttitudeV3.msg`
|
||||||
|
|
||||||
2. **Update Translation References to the Archived Definition**
|
2. **更新对存档定义的转化引用**
|
||||||
|
|
||||||
Update the existing translations header files `msg/translation_node/translations/*.h` to reference the newly archived message definition.
|
更新现有翻译标头文件 `msg/translation_node/translations/*.h` 以参考新存档的消息定义。
|
||||||
|
|
||||||
For example, update references in those files:<br>
|
例如,更新这些文件中的引用:<br>
|
||||||
|
|
||||||
- Replace `px4_msgs::msg::VehicleAttitude` → `px4_msgs_old::msg::VehicleAttitudeV3`
|
- 替换 `px4_msgs::msg::VehicleAttitude` → `px4_msgs_old::msg::VehicleAttitudeV3`
|
||||||
- Replace `#include <px4_msgs/msg/vehicle_attitude.hpp>` → `#include <px4_msgs_old/msg/vehicle_attitude_v3.hpp>`
|
- 替换`#include <px4_msgs/msg/vehicle_attitude.hpp>` -> \`#include <px4_msgs_old/msg/vehicle_attitude_v3.hpp>
|
||||||
|
|
||||||
3. **Update the Versioned Definition**
|
3. **更新版本定义**
|
||||||
|
|
||||||
Update the versioned `.msg` topic message file (or `.srv` service message file) with required changes.
|
更新版本的 `.msg` 主题消息文件 (或`.srv` 服务消息文件) 并进行必要的更改。
|
||||||
|
|
||||||
First increment the `MESSAGE_VERSION` field.
|
第一次递增`MESSAGE_VERSION`字段。
|
||||||
Then update the message fields that prompted the version change.
|
然后更新促使版本变更的消息字段。
|
||||||
|
|
||||||
For example, update `msg/versioned/VehicleAttitude.msg` from:
|
例如,更新 `msg/versioned/vehicleAttitde.msg` 从:
|
||||||
|
|
||||||
```txt
|
```txt
|
||||||
uint32 MESSAGE_VERSION = 3
|
uint32 MESSAGE_VERSION = 3
|
||||||
@@ -324,20 +325,19 @@ The example describes the process of updating the `VehicleAttitude` message defi
|
|||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
to
|
到
|
||||||
|
|
||||||
```txt
|
```txt
|
||||||
uint32 MESSAGE_VERSION = 4 # Increment
|
uint32 MESSAGE_VERSION = 4 # Increment
|
||||||
uint64 timestamp
|
uint64 timestamp
|
||||||
float32 new_field # Make definition changes
|
float32 new_field # Make definition changes
|
||||||
...
|
|
||||||
```
|
```
|
||||||
|
|
||||||
4. **Add a New Translation Header**
|
4. **添加新的翻译标头**
|
||||||
|
|
||||||
Add a new version translation to bridge the archived version and the updated current version, by creating a new translation header.
|
通过创建一个新的翻译标头来添加一个新的版本翻译来连接存档版本和更新的当前版本。
|
||||||
|
|
||||||
For example, create a direct translation header `translation_node/translations/translation_vehicle_attitude_v4.h`:
|
例如,创建一个直接翻译标题`translation_node/translation_vaille_attitude_v4.h`:
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
// Translate VehicleAttitude v3 <--> v4
|
// Translate VehicleAttitude v3 <--> v4
|
||||||
@@ -381,72 +381,70 @@ The example describes the process of updating the `VehicleAttitude` message defi
|
|||||||
// Discards `new_field` from MessageNewer
|
// Discards `new_field` from MessageNewer
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
REGISTER_TOPIC_TRANSLATION_DIRECT(VehicleAttitudeV4Translation);
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Version translation templates are provided here:
|
版本翻译模板在此提供:
|
||||||
|
|
||||||
- [Direct Topic Message Translation Template](https://github.com/PX4/PX4-Autopilot/blob/main/msg/translation_node/translations/example_translation_direct_v1.h)
|
- [Direct Topic Message Translation Template](https://github.com/PX4/PX4-Autopilot/blob/main/msg/translation_node/translations/example_translation_direct_v1.h)
|
||||||
- [Generic Topic Message Translation Template](https://github.com/PX4/PX4-Autopilot/blob/main/msg/translation_node/translations/example_translation_multi_v2.h)
|
- [Generic Topic Message Translation Template](https://github.com/PX4/PX4-Autopilot/blob/main/msg/translation_node/translations/example_translation_multi_v2.h)
|
||||||
- [Direct Service Message Translation Template](https://github.com/PX4/PX4-Autopilot/blob/main/msg/translation_node/translations/example_translation_service_v1.h)
|
- [Direct Service Message Translation Template](https://github.com/PX4/PX4-Autopilot/blob/main/msg/translation_node/translations/example_translation_service_v1.h)
|
||||||
|
|
||||||
5. **Include New Headers in `all_translations.h`**
|
5. **在`all_translations.h`中包含新标头**
|
||||||
|
|
||||||
Add all newly created headers to [`translations/all_translations.h`](https://github.com/PX4/PX4-Autopilot/blob/main/msg/translation_node/translations/all_translations.h) so that the translation node can find them.
|
将所有新创建的标题添加到[`translations/all_translations.h`](https://github.com/PX4/PX4-Autopilot/blob/main/msg/translation_node/translations/all_translations.h),以便翻译节点能够找到它们。
|
||||||
|
|
||||||
For example, append the following line to `all_translation.h`:
|
例如,在`all_translation.h`上加上以下一行:
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
#include "translation_vehicle_attitude_v4.h"
|
#include "translation_vehicle_attitude_v4.h"
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that in the example above and in most cases, step 4 only requires the developer to create a direct translation for the definition change.
|
请注意,在上述示例中以及在大多数情况下,步骤 4 仅要求开发者针对此次定义变更创建一个直接转换。
|
||||||
This is because the changes only involved a single message.
|
这是因为更改只涉及一个消息。
|
||||||
In more complex cases of splitting, merging and/or moving definitions then a generic translation must be created.
|
在更复杂的分割、合并和/或移动定义的情况下,必须创建一个通用转化。
|
||||||
|
|
||||||
For example when moving a field from one message to another, a single generic translation should be added with the two older message versions as input, and the two newer versions as output.
|
例如,当一个字段从一个消息移动到另一个消息时。 应增加一个单一通用翻译,两个较旧的信息版本作为输入,两个较新的版本作为输出。
|
||||||
This ensures there is no information lost when translating forward or backward.
|
这就确保了在向前或向后翻译时不会丢失信息。
|
||||||
|
|
||||||
This is exactly the approach shown by the [Generic Topic Message Translation Template](https://github.com/PX4/PX4-Autopilot/blob/main/msg/translation_node/translations/example_translation_multi_v2.h), omitting only the code for actually modifying fields in the `fromOlder()` and `toOlder()` methods.
|
这正是 [Generic Topic Message Translation Template](https://github.com/PX4/PX4-Autopilot/blob/main/msg/translation_node/translations/example_translation_multi_v2.h) 所显示的方法。 只省略`fromOlder()` 和 `toOlder()` 方法中的字段的代码。
|
||||||
|
|
||||||
:::warning
|
:::warning
|
||||||
If a nested message definition changes, all messages including that message also require a version update.
|
如果嵌套消息定义发生了变化,包括该消息在内的所有消息也需要版本更新。
|
||||||
For example this would be the case for message [PositionSetpointTriplet](../msg_docs/PositionSetpointTriplet.md) if it were versioned.
|
例如,如果消息 [PositionSetpointTriplet](../msg_docs/PositionSetpointTriplet.md)有版本,将会出现这种情况。
|
||||||
This is primarily important for services which are more likely reference other message definitions.
|
这一点对于服务而言尤为重要,因为服务更有可能引用其他消息定义。
|
||||||
:::
|
:::
|
||||||
|
|
||||||
## Implementation Details
|
## 实现细节
|
||||||
|
|
||||||
The translation node dynamically monitors the topics and services.
|
转换节点动态监测主题和服务。
|
||||||
It then instantiates the counterside of the publications and subscribers as required.
|
然后视需要举例说明出版物和订阅者的对应情况。
|
||||||
For example if there is an external publisher for version 1 of a topic and subscriber for version 2.
|
例如,如果主题第1版有外部发行商,第2版则有订阅商。
|
||||||
|
|
||||||
Internally, it maintains a graph of all known topic and version tuples (which are the graph nodes).
|
在内部,它保存一份所有已知主题和版本管束的图表(即图节点)。
|
||||||
The graph is connected by the message translations.
|
该图通过消息转换实现连接。
|
||||||
As arbitrary message translations can be registered, the graph can have cycles and multiple paths from one node to another.
|
由于任意的消息转换可以注册,图可以有周期和从一个节点到另一个节点的多个路径。
|
||||||
Therefore on a topic update, the graph is traversed using a shortest path algorithm.
|
因此,在主题更新中,图形使用最短路径算法。
|
||||||
When moving from one node to the next, the message translation method is called with the current topic data.
|
当从一个节点移动到另一个节点时,消息翻译方法将与当前主题数据调用。
|
||||||
If a node contains an instantiated publisher (because it previously detected an external subscriber), the data is published.
|
如果节点包含实例化发布器 (因为它先前检测到外部订阅者),数据将被发布。
|
||||||
Thus, multiple subscribers of any version of the topic can be updated with the correct version of the data.
|
这样,本专题任何版本的多个订阅者都可以用正确的数据更新数据。
|
||||||
|
|
||||||
For translations with multiple input topics, the translation continues once all input messages are available.
|
对于有多个输入主题的转化,转化将在所有输入消息都可用后继续。
|
||||||
|
|
||||||
## 局限
|
## 局限
|
||||||
|
|
||||||
- Translation of service messages does not work on ROS Humble, but does on ROS Jazzy.
|
- 服务消息的转化不适用于 ROS Humble,而是适用于ROSJazzy。
|
||||||
This is because the current implementation depends on a service API that is not yet available in ROS Humble.
|
这是因为当前的实现取决于尚未在ROS人类中提供的服务 API 。
|
||||||
Translation of topic messages is fully supported.
|
完全支持主题信息转化。
|
||||||
- Services messages only support a linear history, i.e. no message splitting or merging.
|
- 服务消息只支持线性历史记录,即没有消息拆分或合并。
|
||||||
- Having both publishers and subscribers for two different versions of the same topic is currently not handled by the translation node and would trigger infinite circular publications.
|
- 两个不同版本的同一主题的出版商和订户目前都不是由转化节点处理的,会引发无限的循环出版物。
|
||||||
This refers to the following problematic configuration:
|
这是指下列有问题的配置:
|
||||||
|
|
||||||
```
|
```
|
||||||
app 1: pub topic_v1, sub topic_v1
|
app 1: pub topic_v1, sub topic_v1
|
||||||
app 2: pub topic_v2, sub topic_v2
|
app 2: pub topic_v2, sub topic_v2
|
||||||
```
|
```
|
||||||
|
|
||||||
In practice this configuration is unlikely to occur because ROS topics shared with the FMU are intended to be directional (e.g. `/fmu/out/vehicle_status` or `/fmu/in/trajectory_setpoint`), therefore apps typically do not publish and subscribe simultaneously to the same topic.
|
实际上,这种配置不大可能发生,因为与金融监督单位共享的外空系统专题是指向的(例如)。 `/fmu/out/vehicle_status` 或 `/fmu/in/tracjectory_setpoint` ,因此应用通常不会同时发布和订阅相同的主题。
|
||||||
The translation node could be extended to handle this corner-case if required.
|
如果需要,可以扩展翻译节点来处理这个卷轴。
|
||||||
|
|
||||||
Original document with requirements: https://docs.google.com/document/d/18_RxV1eEjt4haaa5QkFZAlIAJNv9w5HED2aUEiG7PVQ/edit?usp=sharing
|
需要原始文件:https://docs.google.com/document/d/18_RxV1eEjt4haaa5QkFZAlIAJNv9w5HED2aUEiG7PVQ/edit?usp=sharing
|
||||||
|
|||||||
@@ -7,16 +7,16 @@ Experimental
|
|||||||
在撰写本文时,PX4 ROS 2 接口库的部分内容仍处于试验阶段,因此可能会发生变动。
|
在撰写本文时,PX4 ROS 2 接口库的部分内容仍处于试验阶段,因此可能会发生变动。
|
||||||
:::
|
:::
|
||||||
|
|
||||||
The [PX4 ROS 2 Interface Library](../ros2/px4_ros2_interface_lib.md) navigation interface enables developers to send their position measurements to PX4 directly from ROS 2 applications, such as a VIO system or a map matching system.
|
[PX4 ROS 2 Interface Library](../ros2/px4_ros2_interface_lib.md) 中的导航接口,支持开发者直接从 ROS 2 应用(如视觉惯性里程计系统或地图匹配系统)向 PX4 发送位置测量数据。
|
||||||
The interface provides a layer of abstraction from PX4 and the uORB messaging framework, and introduces a few sanity checks on the requested state estimation updates sent via the interface.
|
该接口提供了对 PX4 和 uORB 消息框架的抽象层,并对通过该接口发送的请求状态估计更新引入了一些合理性检查。
|
||||||
These measurements are then fused into the EKF just as though they were internal PX4 measurements.
|
这些测量数据随后会被融合到扩展EKF中,其处理方式与 PX4 内部生成的测量数据完全一致。
|
||||||
|
|
||||||
The library provides two classes, [`LocalPositionMeasurementInterface`](https://auterion.github.io/px4-ros2-interface-lib/classpx4__ros2_1_1LocalPositionMeasurementInterface.html) and [`GlobalPositionMeasurementInterface`](https://auterion.github.io/px4-ros2-interface-lib/classpx4__ros2_1_1GlobalPositionMeasurementInterface.html), which both expose a similar `update` method to provide either a local position or global position update to PX4, respectively.
|
库提供两个类,[`LocalPositionMeasurementInterface`](https://auterion.github.io/px4-ros2-interface-lib/classpx4__ros2_1_1LocalPositionMeasurementInterface.html) 和 [`GlobalPositionMeasureInterface`](https://auterion.github.io/px4-ros2-interface-lib/classpx4__ros2_1_1GlobalPositionMeasurementInterface.html) 它都会暴露出一个类似的 "update" 方法来提供一个本地位置或全球位置更新到 PX4。
|
||||||
The `update` method expects a position measurement `struct` ([`LocalPositionMeasurement`](https://auterion.github.io/px4-ros2-interface-lib/structpx4__ros2_1_1LocalPositionMeasurement.html) or [`GlobalPositionMeasurement`](https://auterion.github.io/px4-ros2-interface-lib/structpx4__ros2_1_1GlobalPositionMeasurement.html)) which developers can populate with their own generated position measurements.
|
`update`方法需要一个位置测量`struct`(`LocalPositionMeasure`](https://auterion.github.io/px4-ros2-interface-lib/structpx4__ros2_1_1LocalPositionMeasurement.html)或[\`GlobalPositionMeasure\`](https://auterion.github.io/px4-ros2-interface-lib/structpx4__ros2_1_1GlobalPositionMeasurement.html)],开发者可以在其中填入自己生成的位置测量数据。
|
||||||
|
|
||||||
## Installation and First Test
|
## 安装与首次测试
|
||||||
|
|
||||||
The following steps are required to get started:
|
开始使用前,需完成以下步骤:
|
||||||
|
|
||||||
1. 请确保您在 ROS 2 工作区中有 [ROS 2 设置](../ros2/user_guide.md) 与 [`px4_msgs`](https://github.com/PX4/px4_msgs]。
|
1. 请确保您在 ROS 2 工作区中有 [ROS 2 设置](../ros2/user_guide.md) 与 [`px4_msgs`](https://github.com/PX4/px4_msgs]。
|
||||||
|
|
||||||
@@ -37,32 +37,32 @@ The following steps are required to get started:
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd ..
|
cd ..
|
||||||
colcon build
|
colcon版本
|
||||||
```
|
```
|
||||||
|
|
||||||
4. In a different shell, start PX4 SITL:
|
4. 在另一个外壳中,启动 PX4 SITL:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd $px4-autopilot
|
cd $px4-autopilot
|
||||||
make px4_sitl gazebo-classic
|
make px4_sitl gazebo-classic
|
||||||
```
|
```
|
||||||
|
|
||||||
(here we use Gazebo-Classic, but you can use any model or simulator)
|
(这里我们使用Gazebo-Classic,但你可以使用任何模型或模拟器)
|
||||||
|
|
||||||
5. In yet a different shell, run the micro XRCE agent (you can keep it running afterward):
|
5. 在另一个独立的终端中,运行 micro XRCE 代理(运行后可保持后台持续运行):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
MicroXRCEAgent udp4 -p 8888
|
MicroXRCEAgent udp4 -p 8888
|
||||||
```
|
```
|
||||||
|
|
||||||
6. Back in the ROS 2 terminal, source the workspace you just built (in step 3) and run the [global_navigation](https://github.com/Auterion/px4-ros2-interface-lib/tree/main/examples/cpp/navigation/global_navigation) example, which periodically sends dummy global position updates:
|
6. 返回ROS2终端,为您刚刚构建的工作空间(步骤3),运行 [global_navigation](https://github.com/Auterion/px4-ros2-interface-lib/tree/main/examples/cpp/navigation/global_navigation) 示例。 它会周期性地发送虚拟的全球位置更新(数据):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
source install/setup.bash
|
source install/setup.bash
|
||||||
ros2 run example_global_navigation_cpp example_global_navigation
|
ros2 run example_global_navigation_cpp example_global_navigation
|
||||||
```
|
```
|
||||||
|
|
||||||
You should get an output like this showing that the global interface is successfully sending position updates:
|
你应会看到如下所示的输出,该输出表明全球位置接口正成功发送位置更新:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
[INFO] [1702030701.836897756] [example_global_navigation_node]: example_global_navigation_node running!
|
[INFO] [1702030701.836897756] [example_global_navigation_node]: example_global_navigation_node running!
|
||||||
@@ -70,13 +70,13 @@ The following steps are required to get started:
|
|||||||
[DEBUG] [1702030703.837223884] [example_global_navigation_node]: Successfully sent position update to navigation interface.
|
[DEBUG] [1702030703.837223884] [example_global_navigation_node]: Successfully sent position update to navigation interface.
|
||||||
```
|
```
|
||||||
|
|
||||||
7. In the PX4 shell, you can check that PX4 receives global position updates:
|
7. 在 PX4 终端(PX4 shell)中,你可以通过以下操作检查 PX4 是否接收到全球位置更新(数据)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
listener aux_global_position
|
listener aux_global_position
|
||||||
```
|
```
|
||||||
|
|
||||||
The output should look like:
|
输出内容应如下所示:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
TOPIC: aux_global_position
|
TOPIC: aux_global_position
|
||||||
@@ -97,31 +97,31 @@ The following steps are required to get started:
|
|||||||
dead_reckoning: False
|
dead_reckoning: False
|
||||||
```
|
```
|
||||||
|
|
||||||
8. Now you are ready to use the navigation interface to send your own position updates.
|
8. 现在你已准备好使用该导航接口发送自己的位置更新数据了。
|
||||||
|
|
||||||
## How to use the Library
|
## 如何使用代码库
|
||||||
|
|
||||||
To send a position measurement, you populate the position struct with the values you have measured.
|
要发送位置测量数据,你需要用所测量的值填充位置结构体。
|
||||||
Then call the interface's update function with that struct as the argument.
|
然后以此结构调用接口的更新功能作为参数。
|
||||||
|
|
||||||
For a basic example of how to use this interface, check out the [examples](https://github.com/Auterion/px4-ros2-interface-lib/tree/main/examples/cpp/navigation) in the `Auterion/px4-ros2-interface-lib` repository, such as [examples/cpp/navigation/local_navigation](https://github.com/Auterion/px4-ros2-interface-lib/blob/main/examples/cpp/navigation/local_navigation/include/local_navigation.hpp) or [examples/cpp/navigation/global_navigation](https://github.com/Auterion/px4-ros2-interface-lib/blob/main/examples/cpp/navigation/local_navigation/include/global_navigation.hpp).
|
关于如何使用此接口的基本示例,请在“Auterion/px4-ros2-interface-lib”仓库中查看 [examples](https://github.com/Auterion/px4-ros2-interface-lib/tree/main/examples/cpp/navigation) 例如[示例/cpp/navigation/local_navigation](https://github.com/Auterion/px4-ros2-interface-lib/blob/main/examples/cpp/navigation/local_navigation/include/local_navigation.hpp)或[示例/cpp/navigation/global_navigation](https://github.com/Auterion/px4-ros2-interface-lib/blob/main/examples/cpp/navigation/local_navigation/include/global_navigation.hpp)。
|
||||||
|
|
||||||
### Local Position Updates
|
### 局部位置更新
|
||||||
|
|
||||||
First ensure that the PX4 parameter [`EKF2_EV_CTRL`](../advanced_config/parameter_reference.md#EKF2_EV_CTRL) is properly configured to fuse external local measurements, by setting the appropriate bits to `true`:
|
首先确保正确配置 PX4 参数[`EKF2_EV_CTRL`](../advanced_config/parameter_reference.md#EKF2_EV_CTRL)通过将相应的位设置为true,可以正确配置(系统)以融合外部局部测量数据:
|
||||||
|
|
||||||
- `0`: Horizontal position data
|
- `0`: 水平位置数据
|
||||||
- `1`: Vertical position data
|
- `1`:垂直位置数据
|
||||||
- `2`: Velocity data
|
- `2`:速度数据
|
||||||
- `3`: Yaw data
|
- `3`:偏航角数据
|
||||||
|
|
||||||
To send a local position measurement to PX4:
|
向PX4发送局部位置测量:
|
||||||
|
|
||||||
1. Create a [`LocalPositionMeasurementInterface`](https://auterion.github.io/px4-ros2-interface-lib/classpx4__ros2_1_1LocalPositionMeasurementInterface.html) instance by providing it with: a ROS node, and the pose and velocity reference frames of your measurements.
|
1. 通过提供一个 ROS节点,创建一个 [`localPositionMeasureInterface` ](https://auterion.github.io/px4-ros2-interface-lib/classpx4__ros2_1_1LocalPositionMeasurementInterface.html) 实例:您测量的位置和速度参考框架。
|
||||||
2. Populate a [`LocalPositionMeasurement`](https://auterion.github.io/px4-ros2-interface-lib/structpx4__ros2_1_1LocalPositionMeasurement.html) `struct` with your measurements.
|
2. 包含一个[`本地定位测量`](https://auterion.github.io/px4-ros2-interface-lib/structpx4__ros2_1_1LocalPositionMeasurement.html) `structt` ,包含你测量的数据。
|
||||||
3. Pass the `struct` to the `LocalPositionMeasurementInterface` [`update()`](https://auterion.github.io/px4-ros2-interface-lib/classpx4__ros2_1_1LocalPositionMeasurementInterface.html#a6fd180b944710716d418b2cfe1c0c8e3) method.
|
3. 将 `struct` 传入 `LocalPositionMeasurementInterface` [`update()`](https://auterion.github.io/px4-ros2-interface-lib/classpx4__ros2_1_1LocalPositionMeasurementInterface.html#a6fd180b944710716d418b2cfe1c0c8e3) 方法中。
|
||||||
|
|
||||||
The available pose and velocity reference frames for your measurements are defined by the following `enum`:
|
你的测量数据可用的位置和速度参考坐标系由以下枚举(enum)定义:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
enum class PoseFrame
|
enum class PoseFrame
|
||||||
@@ -140,36 +140,36 @@ enum class VelocityFrame
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
The `LocalPositionMeasurement` struct is defined as follows:
|
`LocalPositionMeasurement`结构定义如下:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
struct LocalPositionMeasurement
|
struct LocalPositionMeasurement
|
||||||
{
|
{
|
||||||
rclcpp::Time timestamp_sample {};
|
rclcpp::Time timestamp_sample {};
|
||||||
|
|
||||||
std::optional<Eigen::Vector2f> position_xy {std::nullopt};
|
std::optional<0> position_xy {std::nullopt};
|
||||||
std::optional<Eigen::Vector2f> position_xy_variance {std::nullopt};
|
std::optional<0> position_xy_variance {std::nullopt};
|
||||||
std::optional<float> position_z {std::nullopt};
|
std::optional<1> position_z {std::nullopt};
|
||||||
std::optional<float> position_z_variance {std::nullopt};
|
std::optional<1> position_z_variance {std::nullopt};
|
||||||
|
|
||||||
std::optional<Eigen::Vector2f> velocity_xy {std::nullopt};
|
std::optional<0> velocity_xy {std::nullopt};
|
||||||
std::optional<Eigen::Vector2f> velocity_xy_variance {std::nullopt};
|
std::optional<0> velocity_xy_variance {std::nullopt};
|
||||||
std::optional<float> velocity_z {std::nullopt};
|
std::optional<1> velocity_z {std::nullopt};
|
||||||
std::optional<float> velocity_z_variance {std::nullopt};
|
std::optional<1> velocity_z_variance {std::nullopt};
|
||||||
|
|
||||||
std::optional<Eigen::Quaternionf> attitude_quaternion {std::nullopt};
|
std::optional<2> attitude_quaternion {std::nullopt};
|
||||||
std::optional<Eigen::Vector3f> attitude_variance {std::nullopt};
|
std::optional<3> attitude_variance {std::nullopt};
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
The `update()` method of the local interface expects the following conditions to hold for `LocalPositionMeasurement`:
|
局部接口的update()方法要求LocalPositionMeasurement(局部位置测量结构体)满足以下条件:
|
||||||
|
|
||||||
- The sample timestamp is defined.
|
- 示例时间戳已定义。
|
||||||
- Values do not have a \`NAN\`\`.
|
- 数值不得包含 `NAN` 。
|
||||||
- If a measurement value is provided, its associated variance value is well defined (e.g. if `position_xy` is defined, then `position_xy_variance` must be defined).
|
- 如果提供了某个测量值,则其关联的方差值必须明确定义(例如,若position_xy已定义,则position_xy_variance也必须定义)。
|
||||||
- If a measurement value is provided, its associated reference frame is not unknown (e.g. if `position_xy` is defined, then the interface was initialised with a pose frame different from `PoseFrame::Unknown`).
|
- 如果提供了某个测量值,那么其关联的参考坐标系不得为 “未知”(例如,若position_xy已定义,则接口必须以不同于PoseFrame::Unknown的位置坐标系进行初始化)。
|
||||||
|
|
||||||
The following code snippet is an example of a ROS 2 node which uses the local navigation interface to send 3D pose updates in the North-East-Down (NED) reference frame to PX4:
|
以下是一个 ROS 2 节点的示例代码片段,该节点使用局部导航接口向 PX4 发送东北天(NED)参考坐标系下的 3D 位姿更新:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
class MyLocalMeasurementUpdateNode : public rclcpp::Node
|
class MyLocalMeasurementUpdateNode : public rclcpp::Node
|
||||||
@@ -185,7 +185,7 @@ public:
|
|||||||
const px4_ros2::VelocityFrame velocity_frame = px4_ros2::VelocityFrame::Unknown;
|
const px4_ros2::VelocityFrame velocity_frame = px4_ros2::VelocityFrame::Unknown;
|
||||||
// Initialize local interface [1]
|
// Initialize local interface [1]
|
||||||
_local_position_measurement_interface =
|
_local_position_measurement_interface =
|
||||||
std::make_shared<px4_ros2::LocalPositionMeasurementInterface>(*this, pose_frame, velocity_frame);
|
std::make_shared<Eigen::Vector2f>(*this, pose_frame, velocity_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendUpdate()
|
void sendUpdate()
|
||||||
@@ -217,45 +217,44 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<px4_ros2::LocalPositionMeasurementInterface> _local_position_measurement_interface;
|
std::shared_ptr<Eigen::Vector2f> _local_position_measurement_interface;
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
### Global Position Updates
|
### 全局位置更新
|
||||||
|
|
||||||
First ensure that the PX4 parameter [`EKF2_AGP_CTRL`](../advanced_config/parameter_reference.md#EKF2_AGP_CTRL) is properly configured to fuse external global measurements, by setting the appropriate bits to `true`:
|
首先确保正确配置 PX4 参数[`EKF2_EV_CTRL`](../advanced_config/parameter_reference.md#EKF2_AGP_CTRL)通过将相应的位设置为true,可以正确配置(系统)以融合外部全部测量数据:
|
||||||
|
|
||||||
- `0`: Horizontal position data
|
- `0`: 水平位置数据
|
||||||
- `1`: Vertical position data
|
- `1`:垂直位置数据
|
||||||
|
|
||||||
To send a global position measurement to PX4:
|
向PX4发送全局位置测量:
|
||||||
|
|
||||||
1. Create a [`GlobalPositionMeasurementInterface`](https://auterion.github.io/px4-ros2-interface-lib/classpx4__ros2_1_1GlobalPositionMeasurementInterface.html) instance by providing it with a ROS node.
|
1. 创建一个 [`GlobalPositionMeasureInterface`](https://auterion.github.io/px4-ros2-interface-lib/classpx4__ros2_1_1GlobalPositionMeasurementInterface.html) 实例,并提供一个 ROS节点。
|
||||||
2. Populate a [`GlobalPositionMeasurement`](https://auterion.github.io/px4-ros2-interface-lib/structpx4__ros2_1_1GlobalPositionMeasurement.html) `struct` with your measurements.
|
2. 包含一个[`GlobalPositionMeasurement`](https://auterion.github.io/px4-ros2-interface-lib/structpx4__ros2_1_1GlobalPositionMeasurement.html) `struct` ,包含你测量的数据。
|
||||||
3. Pass the struct to the `GlobalPositionMeasurementInterface` [update()](https://auterion.github.io/px4-ros2-interface-lib/classpx4__ros2_1_1GlobalPositionMeasurementInterface.html#a1a183b595ef7f6a22f3a83ba543fe86d) method.
|
3. 将结构移至`GlobalPositionMeasurementInterface` [update()](https://auterion.github.io/px4-ros2-interface-lib/classpx4__ros2_1_1GlobalPositionMeasurementInterface.html#a1a183b595ef7f6a22f3a83ba543fe86d) 方法中。
|
||||||
|
|
||||||
The `GlobalPositionMeasurement` struct is defined as follows:
|
`GlobalPositionMeasurement`结构定义如下:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
struct GlobalPositionMeasurement
|
struct GlobalPositionMeasurement
|
||||||
{
|
{
|
||||||
rclcpp::Time timestamp_sample {};
|
rclcpp::Time timestamp_sample {};
|
||||||
|
|
||||||
std::optional<Eigen::Vector2d> lat_lon {std::nullopt};
|
std::optional<px4_ros2::LocalPositionMeasurementInterface> lat_lon {std::nullopt};
|
||||||
std::optional<float> horizontal_variance {std::nullopt};
|
std::optional<1> horizontal_variance {std::nullopt};
|
||||||
|
|
||||||
std::optional<float> altitude_msl {std::nullopt};
|
std::optional<1> altitude_msl {std::nullopt};
|
||||||
std::optional<float> vertical_variance {std::nullopt};
|
std::optional<1> vertical_variance {std::nullopt};
|
||||||
};
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The `update()` method of the global interface expects the following conditions to hold for `GlobalPositionMeasurement`:
|
全局接口的 `update()` 方法预计在 `GlobalPositionMeasurement` 中保留以下条件:
|
||||||
|
|
||||||
- The sample `timestamp_sample` is defined.
|
- 样本`timestamp_sample`已定义。
|
||||||
- Values do not have a NAN.
|
- 数据不得包含NAN。
|
||||||
- If a measurement value is provided, its associated variance value is well defined (e.g. if `lat_lon` is defined, then `horizontal_variance` must be defined).
|
- 如果提供了某个测量值,那么其关联的方差值必须明确定义(例如,若lat_lon(经纬度)已定义,则horizontal_variance(水平方差)也必须定义)。
|
||||||
|
|
||||||
The following code snippet is an example of a ROS 2 node which uses the global navigation interface to send a measurement with latitude, longitude and altitude to PX4:
|
下面的代码片段是一个 ROS 2 节点的示例,该节点使用全局导航接口来发送一个测量纬度。 经度和高度到 PX4:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
class MyGlobalMeasurementUpdateNode : public rclcpp::Node
|
class MyGlobalMeasurementUpdateNode : public rclcpp::Node
|
||||||
@@ -266,7 +265,7 @@ public:
|
|||||||
{
|
{
|
||||||
// Initialize global interface [1]
|
// Initialize global interface [1]
|
||||||
_global_position_measurement_interface =
|
_global_position_measurement_interface =
|
||||||
std::make_shared<px4_ros2::GlobalPositionMeasurementInterface>(*this);
|
std::make_shared<Eigen::Vector2d>(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendUpdate()
|
void sendUpdate()
|
||||||
@@ -298,11 +297,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<px4_ros2::GlobalPositionMeasurementInterface> _global_position_measurement_interface;
|
std::shared_ptr<0> _global_position_measurement_interface;
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
## Multiple Instances of an Interface
|
## 接口的多个实例
|
||||||
|
|
||||||
Using multiple instances of the same interface (e.g. local and local) to send estimation updates will stream all update messages to the same topic and result in cross-talk.
|
使用同一接口的多个实例(例如,多个局部接口实例)发送估计更新时,会将所有更新消息发送到同一个主题,从而导致串扰。
|
||||||
This should not affect measurement fusion into the EKF, but different measurement sources will become indistinguishable.
|
这不应影响计量并入EKF,但不同的计量来源将无法区分。
|
||||||
|
|||||||
+56
-58
@@ -5,11 +5,11 @@ ROS 2-PX4 架构在ROS 2和PX4之间进行了深度整合。 允许 ROS 2 订阅
|
|||||||
本指南介绍了系统架构和应用程序流程,并解释了如何与PX4一起安装和使用ROS2。
|
本指南介绍了系统架构和应用程序流程,并解释了如何与PX4一起安装和使用ROS2。
|
||||||
|
|
||||||
:::info
|
:::info
|
||||||
From PX4 v1.14, ROS 2 uses [uXRCE-DDS](../middleware/uxrce_dds.md) middleware, replacing the _FastRTPS_ middleware that was used in version 1.13 (v1.13 does not support uXRCE-DDS).
|
从 PX4 v1.14, ROS 2 使用 [uXRCE-DDS](../middleware/uxrce_dds.md) 中间件替换版本 1 中使用的 _FastRTPS_ 中间件. 3 (v1.13不支持uXRCE-DDS)。
|
||||||
|
|
||||||
The [migration guide](../middleware/uxrce_dds.md#fast-rtps-to-uxrce-dds-migration-guidelines) explains what you need to do in order to migrate ROS 2 apps from PX4 v1.13 to PX4 v1.14.
|
[migration guide](../middleware/uxrce_dds.md#fast-rtps-to-uxrce-dds-migration-guidelines) 解释您需要做什么来将ROS2 应用程序从 PX4 v1.13 迁移到 PX4 v1.14。
|
||||||
|
|
||||||
If you're still working on PX4 v1.13, please follow the instructions in the [PX4 v1.13 Docs](https://docs.px4.io/v1.13/en/ros/ros2_comm.html).
|
如果您仍然在 PX4 v1.13 上工作,请按照[PX4 v1.13 文档](https://docs.px4.io/v1.13/en/ros/ros2_comm.html)中的说明操作。
|
||||||
|
|
||||||
<!-- remove this when there are PX4 v1.14 docs for some months -->
|
<!-- remove this when there are PX4 v1.14 docs for some months -->
|
||||||
|
|
||||||
@@ -17,66 +17,66 @@ If you're still working on PX4 v1.13, please follow the instructions in the [PX4
|
|||||||
|
|
||||||
## 综述
|
## 综述
|
||||||
|
|
||||||
The application pipeline for ROS 2 is very straightforward, thanks to the use of the [uXRCE-DDS](../middleware/uxrce_dds.md) communications middleware.
|
得益于 uXRCE-DDS(../middleware/uxrce_dds.md) 通信中间件的使用,ROS 2 的应用流程非常简单直接。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<!-- doc source: https://docs.google.com/drawings/d/1WcJOU-EcVOZRPQwNzMEKJecShii2G4U3yhA3U6C4EhE/edit?usp=sharing -->
|
<!-- doc source: https://docs.google.com/drawings/d/1WcJOU-EcVOZRPQwNzMEKJecShii2G4U3yhA3U6C4EhE/edit?usp=sharing -->
|
||||||
|
|
||||||
The uXRCE-DDS middleware consists of a client running on PX4 and an agent running on the companion computer, with bi-directional data exchange between them over a serial, UDP, TCP or custom link.
|
uXRCE-DDS 中间件由两部分组成:一部分是运行在 PX4 上的客户端,另一部分是运行在伴飞计算机上的代理;二者之间通过串口、UDP、TCP或自定义链路进行双向数据交换。
|
||||||
The agent acts as a proxy for the client to publish and subscribe to topics in the global DDS data space.
|
代理充当客户端的代理角色,以便在全局 DDS 数据空间中发布和订阅主题。
|
||||||
|
|
||||||
The PX4 [uxrce_dds_client](../modules/modules_system.md#uxrce-dds-client) is generated at build time and included in PX4 firmware by default.
|
PX4 [uxrce_dds_client](../modules/modules_system.md#uxrce-dds-client) 是在构建时生成,并且默认包含在 PX4 固件中。
|
||||||
It includes both the "generic" micro XRCE-DDS client code, and PX4-specific translation code that it uses to publish to/from uORB topics.
|
它包含“通用”XRCE-DDS客户端代码和它用来发布到/来自uORB主题的 PX4 特定转换代码。
|
||||||
The subset of uORB messages that are generated into the client are specified in [dds_topics.yaml](../middleware/dds_topics.md).
|
生成到客户端中的 uORB 消息子集在 [dds_topics.yaml](../middleware/dds_topics.md)中说明。
|
||||||
The generator uses the uORB message definitions in the source tree: [PX4-Autopilot/msg](https://github.com/PX4/PX4-Autopilot/tree/main/msg) to create the code for sending ROS 2 messages.
|
生成器使用源代码树中的 uORB 消息定义:[PX4-Autopilot/msg](https://github.com/PX4/PX4-Autopilot/tree/main/msg) 用于生成发送 ROS 2 消息的代码。
|
||||||
|
|
||||||
ROS 2 applications need to be built in a workspace that has the _same_ message definitions that were used to create the uXRCE-DDS client module in the PX4 Firmware.
|
ROS 2 应用程序需要在一个工作空间中构建,该工作空间需包含与 PX4 固件中创建 uXRCE-DDS 客户端模块时所用完全相同的消息定义。
|
||||||
You can include these by cloning the interface package [PX4/px4_msgs](https://github.com/PX4/px4_msgs) into your ROS 2 workspace (branches in the repo correspond to the messages for different PX4 releases).
|
您可以通过克隆接口包[PX4/px4_msgs](https://github.com/PX4/px4_msgs)将这些内容纳入您的 ROS 2 工作空间(repo 中的范围与不同的 PX4 版本的消息相对应)。
|
||||||
|
|
||||||
Starting from PX4 v1.16, in which [message versioning](../middleware/uorb.md#message-versioning) was introduced, ROS2 applications may use a different version of message definitions than those used to build PX4.
|
从 PX4 v1.16 版本开始[message versioning](../middleware/uorb.md#message-versioning),ROS 2 应用程序所使用的消息定义版本,可与构建 PX4 时所用的消息定义版本不同。
|
||||||
This requires the [ROS 2 Message Translation Node](../ros2/px4_ros2_msg_translation_node.md) to be running to ensure that messages can be converted and exchanged correctly.
|
这需要[ROS 2 Message Translation Node](../ros2/px4_ros2_msg_translation_node.md)运行ROS 2 消息转换节点,以确保消息能够正确转换和交互。
|
||||||
|
|
||||||
Note that the micro XRCE-DDS _agent_ itself has no dependency on client-side code.
|
需要注意的是,微型XRCE-DDS _agent_ 本身并不依赖客户端代码。
|
||||||
It can be built from [source](https://github.com/eProsima/Micro-XRCE-DDS-Agent) either standalone or as part of a ROS build, or installed as a snap.
|
它可以从 [source](https://github.com/eProsima/Micro-XRCE-DDS-Agent)中单独构建,或者作为ROS构建的一部分,或者作为snap包安装。
|
||||||
|
|
||||||
You will normally need to start both the client and agent when using ROS 2.
|
在使用 ROS 2 时,您通常需要同时启动客户端和代理。
|
||||||
Note that the uXRCE-DDS client is built into firmware by default but not started automatically except for simulator builds.
|
需要注意的是,uXRCE-DDS 客户端默认已内置到固件中,但除仿真器构建版本外,不会自动启动。
|
||||||
|
|
||||||
:::info
|
:::info
|
||||||
In PX4v1.13 and earlier, ROS 2 was dependent on definitions in [px4_ros_com](https://github.com/PX4/px4_ros_com).
|
在 PX4 v1.13 及更早版本中,ROS 2 依赖于 [px4_ros_com](https://github.com/PX4/px4_ros_com) 中的消息定义。
|
||||||
This repo is no longer needed, but does contain useful examples.
|
该代码仓库已不再需要,但其中包含一些实用的示例。
|
||||||
:::
|
:::
|
||||||
|
|
||||||
## Installation & Setup
|
## 安装与设置
|
||||||
|
|
||||||
The supported and recommended ROS 2 platform for working with PX4 is ROS 2 "Humble" LTS on Ubuntu 22.04.
|
支持和推荐使用 PX4 的 ROS 2 平台是 Ubuntu 的 ROS 2 “简易” LTS 22.04。
|
||||||
|
|
||||||
:::tip
|
:::tip
|
||||||
If you're working on Ubuntu 20.04 we recommend you update to Ubuntu 22.04.
|
如果您在 Ubuntu 20.04 上工作,我们建议您更新到 Ubuntu 22.04。
|
||||||
In the meantime you can use ROS 2 "Foxy" with [Gazebo Classic](../sim_gazebo_classic/index.md) on Ubuntu 20.04.
|
同时,你可以在 Ubuntu 20.04 上使用 [Gazebo Class](../sim_gazebo_classic/index.md) 的 ROS 2 "Foxy" 。
|
||||||
Note that ROS 2 "Foxy" reached end-of-life in May 2023, but is (at time of writing) still stable and works with PX4.
|
请注意,第二号外空系统“Foxy”在2023年5月到达寿命终结,但在撰写本报告时仍然稳定并与PX4合作。
|
||||||
:::
|
:::
|
||||||
|
|
||||||
To setup ROS 2 for use with PX4:
|
安装使用 PX4 的 ROS 2:
|
||||||
|
|
||||||
- [Install PX4](#install-px4) (to use the PX4 simulator)
|
- [Install PX4](#install-px4) (to use the PX4 simulator)
|
||||||
- [Install ROS 2](#install-ros-2)
|
- [Install ROS 2](#install-ros-2)
|
||||||
- [Setup Micro XRCE-DDS Agent & Client](#setup-micro-xrce-dds-agent-client)
|
- [Setup Micro XRCE-DDS Agent & Client](#setup-micro-xrce-dds-agent-client)
|
||||||
- [Build & Run ROS 2 Workspace](#build-ros-2-workspace)
|
- [Build & Run ROS 2 Workspace](#build-ros-2-workspace)
|
||||||
|
|
||||||
Other dependencies of the architecture that are installed automatically, such as _Fast DDS_, are not covered.
|
该架构中会自动安装的其他依赖项(如 Fast DDS)未在此处提及。
|
||||||
|
|
||||||
### 安装PX4
|
### 安装PX4
|
||||||
|
|
||||||
You need to install the PX4 development toolchain in order to use the simulator.
|
若要使用该仿真器,你需要安装 PX4 开发工具链。
|
||||||
|
|
||||||
:::info
|
:::info
|
||||||
The only dependency ROS 2 has on PX4 is the set of message definitions, which it gets from [px4_msgs](https://github.com/PX4/px4_msgs).
|
唯一依赖于ROS2的 PX4 是一组信息定义,它从 [px4_msgs](https://github.com/PX4/px4_msgs)获取。
|
||||||
You only need to install PX4 if you need the simulator (as we do in this guide), or if you are creating a build that publishes custom uORB topics.
|
您只需要安装 PX4 当您需要模拟器时(如我们在本指南中所做的那样), 或者如果您正在创建一个发布自定义uORB主题的构建。
|
||||||
:::
|
:::
|
||||||
|
|
||||||
Set up a PX4 development environment on Ubuntu in the normal way:
|
通过以下方式在 Ubuntu 上配置一个 PX4 开发环境:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd
|
cd
|
||||||
@@ -86,16 +86,16 @@ cd PX4-Autopilot/
|
|||||||
make px4_sitl
|
make px4_sitl
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that the above commands will install the recommended simulator for your version of Ubuntu.
|
请注意,上述命令将为您的Ubuntu版本安装推荐的模拟器。
|
||||||
If you want to install PX4 but keep your existing simulator installation, run `ubuntu.sh` above with the `--no-sim-tools` flag.
|
如果您想要安装 PX4,但保留您现有的模拟器安装,请使用 "--no-sim-tools" 标志运行 `ubuntu.sh`。
|
||||||
|
|
||||||
For more information and troubleshooting see: [Ubuntu Development Environment](../dev_setup/dev_env_linux_ubuntu.md) and [Download PX4 source](../dev_setup/building_px4.md).
|
欲了解更多信息和故障排除,请参阅:[Ubuntu 开发环境](../dev_setup/dev_env_linux_ubuntu.md) 和 [下载 PX4 源](../dev_setup/building_px4.md)。
|
||||||
|
|
||||||
### 安装 ROS 2
|
### 安装 ROS 2
|
||||||
|
|
||||||
To install ROS 2 and its dependencies:
|
安装 ROS 2 及其依赖:
|
||||||
|
|
||||||
1. Install ROS 2.
|
1. 安装 ROS 2.
|
||||||
|
|
||||||
:::: tabs
|
:::: tabs
|
||||||
|
|
||||||
@@ -118,35 +118,35 @@ To install ROS 2 and its dependencies:
|
|||||||
source /opt/ros/humble/setup.bash && echo "source /opt/ros/humble/setup.bash" >> .bashrc
|
source /opt/ros/humble/setup.bash && echo "source /opt/ros/humble/setup.bash" >> .bashrc
|
||||||
```
|
```
|
||||||
|
|
||||||
The instructions above are reproduced from the official installation guide: [Install ROS 2 Humble](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html).
|
以上说明转载自官方安装指南:[Install ROS 2 Humble](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html)。
|
||||||
You can install _either_ the desktop (`ros-humble-desktop`) _or_ bare-bones versions (`ros-humble-ros-base`), _and_ the development tools (`ros-dev-tools`).
|
您可以安装 _either_ the desktop (`ros-humble-desktop`) _or_ bare-bones versions (`ros-humble-ros-base`), _and_ the development tools (`ros-dev-tools`).
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
::: tab foxy
|
::: tab foxy
|
||||||
To install ROS 2 "Foxy" on Ubuntu 20.04:
|
To install ROS 2 "Foxy" on Ubuntu 20.04:
|
||||||
|
|
||||||
- Follow the official installation guide: [Install ROS 2 Foxy](https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html).
|
- 按照官方安装指南: [Install ROS 2 Foxy](https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html).
|
||||||
|
|
||||||
You can install _either_ the desktop (`ros-foxy-desktop`) _or_ bare-bones versions (`ros-foxy-ros-base`), _and_ the development tools (`ros-dev-tools`).
|
您可以安装 _either_ the desktop (`ros-foxy-desktop`) _or_ bare-bones versions (`ros-foxy-ros-base`), _and_ the development tools (`ros-dev-tools`).
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
::::
|
::::
|
||||||
|
|
||||||
2. Some Python dependencies must also be installed (using **`pip`** or **`apt`**):
|
2. 一些Python 依赖关系也必须安装 (使用 **`pip`** 或 **`apt`**):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
pip install --user -U empy==3.3.4 pyros-genmsg setuptools
|
pip install --user -U empy==3.3.4 pyros-genmsg setuptools
|
||||||
```
|
```
|
||||||
|
|
||||||
### Setup Micro XRCE-DDS Agent & Client
|
### 配置微型 XRCE-DDS 代理与客户端
|
||||||
|
|
||||||
For ROS 2 to communicate with PX4, [uXRCE-DDS client](../modules/modules_system.md#uxrce-dds-client) must be running on PX4, connected to a micro XRCE-DDS agent running on the companion computer.
|
要实现 ROS 2 与 PX4 的通信,[uXRCE-DDS client](../modules/modules_system.md#uxrce-dds-client)必须在 PX4 上运行,且需与运行在机载计算机上的微型 XRCE-DDS 代理建立连接。
|
||||||
|
|
||||||
#### 设置代理(Agent)
|
#### 设置代理(Agent)
|
||||||
|
|
||||||
The agent can be installed onto the companion computer in a [number of ways](../middleware/uxrce_dds.md#micro-xrce-dds-agent-installation).
|
代理可以安装在机载计算机上 [number of ways](../middleware/uxrce_dds.md#micro-xrce-dds-agent-installation)。
|
||||||
Below we show how to build the agent "standalone" from source and connect to a client running on the PX4 simulator.
|
Below we show how to build the agent "standalone" from source and connect to a client running on the PX4 simulator.
|
||||||
|
|
||||||
To setup and start the agent:
|
To setup and start the agent:
|
||||||
@@ -156,7 +156,7 @@ To setup and start the agent:
|
|||||||
2. 输入以下命令从仓库获取源代码并构建代理(Agent):
|
2. 输入以下命令从仓库获取源代码并构建代理(Agent):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone -b v2.4.2 https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
|
git clone -b v2.4.3 https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
|
||||||
cd Micro-XRCE-DDS-Agent
|
cd Micro-XRCE-DDS-Agent
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
@@ -224,7 +224,6 @@ INFO [uxrce_dds_client] synchronized with time offset 1675929429203524us
|
|||||||
INFO [uxrce_dds_client] successfully created rt/fmu/out/failsafe_flags data writer, topic id: 83
|
INFO [uxrce_dds_client] successfully created rt/fmu/out/failsafe_flags data writer, topic id: 83
|
||||||
INFO [uxrce_dds_client] successfully created rt/fmu/out/sensor_combined data writer, topic id: 168
|
INFO [uxrce_dds_client] successfully created rt/fmu/out/sensor_combined data writer, topic id: 168
|
||||||
INFO [uxrce_dds_client] successfully created rt/fmu/out/timesync_status data writer, topic id: 188
|
INFO [uxrce_dds_client] successfully created rt/fmu/out/timesync_status data writer, topic id: 188
|
||||||
...
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The micro XRCE-DDS agent terminal should also start to show output, as equivalent topics are created in the DDS network:
|
The micro XRCE-DDS agent terminal should also start to show output, as equivalent topics are created in the DDS network:
|
||||||
@@ -234,7 +233,6 @@ The micro XRCE-DDS agent terminal should also start to show output, as equivalen
|
|||||||
[1675929445.268957] info | ProxyClient.cpp | create_publisher | publisher created | client_key: 0x00000001, publisher_id: 0x0DA(3), participant_id: 0x001(1)
|
[1675929445.268957] info | ProxyClient.cpp | create_publisher | publisher created | client_key: 0x00000001, publisher_id: 0x0DA(3), participant_id: 0x001(1)
|
||||||
[1675929445.269521] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0x00000001, datawriter_id: 0x0DA(5), publisher_id: 0x0DA(3)
|
[1675929445.269521] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0x00000001, datawriter_id: 0x0DA(5), publisher_id: 0x0DA(3)
|
||||||
[1675929445.270412] info | ProxyClient.cpp | create_topic | topic created | client_key: 0x00000001, topic_id: 0x0DF(2), participant_id: 0x001(1)
|
[1675929445.270412] info | ProxyClient.cpp | create_topic | topic created | client_key: 0x00000001, topic_id: 0x0DF(2), participant_id: 0x001(1)
|
||||||
...
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Build ROS 2 Workspace
|
### Build ROS 2 Workspace
|
||||||
@@ -378,7 +376,7 @@ accelerometer_integral_dt: 4739
|
|||||||
|
|
||||||
#### (Optional) Starting the Translation Node
|
#### (Optional) Starting the Translation Node
|
||||||
|
|
||||||
<Badge type="tip" text="PX4 v1.16" /> <Badge type="warning" text="Experimental" />
|
<0/> <1/>
|
||||||
|
|
||||||
This example is built with PX4 and ROS2 versions that use the same message definitions.
|
This example is built with PX4 and ROS2 versions that use the same message definitions.
|
||||||
If you were to use incompatible [message versions](../middleware/uorb.md#message-versioning) you would need to install and run the [Message Translation Node](./px4_ros2_msg_translation_node.md) as well, before running the example:
|
If you were to use incompatible [message versions](../middleware/uorb.md#message-versioning) you would need to install and run the [Message Translation Node](./px4_ros2_msg_translation_node.md) as well, before running the example:
|
||||||
@@ -607,7 +605,7 @@ The lines below create a publisher to the `SensorCombined` uORB topic, which can
|
|||||||
|
|
||||||
````cpp
|
````cpp
|
||||||
private:
|
private:
|
||||||
rclcpp::Subscription<px4_msgs::msg::SensorCombined>::SharedPtr subscription_;
|
rclcpp::Subscription<px4_msgs::msg::DebugVect>::SharedPtr subscription_;
|
||||||
};
|
};
|
||||||
```s
|
```s
|
||||||
|
|
||||||
@@ -619,7 +617,7 @@ int main(int argc, char *argv[])
|
|||||||
std::cout << "Starting sensor_combined listener node..." << std::endl;
|
std::cout << "Starting sensor_combined listener node..." << std::endl;
|
||||||
setvbuf(stdout, NULL, _IONBF, BUFSIZ);
|
setvbuf(stdout, NULL, _IONBF, BUFSIZ);
|
||||||
rclcpp::init(argc, argv);
|
rclcpp::init(argc, argv);
|
||||||
rclcpp::spin(std::make_shared<SensorCombinedListener>());
|
rclcpp::spin(std::make_shared<std::chrono::microseconds>());
|
||||||
|
|
||||||
rclcpp::shutdown();
|
rclcpp::shutdown();
|
||||||
return 0;
|
return 0;
|
||||||
@@ -835,7 +833,7 @@ where `request_vehicle_command` handles formatting the request and sending it ov
|
|||||||
```cpp
|
```cpp
|
||||||
void OffboardControl::request_vehicle_command(uint16_t command, float param1, float param2)
|
void OffboardControl::request_vehicle_command(uint16_t command, float param1, float param2)
|
||||||
{
|
{
|
||||||
auto request = std::make_shared<px4_msgs::srv::VehicleCommand::Request>();
|
auto request = std::make_shared<px4_msgs::srv::VehicleCommand>();
|
||||||
|
|
||||||
VehicleCommand msg{};
|
VehicleCommand msg{};
|
||||||
msg.param1 = param1;
|
msg.param1 = param1;
|
||||||
@@ -860,7 +858,7 @@ The response is finally captured asynchronously by the `response_callback` metho
|
|||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
void OffboardControl::response_callback(
|
void OffboardControl::response_callback(
|
||||||
rclcpp::Client<px4_msgs::srv::VehicleCommand>::SharedFuture future) {
|
rclcpp::Client<0>::SharedFuture future) {
|
||||||
auto status = future.wait_for(1s);
|
auto status = future.wait_for(1s);
|
||||||
if (status == std::future_status::ready) {
|
if (status == std::future_status::ready) {
|
||||||
auto reply = future.get()->reply;
|
auto reply = future.get()->reply;
|
||||||
@@ -941,17 +939,17 @@ The output will look something like:
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
average rate: 248.187
|
average rate: 248.187
|
||||||
min: 0.000s max: 0.012s std dev: 0.00147s window: 2724
|
min: 0.000s max: 0.012s std dev: 0.00147s window: 2724
|
||||||
average rate: 248.006
|
average rate: 248.006
|
||||||
min: 0.000s max: 0.012s std dev: 0.00147s window: 2972
|
min: 0.000s max: 0.012s std dev: 0.00147s window: 2972
|
||||||
average rate: 247.330
|
average rate: 247.330
|
||||||
min: 0.000s max: 0.012s std dev: 0.00148s window: 3212
|
min: 0.000s max: 0.012s std dev: 0.00148s window: 3212
|
||||||
average rate: 247.497
|
average rate: 247.497
|
||||||
min: 0.000s max: 0.012s std dev: 0.00149s window: 3464
|
min: 0.000s max: 0.012s std dev: 0.00149s window: 3464
|
||||||
average rate: 247.458
|
average rate: 247.458
|
||||||
min: 0.000s max: 0.012s std dev: 0.00149s window: 3712
|
min: 0.000s max: 0.012s std dev: 0.00149s window: 3712
|
||||||
average rate: 247.485
|
average rate: 247.485
|
||||||
min: 0.000s max: 0.012s std dev: 0.00148s window: 3960
|
min: 0.000s max: 0.012s std dev: 0.00148s window: 3960
|
||||||
```
|
```
|
||||||
|
|
||||||
### ros2 launch
|
### ros2 launch
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ To use the sbgECom driver:
|
|||||||
If you don't want to have this fallback mechanism, you must disable unwanted sensors.
|
If you don't want to have this fallback mechanism, you must disable unwanted sensors.
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
4. If using the sbgECom as an INS, disable EKF2 using [EKF2_EN](../advanced_config/parameter_reference.md#EKF2_EN).
|
4. If using the sbgECom as an INS, disable EKF2 using [EKF2_EN](../advanced_config/parameter_reference.md#EKF2_EN).
|
||||||
|
|
||||||
6. Restart PX4.
|
6. Restart PX4.
|
||||||
@@ -96,7 +95,7 @@ IMU data should be published at 200Hz.
|
|||||||
|
|
||||||
All High Performance and Ellipse 3.0 and higher SBG Systems INS can be configured directly from PX4 firmware:
|
All High Performance and Ellipse 3.0 and higher SBG Systems INS can be configured directly from PX4 firmware:
|
||||||
|
|
||||||
1. Enable [SBG_CONFIGURATION_EN](../advanced_config/parameter_reference.md#SBG_CONFIGURATION_EN)
|
1. Enable [SBG_CONFIGURE_EN](../advanced_config/parameter_reference.md#SBG_CONFIGURE_EN).
|
||||||
|
|
||||||
2. Provide a JSON file `sbg_settings.json` containing SBG Systems INS settings to be applied in your PX4 board `extras` directory (ex: `boards/px4/fmu-v5/extras`). The settings JSON file will be installed in `/etc/extras/sbg_settings.json` on the board.
|
2. Provide a JSON file `sbg_settings.json` containing SBG Systems INS settings to be applied in your PX4 board `extras` directory (ex: `boards/px4/fmu-v5/extras`). The settings JSON file will be installed in `/etc/extras/sbg_settings.json` on the board.
|
||||||
|
|
||||||
@@ -111,7 +110,6 @@ All High Performance and Ellipse 3.0 and higher SBG Systems INS can be configure
|
|||||||
:::
|
:::
|
||||||
|
|
||||||
3. For testing purpose, it's also possible to modify SBG Systems INS settings on the fly:
|
3. For testing purpose, it's also possible to modify SBG Systems INS settings on the fly:
|
||||||
|
|
||||||
- By passing a JSON file path as argument when starting sbgecom driver (ex: `sbgecom start -f /fs/microsd/new_sbg_settings.json`)
|
- By passing a JSON file path as argument when starting sbgecom driver (ex: `sbgecom start -f /fs/microsd/new_sbg_settings.json`)
|
||||||
- By passing a JSON string as argument when starting sbgecom driver: (ex: `sbgecom start -s {"output":{"comA":{"messages":{"airData":"onChange"}}}}`)
|
- By passing a JSON string as argument when starting sbgecom driver: (ex: `sbgecom start -s {"output":{"comA":{"messages":{"airData":"onChange"}}}}`)
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ These include: [`pwm_out_sim`](../modules/modules_driver.md#pwm-out-sim), [`sens
|
|||||||
|
|
||||||
To check that these are present on your flight controller:
|
To check that these are present on your flight controller:
|
||||||
|
|
||||||
1. Start QGroundControl.
|
1. 启动QGroundControl。
|
||||||
|
|
||||||
2. Open **Analyze Tools > Mavlink Console**.
|
2. Open **Analyze Tools > Mavlink Console**.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user