Skip to content

Session 3: Subsystems, Commands, and the Romi RSL

Today you learn how a command-based robot is organized, and you make the Romi's yellow LED behave like a real robot signal light: solid when the robot is disabled, blinking when it is enabled. The unit tests are already on main. Your job is to write the logic that makes them pass.

๐ŸŽฏ Objectives

By the end of this session you will be able to:

  • Explain what a subsystem is, what a command is, and what the scheduler does with them.
  • Read a class and point to its attributes, its constructor, and its methods.
  • Tell the difference between a static method you call on a class and a method you call on an object.
  • Write an if statement with !, %, and < that returns a boolean.
  • Run unit tests, read a failing test, and make it pass.

โœ… Before you arrive

  • Session 2's branch is pushed. Today starts from a fresh main, which already has Session 2's exercise in it.
  • Mentors: solution/session-2 is merged into main.

๐Ÿ—“๏ธ Agenda

Time Activity Page
0:00 Recap: modes, init, periodic. Questions
0:05 The routine: refresh main, branch yourname/session-3 The Routine
0:15 Command-based robots: subsystems, commands, the scheduler, the Romi's LEDs Command-Based Robots
0:25 Classes and objects: reading SignalLight and RslLogic Classes and Objects
0:35 Booleans and conditionals: the RSL rule in English, then in Java Conditionals
0:45 Exercise: make the RSL tests pass Exercise: The RSL
1:05 Commit, push, stop your Codespace The Routine
1:10 Wrap up: what Session 4 adds. The challenge is for home Challenge: SOS

Mentor pacing note

Write the RSL rule as a truth table on the board before anyone types. Disabled: on. Enabled, first half second: on. Enabled, second half second: off. The code is three lines once the table is right.

๐Ÿงช Exercises

  1. The Routine - refresh main and create yourname/session-3.
  2. Exercise: The RSL - enable the tests, watch them fail, write shouldBeOn, watch them pass, push.

๐Ÿ† Challenge (optional)

SOS - make the red LED flash SOS in Morse code while the robot is disabled. Pure logic, a pin to reconfigure, and a test of your own.

๐Ÿ“š Reference

โญ๏ธ Next session

Session 4 moves to the programming laptops. You write a command that drives the Romi from an Xbox controller, bind buttons to behaviors, and run it all in the WPILib simulator.