Overview of the Software Structure
The robot software is based on the TimedRobot class which provides the framework for executing robot functions according to the mode (disabled, teleop, autonomous). The Main class in the program only creates the Robot object and starts it up. This code does not need to be modified.
In the Robot class we can define functions that are called once when entering each mode or periodically during the mode. This is also where the RobotContainer object is created and Data Logging is started.
The RobotContainer creates the individual Subsystems of the robot, sets default commands for those subsystems and sets up actions to perform when different buttons on the operator_interface_controllers are pressed. The command to run in autonomous_mode is also set here.
The following example shows snippets of the code including the creation of the drive subsystem, setting the default drive command and setting an arm subsystem command to run when a button is pressed.
References:
https://docs.wpilib.org/en/stable/docs/software/vscode-overview/creating-robot-program.html
https://docs.wpilib.org/en/stable/docs/software/commandbased/structuring-command-based-project.html


Discussion