Giter Club home page Giter Club logo

robomaster-micropython's Introduction

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

robomaster-micropython's People

Contributors

johniebraaf avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.