mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-22 22:32:11 +08:00
docs(simulation) add video streaming docs for Gazebo
This commit is contained in:
@@ -228,6 +228,49 @@ In addition to being a precondition for running the simulation faster/slower tha
|
||||
Lockstep cannot be disabled on Gazebo.
|
||||
:::
|
||||
|
||||
### Video Streaming
|
||||
|
||||
Some models (e.g. `gz_x500_mono_cam`, `gz_x500_gimbal`) include a camera and support video streaming. By default, the stream is published over UDP on port 5600 using the RTP protocol.
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
GStreamer 1.0 is required. The necessary dependencies are included in the standard PX4 installation scripts for Ubuntu Linux and macOS.
|
||||
|
||||
::: info
|
||||
Required packages: `gstreamer1.0-plugins-base`, `gstreamer1.0-plugins-good`, `gstreamer1.0-plugins-bad`, `gstreamer1.0-plugins-ugly`, `libgstreamer-plugins-base1.0-dev`. If missing, install them via `apt` or your system package manager.
|
||||
:::
|
||||
|
||||
#### Viewing the Video Stream
|
||||
|
||||
**QGroundControl (recommended)**
|
||||
|
||||
Open **Application Settings > General**, set **Video Source** to _UDP h.264 Video Stream_, and set **UDP Port** to `5600`.
|
||||
|
||||

|
||||
|
||||
The Gazebo video feed will then appear in QGroundControl exactly as it would from a real camera.
|
||||
|
||||

|
||||
|
||||
**GStreamer pipeline**
|
||||
|
||||
To view the stream directly from a terminal:
|
||||
|
||||
```sh
|
||||
gst-launch-1.0 -v udpsrc port=5600 \
|
||||
caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264' \
|
||||
! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false
|
||||
```
|
||||
|
||||
#### Multi-Vehicle Simulation
|
||||
|
||||
In a multi-vehicle simulation, each vehicle instance streams to a separate port starting from `5600` — i.e. `5600`, `5601`, `5602`, and so on. If an instance (other than the first, which acts as the Gazebo world host) is restarted, it resumes streaming on its originally assigned port.
|
||||
|
||||
#### Advanced Usage
|
||||
|
||||
The default port and protocol (RTP) can be changed by modifying the world's SDF file.
|
||||
See the [GStreamer plugin README](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/simulation/gz_plugins/gstreamer/README.md) for details.
|
||||
|
||||
## Usage/Configuration Options
|
||||
|
||||
The startup pipeline allows for highly flexible configuration.
|
||||
|
||||
Reference in New Issue
Block a user