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
  • Setting up the Romi
  • Connecting to the Romi
  • Simulating the Romi
  1. Romi Curriculum- Timed Base

Running Your Code

PreviousCreating a WPILIB ProjectNextThe Robot Class

Last updated 1 month ago

Running your code is different from running a regular Java Project.

Setting up the Romi

To simulate the program, you have to first set up a few things. First off, you have to turn on your Romi. You can do this by flicking the switch on the side of the hardware on the Romi. Once you flick the switch, the lights should turn on around the hardware.

To turn the Romi off, flick the switch and then press the button next to it in the corner. The lights on the robot should turn off signaling that you turned it off correctly.


Connecting to the Romi

Before running the program, you have to first connect to the Romi. To do this, you should have the Romi turned on already. Then, go to your WiFi settings and select your Romi's WiFi network (This part of the Romi should be set up and you should know the network name and password). After that is done you are ready to start simulating your program on the Romi.

After connecting to the Romi, your internet connection will disappear. This is because your WiFi is solely connected to the Romi and the Romi doesn't have access to the internet leading to all devices connected to the Romi losing internet connection.


Simulating the Romi

Now that you're connected to the Romi via WiFi. You can start stimulating code. So for now let's make a simple program that goes straight when in Autonomous mode. To do this, use the m_drivetrain object (that RomiDrivetrain class) in the Robot.java class to access the go() method inside the autonomousPeriodic() method. Put the parameters 1 and 1 into the go() method to make it go straight.

Now that you finished making the program, open the command palette and select the option "WPILIB: Simulate Robot Code". After selecting the command, some processing will happen (shown in the console) before a new window opens up, This is the Simulation Interface.

The Simulation Interface is the window that will help you use the Romi while the code is being run. Here is a diagram of everything in the window.

Here is what each thing is in detail:

  • Robot State Changer: Allows you to change the state/mode of the robot (These are the modes of the different methods in the Robot class).

  • Connected Devices: shows what devices are connected to your computer such as controllers or keyboards.

  • Controller Readings: Shows what devices (mostly controllers) are being used and what readings are they returning.


Now that you know how the simulation interface works. Run/Simulate the program with the new code we added to the Robot class and switch the mode to Autonomous mode. If done correctly, your Robot should start going straight once you switch to the Autonomous mode.

Now that the program works, you can stop it from running. To do this properly, click on Workspace in the top left corner then click Exit. This should delete the window and stop the program.

Now that you know how to run the program, you can test future methods and systems in the course.

🕑
Switch location on the Romi
Drawing
Drawing
Drawing