Intro to FRC Programming - Romi
  • INTRODUCTION
    • Overview
    • Important Links
  • đź’˝Setup
    • Setting up the Romi's Software
    • Downloading Essential Tools
    • APCS vs FRC
  • How To Code in VSC
    • VSC- Intro
    • A Tour Through VSC
    • Creating a Regular Java Project
  • Intro to Java
    • What is Java?
    • Beginning Steps
    • đźź©Fundimentals of Java
      • Variables
      • Operations
      • Methods
      • Comments
      • If Statements and Conditions
      • Boolean Zen
      • Loops
      • Challenge- Create a Box House
    • 🟨Advanced Concepts
      • Objects
      • Scanners
      • Null Objects
      • Arrays
      • Errors
      • For-Each Loops
    • 🟥Object Oriented Programming
      • Basics of OOP
      • Instance Classes
      • Static Classes
  • đź•‘Romi Curriculum- Timed Base
    • Romi Curriculum- Introduction
    • Creating a WPILIB Project
    • Running Your Code
    • The Robot Class
    • Subsystems
      • RomiDrivetrain
    • Cool stuff i will rename this category later
      • Spark Motors
      • PIDs
      • External Controllers
      • Encoders
  • 🖥️Romi Curriculum- Command Based
    • Command Based Code
    • RobotContainer
    • Commands
    • CommandScheduler
  • UNRELATED IMPORTANT CODING KNOWLEDGE
    • Constants
  • SAMPLE CODE
    • Tank Drive Example
      • RobotContainer
      • TankDriveSubsystem
      • MoveRobotCommand
    • Worktop Systems Sample Java Code
      • Belt Elevator Sample Code
      • Rotating Arm Sample Code
Powered by GitBook
On this page
  1. Romi Curriculum- Timed Base

The Robot Class

PreviousRunning Your CodeNextSubsystems

Last updated 1 month ago

Welcome to the backbone of the robot— the Robot class! Without this class, your robot literally won't do anything.

If you look at it for a bit, you might notice that it's packed with methods. You might also notice that their names end in either Init() or Periodic(). You might also notice that they all have some state in front of them, like Autonomous or Teleop.

If you know a little bit about FRC/FTC competitions, you might know about the different stages of the game— Autonomous, Teleop, and whatever. You also might notice that some of these methods begin with this stuff. Interesting. All of these methods can run depending on the state of the robot.

Methods that end with Init() run only when the robot just switched to that state (for example- when a robot switches from auto to teleop, TeleopInit() will be called)

Method names that end with Periodic() run while that robot is still in that state (ex: during Teleop, TeleopPeriodic() will be ran)

Here is a list of states you'd probably need to use.

  • Robot— runs while the robot is powered.

  • Auto— runs during the Autonomous period of a match

  • Teleop— runs during the TeleOperated period of a match

  • Disabled— runs when the robot is disabled (safety stop and stuff)

  • Test + Simulation— run when Test and Simulation modes are ran

If you're wondering what Test and Simulation are for, they're just extra modes you can turn on through WPILIB's Command Palette (basically just a list of cool commands you can do).

Exploration— Adding Code to Your Robot

Let's try something. Let's write some code iforn the robot!

All you'll need is:

Yes, I know this is boring. However- this is exactly how I learned how to use these methods. Just screw around, sticking whatever in each method and changing the Robot's

đź•‘
a screenshot of WPILIB's command palette