DJI Matrice Series PSDK

Introduction

The DJI Matrice Series using DJI Payload PSDK is compatible with DJI M300, DJI M350, and DJI M30T.

DJI Matrice M300

Installation

Prerequisites (One-Time Setup on Xavier/Orin NX/AGX Boards)

1. Clone configuration repository

cd ~
git clone git@github.com:aerostack2/psdk_config_files.git
cd psdk_config_files

2. Disable l4t-device-mode auto start

sudo systemctl disable nv-l4t-usb-device-mode.service

3. Replace system device-mode script

Copy your custom startup script into place and make it executable:

sudo cp ./nv-l4t-usb-device-mode-start.sh \
   /opt/nvidia/l4t-usb-device-mode/nv-l4t-usb-device-mode-start.sh
chmod +x ./nv-l4t-usb-device-mode-start.sh

4. Customize the script

Update the script to use the correct USB-UDC port:

  • For AGX:

    sed -i 's/3550000\.xudc/3550000.usb/g' nv-l4t-usb-device-mode-start.sh
    
  • For NX:

    sed -i 's/3550000\.usb/3550000.xudc/g' nv-l4t-usb-device-mode-start.sh
    

5. Grab bulk-mode program folder

Download and unzip the reference package into ~/Desktop/startup_bulk:

wget https://terra-1-g.djicdn.com/71a7d383e71a4fb8887a310eb746b47f/psdk/e-port/usb-bulk-configuration-reference.zip \
  && unzip usb-bulk-configuration-reference.zip -d startup_bulk \
  && mv startup_bulk/ ~/Desktop/ \
  && chmod +x ~/Desktop/startup_bulk/*

6. Reboot

7. Load necessary kernel modules on boot

Append to /etc/modules (ensure correct formatting):

echo -e "configfs\nlibcomposite\nusb_f_fs\ntegra-xudc" | sudo tee -a /etc/modules

8. Test the setup

cd /opt/nvidia/l4t-usb-device-mode/
./nv-l4t-usb-device-mode-start.sh

9. Re-enable the service (if successful)

sudo systemctl enable /opt/nvidia/l4t-usb-device-mode/nv-l4t-usb-device-mode.service

Now both bulk mode and network mode are configured.

Prerequisites (Every Boot on Xavier/Orin NX/AGX Boards)

M300

Hardware

  • Onboard computer = host

  • E-Port = device

  • Use the Type-C port supporting both bulk and usbnet mode.

E-Port in device mode AGX USB connections (device)

Software

Enable host mode on the onboard computer:

echo host | sudo tee /sys/class/usb_role/usb2-0-role-switch/role

You should now see /dev/ttyACM0 when powering on the drone.

M350

Hardware

  • Onboard computer = device

  • E-Port = host

  • Use the Type-C port supporting both bulk and usbnet mode.

E-Port in host mode AGX USB connections (host)

Software

Enable device mode on the onboard computer:

echo device | sudo tee /sys/class/usb_role/usb2-0-role-switch/role

Bring up the l4tbr0 interface:

sudo ifconfig usb0 192.168.1.1 netmask 255.255.255.0 up

Verify with:

ifconfig

You should see an entry for l4tbr0. If not, repeat the above steps.

M30T

Hardware

  • Onboard computer = device

  • E-Port = host

  • Use the Type-C port supporting both bulk and usbnet mode.

E-Port in host mode NX USB connections (host)

Software

Enable device mode on the onboard computer:

echo device | sudo tee /sys/class/usb_role/usb2-0-role-switch/role

Bring up the l4tbr0 interface:

sudo ifconfig usb0 192.168.1.1 netmask 255.255.255.0 up

Verify with:

ifconfig

You should see an entry for l4tbr0. If not, repeat the above steps.

Note

Both bulk and network mode remain enabled. The link_select parameter in the platform configuration should be use_uart_and_usb_bulk_device for M300 and use_uart_and_network_device for M350 and M30T. To connect to the drone, run the platform with the following JSON parameters:

{
   "dji_sdk_link_config": {
      "link_available": "use_only_uart/use_uart_and_usb_bulk_device/use_uart_and_network_device",
      "link_select": "use_uart_and_network_device",
      "uart_config": {
         "uart1_device_name": "/dev/ttyUSB0",
         "uart2_device_enable": "true",
         "uart2_device_name": "/dev/ttyACM0"
      },
      "network_config": {
         "network_device_name": "l4tbr0",
         "network_usb_adapter_vid": "0x0B95",
         "network_usb_adapter_pid": "0x1790"
      },
      "usb_bulk_config": {
         "usb_device_vid": "0x0B95",
         "usb_device_pid": "0x1790",
         "usb_bulk1_device_name": "/dev/usb-ffs/bulk1",
         "usb_bulk1_interface_num": "2",
         "usb_bulk1_endpoint_in": "0x83",
         "usb_bulk1_endpoint_out": "0x02",
         "usb_bulk2_device_name": "/dev/usb-ffs/bulk2",
         "usb_bulk2_interface_num": "3",
         "usb_bulk2_endpoint_in": "0x84",
         "usb_bulk2_endpoint_out": "0x03"
      }
   }
}

Install Platform Package

Binary installation

sudo apt install ros-humble-as2-platform-dji-psdk

Source installation

# If Aerostack2 was installed from sources, clone into the src folder of your workspace.
cd ~/aerostack2_ws/src/aerostack2/as2_aerial_platforms
git clone git@github.com:aerostack2/as2_platform_dji_psdk.git
cd ~/aerostack2_ws
rosdep install as2_platform_dji_psdk --from-paths src --ignore-src -r -y
colcon build --packages-up-to as2_platform_dji_psdk

Aerostack2 Common Interface

For more details about platform control modes and sensors, see Aerostack2 Aerial Platform Concepts.

Control Modes

Supported Control Modes for DJI PSDK Platform

Control Mode

Yaw Mode

Reference Frame

Speed

Speed

ENU

Sensors

Supported Sensors for DJI PSDK Platform

Sensor

Topic

Type

Odometry

sensor_measurements/odom

nav_msgs/Odometry

IMU

sensor_measurements/imu

sensor_msgs/Imu

Battery

sensor_measurements/battery

sensor_msgs/BatteryState

GPS

sensor_measurements/gps

sensor_msgs/NavSatFix

Camera

sensor_measurements/camera

sensor_msgs/Image

Platform Launch

Aerostack2 provides a launch file for this platform:

ros2 launch as2_platform_dji_psdk as2_platform_dji_psdk.launch.py

Additionally, the ROS 2 PSDK Wrapper must be launched before the platform:

ros2 launch as2_platform_dji_psdk psdk_wrapper.launch.py

To view all available parameters, use the -s flag to show descriptions in the launch file.