Setup guide
Build the two components and bring up camera and telemetry on the same local network. The checks below can be run with the aircraft on the ground.
Requirements
- Ubuntu 22.04 with ROS 2 Humble,
colcon, Git, PyAV, OpenCV and NumPy. Installros-humble-rqt-image-viewto use the image viewer below. - A DJI Mobile SDK 4 aircraft and an Android device connected to its controller. See the aircraft and controller list below.
- JDK 11, Android SDK platform 33 and SDK build tools for the modified sample. The app uses package ID
com.dji.sdk.sample, minimum API 23, and DJI Mobile SDK 4.18. Android build configuration - A DJI developer account and your own app key registered for
com.dji.sdk.sample. DJI activation guide
Aircraft and controllers
The bridge targets the DJI Mavic 2 Enterprise. DJI lists the Mavic 2 Enterprise, Mavic 2 Enterprise Dual, and Mavic 2 Enterprise Advanced as Mobile SDK compatible and pairs the DJI Smart Controller (RM500) with all three. Bridge testing on Dual and Advanced is unverified.
DJI product and SDK compatibility · Smart Controller aircraft support (PDF) · RM500 in the Enterprise Advanced manual (PDF)
Build both components
ROS 2 bridge
sudo apt install python3-colcon-common-extensions python3-av python3-opencv python3-numpy
mkdir -p ~/dji_ws/src
git clone https://github.com/Manouselis/dji_ros2_bridge.git ~/dji_ws/src/dji_ros2_bridge
cd ~/dji_ws
source /opt/ros/humble/setup.bash
colcon build --packages-select dji_ros2_bridge
source install/setup.bash
Android app
- Clone the Android repository and open its
Sample Codedirectory. Point Android Studio or the Gradle CLI at your local Android SDK. - In
~/.gradle/gradle.properties, addDJI_APP_KEY=your_key_herewith your own registered key. You can also set theDJI_APP_KEYenvironment variable if the Gradle property is absent. Gradle inserts the key into your local APK. Keep the key and APK private. - Build a debug APK with JDK 11 and install the local result on the Android device connected to the controller.
git clone https://github.com/Manouselis/Mobile-SDK-Android.git
cd "Mobile-SDK-Android/Sample Code"
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 bash gradlew :app:assembleDebug
The APK is written to app/build/outputs/apk/debug/app-debug.apk. With your intended Android device connected and authorized, install it with adb install -r app/build/outputs/apk/debug/app-debug.apk.
Connect and verify
- Connect the Android device and Linux PC to the same trusted Wi‑Fi network. Broadcast discovery needs a network without client isolation.
- Open four PC terminals, source
~/dji_ws/install/setup.bashin each, and start one receiver in each terminal.
ros2 run dji_ros2_bridge video_h264_tcp_node
ros2 run dji_ros2_bridge gimbal_udp_node
ros2 run dji_ros2_bridge position_udp_node
ros2 run dji_ros2_bridge fov_udp_node
- On Android, close any DJI or third-party app that may already have the aircraft connection. Open DJI SDK Sample and tap Register APP. Allow registration to finish before checking product connection.
- Leave ROS PC IP blank for automatic discovery. If broadcast fails, enter the PC’s LAN address and tap Register APP again.
- From another sourced PC terminal, check that ROS 2 receives messages. In
rqt_image_view, select/dji/imagewith compressed transport to view the feed. Start the viewer withros2 run rqt_image_view rqt_image_view.
ros2 topic echo /dji/gimbal_orientation --once
ros2 topic echo /dji/gps/fix --once
ros2 topic echo /dji/image/compressed --once --qos-reliability best_effort --field format
ros2 topic hz /dji/image/compressed
For the position check, read the NavSatStatus in the message. A received topic can report STATUS_NO_FIX.
Topics and ports
| Port | Direction | Payload |
|---|---|---|
| UDP 5005 | Android to PC | Gimbal attitude JSON |
| TCP 5006 | Android to PC | H.264 chunks with four-byte big-endian lengths |
| UDP 5007 | Android and PC | Broadcast discovery and unicast reply |
| UDP 5008 | Android to PC | GNSS, RTK and NED velocity JSON |
| UDP 5009 | Android to PC | Field of view and zoom metadata JSON |
| TCP 5010 | Android connects to PC | Optional mission commands and replies in newline-delimited JSON |
| Topic | ROS 2 type and notes |
|---|---|
/dji/gimbal_orientation | geometry_msgs/msg/Vector3Stamped, roll, pitch and yaw in radians |
/dji/gimbal_orientation_quat | geometry_msgs/msg/QuaternionStamped |
/dji/gps/fix and /dji/rtk/fix | sensor_msgs/msg/NavSatFix, check fix status |
/dji/velocity_ned | geometry_msgs/msg/Vector3Stamped, north, east and down in m/s |
/dji/video/h264 | sensor_msgs/msg/CompressedImage, original encoded chunks |
/dji/image/compressed | sensor_msgs/msg/CompressedImage, decoded frames re-encoded as JPEG with best-effort QoS by default |
/dji/image_raw | sensor_msgs/msg/Image, decoded raw frames when enabled |
/dji/fov_info | geometry_msgs/msg/Vector3Stamped, zoom factor and estimated horizontal fields of view in degrees |
The Android app reports an 82.6° base visual field of view and uses zoom data from the SDK when available, with a 1× fallback. Treat these values as estimates for this camera configuration.
Mission behavior
ROS 2 clients call mission services on the bridge. Its planner reads and validates a Litchi-style CSV. In live mode it sends the plan and commands as JSON over TCP to Android, where DJI’s WaypointMissionOperator handles execution. Android returns results for the ROS 2 service replies and sends status updates that the bridge publishes under /dji/mission/.
The full dji_bridge.launch.py starts the mission node with the shipped dry_run=false default. An explicit dry run exercises local state transitions and suppresses outgoing mission commands. The node still opens its TCP listener in dry run. Leave the planner out for telemetry-only operation.
For aerial inspection, a generated oblique path can be converted to the planner’s Litchi-style CSV format. The available recordings establish camera and telemetry transport. An end-to-end DJI inspection mission is still unverified.
ROS 2 planner defaults and services · Android waypoint execution
Troubleshooting
- SDK registration fails
- Check that the local app key matches the package ID and that the Android device can reach DJI’s registration service.
- No bridge discovered
- Check Wi‑Fi isolation and the PC firewall. Use the PC’s LAN IP as a manual fallback. Clear the saved override to resume discovery.
- Encoded video only
- Check ROS logs for PyAV, OpenCV and NumPy imports. Use
/dji/image/compressedwith a best-effort subscription to see decoded JPEG frames. - No position fix
- Confirm that the aircraft has a suitable view of the sky, and check the controller’s GNSS and RTK status before interpreting coordinates.
Keep the bridge on a trusted network. The current sockets bind to all interfaces by default and the application protocol does not authenticate peers.
Credits and licensing
Project led by Pantelis Manouselis.
With contributions from Chandan Kumar Rajendra and Hojat, with acknowledgments to Saxion’s SMART research group.
Upstream software and licenses
The controller app is based on DJI’s Android Mobile SDK 4.18 sample. DJI licenses the sample code under MIT and sets separate terms for the Mobile SDK itself. Android sample license and SDK terms
The ROS 2 package declares Apache-2.0 in its package metadata. The reviewed repository revision lacks a standalone license file. ROS 2 package metadata