Deploying Starter Code
More documentation on connecting to the robot and deploying code can be found here . This page contains Everybot-specific information.
Before enabling the robot with code for the first time, put it up on 2x4s or other “blocks” so that the wheels and drive belts are not touching anything and it will not move or run anybody or anything over. When you are confident the drive system is working properly, you can try running it on the floor.
Ensure you have followed the previous steps and have the necessary software installed and hardware configured Download a ZIP file of the 2024 Everybot code here
Unzip the file and move it to a location you will remember like the desktop. Open up WPILib VS Code In the “File” menu, click “Open Folder…” and select the folder you extracted. This folder should contain the folders .vscode, .wpilib, gradle, src, and vendordeps. You may need to incidate that you trust the authors of these files before you can edit and use them Click on the “W” in a hexagon in the upper right corner of the screen and search for “set team number”. Set the number to your team’s number (the same number used when you set up the roboRIO and radio) The actual code for the robot is in the file Robot.java. This file can be found by clicking into the src/main/java/frc/robot folder path in the file manager to the left of the main window. Check that this file does contain the robot code. Ensure the robot is wired and the Spark Max CAN IDs have been assigned. Power on the robot and wait for it to boot up, joining the Wifi network with your team’s number when it appears. Alternately, connect directly to the robot with a USB printer cable or Ethernet cable (this is required at competition where the radios are reprogrammed to only communicate with the field). Deploy the robot code. Click the “W” again and search for “deploy robot code”. This will take longer the first time you do it, and any errors that WPILib encounters will appear in the terminal at the bottom of the screen.If you encounter an error about not being able to communicate with the robot or roboRIO, check that all of the control system is receiving power and change connection methods (switch to a USB or Ethernet cable). If there is an error about code compiling, check that the code was properly downloaded and extracted.
If you are using one laptop to program and drive the robot, open the FRC Driver Station software installed as part of FRC Game Tools previously. If you have a different driver laptop, disconnect the programming laptop and connect the driving laptop to the robot’s wireless network instead and open the FRC Driver Station on that computer. If this is your first time opening the driver station, you will need to set your team’s number. Click the settings gear in the lower left corner and set the team number. The driver station will likely say “No Robot Communication” when it first opens. If the robot is connected properly, this should change to “Tele-op Disabled” after a short time, and the communication and robot code indicators should change from red to green. This may take a minute or two, but if you have been waiting for five or so minutes there is probably a connection problem. Try connecting directly to the robot with a USB or Ethernet cable. Connect whatever USB controllers your team wishes to use to control the robot to the driver station laptop (some are provided in the Rookie Kit of Parts, but XBox or other wired controllers can also be used). Click on the USB symbol in the lower left hand corner and you should see a list of connected USB controllers. Pressing a button on a controller will show which number it has been assigned.
The default Everybot code desires two controllers. By default the controls are set up for the two Logitech controllers included in the Rookie Kit of Parts. XBox and PlayStation style controllers use different axis and button mappings and may cause the robot to move unexpectedly if used without modifying the provided code.
The driver controller uses axis 1 (up and down on the left stick) to move forwards/backwards and axis 4 (left and right on the right stick) to turn left/right.
The other controller, for the “operator”, controls the mechanisms. The Logitech controller buttons are indexed from 1, not zero, with raw button 1 (A on the Logitech) used to spin up the launcher wheel and button 6, the right bumper (button above the right trigger) to feed the Note into the spinning launcher wheel. Button 5, the left bumper, is used to intake Notes into the launcher. Button 2, the B button on the Logitech controller, is used to spit a Note in the launcher out onto the floor. Buttons 3 and 4 (X and Y on the Logitech) are used to power the roller claw in and out, with the buttons powering it in opposite directions. POV down and up (also called 0 & 180, the “POV” control is more commonly referred to as the D-Pad or directional pad. It can be pushed any cardinal or intermediate direction) will move the climber up and down. Click back to the steering wheel tab in the left hand side of the driver station window. This main tab has controls for “enabling” the robot. Enabling is the process for starting the main sections of your robot code that allow it to actually respond to controls and do things. There are also options to test specifically the autonomous modes as well as run a complete “practice” match with a timed autonomous mode that then transitions to teleoperated before disabling the robot at the end of the match period. Make sure nobody is touching the controls and that everyone is clear of the robot. It is good practice to say “Enabling!” before enabling the robot so that people around know that the robot is going to begin moving soon and to stay out of the way. The orange Robot Signal Light should begin blinking. The number 0 controller should have control over the drivetrain. Carefully push the stick forward and see if the robot’s wheels run forwards. Check that the launcher and other mechanisms are working properly. If motors are spinning in the wrong direction, look at the code in WPILib and change the “inverted” settings for the relevant motors (see the comments in the code for more information). If motors are not moving at all, make sure they have the correct CAN IDs and check if the motors are plugged in properly. The lights on the motor controllers will go from blinking to solid when getting a “0” signal and then blink red when told to reverse and green when told to go forward. If the lights do not change color, there is probably a problem with the communication wiring. If the lights do change colors but the mechanisms are not running, there may be a problem with the wiring going to the motor or a mechanical issue with the gearbox or mechanism. If the motor controllers have no lights at all, they probably are not receiving any power. Check that there are breakers inserted into the relevant slots in the PDP/PDH. After testing out teleoperated (normal human-controled) mode, try out the pre-programmed autonomous mode. Select the autonomous mode in the driver station. This can be done via the smartdashboard, select the radio button that corresponds to the desired auto.
Enable the robot in autonomous mode to see if it functions correctly (try it up on blocks first). The score auton will only run the launcher, the back up auton will back the robot up, and the launch and back up auton will do both. The do nothing auton does nothing. Try out adjusting some of the auton time settings in the code (you will have to redeploy code every time you make a change) and see how they affect how long and far the auton runs. You may need to adjust autons before matches based on what you and your alliance partners want to get done in auton for a particular match.
If you look carefully at the code and the comments included, you should be able to see how the autonomous routines are written and how your team can modify the existing ones or add new ones. More complex autonomous routines may benefit from encoders, gyroscopes, or other navigational sensors.