Skip to content

JohnieBraaf/Robomaster-Micropython

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DJI Robomaster CAN BUS Controller

This project allows the use of STM32 microcontrollers running micropython to control the Robomaster S1 or EDU.

Only CAN BUS High / Low wires need to be connected to the robot gimbal, replacing the cable leading to the control unit (with the antennas).

Use A STM32 NUCLEO board (ethernet) or PYBD-SF6W (WiFi).

Micropython firmware

The code relies on a patched version of Micropython:

  • Hack for non-extended CAN BUS addresses being filtered. See miropython-bug.
  • Enabled _thread module to allow for REPL debugging while running a uasyncio control loop to switch between CAN RX/TX and network traffic. See enable _thread.

Current firmwares (feel free to request, see boards):

  • bin/firmware_NUCLEO_F767ZI.hex (2020-11-17)
  • bin/firmware_PYBD_SF6.dfu (2020-11-15)

Flashing firmware

For NUCLEO boards:

  • Firmwares can be flashed to the board with STM32CubeProgrammer
  • Use ST-Link usb connection to flash the firmware
  • Use board USB connection to access PYBFLASH

For PYBD boards:

Enter DFU bootloader mode by holding down the USR button, pressing and releasing the RST button, and continuing to hold down USR until the LED is white (4th in the cycle), then let go of USR while the LED is white. The LED will then flash red once per second to indicate it is in USB DFU mode. You can then program the firmware using a DFU programmer, eg dfu-util or pydfu.py.

PYBFLASH

All files except the bin directory to your micro controller FLASH memory. Micropython boards are configured as a USB storage device, so just plug and copy.

Serial connection (for monitoring)

For a serial monitoring:

  • Windows: putty (baudrate 115200)
  • Mac OS X: screen /dev/tty.usbmodem*
  • Linux: screen /dev/ttyACM0

Clients (for control)

A TCP socket server is setup configure IP parameters in main.py. The client.py script can be used from a PC to send commands using the arrows on the keyboard.

TODO

  • Implement complete protocol (see already parsable commands in proc.py)
  • ROS bridge

Credits to robomaster_s1_can_hack project, for inspiring me to create this project

About

Robomaster S1 - Micropython CAN BUS controller

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages