Skip to content
🌪️ An extensible task-based robot control system on embedded platforms made for SJTU RoboMaster Competition (STM32 + OpenSTM32)
C++ CMake C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
.settings
Drivers
Inc
Src-CAH
Src
startup
.cproject
.gitattributes
.gitignore
.gitmodules
.mxproject
.osx.project
.project
CMakeLists.txt
CMakeLists_template.txt
Hurricane Run.cfg
Hurricane.ioc
Hurricane.xml
LICENSE
README.md
STM32F427IIHx_FLASH.ld

README.md

banner

Hurricane

Hurricane Robot Control System for SJTU RoboMaster Competition

This project is generated with STM32CubeMX and built with CMake.

This project depends on CAHRR. CAHRR (Chi's Advanced Hurricane Robot Runtime) is a well-tested yet simple library which defines modules such as tasks and contains many utility classes for this project. It can be integrated into any project.

Structure

All directory except Src-CAH are generated by STM32CubeMX.

Src/runtime contains Dajiang official code.

We've made changes to Src/stm32f4xx_it.c and main.c, to redirect interrupts to Hurricane system and bootstrap the Hurricane control system.

Systems

  • HurricaneArmSystem - control two arms of our robot
  • HurricaneCANSystem - control CAN devices
  • HurricaneChassisSystem - control chassis
  • HurricaneClawSystem - control claw, which is built with potentiometer and pwm motor
  • HurricaneClawSystem - control claw for collecting buff and elevator for the claw
  • HurricaneCollectorSystem - control ball collector, which is built with servo
  • HurricaneDebugSystem - transmit debug information
  • HurricaneGPIOSystem - process GPIO interrupts
  • HurricaneIMUSystem - get gyro data
  • HurricaneRemoteSystem - get data from Dajiang joystick
  • HurricaneUltrasonicSystem - get data from 4 ultrasonic sensors while preventing interference. We didn't use those sensors in final competition and therefore deleted these parts. These changes can be found in code history.

Tasks

  • ArmTask - control arm
  • TimedTask - timing task on STM32
  • MainSwitchTask(s) - joystick switch control
  • SaveDriveTask - control chassis when saving other robots
  • ServoTask - control servo of ball collector
  • TankDriveTask - control chassis

In particular, MainTask

Task *mainTask() {
    return new ParallelTask(std::vector<Task *>({
            new LeftSwitchNone(
                    nullptr,                                     // [1]
                    new RightSwitchBottom(
                            new LeftSwitchBottom(
                                    new LeftSwitchTop(
                                            new TankDriveTask,   // [4]
                                            nullptr
                                    ),
                                    new SaveDriveTask            // [3]
                            ),
                            new ArmTask                          // [2]
                    )

            ),
            new RightSwitchTopTrigger(                           // [5]
                    new CollectorCloseTask,
                    new CollectorOpenTask)
    }));
}

Tasks are organized like a tree in CAHRR. They are processed and executed in the following sequence

[1] If joystick is not connected, do nothing.
[2] If right switch is switched to bottom, control arm.
[3] If left switch is switched to bottom, control chassis in save mode.
[4] If left switch is switched to middle, control chassis
[5] If right switch is switched to top, open or close the collector.

Models

  • Arm, ArmBottom, ArmTop - PID control of different arms
  • ArmBase - PID control of arm base

Other things

  • OI - pack all systems and bootstrap tasks
  • HAL - include all HAL libraries

Building

You can deploy the project with CLion and STM32 plugin.

License

MIT

SJTU RoboMaster Competition

We won the eighth place in the first SJTU (Inter-Campus) RoboMaster Competition. Here's our chaotic robot.

mr4js8y7rrgl0apwn7sytq_thumb_5d22 byvrruayqjucbo0 yjd6pw_thumb_5d21

I personally would like to thank Shaofei Qin and SJTU RoboMaster Team for their open-source project RM_frame. Without them there won't be Hurricane and CAHRR. I learned a lot through the building of this project on embedded system STM32.

You can’t perform that action at this time.