Java seems deployed but the driver station says there is no robot code

package frc.robot;

import java.io.IOException;
import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.SpeedController;
//import edu.wpi.first.wpilibj.buttons.Button;
//import edu.wpi.first.wpilibj.buttons.Trigger;
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
//import edu.wpi.first.wpilibj.buttons.JoystickButton;

class Driver extends Buttons {
//Things we want to do: get robot to move with controller, get drive base to work with code
//This should make the robot go forward when joystick goes forward and backwards
public Double Move(Double i){
Double Speed = i;
return Speed;
}
// When Both Triggers are pressed, speed is only half
public void main (Double[] args, SpeedController rightMotor, SpeedController leftMotor) throws IOException {
Joystick Joystick = new Joystick(0);
DifferentialDrive differentialDrive = new DifferentialDrive(leftMotor, rightMotor);
try {
Double Speed = Joystick.getY();
Double Rotate = Joystick.getX();
Move(Speed);
differentialDrive.arcadeDrive(Speed, Rotate, true);
} finally {
differentialDrive.close();
}
}
}
This is the code I was attempting the deploy to our robot to test it out. Whenever I deploy it in Visual Studio it says Build Successful but whenever I go to the Driver Station it says there is no robot code. Also, if there is any errors that will not let the robot be able to drive please point it out. My team is new to java so please help. Thanks to whomever comes with a solution, from 2183 programming team.

To attempt to boil this down, and its partially speculation, but you aren’t initializing the RobotBase class anywhere, so things like the Driver Station and such are never going to be setup or polled, so its likely the flags checked to see if code is present on the rio aren’t setup either.

I’d highly recommend using one of the templates provided in the WPILIB. Check out this page on the ScreenStepsLive site for info on the various robot bases: http://wpilib.screenstepslive.com/s/currentCS/m/java/l/599697-choosing-a-base-class

Please provide more code (ideally as a link to a github project). We have no idea what that “Buttons” superclass is/does, or where this class gets instantiated/called from


This is the repository for the code.
Also I used that RobotBase class and it still has the same issue.

If you’re trying to run this on the Roborio and actually run I would suggest starting from one of the Example or Templates they provide.

There are a lot of errors and sort of mis-steps that you’re taking along the way if you’re trying to ultimately interact with WPILib robot classes.

You can do that from the VS Code Command Palette and choose new project.

1 Like

To add some more pointers:

Our students use the WPI Command Based robot paradigm, but here’s a link to our Github for our on-going code for this year (up to this point, yours will be different as you’re not doing Command-Based programming, but it will give you and idea of what you’ll need for a full robot deployment).

I agree 100% with @NewtonCrosby. You’ll definitely want to start with one of the templates. You’ll find (almost) everything you need here: http://wpilib.screenstepslive.com/s/currentCS/m/java