Field Value
Research agenda item UTIL.01
Short title Robot self-test library
Extended title Develop a library for automating pre-match self-tests of common FRC mechanisms

Additional requirements

The self-testing library should feature user-definable pass/fail criteria.

Impact

Pre-match checklists are commonplace in FRC. However, it’s still possible for people to accidentally skip critical pre-match checks, and as a result, leave room for preventable errors before taking the field.

Every match counts towards a team’s ranking, and it’s vitally important that the team knows the robot is working at full potential before playing the match. An automated testing library for an FRC robot would remove room for human mistakes, allow for more in-depth testing, and give teams more confidence that their robot will work as expected on-field.

Priority

While matches do not resume for several months, this could be a critically important application for teams come 2022.

Software testing is extremely commonplace and there are lots of ways to do it. We recommend utilizing the testPeriodic function (and associated Test Mode functions) made available through WPILib.

JUnit is the most common testing framework for Java. You may want to integrate it.

A pseudocode implementation of an elevator may be:


public class Robot extends TimedRobot {
    // ...
    Elevator m_elevator = new Elevator();

    public void testPeriodic() {
        RobotTestSuite rts = new RobotTestSuite();

        rts.when(new ElevatorGoToHeight(100)) // given a command
            .isRun(() => {
                rts.expect(m_elevator::getCurrentDraw).toPeakAt(30);
            })
            .isCompleted(() => {
                rts.expect(m_elevator::getHeight).toRoughlyEqual(100);
            });
    }
}


Prior art

FRC 254 has implemented a check system previously.