DJI Matrice Series PSDK

Introduction

DJI Matrice Series using DJI Onboard PSDK has compatibility with DJI M300, DJI M350 and DJI M30T.

../../_images/DJI_M3002.jpg

Installation

Prerequisites to configure any Xavier/Orin NX/AGX board to connect to PSDK, These steps are only done once

Clone configuration repository to grab the necessary files

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

Disable l4t-device-mode auto start

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

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

Customize the script program

You need to modify the script to use the correct USB-UDC port.

For the AGX:

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

For the NX:

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

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/*

Reboot

Load necessary kernel modules on boot

Append to /etc/modules (ensure the file remains correctly formatted):

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

Test the setup

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

If it works, re-enable the service

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 to configure any Xavier/Orin NX/AGX board to connect to PSDK, These steps are only done every time the board boots up

M300

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

  • Onboard computer = host

  • E-Port = device.

E-Port in device mode
  • On the AGX, connections as shown:

AGX USB connections

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 Use the Type-C port supporting both bulk and usbnet mode

  • Onboard computer = device

  • E-Port = host.

E-Port in host mode
  • On the AGX, connections as shown:

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

Then verify with:

ifconfig

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

M30T

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

  • Onboard computer = device

  • E-Port = host.

E-Port in host mode
  • On the NX, connections as shown:

NX USB connections

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

Then verify with:

ifconfig

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

This leaves both bulk and network mode enabled. You can switch between them by running the appropriate command. In order to connect to the drone, either in bulk or network mode, you need to run the platform with the following JSON parameter values:

.
.
.
 "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"
 }

Install platform package

  • For binary installation, install by running:

sudo apt install ros-humble-as2-platform-dji-psdk
  • For source installation, follow the steps below:

# If you have installed Aerostack2 from sources we recommend to clone the package in the src folder of your workspace otherwise you can clone it in any ROS 2 workspace you want.
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

These are supported control modes:

Control Modes DJI PSDK Platform

Control Mode

Yaw Mode

Reference Frame

Speed

Speed

ENU

Sensors

These are supported sensors:

Sensors 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

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

ros2 launch as2_platform_dji_psdk psdk_wrapper.launch.py

To see all the available parameters, use the ‘-s’ flag to show the description of each parameter in the launch file.