RoboMaster-SDK

repository·master·Indexed 19 days ago

https://github.com/dji-sdk/robomaster-sdk

A developer kit for the RoboMaster Education Robot that enables programming and control of robotic hardware. The SDK includes modules for networking (robot_connection.py), UART connections, and real-time video and audio liveview using H.264 and Opus decoders. It utilizes pybind11 for C++/Python interoperability and provides sample scripts for direct, network, and USB communication.

Tokens
127.5K
Snippets
402
Records
526
Agent score
62%

What's inside RoboMaster-SDK

  1. Overview of pybind11 for C++/Python interoperability

    master
    pybind11 is a lightweight, header-only library designed to expose C++ types in Python and vice versa. It is primarily used to create Python bindings for existing C++ code. Unlike Boost.Python, it is a compact, self-contained implementation that leverages C++11 features (such as tuples, lambda functions, and variadic templates) to minimize boilerplate code through compile-time introspection. It requires only the C++ standard library and a Python runtime (2.7, 3.x, or PyPy2.7 >= 5.7).
  2. Introduction to Python Programming on RoboMaster EP

    master

    Python programming on RoboMaster EP is performed within the 'App Lab' after connecting to the robot. It uses Python 3.6.6 syntax.

    Key capabilities include:

    • Custom Logic: Write programs that can be deployed as autonomous programs or custom skills.
    • Multi-Robot Communication: Use the multi-robot communication interface to enable real-time interaction between multiple robots.
    • Custom UI System: Design interactive interfaces by writing virtual controls via Python.

    For full implementation details, refer to the official RoboMaster EP Programming Module Manual and the local Python API documentation.

  3. Overview of the Custom UI System

    master

    The Custom UI System allows users to extend the RoboMaster App's input and output capabilities by creating custom UI controls via Python programming.

    Use Cases:

    • Output: Control robot modules (chassis, gimbal, launcher) or visual/auditory feedback (lights, sound effects) based on program logic.
    • Input: Capture user interaction through custom UI controls to trigger program actions, complementing existing inputs like visual recognition, clap detection, armor plate hits, or mobile phone gyroscopes.

    Users write and debug Python programs within the RoboMaster App, generate UI controls, and bind event callbacks. Once tested, these programs can be packaged as 'Custom Skills' for use in single-machine driving or multi-player competitions.

  4. Introduction to the RoboMaster EP Plaintext SDK

    master

    The RoboMaster EP supports a Plaintext SDK that provides control interfaces for various built-in and expansion modules, as well as output interfaces for video and audio streams.

    Users can connect via multiple methods including USB, Wi-Fi, and UART. The SDK enables secondary development and communication with third-party platforms by sending plaintext commands over a TCP/IP connection.

  5. Overview of pybind11

    master
    pybind11 is a lightweight, header-only C++11 library designed to expose C++ types in Python and vice versa. It is primarily used to create Python bindings for existing C++ code. It serves as a modern, compact alternative to Boost.Python, leveraging C++11 features like tuples, lambda functions, and variadic templates to minimize boilerplate through compile-time introspection.
  6. Overview of RoboMaster-SDK

    master
    RoboMaster-SDK is the developer kit for the RoboMaster Education Robot. It provides the necessary interfaces to program and control RoboMaster hardware. For detailed technical documentation and hardware specifications, refer to the official RoboMaster Developer Guide.
  7. Overview of RoboMaster EP Robot Configurations

    master

    The RoboMaster EP Educational Kit is an extension of the RoboMaster S1, designed for enhanced programmability and sensor integration. It can be assembled into two primary robot forms:

    1. Infantry Robot (步兵机器人): Similar in appearance to the standard S1 but features hardware and software upgrades. It includes a sensor adapter module that allows connection to third-party sensors, significantly increasing programmable space.
    2. Engineer Robot (工程机器人): Features a major structural change where a parallel mechanical arm replaces the central gimbal structure. The mechanical arm is equipped with a gripper at the end to perform complex tasks. It retains the video transmission system and offers similar mobility and expansion capabilities to the Infantry robot.
  8. Hardware specifications for Robotic Arm and Gripper

    master

    The Robotic Arm supports precise remote control via FPV. The Gripper is used in conjunction with the arm and supports force control.

    Movement Ranges:

    • Arm Horizontal Movement: 0 to 0.22 meters.
    • Arm Vertical Movement: 0 to 0.15 meters.
    • Gripper Opening Distance: Approximately 10 cm.

    Safety Warnings:

    • Avoid applying external force while the arm or gripper is in operation.
    • Do not collide with or damage the components to prevent servo malfunction.
    • Avoid contact with rotating or sharp parts to prevent injury.
    • Regularly clean debris (e.g., water drops, crystal ball residue) to prevent surface corrosion.
  9. Control robot movement and hardware components

    master

    The SDK provides specialized modules to control various subsystems of the RoboMaster hardware:

    • Movement: robomaster.chassis for base movement and robomaster.flight for aerial movement.
    • Vision & Perception: robomaster.camera (includes TelloCamera and EPCamera), robomaster.vision, and robomaster.armor for detecting specific targets.
    • Manipulation: robomaster.gimbal for camera/weapon orientation, robomaster.gripper for grasping, and robomaster.robotic_arm for arm control.
    • Combat & Interaction: robomaster.blaster for firing mechanisms and robomaster.led for light control.
    • Sensors & Communication: robomaster.sensor for environmental data, robomaster.uart for serial communication, and robomaster.servo for servo control.
  10. Connection methods for RoboMaster SDK

    master

    The RoboMaster SDK supports multiple connection modes to access robot functionality. You can choose between direct connection or network-based connection:

    Direct Connection

    • Wi-Fi Direct: Set the robot to direct connection mode and connect your computing device to the robot's Wi-Fi hotspot.
    • USB Connection: Connect via the USB port on the robot's intelligent control unit (requires the device to support RNDIS).
    • UART Connection: Connect via the UART interface on the robot's motion controller.

    Network Connection

    • Wi-Fi Networking: Set the robot to networking mode and ensure both the robot and your computing device are on the same local area network (LAN).