-
Notifications
You must be signed in to change notification settings - Fork 1
File Directory Structure
The project folder includes the generated modm files as well as the source and test code.
The modm submodule is included at the root. This is used to generate the necessary modm HALs. The
generated hardware HALs (used for building code to be deployed on the MCB) are located in
aruw-mcb-project/modm
and the generated simulated HALs (used for building code for to be ran on
Linux) are located in aruw-mcb-project/sim-modm
The source code is broken into aruw-mcb-project/src/aruwlib
and aruw-mcb-project/src/aruwsrc
.
aruwlib
is a static library encapsulated in a Drivers
class. This code is meant to be developed
for long term codebase use, independent of robot type. In addition, there are other independent
algorithms and device objects that interact with the Drivers
class. aruwsrc
is control code that
differs from robot to robot and potentially year to year. The test code mirrors the main source
directory with the exception of periphery mocks that are used in unit testing. The directories
aruw-mcb-project/test/aruwlib/mocks
and aruw-mcb-project/test/aruwsrc/mocks
contains mocks of
drivers and control code.
In addition to the main source code, the folder docs
contains tooling for generating doxygen
documents and transfering these to Sphinx for more readable documentation. Also, scripts
contains
python and shell scripts that are either useful for developers or are used during validation.
The .gitlab
folder contains the Dockerfile used to build the CI image as well as tools for
building and publishing it.
Finally, isolated-deploy
contains instructions and tooling for deploying to and MCB, which allows
team members to deploy robot code if they do not have a Linux environment set up. Build artifacts
are produced that any member can download and deploy to a robot.
Here is the project structure. Code in the modm directory is omitted for brevity.
.
|-- COPYING
|-- README.md
|-- scripts
| |-- build_all_targets.sh Builds all robot types, for testing
| |-- check_singleton_drivers.py Script used in CI
| |-- clang-format-all Script to apply clang-format rules to all C/C++ files in a directory
| `-- run_all_unit_tests.sh
|-- docs
| |-- Makefile Used to auto-generate documentation based on comments
| |-- conf.py
| |-- index.rst
| |-- make.bat
| `-- module.rst
|-- isolated-deploy Instructions and tooling necessary for deploying to an MCB without a build environment
| |-- README.md
| `-- openocd.cfg Configuration file included with build artifacts for ease of deploying
|-- .vscode/ Folder that contains VSCode specifications so that we have tools such as text autocomplete
| |-- extensions.json and syntax highlighting.
| |-- launch.json Configuration file used for debugging in VSCode
| |-- settings.json
| `-- tasks.json
|-- .gitlab
| |-- Dockerfile
| |-- Makefile
| |-- README.md
| `-- get-new-version.sh
|-- .clang-format Clang-format configuration file
|-- .devcontainer.json WSL2 container configuration file
|-- .gitignore
|-- .gitlab-ci.yml CI script
|-- modm Submodule
`-- aruw-mcb-project
|-- modm
| `-- ...
|-- SConstruct Main build file
|-- openocd.cfg Openocd configuration
|-- project.xml Used by lbuild to generate modm files
|-- robot-type
| `-- robot_type.hpp Used for specifying a robot type
|-- sim-modm
| |-- modm
| | `-- ...
| `-- project.xml Used by lbuild to generate modm files for simulation
|-- src
| |-- aruwlib
| | |-- Drivers.hpp Main interface for singleton IO in aruwlib
| | |-- DriversSingleton.cpp Declares an instance of the Drivers class, to be used only in main.cpp and *_control.cpp
| | |-- DriversSingleton.hpp
| | |-- SConscript Build file that compiles and creates the aruwlib static library
| | |-- algorithms
| | | |-- MahonyAHRS.cpp Open source IMU attitude calculation algorithm
| | | |-- MahonyAHRS.h
| | | |-- contiguous_float.cpp A float wrapped around some [min, max]
| | | |-- contiguous_float.hpp
| | | |-- crc.cpp
| | | |-- crc.hpp
| | | |-- extended_kalman.cpp
| | | |-- extended_kalman.hpp
| | | |-- linear_interpolation.cpp A time-based interpolation algorithm that predicts a value using two previous values, useful
| | | |-- linear_interpolation.hpp for converting inputs from lower frequency to higher frequency without introducing latency
| | | |-- math_user_utils.cpp Miscellaneous helpful math tools and constants not already defined in cmath
| | | |-- math_user_utils.hpp
| | | |-- ramp.cpp Time-dependent ramping
| | | `-- ramp.hpp
| | |-- architecture
| | | |-- clock.hpp
| | | |-- periodic_timer.cpp A timeout that restarts every time it has been stopped
| | | |-- periodic_timer.hpp
| | | |-- timeout.cpp
| | | `-- timeout.hpp
| | |-- communication
| | | |-- can
| | | | |-- can.cpp
| | | | |-- can.hpp
| | | | |-- can_rx_handler.cpp A singleton responsible for receiving CAN data and forwarding messages to the correct
| | | | |-- can_rx_handler.hpp CanRxListeners
| | | | |-- can_rx_listener.cpp An interface used for interacting with the CanRxHandler
| | | | `-- can_rx_listener.hpp
| | | |-- gpio Wrapper classes around modm GPIO classes to regulate which GPIO pins are used for
| | | | |-- analog.cpp what purpose
| | | | |-- analog.hpp
| | | | |-- digital.cpp
| | | | |-- digital.hpp
| | | | |-- leds.cpp
| | | | |-- leds.hpp
| | | | |-- pwm.cpp
| | | | `-- pwm.hpp
| | | |-- remote.cpp Remote code using UART and timing. modm does not support DBUS, so an interesting
| | | |-- remote.hpp timing mechanism had to be used
| | | |-- sensors
| | | | |-- distance
| | | | | |-- analog_distance_sensor.cpp Interface that defines basics of an analog distance sensor
| | | | | |-- analog_distance_sensor.hpp
| | | | | |-- distance_sensor.cpp Interface that defines basics of a distance sensor
| | | | | |-- distance_sensor.hpp
| | | | | |-- sharp_ir_GP2Y0A41.cpp
| | | | | `-- sharp_ir_GP2Y0A41.hpp
| | | | `-- mpu6500
| | | | |-- mpu6500.cpp I2C blocking communication with the on-board Mpu6500
| | | | |-- mpu6500.hpp
| | | | `-- mpu6500_reg.hpp
| | | `-- serial
| | | |-- dji_serial.cpp Serial interface with a generic serial protocol that supports the referee system
| | | |-- dji_serial.hpp as well as vision system serial
| | | |-- ref_serial.cpp
| | | |-- ref_serial.hpp
| | | |-- serial_test_class.cpp
| | | |-- serial_test_class.hpp
| | | |-- uart.cpp
| | | |-- uart.hpp
| | | |-- xavier_serial.cpp
| | | `-- xavier_serial.hpp
| | |-- control See "Command Subsystem Framework" for more info on this directory
| | | |-- command.cpp A basic control building block, an action that a robot should perform
| | | |-- command.hpp
| | | |-- command_mapper.cpp Singleton that handles the scheduling of commands based on remote input
| | | |-- command_mapper.hpp
| | | |-- command_scheduler.cpp Singleton that manages safe scheduling, resolving scheduling conflicts
| | | |-- command_scheduler.hpp
| | | |-- comprised_command.hpp A command made up of multiple commands
| | | |-- control_operator_interface.cpp An abstraction layer for commands to interact with remote input
| | | |-- control_operator_interface.hpp
| | | |-- subsystem.cpp An organizational unit that encapsulates robot hardware
| | | `-- subsystem.hpp
| | |-- display
| | | |-- sh1106.hpp For communicating with the RoboMaster OLED display
| | | |-- sh1106_defines.hpp
| | | |-- sh1106_impl.hpp
| | | `-- sh1106_mock_impl.hpp
| | |-- errors
| | | |-- create_errors.hpp
| | | |-- error_controller.cpp A singleton that stores all errors and manages blinking LEDs based on
| | | |-- error_controller.hpp which errors are being stored
| | | |-- system_error.cpp Object for storing information about a single error, including line, file,
| | | `-- system_error.hpp description, and error type information
| | |-- motor
| | | |-- dji_motor.cpp Object that stores all information about a particular DJI motor
| | | |-- dji_motor.hpp
| | | |-- dji_motor_tx_handler.cpp Singleton responsible for sending CAN packets across CAN lines for all motors
| | | |-- dji_motor_tx_handler.hpp
| | | |-- servo.cpp PWM wrapper for servo
| | | `-- servo.hpp
| | `-- rm-dev-board-a
| | |-- board.cpp Defines the system clock parameters
| | `-- board.hpp
| |-- aruwsrc
| | |-- algorithms
| | | |-- turret_pid.cpp Configurable PID controller used as a controller for many subsystems such as the turret
| | | `-- turret_pid.hpp and agitator
| | `-- control
| | |-- agitator Control code necessary for interacting with an agitator motor (M2006 or M3510 currently being used)
| | | |-- agitator_calibrate_command.cpp
| | | |-- agitator_calibrate_command.hpp
| | | |-- agitator_rotate_command.cpp
| | | |-- agitator_rotate_command.hpp
| | | |-- agitator_shoot_comprised_command.cpp The main agitator command that handles rotation and unjamming with configurable speed,
| | | |-- agitator_shoot_comprised_command.hpp delay, and unjamming parameters
| | | |-- agitator_shoot_comprised_command_instances.hpp
| | | |-- agitator_subsystem.cpp
| | | |-- agitator_subsystem.hpp
| | | |-- agitator_unjam_command.cpp
| | | `-- agitator_unjam_command.hpp
| | |-- chassis Control code necessary for interacting with a generic chassis
| | | |-- chassis_autorotate_command.cpp
| | | |-- chassis_autorotate_command.hpp
| | | |-- chassis_drive_command.cpp
| | | |-- chassis_drive_command.hpp
| | | |-- chassis_subsystem.cpp
| | | |-- chassis_subsystem.hpp
| | | |-- wiggle_drive_command.cpp
| | | `-- wiggle_drive_command.hpp
| | |-- drone_control.cpp Defines subsystems, commands, and command mappings necessary for drone control
| | |-- engineer Control code necessary for interacting with various engineer mechanism
| | | |-- extend_xaxis_command.cpp
| | | |-- extend_xaxis_command.hpp
| | | |-- grabber_subsystem.cpp
| | | |-- grabber_subsystem.hpp
| | | |-- squeeze_grabber_command.cpp
| | | |-- squeeze_grabber_command.hpp
| | | |-- xaxis_subsystem.cpp
| | | `-- xaxis_subsystem.hpp
| | |-- engineer_control.cpp Defines subsystems, commands, and command mappings necessary for engineer control
| | |-- example Example code demonstrating how to use the subsystem/command framework
| | | |-- blink_led_command.cpp
| | | |-- blink_led_command.hpp
| | | |-- example_command.cpp
| | | |-- example_command.hpp
| | | |-- example_comprised_command.cpp
| | | |-- example_comprised_command.hpp
| | | |-- example_subsystem.cpp
| | | `-- example_subsystem.hpp
| | |-- hero_control.cpp Defines subsystems, commands, and command mappings necessary for hero control
| | |-- hopper-cover Control code necessary for interacting with a hopper cover
| | | |-- hopper_subsystem.cpp
| | | |-- hopper_subsystem.hpp
| | | |-- open_hopper_command.cpp
| | | `-- open_hopper_command.hpp
| | |-- launcher Control code necessary for interacting with friction wheel motors (M3510s)
| | | |-- friction_wheel_rotate_command.cpp
| | | |-- friction_wheel_rotate_command.hpp
| | | |-- friction_wheel_subsystem.cpp
| | | `-- friction_wheel_subsystem.hpp
| | |-- old_soldier_control.cpp Defines subsystems, commands, and command mappings necessary for old soldier (2019 soldier) control
| | |-- robot_control.hpp
| | |-- sentinel Control code necessary for interacting with a sentinel chassis and any other sentinel-specific mechanisms
| | | |-- sentinel_auto_drive_command.cpp
| | | |-- sentinel_auto_drive_command.hpp
| | | |-- sentinel_drive_manual_command.cpp
| | | |-- sentinel_drive_manual_command.hpp
| | | |-- sentinel_drive_subsystem.cpp
| | | `-- sentinel_drive_subsystem.hpp
| | |-- sentinel_control.cpp Defines subsystems, commands, and command mappings necessary for sentinel control
| | |-- soldier_control.cpp Defines subsystems, commands, and command mappings necessary for soldier control
| | `-- turret Control code necessary for interacting with a turret gimbal
| | |-- turret_cv_command.cpp Position-based turret control that takes commands from the vision system
| | |-- turret_cv_command.hpp
| | |-- turret_init_command.cpp
| | |-- turret_init_command.hpp
| | |-- turret_manual_command.cpp Velocity-based turret control
| | |-- turret_manual_command.hpp
| | |-- turret_subsystem.cpp
| | |-- turret_subsystem.hpp
| | |-- turret_world_relative_position_command.cpp Position-based turret control in world frame
| | `-- turret_world_relative_position_command.hpp
| |-- main.cpp Main control loop
| `-- mock_macros.hpp Any macros necessary for simulation/mocking
`-- test
|-- aruwlib
| |-- ...
| `-- mock aurwlib mocks replace drivers class during unit testing
| |-- AnalogMock.hpp
| |-- CanMock.hpp
| |-- CanRxHandlerMock.hpp
| |-- CommandMapperMock.hpp
| |-- CommandSchedulerMock.hpp
| |-- ControlOperatorInterfaceMock.hpp
| |-- DigitalMock.hpp
| |-- DjiMotorTxHandlerMock.hpp
| |-- ErrorControllerMock.hpp
| |-- LedsMock.hpp
| |-- Mpu6500Mock.hpp
| |-- PwmMock.hpp
| |-- RefSerialMock.hpp
| |-- RemoteMock.hpp
| |-- UartMock.hpp
| `-- XavierSerialMock.hpp
`-- aruwsrc
|-- control
| `-- ...
`-- mock aruwsrc mocks used in leu of subsystems/commands during testing
|-- ...
`-- FrictionWheelSubsystemMock.hpp`
This wiki is specific to the RoboMaster robotics competition open source software award. Refer to our GitLab wiki instead if you would like to contribute.
Compilation and Installation
Block Diagrams
Theoretical Support Analysis
Software Architecture or Hierarchy Diagram
Embedded Debugging Tools
Miscellaneous