uwrobotics / MarsRoverFirmware

Firmware for the University of Waterloo Rover Team URC Mars Rover
22 stars 57 forks source link

App structure redesign #408

Closed cindyli-13 closed 2 years ago

cindyli-13 commented 2 years ago

Moving forward, the fw repo will follow our custom modules structure. This PR lays the foundation for writing apps that are based on modules.

Our 2021 rover apps did not follow the modules structure. Some porting effort has been made to transition the 2021 apps to the new modules structure but this effort is currently on hold and may not be completed as our current focus is on developing our 2022 apps. Moving forward, we will not be supporting past apps that do not follow the modules structure.

This PR keeps the 2021 apps buildable under the modules structure, but with little to no actual functionality. The original source code for 2021 apps are still kept for reference as we design our 2022 apps - they will eventually be deleted from master when the modules transition is complete. The branch rover-apps-2021-archive archives all 2021 source code.

FW Modules Structure

All rover apps (eg. apps that get flashed to our rover boards) will be built using the same main.cpp under rover-apps/common/src/main.cpp. main.cpp contains the following generic periodic tasks that are run at their respective rates:

All modules are C++ classes derived from the Module virtual base class under rover-apps/common/include/Module.h.

All rover apps will contain a AppConfig.h header under rover-apps/<app_name>/include that defines the std::vector<Module*> gModules global. gModules is a list of references to all modules that are part of the app. See rover-apps/pdb_2021/include/AppConfig.h for an example.

Modules that are common to multiple rover apps will be placed under rover-apps/common (eg. watchdog, CAN driver). Modules that are specific to a single app are placed under that app's folder: rover-apps/<app_name>.

wmmc88 commented 2 years ago

wow. a pr with a well documented description 😮

cindyli-13 commented 2 years ago

wow. a pr with a well documented description open_mouth

Hopefully people read it XD

cindyli-13 commented 2 years ago

Does std::endl not work?

Otherwise lgtm

Logger doesn't support std::endl at the moment...