Edit this page on GitHub
Home > Software > Organization

Organization

Introduction

We, like many robotics teams, use an organizational pattern called command-based programming. Our robot code is split among:

For example, this is structure of the YogaBallBot code:

├───commands
│   ├───DriveWithJoystick.java
│   ├───MoveArm.java
│   ├───RollIn.java
│   └───RollOut.java
├───subsystems
│   ├───Arm.java
│   ├───DriveTrain.java
│   └───Roller.java
├───OI.java
├───Robot.java
└───RobotMap.java

RobotMap.java

This creates global integers telling you where each input is. These integers are the values of the port numbers and are used when setting an object to a port.

Command-based

There are two categories extremely important to command-based programming: subsystems and commands. Subsystems are classes that correspond to an actual smaller system of the robot’s hardware. A drive train, an elevator, a shooter, and a claw are examples of subsystems. Commands are like demands for a subsystem to do something specifically. For example, drive forward, raise elevator, shoot balls, and close claw are examples of commands. Commands run either when scheduled or in response to a button press.

Subsystems

Each subsystem has a constructor and these methods:

Commands

Each subsystem has a constructor and these methods:

Command groups

Command groups are complex commands made from a sequence of simpler commands. You can specify the commands to run in some order, with some commands either running at the same time (parallel) or one after the other (sequential).

It is very common for autonomous routines to use command groups to execute a complex series of tasks.

Git

Git is a distributed version control system. GitHub is a website and a free service that hosts git stuff so that people can collaborate on projects. Projects are called repositories. So each of Spartabots’ code projects is in a repository. GitHub puts them all in our organization: SkylineSpartabots.

Reasons we use Git: