Команда Java не вызывается при нажатии кнопки
У меня небольшие проблемы с Java-программой, которую я сейчас пишу для командного робота. Команды, данные программе для запуска при нажатии кнопки джойстика, вообще не выполняются. Кнопки были протестированы для регистрации. Я не очень хорош с Java, и я не уверен, нужна ли для выполнения этих команд подсистема. У них не должно быть никаких зависимостей, так как я только пытался заставить команду вернуть хотя бы оператор print.
ЧАСТЬ ПРОГРАММЫ:
private DifferentialDrive m_robotDrive
= new DifferentialDrive(new Spark(0), new Spark(1));
static Joystick m_stick = new Joystick(1);
private Timer m_timer = new Timer();
static Subsystem ExampleSubsystem;
Command ExampleCommand;
Command CompressCommand;
Command DecompressCommand;
Command OpenClawCommand;
Command CloseClawCommand;
Command CompressorToggleCommand;
public static class OI {
static Button button1 = new JoystickButton(m_stick, 1);
static Button button2 = new JoystickButton(m_stick, 2);
static Button button3 = new JoystickButton(m_stick, 3);
static Button button4 = new JoystickButton(m_stick, 4);
static Button button5 = new JoystickButton(m_stick, 5);
static Button button6 = new JoystickButton(m_stick, 6);
static Button button7 = new JoystickButton(m_stick, 7);
static Button button8 = new JoystickButton(m_stick, 8);
}
// Define Commands for Joystick Buttons
public void OI() {
OI.button1.whileHeld(new CompressorToggleCommand());
OI.button2.whileHeld(new CompressCommand());
OI.button3.whileHeld(new DecompressCommand());
OI.button4.whileHeld(new OpenClawCommand());
OI.button5.whileHeld(new CloseClawCommand());
OI.button6.whileHeld(new ExampleCommand());
OI.button7.whileHeld(new ExampleCommand());
OI.button8.whileHeld(new ExampleCommand());
}
public class Compressor {
Compressor c = new Compressor();
}
public class Solenoid {
Solenoid exampleSolenoid = new Solenoid();
}
ОПЫТНАЯ КОМАНДА:
package org.usfirst.frc.team5621.robot;
import edu.wpi.first.wpilibj.command.Command;
public class CompressCommand extends Command {
public CompressCommand() {
}
// Called just before this Command runs the first time
@Override
protected void initialize() {
}
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
System.out.println("Compressing...");
exampleSolenoid.set(true);
}
// Make this return true when this Command no longer needs to run execute()
@Override
protected boolean isFinished() {
return false;
}
}
Затмение не возвращает ошибок.