I tried everything but it does not working. It deploys, code is not giving error but it says “No Robot Code”.
Here is the DriveSubsystem:
package frc.robot.subsystems;
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
import com.ctre.phoenix.motorcontrol.can.WPI_VictorSPX;
public class DriveSubsystem extends SubsystemBase {
private WPI_VictorSPX frontleft = new WPI_VictorSPX(23);
private WPI_TalonSRX frontright = new WPI_TalonSRX(24);
private WPI_VictorSPX backleft = new WPI_VictorSPX(22);
private WPI_VictorSPX backright = new WPI_VictorSPX(25);
private DifferentialDrive m_robotDrive_first = new DifferentialDrive(frontleft, frontright);
private DifferentialDrive m_robotDrive_second = new DifferentialDrive(backleft, backright);
public DriveSubsystem() {
}
@Override
public void periodic() {
}
public void setMotors(double rightXaxis, double leftYaxis) {
m_robotDrive_first.arcadeDrive(rightXaxis * 1, leftYaxis * 1);
m_robotDrive_second.arcadeDrive(rightXaxis * 1, leftYaxis * 1);
}
}
here is the ArcadeDriveCmd
package frc.robot.commands;
import java.util.function.Supplier;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystems.DriveSubsystem;
public class ArcadeDriveCmd extends Command {
private final DriveSubsystem driveSubsystem;
private final double xAxis, yAxis;
public ArcadeDriveCmd(DriveSubsystem driveSubsystem, double xAxis, double yAxis){
this.driveSubsystem = driveSubsystem;
this.xAxis = xAxis;
this.yAxis = yAxis;
addRequirements(driveSubsystem);
}
@Override
public void initialize() {
}
@Override
public void execute() {
driveSubsystem.setMotors(xAxis,yAxis);
}
@Override
public void end(boolean interrupted) {
System.out.println("ArcadeDriveCmd ended!");
}
@Override
public boolean isFinished() {
return false;
}
}
and here is the RobotContainer:
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package frc.robot;
import frc.robot.commands.ArcadeDriveCmd;
import frc.robot.commands.ArmJoystickCmd;
import frc.robot.commands.IntakeSetCmd;
import frc.robot.commands.ShooterSetCmd;
import frc.robot.subsystems.ArmSubsystem;
import frc.robot.subsystems.DriveSubsystem;
import frc.robot.subsystems.IntakeSubsystem;
import frc.robot.subsystems.ShooterSubsystem;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.button.JoystickButton;
import edu.wpi.first.wpilibj.Joystick;
public class RobotContainer {
private final DriveSubsystem driveSubsystem = new DriveSubsystem();
private final ArmSubsystem armSubsystem = new ArmSubsystem();
private final IntakeSubsystem intakeSubsystem = new IntakeSubsystem();
private final ShooterSubsystem ShooterSubsystem = new ShooterSubsystem();
Joystick joystick = new Joystick(0);
public RobotContainer() {
intakeSubsystem.setDefaultCommand(new IntakeSetCmd(intakeSubsystem, false));
ShooterSubsystem.setDefaultCommand(new ShooterSetCmd(ShooterSubsystem, false));
driveSubsystem.setDefaultCommand(new ArcadeDriveCmd(driveSubsystem,joystick.getRawAxis(4), joystick.getRawAxis(1)));
armSubsystem.setDefaultCommand(new ArmJoystickCmd(armSubsystem,joystick.getRawAxis(3) , joystick.getRawAxis(2)));
configureBindings();
}
private void configureBindings() {
new JoystickButton(joystick, 3).whileTrue(new IntakeSetCmd(intakeSubsystem, true));
new JoystickButton(joystick, 4).whileTrue(new ShooterSetCmd(ShooterSubsystem, true));
}
public Command getAutonomousCommand() {
return null;
}
}