mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
New Crowdin translations - zh-CN
This commit is contained in:
parent
f9c36b8235
commit
e0b5342e98
@ -733,6 +733,7 @@
|
||||
- [Protocols/Microservices](mavlink/protocols.md)
|
||||
- [Standard Modes Protocol](mavlink/standard_modes.md)
|
||||
- [uXRCE-DDS (PX4-ROS 2/DDS Bridge)](middleware/uxrce_dds.md)
|
||||
- [UORB Bridged to ROS 2](middleware/dds_topics.md)
|
||||
- [模块 & 命令](modules/modules_main.md)
|
||||
- [自动调参](modules/modules_autotune.md)
|
||||
- [命令](modules/modules_command.md)
|
||||
|
||||
@ -47,7 +47,7 @@ PX4 v1.14 (and later) supports the [LightWare LiDAR SF45](../sensor/sf45_rotatin
|
||||
|
||||
- Attach and configure the distance sensor on a particular port (see [sensor-specific docs](../sensor/rangefinders.md)) and enable collision prevention using [CP_DIST](#CP_DIST).
|
||||
- 修改驱动程序以设置方向。
|
||||
This should be done by mimicking the `SENS_CM8JL65_R_0` parameter (though you might also hard-code the orientation in the sensor _module.yaml_ file to something like `sf0x start -d ${SERIAL_DEV} -R 25` - where 25 is equivalent to `ROTATION_DOWNWARD_FACING`).
|
||||
This should be done by mimicking the `SENS_CM8JL65_R_0` parameter (though you might also hard-code the orientation in the sensor _module.yaml_ file to something like `sf0x start -d ${SERIAL_DEV} -R 25` - where 25 is equivalent to `ROTATION_DOWNWARD_FACING`).
|
||||
- Modify the driver to set the _field of view_ in the distance sensor UORB topic (`distance_sensor_s.h_fov`).
|
||||
|
||||
## PX4 (Software) Setup
|
||||
@ -203,85 +203,85 @@ The Lua script works by extracting the `obstacle_distance_fused` data at each ti
|
||||
|
||||
2. Configure PX4 to publish obstacle distance data (so that it is available to PlotJuggler):
|
||||
|
||||
Add the [`obstacle_distance_fused`](../msg_docs/ObstacleDistance.md) UORB topic to your [`dds_topics.yaml`](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml) so that it is published by PX4:
|
||||
Add the [`obstacle_distance_fused`](../msg_docs/ObstacleDistance.md) UORB topic to your [`dds_topics.yaml`](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml) so that it is published by PX4:
|
||||
|
||||
```sh
|
||||
- topic: /fmu/out/obstacle_distance_fused
|
||||
type: px4_msgs::msg::ObstacleDistance
|
||||
```
|
||||
```sh
|
||||
- topic: /fmu/out/obstacle_distance_fused
|
||||
type: px4_msgs::msg::ObstacleDistance
|
||||
```
|
||||
|
||||
For more information see [DDS Topics YAML](../middleware/uxrce_dds.md#dds-topics-yaml) in _uXRCE-DDS (PX4-ROS 2/DDS Bridge)_.
|
||||
For more information see [DDS Topics YAML](../middleware/uxrce_dds.md#dds-topics-yaml) in [uXRCE-DDS](../middleware/uxrce_dds.md) (PX4-ROS 2/DDS Bridge)_.
|
||||
|
||||
3. Open PlotJuggler and navigate to the **Tools > Reactive Script Editor** section.
|
||||
In the **Script Editor** tab, add following scripts in the appropriate sections:
|
||||
In the **Script Editor** tab, add following scripts in the appropriate sections:
|
||||
|
||||
- **Global code, executed once:**
|
||||
- **Global code, executed once:**
|
||||
|
||||
```lua
|
||||
obs_dist_fused_xy = ScatterXY.new("obstacle_distance_fused_xy")
|
||||
obs_dist_min = Timeseries.new("obstacle_distance_minimum")
|
||||
```
|
||||
```lua
|
||||
obs_dist_fused_xy = ScatterXY.new("obstacle_distance_fused_xy")
|
||||
obs_dist_min = Timeseries.new("obstacle_distance_minimum")
|
||||
```
|
||||
|
||||
- **function(tracker_time)**
|
||||
- **function(tracker_time)**
|
||||
|
||||
```lua
|
||||
obs_dist_fused_xy:clear()
|
||||
```lua
|
||||
obs_dist_fused_xy:clear()
|
||||
|
||||
i = 0
|
||||
angle_offset = TimeseriesView.find("/fmu/out/obstacle_distance_fused/angle_offset")
|
||||
increment = TimeseriesView.find("/fmu/out/obstacle_distance_fused/increment")
|
||||
min_dist = 65535
|
||||
i = 0
|
||||
angle_offset = TimeseriesView.find("/fmu/out/obstacle_distance_fused/angle_offset")
|
||||
increment = TimeseriesView.find("/fmu/out/obstacle_distance_fused/increment")
|
||||
min_dist = 65535
|
||||
|
||||
-- Cache increment and angle_offset values at tracker_time to avoid repeated calls
|
||||
local angle_offset_value = angle_offset:atTime(tracker_time)
|
||||
local increment_value = increment:atTime(tracker_time)
|
||||
-- Cache increment and angle_offset values at tracker_time to avoid repeated calls
|
||||
local angle_offset_value = angle_offset:atTime(tracker_time)
|
||||
local increment_value = increment:atTime(tracker_time)
|
||||
|
||||
if increment_value == nil or increment_value <= 0 then
|
||||
print("Invalid increment value: " .. tostring(increment_value))
|
||||
return
|
||||
end
|
||||
if increment_value == nil or increment_value <= 0 then
|
||||
print("Invalid increment value: " .. tostring(increment_value))
|
||||
return
|
||||
end
|
||||
|
||||
local max_steps = math.floor(360 / increment_value)
|
||||
local max_steps = math.floor(360 / increment_value)
|
||||
|
||||
while i < max_steps do
|
||||
local str = string.format("/fmu/out/obstacle_distance_fused/distances[%d]", i)
|
||||
local distance = TimeseriesView.find(str)
|
||||
if distance == nil then
|
||||
print("No distance data for: " .. str)
|
||||
break
|
||||
end
|
||||
while i < max_steps do
|
||||
local str = string.format("/fmu/out/obstacle_distance_fused/distances[%d]", i)
|
||||
local distance = TimeseriesView.find(str)
|
||||
if distance == nil then
|
||||
print("No distance data for: " .. str)
|
||||
break
|
||||
end
|
||||
|
||||
local dist = distance:atTime(tracker_time)
|
||||
if dist ~= nil and dist < 65535 then
|
||||
-- Calculate angle and Cartesian coordinates
|
||||
local angle = angle_offset_value + i * increment_value
|
||||
local y = dist * math.cos(math.rad(angle))
|
||||
local x = dist * math.sin(math.rad(angle))
|
||||
local dist = distance:atTime(tracker_time)
|
||||
if dist ~= nil and dist < 65535 then
|
||||
-- Calculate angle and Cartesian coordinates
|
||||
local angle = angle_offset_value + i * increment_value
|
||||
local y = dist * math.cos(math.rad(angle))
|
||||
local x = dist * math.sin(math.rad(angle))
|
||||
|
||||
obs_dist_fused_xy:push_back(x, y)
|
||||
obs_dist_fused_xy:push_back(x, y)
|
||||
|
||||
-- Update minimum distance
|
||||
if dist < min_dist then
|
||||
min_dist = dist
|
||||
end
|
||||
end
|
||||
-- Update minimum distance
|
||||
if dist < min_dist then
|
||||
min_dist = dist
|
||||
end
|
||||
end
|
||||
|
||||
i = i + 1
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
|
||||
-- Push minimum distance once after the loop
|
||||
if min_dist < 65535 then
|
||||
obs_dist_min:push_back(tracker_time, min_dist)
|
||||
else
|
||||
print("No valid minimum distance found")
|
||||
end
|
||||
```
|
||||
-- Push minimum distance once after the loop
|
||||
if min_dist < 65535 then
|
||||
obs_dist_min:push_back(tracker_time, min_dist)
|
||||
else
|
||||
print("No valid minimum distance found")
|
||||
end
|
||||
```
|
||||
|
||||
4. Enter a name for the script on the top right, and press **Save**.
|
||||
Once saved, the script should appear in the _Active Scripts_ section.
|
||||
Once saved, the script should appear in the _Active Scripts_ section.
|
||||
|
||||
5. Start streaming the data using the approach described in [Plotting uORB Topic Data in Real Time using PlotJuggler](../debug/plotting_realtime_uorb_data.md).
|
||||
You should see the `obstacle_distance_fused_xy` and `obstacle_distance_minimum` timeseries on the left.
|
||||
You should see the `obstacle_distance_fused_xy` and `obstacle_distance_minimum` timeseries on the left.
|
||||
|
||||
Note that you have to press **Save** again to re-enable the scripts after loading a new log file or otherwise clearing data.
|
||||
|
||||
|
||||
@ -96,13 +96,13 @@ Exporting the messages allows ROS 2 and the uXRCE-DDS agent to be independent of
|
||||
|
||||
While `px4_msgs` has messages for all uORB topics in PX4, not all messages in `px4_msgs` are available to ROS 2/PlotJuggler by default.
|
||||
The set that are available must be built into the client running on PX4.
|
||||
These are defined in [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml).
|
||||
These are defined in [dds_topics.yaml](../middleware/dds_topics.md).
|
||||
|
||||
The instructions below explain the changes needed to monitor topics that are not available by default.
|
||||
|
||||
### Missing Topics
|
||||
|
||||
If a normal uORB topic is not available in PlotJuggler you will need to modify the [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml) to include the topic and rebuild PX4.
|
||||
If a normal uORB topic is not available in PlotJuggler you will need to modify the [dds_topics.yaml](../middleware/dds_topics.md) ([source](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml)) to include the topic and rebuild PX4.
|
||||
|
||||
If working with real hardware you will need to build and [install](../config/firmware.md#installing-px4-main-beta-or-custom-firmware) custom firmware after changing the YAML file.
|
||||
|
||||
@ -122,7 +122,7 @@ cd ~/ros2_ws/ && colcon build
|
||||
|
||||
### Custom Topics
|
||||
|
||||
After defining the topic, follow the instructions above to add the topic to [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml), and export the new message into your ROS 2 workspace.
|
||||
After defining the topic, follow the instructions above to add the topic to [dds_topics.yaml](../middleware/dds_topics.md), and export the new message into your ROS 2 workspace.
|
||||
|
||||
## See also
|
||||
|
||||
|
||||
@ -128,8 +128,7 @@ In EKF2 mode, the replay will automatically create the ORB publisher rules descr
|
||||
|
||||
To perform an EKF2 replay:
|
||||
|
||||
- Record the original log.
|
||||
Optionally set `SDLOG_MODE` to `1` to log from boot.
|
||||
- Record the original log with `SDLOG_MODE` set to `1` to log from boot.
|
||||
|
||||
- In addition to the `replay` environment variable, set `replay_mode` to `ekf2`:
|
||||
|
||||
|
||||
277
docs/zh/middleware/dds_topics.md
Normal file
277
docs/zh/middleware/dds_topics.md
Normal file
@ -0,0 +1,277 @@
|
||||
# dds_topics.yaml — PX4 Topics Exposed to ROS 2
|
||||
|
||||
:::info
|
||||
This document is [auto-generated](https://github.com/PX4/PX4-Autopilot/blob/main/Tools/msg/generate_msg_docs.py) from the source code.
|
||||
:::
|
||||
|
||||
The [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml) file specifies which uORB message definitions are compiled into the [uxrce_dds_client](../modules/modules_system.md#uxrce-dds-client) module when [PX4 is built](../middleware/uxrce_dds.md#code-generation), and hence which topics are available for ROS 2 applications to subscribe or publish (by default).
|
||||
|
||||
This document shows a markdown-rendered version of [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml), listing the publications, subscriptions, and so on.
|
||||
|
||||
## Publications
|
||||
|
||||
| Topic | 类型 | Rate Limit |
|
||||
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
|
||||
| `/fmu/out/register_ext_component_reply` | [px4_msgs::msg::RegisterExtComponentReply](../msg_docs/RegisterExtComponentReply.md) | |
|
||||
| `/fmu/out/arming_check_request` | [px4_msgs::msg::ArmingCheckRequest](../msg_docs/ArmingCheckRequest.md) | 5.0 |
|
||||
| `/fmu/out/mode_completed` | [px4_msgs::msg::ModeCompleted](../msg_docs/ModeCompleted.md) | 50.0 |
|
||||
| `/fmu/out/battery_status` | [px4_msgs::msg::BatteryStatus](../msg_docs/BatteryStatus.md) | 1.0 |
|
||||
| `/fmu/out/collision_constraints` | [px4_msgs::msg::CollisionConstraints](../msg_docs/CollisionConstraints.md) | 50.0 |
|
||||
| `/fmu/out/estimator_status_flags` | [px4_msgs::msg::EstimatorStatusFlags](../msg_docs/EstimatorStatusFlags.md) | 5.0 |
|
||||
| `/fmu/out/failsafe_flags` | [px4_msgs::msg::FailsafeFlags](../msg_docs/FailsafeFlags.md) | 5.0 |
|
||||
| `/fmu/out/manual_control_setpoint` | [px4_msgs::msg::ManualControlSetpoint](../msg_docs/ManualControlSetpoint.md) | 25.0 |
|
||||
| `/fmu/out/message_format_response` | [px4_msgs::msg::MessageFormatResponse](../msg_docs/MessageFormatResponse.md) | |
|
||||
| `/fmu/out/position_setpoint_triplet` | [px4_msgs::msg::PositionSetpointTriplet](../msg_docs/PositionSetpointTriplet.md) | 5.0 |
|
||||
| `/fmu/out/sensor_combined` | [px4_msgs::msg::SensorCombined](../msg_docs/SensorCombined.md) | |
|
||||
| `/fmu/out/timesync_status` | [px4_msgs::msg::TimesyncStatus](../msg_docs/TimesyncStatus.md) | 10.0 |
|
||||
| `/fmu/out/vehicle_land_detected` | [px4_msgs::msg::VehicleLandDetected](../msg_docs/VehicleLandDetected.md) | 5.0 |
|
||||
| `/fmu/out/vehicle_attitude` | [px4_msgs::msg::VehicleAttitude](../msg_docs/VehicleAttitude.md) | |
|
||||
| `/fmu/out/vehicle_control_mode` | [px4_msgs::msg::VehicleControlMode](../msg_docs/VehicleControlMode.md) | 50.0 |
|
||||
| `/fmu/out/vehicle_command_ack` | [px4_msgs::msg::VehicleCommandAck](../msg_docs/VehicleCommandAck.md) | |
|
||||
| `/fmu/out/vehicle_global_position` | [px4_msgs::msg::VehicleGlobalPosition](../msg_docs/VehicleGlobalPosition.md) | 50.0 |
|
||||
| `/fmu/out/vehicle_gps_position` | [px4_msgs::msg::SensorGps](../msg_docs/SensorGps.md) | 50.0 |
|
||||
| `/fmu/out/vehicle_local_position` | [px4_msgs::msg::VehicleLocalPosition](../msg_docs/VehicleLocalPosition.md) | 50.0 |
|
||||
| `/fmu/out/vehicle_odometry` | [px4_msgs::msg::VehicleOdometry](../msg_docs/VehicleOdometry.md) | |
|
||||
| `/fmu/out/vehicle_status` | [px4_msgs::msg::VehicleStatus](../msg_docs/VehicleStatus.md) | 5.0 |
|
||||
| `/fmu/out/airspeed_validated` | [px4_msgs::msg::AirspeedValidated](../msg_docs/AirspeedValidated.md) | 50.0 |
|
||||
| `/fmu/out/vtol_vehicle_status` | [px4_msgs::msg::VtolVehicleStatus](../msg_docs/VtolVehicleStatus.md) | |
|
||||
| `/fmu/out/home_position` | [px4_msgs::msg::HomePosition](../msg_docs/HomePosition.md) | 5.0 |
|
||||
|
||||
## Subscriptions
|
||||
|
||||
| Topic | 类型 |
|
||||
| ------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| /fmu/in/register_ext_component_request | [px4_msgs::msg::RegisterExtComponentRequest](../msg_docs/RegisterExtComponentRequest.md) |
|
||||
| /fmu/in/unregister_ext_component | [px4_msgs::msg::UnregisterExtComponent](../msg_docs/UnregisterExtComponent.md) |
|
||||
| /fmu/in/config_overrides_request | [px4_msgs::msg::ConfigOverrides](../msg_docs/ConfigOverrides.md) |
|
||||
| /fmu/in/arming_check_reply | [px4_msgs::msg::ArmingCheckReply](../msg_docs/ArmingCheckReply.md) |
|
||||
| /fmu/in/message_format_request | [px4_msgs::msg::MessageFormatRequest](../msg_docs/MessageFormatRequest.md) |
|
||||
| /fmu/in/mode_completed | [px4_msgs::msg::ModeCompleted](../msg_docs/ModeCompleted.md) |
|
||||
| /fmu/in/config_control_setpoints | [px4_msgs::msg::VehicleControlMode](../msg_docs/VehicleControlMode.md) |
|
||||
| /fmu/in/distance_sensor | [px4_msgs::msg::DistanceSensor](../msg_docs/DistanceSensor.md) |
|
||||
| /fmu/in/manual_control_input | [px4_msgs::msg::ManualControlSetpoint](../msg_docs/ManualControlSetpoint.md) |
|
||||
| /fmu/in/offboard_control_mode | [px4_msgs::msg::OffboardControlMode](../msg_docs/OffboardControlMode.md) |
|
||||
| /fmu/in/onboard_computer_status | [px4_msgs::msg::OnboardComputerStatus](../msg_docs/OnboardComputerStatus.md) |
|
||||
| /fmu/in/obstacle_distance | [px4_msgs::msg::ObstacleDistance](../msg_docs/ObstacleDistance.md) |
|
||||
| /fmu/in/sensor_optical_flow | [px4_msgs::msg::SensorOpticalFlow](../msg_docs/SensorOpticalFlow.md) |
|
||||
| /fmu/in/goto_setpoint | [px4_msgs::msg::GotoSetpoint](../msg_docs/GotoSetpoint.md) |
|
||||
| /fmu/in/telemetry_status | [px4_msgs::msg::TelemetryStatus](../msg_docs/TelemetryStatus.md) |
|
||||
| /fmu/in/trajectory_setpoint | [px4_msgs::msg::TrajectorySetpoint](../msg_docs/TrajectorySetpoint.md) |
|
||||
| /fmu/in/vehicle_attitude_setpoint | [px4_msgs::msg::VehicleAttitudeSetpoint](../msg_docs/VehicleAttitudeSetpoint.md) |
|
||||
| /fmu/in/vehicle_mocap_odometry | [px4_msgs::msg::VehicleOdometry](../msg_docs/VehicleOdometry.md) |
|
||||
| /fmu/in/vehicle_rates_setpoint | [px4_msgs::msg::VehicleRatesSetpoint](../msg_docs/VehicleRatesSetpoint.md) |
|
||||
| /fmu/in/vehicle_visual_odometry | [px4_msgs::msg::VehicleOdometry](../msg_docs/VehicleOdometry.md) |
|
||||
| /fmu/in/vehicle_command | [px4_msgs::msg::VehicleCommand](../msg_docs/VehicleCommand.md) |
|
||||
| /fmu/in/vehicle_command_mode_executor | [px4_msgs::msg::VehicleCommand](../msg_docs/VehicleCommand.md) |
|
||||
| /fmu/in/vehicle_thrust_setpoint | [px4_msgs::msg::VehicleThrustSetpoint](../msg_docs/VehicleThrustSetpoint.md) |
|
||||
| /fmu/in/vehicle_torque_setpoint | [px4_msgs::msg::VehicleTorqueSetpoint](../msg_docs/VehicleTorqueSetpoint.md) |
|
||||
| /fmu/in/actuator_motors | [px4_msgs::msg::ActuatorMotors](../msg_docs/ActuatorMotors.md) |
|
||||
| /fmu/in/actuator_servos | [px4_msgs::msg::ActuatorServos](../msg_docs/ActuatorServos.md) |
|
||||
| /fmu/in/aux_global_position | [px4_msgs::msg::VehicleGlobalPosition](../msg_docs/VehicleGlobalPosition.md) |
|
||||
| /fmu/in/fixed_wing_longitudinal_setpoint | [px4_msgs::msg::FixedWingLongitudinalSetpoint](../msg_docs/FixedWingLongitudinalSetpoint.md) |
|
||||
| /fmu/in/fixed_wing_lateral_setpoint | [px4_msgs::msg::FixedWingLateralSetpoint](../msg_docs/FixedWingLateralSetpoint.md) |
|
||||
| /fmu/in/longitudinal_control_configuration | [px4_msgs::msg::LongitudinalControlConfiguration](../msg_docs/LongitudinalControlConfiguration.md) |
|
||||
| /fmu/in/lateral_control_configuration | [px4_msgs::msg::LateralControlConfiguration](../msg_docs/LateralControlConfiguration.md) |
|
||||
|
||||
## Subscriptions Multi
|
||||
|
||||
None
|
||||
|
||||
## Not Exported
|
||||
|
||||
These messages are not listed in the yaml file.
|
||||
They are not build into the module, and hence are neither published or subscribed.
|
||||
|
||||
:::details
|
||||
See messages
|
||||
|
||||
- [SensorCorrection](../msg_docs/SensorCorrection.md)
|
||||
- [ActuatorOutputs](../msg_docs/ActuatorOutputs.md)
|
||||
- [FixedWingRunwayControl](../msg_docs/FixedWingRunwayControl.md)
|
||||
- [EstimatorInnovations](../msg_docs/EstimatorInnovations.md)
|
||||
- [FlightPhaseEstimation](../msg_docs/FlightPhaseEstimation.md)
|
||||
- [PurePursuitStatus](../msg_docs/PurePursuitStatus.md)
|
||||
- [Px4ioStatus](../msg_docs/Px4ioStatus.md)
|
||||
- [SatelliteInfo](../msg_docs/SatelliteInfo.md)
|
||||
- [GeofenceResult](../msg_docs/GeofenceResult.md)
|
||||
- [GimbalManagerStatus](../msg_docs/GimbalManagerStatus.md)
|
||||
- [ManualControlSwitches](../msg_docs/ManualControlSwitches.md)
|
||||
- [OpenDroneIdSelfId](../msg_docs/OpenDroneIdSelfId.md)
|
||||
- [OpenDroneIdSystem](../msg_docs/OpenDroneIdSystem.md)
|
||||
- [EventV0](../msg_docs/EventV0.md)
|
||||
- [QshellRetval](../msg_docs/QshellRetval.md)
|
||||
- [RoverThrottleSetpoint](../msg_docs/RoverThrottleSetpoint.md)
|
||||
- [AirspeedValidatedV0](../msg_docs/AirspeedValidatedV0.md)
|
||||
- [RcChannels](../msg_docs/RcChannels.md)
|
||||
- [SensorAccel](../msg_docs/SensorAccel.md)
|
||||
- [GimbalDeviceAttitudeStatus](../msg_docs/GimbalDeviceAttitudeStatus.md)
|
||||
- [EscStatus](../msg_docs/EscStatus.md)
|
||||
- [RoverAttitudeSetpoint](../msg_docs/RoverAttitudeSetpoint.md)
|
||||
- [RateCtrlStatus](../msg_docs/RateCtrlStatus.md)
|
||||
- [AirspeedWind](../msg_docs/AirspeedWind.md)
|
||||
- [InputRc](../msg_docs/InputRc.md)
|
||||
- [GpioIn](../msg_docs/GpioIn.md)
|
||||
- [LaunchDetectionStatus](../msg_docs/LaunchDetectionStatus.md)
|
||||
- [VehicleImu](../msg_docs/VehicleImu.md)
|
||||
- [Event](../msg_docs/Event.md)
|
||||
- [SensorUwb](../msg_docs/SensorUwb.md)
|
||||
- [ActuatorServosTrim](../msg_docs/ActuatorServosTrim.md)
|
||||
- [DatamanResponse](../msg_docs/DatamanResponse.md)
|
||||
- [OrbTest](../msg_docs/OrbTest.md)
|
||||
- [VehicleLocalPositionSetpoint](../msg_docs/VehicleLocalPositionSetpoint.md)
|
||||
- [VehicleAngularVelocity](../msg_docs/VehicleAngularVelocity.md)
|
||||
- [FollowTargetStatus](../msg_docs/FollowTargetStatus.md)
|
||||
- [NormalizedUnsignedSetpoint](../msg_docs/NormalizedUnsignedSetpoint.md)
|
||||
- [YawEstimatorStatus](../msg_docs/YawEstimatorStatus.md)
|
||||
- [TakeoffStatus](../msg_docs/TakeoffStatus.md)
|
||||
- [UlogStreamAck](../msg_docs/UlogStreamAck.md)
|
||||
- [OrbTestLarge](../msg_docs/OrbTestLarge.md)
|
||||
- [RoverSteeringSetpoint](../msg_docs/RoverSteeringSetpoint.md)
|
||||
- [CameraCapture](../msg_docs/CameraCapture.md)
|
||||
- [VehicleRoi](../msg_docs/VehicleRoi.md)
|
||||
- [ActuatorArmed](../msg_docs/ActuatorArmed.md)
|
||||
- [FixedWingLateralGuidanceStatus](../msg_docs/FixedWingLateralGuidanceStatus.md)
|
||||
- [ParameterSetValueResponse](../msg_docs/ParameterSetValueResponse.md)
|
||||
- [GeofenceStatus](../msg_docs/GeofenceStatus.md)
|
||||
- [VehicleAngularAccelerationSetpoint](../msg_docs/VehicleAngularAccelerationSetpoint.md)
|
||||
- [SensorGnssRelative](../msg_docs/SensorGnssRelative.md)
|
||||
- [PowerMonitor](../msg_docs/PowerMonitor.md)
|
||||
- [RoverVelocityStatus](../msg_docs/RoverVelocityStatus.md)
|
||||
- [ParameterResetRequest](../msg_docs/ParameterResetRequest.md)
|
||||
- [RoverAttitudeStatus](../msg_docs/RoverAttitudeStatus.md)
|
||||
- [TecsStatus](../msg_docs/TecsStatus.md)
|
||||
- [EstimatorSelectorStatus](../msg_docs/EstimatorSelectorStatus.md)
|
||||
- [CanInterfaceStatus](../msg_docs/CanInterfaceStatus.md)
|
||||
- [Ping](../msg_docs/Ping.md)
|
||||
- [LedControl](../msg_docs/LedControl.md)
|
||||
- [Wind](../msg_docs/Wind.md)
|
||||
- [VehicleStatusV0](../msg_docs/VehicleStatusV0.md)
|
||||
- [ActuatorTest](../msg_docs/ActuatorTest.md)
|
||||
- [IridiumsbdStatus](../msg_docs/IridiumsbdStatus.md)
|
||||
- [FailureDetectorStatus](../msg_docs/FailureDetectorStatus.md)
|
||||
- [GimbalManagerSetAttitude](../msg_docs/GimbalManagerSetAttitude.md)
|
||||
- [Gripper](../msg_docs/Gripper.md)
|
||||
- [SensorMag](../msg_docs/SensorMag.md)
|
||||
- [DebugValue](../msg_docs/DebugValue.md)
|
||||
- [SensorPreflightMag](../msg_docs/SensorPreflightMag.md)
|
||||
- [RcParameterMap](../msg_docs/RcParameterMap.md)
|
||||
- [LandingGear](../msg_docs/LandingGear.md)
|
||||
- [GimbalDeviceInformation](../msg_docs/GimbalDeviceInformation.md)
|
||||
- [VehicleOpticalFlow](../msg_docs/VehicleOpticalFlow.md)
|
||||
- [UlogStream](../msg_docs/UlogStream.md)
|
||||
- [GimbalControls](../msg_docs/GimbalControls.md)
|
||||
- [RoverRateSetpoint](../msg_docs/RoverRateSetpoint.md)
|
||||
- [LogMessage](../msg_docs/LogMessage.md)
|
||||
- [RoverVelocitySetpoint](../msg_docs/RoverVelocitySetpoint.md)
|
||||
- [GpioOut](../msg_docs/GpioOut.md)
|
||||
- [TaskStackInfo](../msg_docs/TaskStackInfo.md)
|
||||
- [VelocityLimits](../msg_docs/VelocityLimits.md)
|
||||
- [MagWorkerData](../msg_docs/MagWorkerData.md)
|
||||
- [ParameterUpdate](../msg_docs/ParameterUpdate.md)
|
||||
- [TrajectorySetpoint6dof](../msg_docs/TrajectorySetpoint6dof.md)
|
||||
- [SensorBaro](../msg_docs/SensorBaro.md)
|
||||
- [VehicleImuStatus](../msg_docs/VehicleImuStatus.md)
|
||||
- [InternalCombustionEngineStatus](../msg_docs/InternalCombustionEngineStatus.md)
|
||||
- [VehicleOpticalFlowVel](../msg_docs/VehicleOpticalFlowVel.md)
|
||||
- [GimbalManagerSetManualControl](../msg_docs/GimbalManagerSetManualControl.md)
|
||||
- [Rpm](../msg_docs/Rpm.md)
|
||||
- [MagnetometerBiasEstimate](../msg_docs/MagnetometerBiasEstimate.md)
|
||||
- [MountOrientation](../msg_docs/MountOrientation.md)
|
||||
- [ActionRequest](../msg_docs/ActionRequest.md)
|
||||
- [OpenDroneIdArmStatus](../msg_docs/OpenDroneIdArmStatus.md)
|
||||
- [SensorAccelFifo](../msg_docs/SensorAccelFifo.md)
|
||||
- [LoggerStatus](../msg_docs/LoggerStatus.md)
|
||||
- [GeneratorStatus](../msg_docs/GeneratorStatus.md)
|
||||
- [InternalCombustionEngineControl](../msg_docs/InternalCombustionEngineControl.md)
|
||||
- [Ekf2Timestamps](../msg_docs/Ekf2Timestamps.md)
|
||||
- [LandingTargetPose](../msg_docs/LandingTargetPose.md)
|
||||
- [PositionControllerLandingStatus](../msg_docs/PositionControllerLandingStatus.md)
|
||||
- [UavcanParameterValue](../msg_docs/UavcanParameterValue.md)
|
||||
- [OrbitStatus](../msg_docs/OrbitStatus.md)
|
||||
- [PositionControllerStatus](../msg_docs/PositionControllerStatus.md)
|
||||
- [EstimatorStatus](../msg_docs/EstimatorStatus.md)
|
||||
- [DatamanRequest](../msg_docs/DatamanRequest.md)
|
||||
- [HoverThrustEstimate](../msg_docs/HoverThrustEstimate.md)
|
||||
- [FixedWingLateralStatus](../msg_docs/FixedWingLateralStatus.md)
|
||||
- [NavigatorMissionItem](../msg_docs/NavigatorMissionItem.md)
|
||||
- [Cpuload](../msg_docs/Cpuload.md)
|
||||
- [EstimatorAidSource3d](../msg_docs/EstimatorAidSource3d.md)
|
||||
- [RoverRateStatus](../msg_docs/RoverRateStatus.md)
|
||||
- [EscReport](../msg_docs/EscReport.md)
|
||||
- [DebugArray](../msg_docs/DebugArray.md)
|
||||
- [ControlAllocatorStatus](../msg_docs/ControlAllocatorStatus.md)
|
||||
- [SensorHygrometer](../msg_docs/SensorHygrometer.md)
|
||||
- [EstimatorSensorBias](../msg_docs/EstimatorSensorBias.md)
|
||||
- [EstimatorBias3d](../msg_docs/EstimatorBias3d.md)
|
||||
- [GimbalManagerInformation](../msg_docs/GimbalManagerInformation.md)
|
||||
- [QshellReq](../msg_docs/QshellReq.md)
|
||||
- [CameraStatus](../msg_docs/CameraStatus.md)
|
||||
- [GpsInjectData](../msg_docs/GpsInjectData.md)
|
||||
- [FigureEightStatus](../msg_docs/FigureEightStatus.md)
|
||||
- [TransponderReport](../msg_docs/TransponderReport.md)
|
||||
- [UavcanParameterRequest](../msg_docs/UavcanParameterRequest.md)
|
||||
- [MavlinkLog](../msg_docs/MavlinkLog.md)
|
||||
- [EstimatorGpsStatus](../msg_docs/EstimatorGpsStatus.md)
|
||||
- [FuelTankStatus](../msg_docs/FuelTankStatus.md)
|
||||
- [Mission](../msg_docs/Mission.md)
|
||||
- [PositionSetpoint](../msg_docs/PositionSetpoint.md)
|
||||
- [MissionResult](../msg_docs/MissionResult.md)
|
||||
- [EstimatorEventFlags](../msg_docs/EstimatorEventFlags.md)
|
||||
- [VehicleMagnetometer](../msg_docs/VehicleMagnetometer.md)
|
||||
- [MavlinkTunnel](../msg_docs/MavlinkTunnel.md)
|
||||
- [DifferentialPressure](../msg_docs/DifferentialPressure.md)
|
||||
- [CellularStatus](../msg_docs/CellularStatus.md)
|
||||
- [GpsDump](../msg_docs/GpsDump.md)
|
||||
- [GimbalDeviceSetAttitude](../msg_docs/GimbalDeviceSetAttitude.md)
|
||||
- [ArmingCheckReplyV0](../msg_docs/ArmingCheckReplyV0.md)
|
||||
- [NavigatorStatus](../msg_docs/NavigatorStatus.md)
|
||||
- [RoverPositionSetpoint](../msg_docs/RoverPositionSetpoint.md)
|
||||
- [FollowTarget](../msg_docs/FollowTarget.md)
|
||||
- [SensorsStatusImu](../msg_docs/SensorsStatusImu.md)
|
||||
- [EstimatorStates](../msg_docs/EstimatorStates.md)
|
||||
- [SensorGyro](../msg_docs/SensorGyro.md)
|
||||
- [SensorAirflow](../msg_docs/SensorAirflow.md)
|
||||
- [ButtonEvent](../msg_docs/ButtonEvent.md)
|
||||
- [DebugKeyValue](../msg_docs/DebugKeyValue.md)
|
||||
- [GpioConfig](../msg_docs/GpioConfig.md)
|
||||
- [CameraTrigger](../msg_docs/CameraTrigger.md)
|
||||
- [LandingGearWheel](../msg_docs/LandingGearWheel.md)
|
||||
- [VehicleConstraints](../msg_docs/VehicleConstraints.md)
|
||||
- [HealthReport](../msg_docs/HealthReport.md)
|
||||
- [PowerButtonState](../msg_docs/PowerButtonState.md)
|
||||
- [RadioStatus](../msg_docs/RadioStatus.md)
|
||||
- [SensorGyroFifo](../msg_docs/SensorGyroFifo.md)
|
||||
- [EstimatorBias](../msg_docs/EstimatorBias.md)
|
||||
- [DebugVect](../msg_docs/DebugVect.md)
|
||||
- [DistanceSensorModeChangeRequest](../msg_docs/DistanceSensorModeChangeRequest.md)
|
||||
- [RtlTimeEstimate](../msg_docs/RtlTimeEstimate.md)
|
||||
- [PpsCapture](../msg_docs/PpsCapture.md)
|
||||
- [SensorSelection](../msg_docs/SensorSelection.md)
|
||||
- [SystemPower](../msg_docs/SystemPower.md)
|
||||
- [ActuatorControlsStatus](../msg_docs/ActuatorControlsStatus.md)
|
||||
- [SensorGyroFft](../msg_docs/SensorGyroFft.md)
|
||||
- [VehicleAirData](../msg_docs/VehicleAirData.md)
|
||||
- [FollowTargetEstimator](../msg_docs/FollowTargetEstimator.md)
|
||||
- [ParameterSetUsedRequest](../msg_docs/ParameterSetUsedRequest.md)
|
||||
- [GpioRequest](../msg_docs/GpioRequest.md)
|
||||
- [OpenDroneIdOperatorId](../msg_docs/OpenDroneIdOperatorId.md)
|
||||
- [RtlStatus](../msg_docs/RtlStatus.md)
|
||||
- [Airspeed](../msg_docs/Airspeed.md)
|
||||
- [VehicleAcceleration](../msg_docs/VehicleAcceleration.md)
|
||||
- [ParameterSetValueRequest](../msg_docs/ParameterSetValueRequest.md)
|
||||
- [IrlockReport](../msg_docs/IrlockReport.md)
|
||||
- [HeaterStatus](../msg_docs/HeaterStatus.md)
|
||||
- [AdcReport](../msg_docs/AdcReport.md)
|
||||
- [PwmInput](../msg_docs/PwmInput.md)
|
||||
- [TiltrotorExtraControls](../msg_docs/TiltrotorExtraControls.md)
|
||||
- [EstimatorAidSource1d](../msg_docs/EstimatorAidSource1d.md)
|
||||
- [OrbTestMedium](../msg_docs/OrbTestMedium.md)
|
||||
- [VehicleAttitudeSetpointV0](../msg_docs/VehicleAttitudeSetpointV0.md)
|
||||
- [EstimatorAidSource2d](../msg_docs/EstimatorAidSource2d.md)
|
||||
- [TuneControl](../msg_docs/TuneControl.md)
|
||||
- [WheelEncoders](../msg_docs/WheelEncoders.md)
|
||||
- [AutotuneAttitudeControlStatus](../msg_docs/AutotuneAttitudeControlStatus.md)
|
||||
- [LandingTargetInnovations](../msg_docs/LandingTargetInnovations.md)
|
||||
- [SensorsStatus](../msg_docs/SensorsStatus.md)
|
||||
|
||||
:::
|
||||
@ -61,12 +61,12 @@ For example the [VelocityLimits](../msg_docs/VelocityLimits.md) message definiti
|
||||
```text
|
||||
# Velocity and yaw rate limits for a multicopter position slow mode only
|
||||
|
||||
uint64 timestamp # time since system start (microseconds)
|
||||
uint64 timestamp # [us] Time since system start.
|
||||
|
||||
# absolute speeds, NAN means use default limit
|
||||
float32 horizontal_velocity # [m/s]
|
||||
float32 vertical_velocity # [m/s]
|
||||
float32 yaw_rate # [rad/s]
|
||||
float32 horizontal_velocity # [m/s] Horizontal velocity.
|
||||
float32 vertical_velocity # [m/s] Vertical velocity.
|
||||
float32 yaw_rate # [rad/s] Yaw rate.
|
||||
```
|
||||
|
||||
By default this message definition will be compiled to a single topic with an id `velocity_limits`, a direct conversion from the CamelCase name to a snake_case version.
|
||||
@ -92,15 +92,34 @@ To nest a message, simply include the nested message type in the parent message
|
||||
|
||||
```text
|
||||
# Global position setpoint triplet in WGS84 coordinates.
|
||||
#
|
||||
# This are the three next waypoints (or just the next two or one).
|
||||
|
||||
uint64 timestamp # time since system start (microseconds)
|
||||
uint64 timestamp # [us] Time since system start.
|
||||
|
||||
PositionSetpoint previous
|
||||
PositionSetpoint current
|
||||
PositionSetpoint next
|
||||
```
|
||||
|
||||
### uORB Buffer Length (ORB_QUEUE_LENGTH)
|
||||
|
||||
uORB messages have a single-message buffer by default, which may be overwritten if the message publication rate is too high.
|
||||
In most cases this does not matter: either we are only interested in the latest sample of a topic, such as a sensor value or a setpoint, or losing a few samples is not a particular problem.
|
||||
For relatively few cases, such as vehicle commands, it is important that we don't drop topics.
|
||||
|
||||
In order to reduce the chance that messages will be dropped we can use named constant `ORB_QUEUE_LENGTH` to create a buffer of the specified length.
|
||||
For example, to create a four-message queue, add the following line to your message definition:
|
||||
|
||||
```sh
|
||||
uint8 ORB_QUEUE_LENGTH = 4
|
||||
```
|
||||
|
||||
As long as subscribers are able to read messages out of the buffer quickly enough than it isn't ever fully filled to the queue length (by publishers), they will be able to get all messages that are sent.
|
||||
Messages will still be lost they are published when the queue is filled.
|
||||
|
||||
Note that the queue length value must be a power of 2 (so 2, 4, 8, ...).
|
||||
|
||||
### Message/Field Deprecation {#deprecation}
|
||||
|
||||
As there are external tools using uORB messages from log files, such as [Flight Review](https://github.com/PX4/flight_review), certain aspects need to be considered when updating existing messages:
|
||||
|
||||
@ -38,7 +38,7 @@ The PX4 [uxrce_dds_client](../modules/modules_system.md#uxrce-dds-client) is gen
|
||||
The agent has no dependency on client code.
|
||||
It can be built standalone or in a ROS 2 workspace, or installed as a snap package on Ubuntu.
|
||||
|
||||
When PX4 is built, a code generator uses the uORB message definitions in the source tree ([PX4-Autopilot/msg](https://github.com/PX4/PX4-Autopilot/tree/main/msg)) to compile support for the subset of uORB topics in [PX4-Autopilot/src/modules/uxrce_dds_client/dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml) into [uxrce_dds_client](../modules/modules_system.md#uxrce-dds-client).
|
||||
When PX4 is built, a code generator uses the uORB message definitions in the source tree ([PX4-Autopilot/msg](https://github.com/PX4/PX4-Autopilot/tree/main/msg)) to compile support for the subset of uORB topics in [/src/modules/uxrce_dds_client/dds_topics.yaml](../middleware/dds_topics.md) into [uxrce_dds_client](../modules/modules_system.md#uxrce-dds-client).
|
||||
|
||||
PX4 main or release builds automatically export the set of uORB messages definitions in the build to an associated branch in [PX4/px4_msgs](https://github.com/PX4/px4_msgs).
|
||||
|
||||
@ -326,13 +326,11 @@ ROS_DOMAIN_ID=3 PX4_UXRCE_DDS_PORT=9999 PX4_UXRCE_DDS_NS=drone make px4_sitl gz_
|
||||
|
||||
## Supported uORB Messages
|
||||
|
||||
The set of [PX4 uORB topics](../msg_docs/index.md) that are exposed through the client are set in [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml).
|
||||
The set of [PX4 uORB topics](../msg_docs/index.md) that are exposed through the client are set in [dds_topics.yaml](../middleware/dds_topics.md).
|
||||
|
||||
The topics are release specific (support is compiled into [uxrce_dds_client](../modules/modules_system.md#uxrce-dds-client) at build time).
|
||||
While most releases should support a very similar set of messages, to be certain you would need to check the yaml file for your particular release.
|
||||
|
||||
<!-- Jublish the set we use?: https://github.com/PX4/px4_msgs/issues/22 -->
|
||||
|
||||
Note that ROS 2/DDS needs to have the _same_ message definitions that were used to create the uXRCE-DDS client module in the PX4 Firmware in order to interpret the messages.
|
||||
The message definitions are stored in the ROS 2 interface package [PX4/px4_msgs](https://github.com/PX4/px4_msgs), and they are automatically synchronized by CI on the `main` and release branches.
|
||||
Note that all the messages from PX4 source code are present in the repository, but only those listed in `dds_topics.yaml` will be available as ROS 2 topics.
|
||||
@ -349,21 +347,21 @@ Therefore,
|
||||
```
|
||||
|
||||
::: info
|
||||
Technically, [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml) completely defines the relationship between PX4 uORB topics and ROS 2 messages.
|
||||
Technically, [dds_topics.yaml](../middleware/dds_topics.md) completely defines the relationship between PX4 uORB topics and ROS 2 messages.
|
||||
For more information see [DDS Topics YAML](#dds-topics-yaml) below.
|
||||
|
||||
:::
|
||||
|
||||
## Customizing the Namespace
|
||||
|
||||
Custom topic and service namespaces can be applied at build time (changing [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml)) 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)) or at runtime (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.
|
||||
This technique can be used both in simulation and real vehicles.
|
||||
- A custom namespace can be provided for simulations (only) by setting the environment variable `PX4_UXRCE_DDS_NS` before starting the simulation.
|
||||
|
||||
:::info
|
||||
Changing the namespace at runtime will append the desired namespace as a prefix to all `topic` fields in [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml) and all [service servers](#dds-ros-2-services).
|
||||
Changing the namespace at runtime will append the desired namespace as a prefix to all `topic` fields in [dds_topics.yaml](../middleware/dds_topics.md) and all [service servers](#dds-ros-2-services).
|
||||
Therefore, commands like:
|
||||
|
||||
```sh
|
||||
@ -420,7 +418,7 @@ Deadline, lifespan, and lease durations are also all set to "default".
|
||||
|
||||
## DDS Topics YAML
|
||||
|
||||
The PX4 yaml file [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml) defines the set of PX4 uORB topics that are built into firmware and published.
|
||||
The PX4 [dds_topics.yaml](../middleware/dds_topics.md) file defines the set of PX4 uORB topics that are built into firmware and published.
|
||||
More precisely, it completely defines the relationship/pairing between PX4 uORB and ROS 2 messages.
|
||||
|
||||
The file is structured as follows:
|
||||
@ -549,7 +547,7 @@ Take a look at the [client startup section](#starting-the-client) to learn how t
|
||||
|
||||
#### New file for setting which topics are published
|
||||
|
||||
The list of topics that are published and subscribed for a particular firmware is now managed by the [dds_topic.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml) configuration file, which replaces [urtps_bridge_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/release/1.13/msg/tools/urtps_bridge_topics.yaml)
|
||||
The list of topics that are published and subscribed for a particular firmware is now managed by the [dds_topics.yaml](../middleware/dds_topics.md) configuration file, which replaces [urtps_bridge_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/release/1.13/msg/tools/urtps_bridge_topics.yaml)
|
||||
|
||||
See [Supported uORB Messages](#supported-uorb-messages) and [DDS Topics YAML](#dds-topics-yaml) sections for more information.
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ The agent acts as a proxy for the client to publish and subscribe to topics in t
|
||||
|
||||
The PX4 [uxrce_dds_client](../modules/modules_system.md#uxrce-dds-client) is generated at build time and included in PX4 firmware by default.
|
||||
It includes both the "generic" micro XRCE-DDS client code, and PX4-specific translation code that it uses to publish to/from uORB topics.
|
||||
The subset of uORB messages that are generated into the client are listed in [PX4-Autopilot/src/modules/uxrce_dds_client/dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml).
|
||||
The subset of uORB messages that are generated into the client are specified in [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.
|
||||
|
||||
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.
|
||||
@ -97,48 +97,48 @@ To install ROS 2 and its dependencies:
|
||||
|
||||
1. Install ROS 2.
|
||||
|
||||
:::: tabs
|
||||
:::: tabs
|
||||
|
||||
::: tab humble
|
||||
To install ROS 2 "Humble" on Ubuntu 22.04:
|
||||
::: tab humble
|
||||
To install ROS 2 "Humble" on Ubuntu 22.04:
|
||||
|
||||
```sh
|
||||
sudo apt update && sudo apt install locales
|
||||
sudo locale-gen en_US en_US.UTF-8
|
||||
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
|
||||
export LANG=en_US.UTF-8
|
||||
sudo apt install software-properties-common
|
||||
sudo add-apt-repository universe
|
||||
sudo apt update && sudo apt install curl -y
|
||||
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
sudo apt install ros-humble-desktop
|
||||
sudo apt install ros-dev-tools
|
||||
source /opt/ros/humble/setup.bash && echo "source /opt/ros/humble/setup.bash" >> .bashrc
|
||||
```
|
||||
```sh
|
||||
sudo apt update && sudo apt install locales
|
||||
sudo locale-gen en_US en_US.UTF-8
|
||||
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
|
||||
export LANG=en_US.UTF-8
|
||||
sudo apt install software-properties-common
|
||||
sudo add-apt-repository universe
|
||||
sudo apt update && sudo apt install curl -y
|
||||
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
sudo apt install ros-humble-desktop
|
||||
sudo apt install ros-dev-tools
|
||||
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).
|
||||
You can install _either_ the desktop (`ros-humble-desktop`) _or_ bare-bones versions (`ros-humble-ros-base`), _and_ the development tools (`ros-dev-tools`).
|
||||
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).
|
||||
You can install _either_ the desktop (`ros-humble-desktop`) _or_ bare-bones versions (`ros-humble-ros-base`), _and_ the development tools (`ros-dev-tools`).
|
||||
|
||||
:::
|
||||
|
||||
::: tab foxy
|
||||
To install ROS 2 "Foxy" on Ubuntu 20.04:
|
||||
::: tab foxy
|
||||
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).
|
||||
- Follow the official installation guide: [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`).
|
||||
You can install _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`**):
|
||||
|
||||
```sh
|
||||
pip install --user -U empy==3.3.4 pyros-genmsg setuptools
|
||||
```
|
||||
```sh
|
||||
pip install --user -U empy==3.3.4 pyros-genmsg setuptools
|
||||
```
|
||||
|
||||
### Setup Micro XRCE-DDS Agent & Client
|
||||
|
||||
@ -155,22 +155,22 @@ To setup and start the agent:
|
||||
|
||||
2. 输入以下命令从仓库获取源代码并构建代理(Agent):
|
||||
|
||||
```sh
|
||||
git clone -b v2.4.2 https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
|
||||
cd Micro-XRCE-DDS-Agent
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
sudo make install
|
||||
sudo ldconfig /usr/local/lib/
|
||||
```
|
||||
```sh
|
||||
git clone -b v2.4.2 https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
|
||||
cd Micro-XRCE-DDS-Agent
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
sudo make install
|
||||
sudo ldconfig /usr/local/lib/
|
||||
```
|
||||
|
||||
3. 启动代理并设置以连接运行在模拟器上的 uXRCE-DDS客户端(Client):
|
||||
|
||||
```sh
|
||||
MicroXRCEAgent udp4 -p 8888
|
||||
```
|
||||
```sh
|
||||
MicroXRCEAgent udp4 -p 8888
|
||||
```
|
||||
|
||||
The agent is now running, but you won't see much until we start PX4 (in the next step).
|
||||
|
||||
@ -187,31 +187,31 @@ To start the simulator (and client):
|
||||
|
||||
1. Open a new terminal in the root of the **PX4 Autopilot** repo that was installed above.
|
||||
|
||||
:::: tabs
|
||||
:::: tabs
|
||||
|
||||
::: tab humble
|
||||
::: tab humble
|
||||
|
||||
- Start a PX4 [Gazebo](../sim_gazebo_gz/index.md) simulation using:
|
||||
- Start a PX4 [Gazebo](../sim_gazebo_gz/index.md) simulation using:
|
||||
|
||||
```sh
|
||||
make px4_sitl gz_x500
|
||||
```
|
||||
```sh
|
||||
make px4_sitl gz_x500
|
||||
```
|
||||
|
||||
|
||||
:::
|
||||
|
||||
::: tab foxy
|
||||
::: tab foxy
|
||||
|
||||
- Start a PX4 [Gazebo Classic](../sim_gazebo_classic/index.md) simulation using:
|
||||
- Start a PX4 [Gazebo Classic](../sim_gazebo_classic/index.md) simulation using:
|
||||
|
||||
```sh
|
||||
make px4_sitl gazebo-classic
|
||||
```
|
||||
```sh
|
||||
make px4_sitl gazebo-classic
|
||||
```
|
||||
|
||||
|
||||
:::
|
||||
|
||||
::::
|
||||
::::
|
||||
|
||||
The agent and client are now running they should connect.
|
||||
|
||||
@ -261,52 +261,52 @@ To create and build the workspace:
|
||||
|
||||
2. Create and navigate into a new workspace directory using:
|
||||
|
||||
```sh
|
||||
mkdir -p ~/ws_sensor_combined/src/
|
||||
cd ~/ws_sensor_combined/src/
|
||||
```
|
||||
```sh
|
||||
mkdir -p ~/ws_sensor_combined/src/
|
||||
cd ~/ws_sensor_combined/src/
|
||||
```
|
||||
|
||||
::: info
|
||||
A naming convention for workspace folders can make it easier to manage workspaces.
|
||||
::: info
|
||||
A naming convention for workspace folders can make it easier to manage workspaces.
|
||||
|
||||
:::
|
||||
|
||||
3. Clone the example repository and [px4_msgs](https://github.com/PX4/px4_msgs) to the `/src` directory (the `main` branch is cloned by default, which corresponds to the version of PX4 we are running):
|
||||
|
||||
```sh
|
||||
git clone https://github.com/PX4/px4_msgs.git
|
||||
git clone https://github.com/PX4/px4_ros_com.git
|
||||
```
|
||||
```sh
|
||||
git clone https://github.com/PX4/px4_msgs.git
|
||||
git clone https://github.com/PX4/px4_ros_com.git
|
||||
```
|
||||
|
||||
4. Source the ROS 2 development environment into the current terminal and compile the workspace using `colcon`:
|
||||
|
||||
:::: tabs
|
||||
:::: tabs
|
||||
|
||||
::: tab humble
|
||||
::: tab humble
|
||||
|
||||
```sh
|
||||
cd ..
|
||||
source /opt/ros/humble/setup.bash
|
||||
colcon build
|
||||
```
|
||||
```sh
|
||||
cd ..
|
||||
source /opt/ros/humble/setup.bash
|
||||
colcon build
|
||||
```
|
||||
|
||||
|
||||
:::
|
||||
|
||||
::: tab foxy
|
||||
::: tab foxy
|
||||
|
||||
```sh
|
||||
cd ..
|
||||
source /opt/ros/foxy/setup.bash
|
||||
colcon build
|
||||
```
|
||||
```sh
|
||||
cd ..
|
||||
source /opt/ros/foxy/setup.bash
|
||||
colcon build
|
||||
```
|
||||
|
||||
|
||||
:::
|
||||
|
||||
::::
|
||||
::::
|
||||
|
||||
This builds all the folders under `/src` using the sourced toolchain.
|
||||
This builds all the folders under `/src` using the sourced toolchain.
|
||||
|
||||
#### Running the Example
|
||||
|
||||
@ -322,42 +322,42 @@ In a new terminal:
|
||||
|
||||
1. Navigate into the top level of your workspace directory and source the ROS 2 environment (in this case "Humble"):
|
||||
|
||||
:::: tabs
|
||||
:::: tabs
|
||||
|
||||
::: tab humble
|
||||
::: tab humble
|
||||
|
||||
```sh
|
||||
cd ~/ws_sensor_combined/
|
||||
source /opt/ros/humble/setup.bash
|
||||
```
|
||||
```sh
|
||||
cd ~/ws_sensor_combined/
|
||||
source /opt/ros/humble/setup.bash
|
||||
```
|
||||
|
||||
|
||||
:::
|
||||
|
||||
::: tab foxy
|
||||
::: tab foxy
|
||||
|
||||
```sh
|
||||
cd ~/ws_sensor_combined/
|
||||
source /opt/ros/foxy/setup.bash
|
||||
```
|
||||
```sh
|
||||
cd ~/ws_sensor_combined/
|
||||
source /opt/ros/foxy/setup.bash
|
||||
```
|
||||
|
||||
|
||||
:::
|
||||
|
||||
::::
|
||||
::::
|
||||
|
||||
2. Source the `local_setup.bash`.
|
||||
|
||||
```sh
|
||||
source install/local_setup.bash
|
||||
```
|
||||
```sh
|
||||
source install/local_setup.bash
|
||||
```
|
||||
|
||||
3. Now launch the example.
|
||||
Note here that we use `ros2 launch`, which is described below.
|
||||
Note here that we use `ros2 launch`, which is described below.
|
||||
|
||||
```sh
|
||||
ros2 launch px4_ros_com sensor_combined_listener.launch.py
|
||||
```
|
||||
```sh
|
||||
ros2 launch px4_ros_com sensor_combined_listener.launch.py
|
||||
```
|
||||
|
||||
If this is working you should see data being printed on the terminal/console where you launched the ROS listener:
|
||||
|
||||
@ -385,18 +385,18 @@ If you were to use incompatible [message versions](../middleware/uorb.md#message
|
||||
|
||||
1. Include the [Message Translation Node](../ros2/px4_ros2_msg_translation_node.md) into the example workspace or a separate workspace by running the following script:
|
||||
|
||||
```sh
|
||||
cd /path/to/ros_ws
|
||||
/path/to/PX4-Autopilot/Tools/copy_to_ros_ws.sh .
|
||||
```
|
||||
```sh
|
||||
cd /path/to/ros_ws
|
||||
/path/to/PX4-Autopilot/Tools/copy_to_ros_ws.sh .
|
||||
```
|
||||
|
||||
2. Build and run the translation node:
|
||||
|
||||
```sh
|
||||
colcon build
|
||||
source install/local_setup.bash
|
||||
ros2 run translation_node translation_node_bin
|
||||
```
|
||||
```sh
|
||||
colcon build
|
||||
source install/local_setup.bash
|
||||
ros2 run translation_node translation_node_bin
|
||||
```
|
||||
|
||||
## Controlling a Vehicle
|
||||
|
||||
@ -405,7 +405,7 @@ To control applications, ROS 2 applications:
|
||||
- subscribe to (listen to) telemetry topics published by PX4
|
||||
- publish to topics that cause PX4 to perform some action.
|
||||
|
||||
The topics that you can use are defined in [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml), and you can get more information about their data in the [uORB Message Reference](../msg_docs/index.md).
|
||||
The topics that you can use are defined in [dds_topics.yaml](../middleware/dds_topics.md), and you can get more information about their data in the [uORB Message Reference](../msg_docs/index.md).
|
||||
For example, [VehicleGlobalPosition](../msg_docs/VehicleGlobalPosition.md) can be used to get the vehicle global position, while [VehicleCommand](../msg_docs/VehicleCommand.md) can be used to command actions such as takeoff and land.
|
||||
|
||||
The [ROS 2 Example applications](#ros-2-example-applications) examples below provide concrete examples of how to use these topics.
|
||||
@ -456,13 +456,13 @@ Therefore, ROS 2 nodes that want to interface with PX4 must take care of the fra
|
||||
|
||||
- To rotate a vector from ENU to NED two basic rotations must be performed:
|
||||
|
||||
- first a pi/2 rotation around the `Z`-axis (up),
|
||||
- then a pi rotation around the `X`-axis (old East/new North).
|
||||
- first a pi/2 rotation around the `Z`-axis (up),
|
||||
- then a pi rotation around the `X`-axis (old East/new North).
|
||||
|
||||
- To rotate a vector from NED to ENU two basic rotations must be performed:
|
||||
|
||||
- - first a pi/2 rotation around the `Z`-axis (down),
|
||||
- then a pi rotation around the `X`-axis (old North/new East). Note that the two resulting operations are mathematically equivalent.
|
||||
- then a pi rotation around the `X`-axis (old North/new East). Note that the two resulting operations are mathematically equivalent.
|
||||
|
||||
- To rotate a vector from FLU to FRD a pi rotation around the `X`-axis (front) is sufficient.
|
||||
|
||||
@ -720,17 +720,17 @@ Therefore,
|
||||
|
||||
- If you're using a main or release version of PX4 you can get the message definitions by cloning the interface package [PX4/px4_msgs](https://github.com/PX4/px4_msgs) into your workspace.
|
||||
- If you're creating or modifying uORB messages you must manually update the messages in your workspace from your PX4 source tree.
|
||||
Generally this means that you would update [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml), clone the interface package, and then manually synchronize it by copying the new/modified message definitions from [PX4-Autopilot/msg](https://github.com/PX4/PX4-Autopilot/tree/main/msg) to its `msg` folders.
|
||||
Assuming that PX4-Autopilot is in your home directory `~`, while `px4_msgs` is in `~/ros2_ws/src/`, then the command might be:
|
||||
Generally this means that you would update [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml), clone the interface package, and then manually synchronize it by copying the new/modified message definitions from [PX4-Autopilot/msg](https://github.com/PX4/PX4-Autopilot/tree/main/msg) to its `msg` folders.
|
||||
Assuming that PX4-Autopilot is in your home directory `~`, while `px4_msgs` is in `~/ros2_ws/src/`, then the command might be:
|
||||
|
||||
```sh
|
||||
rm ~/ros2_ws/src/px4_msgs/msg/*.msg
|
||||
cp ~/PX4-Autopilot/mgs/*.msg ~/ros2_ws/src/px4_msgs/msg/
|
||||
```
|
||||
```sh
|
||||
rm ~/ros2_ws/src/px4_msgs/msg/*.msg
|
||||
cp ~/PX4-Autopilot/mgs/*.msg ~/ros2_ws/src/px4_msgs/msg/
|
||||
```
|
||||
|
||||
::: info
|
||||
Technically, [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml) completely defines the relationship between PX4 uORB topics and ROS 2 messages.
|
||||
For more information see [uXRCE-DDS > DDS Topics YAML](../middleware/uxrce_dds.md#dds-topics-yaml).
|
||||
::: info
|
||||
Technically, [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml) completely defines the relationship between PX4 uORB topics and ROS 2 messages.
|
||||
For more information see [uXRCE-DDS > DDS Topics YAML](../middleware/uxrce_dds.md#dds-topics-yaml).
|
||||
|
||||
:::
|
||||
|
||||
@ -739,11 +739,11 @@ Therefore,
|
||||
Custom topic and service namespaces can be applied at build time (changing [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml)) or at runtime (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.
|
||||
This technique can be used both in simulation and real vehicles.
|
||||
This technique can be used both in simulation and real vehicles.
|
||||
- A custom namespace can be provided for simulations (only) by setting the environment variable `PX4_UXRCE_DDS_NS` before starting the simulation.
|
||||
|
||||
:::info
|
||||
Changing the namespace at runtime will append the desired namespace as a prefix to all `topic` fields in [dds_topics.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/uxrce_dds_client/dds_topics.yaml) and all [service servers](#px4-ros-2-service-servers).
|
||||
Changing the namespace at runtime will append the desired namespace as a prefix to all `topic` fields in [dds_topics.yaml](../middleware/dds_topics.md) and all [service servers](#px4-ros-2-service-servers).
|
||||
Therefore, commands like:
|
||||
|
||||
```sh
|
||||
@ -780,7 +780,7 @@ The service servers that are built into the PX4 [uxrce_dds_client](../modules/mo
|
||||
|
||||
- `/fmu/vehicle_command` (definition: [`px4_msgs::srv::VehicleCommand`](https://github.com/PX4/px4_msgs/blob/main/srv/VehicleCommand.srv).)
|
||||
|
||||
This service can be called by ROS 2 applications to send PX4 [VehicleCommand](../msg_docs/VehicleCommand.md) uORB messages and receive PX4 [VehicleCommandAck](../msg_docs/VehicleCommandAck.md) uORB messages in response.
|
||||
This service can be called by ROS 2 applications to send PX4 [VehicleCommand](../msg_docs/VehicleCommand.md) uORB messages and receive PX4 [VehicleCommandAck](../msg_docs/VehicleCommandAck.md) uORB messages in response.
|
||||
|
||||
All PX4 service names follow the convention `{extra_namespace}/fmu/{server_specific_name}` where `{extra_namespace}` is the same [custom namespace](#customizing-the-namespace) that can be given to the PX4 topics.
|
||||
|
||||
@ -973,36 +973,36 @@ The standard installation should include all the tools needed by ROS 2.
|
||||
If any are missing, they can be added separately:
|
||||
|
||||
- **`colcon`** build tools should be in the development tools.
|
||||
It can be installed using:
|
||||
It can be installed using:
|
||||
|
||||
```sh
|
||||
sudo apt install python3-colcon-common-extensions
|
||||
```
|
||||
```sh
|
||||
sudo apt install python3-colcon-common-extensions
|
||||
```
|
||||
|
||||
- The Eigen3 library used by the transforms library should be in the both the desktop and base packages.
|
||||
It should be installed as shown:
|
||||
It should be installed as shown:
|
||||
|
||||
:::: tabs
|
||||
:::: tabs
|
||||
|
||||
::: tab humble
|
||||
::: tab humble
|
||||
|
||||
```sh
|
||||
sudo apt install ros-humble-eigen3-cmake-module
|
||||
```
|
||||
```sh
|
||||
sudo apt install ros-humble-eigen3-cmake-module
|
||||
```
|
||||
|
||||
|
||||
:::
|
||||
|
||||
::: tab foxy
|
||||
::: tab foxy
|
||||
|
||||
```sh
|
||||
sudo apt install ros-foxy-eigen3-cmake-module
|
||||
```
|
||||
```sh
|
||||
sudo apt install ros-foxy-eigen3-cmake-module
|
||||
```
|
||||
|
||||
|
||||
:::
|
||||
|
||||
::::
|
||||
::::
|
||||
|
||||
### ros_gz_bridge not publishing on the \clock topic
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user