Skip to content

This script turns your DJI RC-N1 controller into an Xbox 360 controller so you can use it with your favorite drone simulator

Notifications You must be signed in to change notification settings

pverhaert/DJI_RCN1_for_drone_simulators

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DJI RC-N1 as Xbox 360 Controller

This script turns your DJI RC-N1 controller into an Xbox 360 controller, so you can use it with your favorite drone simulator.

DJI RC-N1 controller with Zaphyr simulator

Installation

  1. Only for Mac users: first install the Xbox 360 Controller driver for your OS version (not tested yet).
  2. Download and install DJI Assistant 2 (Consumer Drones Series)
    This is only needed to install the DJI drivers for the controller.
    IMPORTANT: DO NOT run this script while DJI Assistant 2 is running!
  3. Download and install Python 3.x.x.
  4. Install the required packages for this project: pip3 install vgamepad pyserial python-dotenv colorama.

How to use

  1. Connect your DJI RC-N1 controller to your computer via the USB-C port ON THE BOTTOM PORT (the port between the two joystick holders) of the controller.
  2. Power on the controller.
  3. Run python dji.py from the terminal to start the script.

terminal with SHOW_DEBUG=1 (animated gif)

Working in Windows terminal, debug on

terminal with SHOW_DEBUG=0, perhaps faster

Working in Windows terminal, debug off

From time to time there is bigger lag between measurements, to observe this phenomenon with SHOW_DEBUG=1 there is possibility to set SHOW_GT20=1 and programs shows such situations

Working in Windows terminal, measurement time greater than 20ms

Additionally after stopping program there is deatiles statistics of transfered data and some information about processed packets

Working in Windows terminal, ending statistic

  1. Click Ctrl+C on Windows or Cmd+C on Mac to stop the script.

TIP: test if the controller works with the Gamepad Tester.
Move the joysticks and the Camera Control Dial to see if the buttons are activated.

Customization

Besides the two joysticks, only the Camera Control Dial is accessible through the script.
By default, the Camera Dial is mapped to the A (dial all the way to the left) and B (dial all the way to the right) buttons of the Xbox controller.
In the .env file you can change the Camera Dial mapping.

# possible values for BAUD_RATE are: 9600 (slowest), 19200, 38400, 57600, 115200 (fastest)
# BAUD_RATE is not used, nothing changes for different values, Windows sets everything
BAUD_RATE=921600

#ON/OFF runtime information, 1 show, 0 do not show (default)
SHOW_DEBUG=0

#ON/OFF show situations when time difference between measure packets is > 20 ms, 1 show, 0 do not show (default), works when SHOW_DEBUG = 1
SHOW_GT20=0


# possible values for Xbox controller are:
# A, B, X, Y, START, BACK, LB (left bumper), RB (right bumper), LT (left trigger), RT (right trigger)
CAMERA_RIGHT_BUTTON=B
CAMERA_LEFT_BUTTON=A

# how for to move the camera roller to the left/right before the button is triggered (min 0.1, max 1.0, default 0.2)
CAMERA_ROLL_SENSITIVITY=0.2

Troubleshooting

  1. You have installed the drivers for the controller with DJI Assistant 2 (Consumer Drones Series)?
  2. Your controller is connected to your computer via the USB-C port ON THE BOTTOM of the controller?
  3. Use a good quality USB-C cable (not all cables are capable of data transfer, some of them are from poor quality and maybe the cable is just to long).
    Try different cables or lower the baud rate in the .env file.

If all of the above is correct, you should see the controller as "DJI USB VCOM For Protocol (COMx)" in the device manager of Windows under "Ports (COM & LPT)"
DJI USB VCOM

Simulators tested

Credits

This script is based on the Matsemann/mDjiController script with extra features to customize the mapping of the Camera Control Dial.

Contributors

Change log

1.0.3 (2023-12-23)

  • Added sensitivity setting for Camera Control Dial

1.0.2 (2023-10-06)

  • Simpler and more stable and faster
  • possibility to monitor measure times greater than 20 ms
  • measure of serial speed
  • statistic of transmitted data and distribution of time between measure packets

1.0.11 (2023-08-31)

  • More stable and with position status report.

1.0.1 (2023-07-02)

  • Fallback for Windows 11: port must be configured before it can be used.

1.0.0 (2023-06-20)

  • First release

About

This script turns your DJI RC-N1 controller into an Xbox 360 controller so you can use it with your favorite drone simulator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages