Command Based Java code deploys but it says no robot code?

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;
  }
}

You’re code is probably crashing. Any logs from driver station? Also u should create 2 differential drivetrain objects. U should create one with 2 arguments, left side motors and right side motors. Since u have multiple motors on each side, u can make the second of each follow the leader. See Using the WPILib Classes to Drive your Robot — FIRST Robotics Competition documentation

Tbh we sometimes have this issue on newly created projects, just copy the src folder onto a new project and it works most of the time.

I tried but it didn’t work either.

I cant copy driver station logs cause when i try they are turning into Chinese. Do you have more understandable links to learn more about Command Based?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.