Skip to content

Commit

Permalink
test code addded (debugging)
Browse files Browse the repository at this point in the history
  • Loading branch information
amina7mona committed Feb 27, 2024
1 parent 020c344 commit ac2fe69
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 17 deletions.
33 changes: 21 additions & 12 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
import frc.robot.commands.manualCommands.RunRevUP;
import frc.robot.commands.manualCommands.RunTrack;
import frc.robot.commands.manualCommands.RunWrist;
import frc.robot.commands.manualCommands.testtest;
import frc.robot.subsystems.Indexer;
import frc.robot.subsystems.Intake;
import frc.robot.subsystems.LEDs;
import frc.robot.subsystems.Pivot;
import frc.robot.subsystems.Shooter;
import frc.robot.subsystems.Trolley;
import frc.robot.subsystems.Wrist;
import frc.robot.subsystems.test;


/**
Expand All @@ -43,18 +45,20 @@ public class RobotContainer {
private final LEDs m_Leds = new LEDs();
private final Indexer m_Indexer = new Indexer();
private final Joystick joy = new Joystick(0);


private final JoystickButton INTAKE_MANUAL_BUTTON = new JoystickButton(joy, PS5Controller.Button.kR2.value);
private final JoystickButton INTAKE_SENSORS_BUTTON = new JoystickButton(joy, PS5Controller.Button.kR1.value);
private final JoystickButton FIRE_BUTTON = new JoystickButton(joy, PS5Controller.Button.kCircle.value);
private final JoystickButton IDLE_FIRE_BUTTON = new JoystickButton(joy, PS5Controller.Button.kTouchpad.value);
private final JoystickButton TRACK_UP = new JoystickButton(joy, PS5Controller.Button.kR3.value);
private final JoystickButton TRACK_DOWN = new JoystickButton(joy, PS5Controller.Button.kL3.value);
private final JoystickButton WRIST_UP = new JoystickButton(joy, PS5Controller.Button.kCross.value);
private final JoystickButton WRIST_DOWN = new JoystickButton(joy, PS5Controller.Button.kSquare.value);
private final JoystickButton PIVOT_UP = new JoystickButton(joy, PS5Controller.Button.kL1.value);
private final JoystickButton PIVOT_DOWN = new JoystickButton(joy, PS5Controller.Button.kL2.value);
private final test m_Test = new test();


// private final JoystickButton INTAKE_MANUAL_BUTTON = new JoystickButton(joy, PS5Controller.Button.kR2.value);
// private final JoystickButton INTAKE_SENSORS_BUTTON = new JoystickButton(joy, PS5Controller.Button.kR1.value);
// private final JoystickButton FIRE_BUTTON = new JoystickButton(joy, PS5Controller.Button.kCircle.value);
// private final JoystickButton IDLE_FIRE_BUTTON = new JoystickButton(joy, PS5Controller.Button.kTouchpad.value);
// private final JoystickButton TRACK_UP = new JoystickButton(joy, PS5Controller.Button.kR3.value);
// private final JoystickButton TRACK_DOWN = new JoystickButton(joy, PS5Controller.Button.kL3.value);
// private final JoystickButton WRIST_UP = new JoystickButton(joy, PS5Controller.Button.kCross.value);
// private final JoystickButton WRIST_DOWN = new JoystickButton(joy, PS5Controller.Button.kSquare.value);
// private final JoystickButton PIVOT_UP = new JoystickButton(joy, PS5Controller.Button.kL1.value);
// private final JoystickButton PIVOT_DOWN = new JoystickButton(joy, PS5Controller.Button.kL2.value);
private final JoystickButton TEST_BUT = new JoystickButton(joy, PS5Controller.Button.kCircle.value);

/** The container for the robot. Contains subsystems, OI devices, and commands. */
public RobotContainer() {
Expand Down Expand Up @@ -110,6 +114,11 @@ private void configureButtonBindings() {
// PIVOT_UP.whileTrue(new RunCommand(() -> m_Pivot.pivot(0.4)));

// PIVOT_DOWN.whileTrue(new RunCommand(() -> m_Pivot.pivot(-0.4)));


//TEST_BUT.whileTrue(new testtest(m_Test));
TEST_BUT.whileTrue(new RunCommand(() -> m_Test.testIN()));
TEST_BUT.whileFalse(new RunCommand(() -> m_Test.testSTOP()));
}
/**
* Use this to pass the autonomous command to the main {@link Robot} class.
Expand Down
40 changes: 40 additions & 0 deletions src/main/java/frc/robot/commands/manualCommands/testtest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// 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.commands.manualCommands;

import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystems.test;

public class testtest extends Command {
/** Creates a new testtest. */
private final test m_test;

public testtest(test m_Test) {
// Use addRequirements() here to declare subsystem dependencies.
this.m_test = m_Test;
}

// Called when the command is initially scheduled.
@Override
public void initialize() {}

// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
m_test.testIN();
}

// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {
m_test.testSTOP();
}

// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}
17 changes: 12 additions & 5 deletions src/main/java/frc/robot/subsystems/test.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@

/** Add your docs here. */
public class test extends SubsystemBase{
private CANSparkFlex intakeMotor;
private CANSparkFlex testMotor;
public test(){
intakeMotor = new CANSparkFlex(Constants.IntakeConstants.INTAKE_MOTOR_ID, MotorType.kBrushless);
intakeMotor.setIdleMode(IdleMode.kCoast);


testMotor = new CANSparkFlex(Constants.IntakeConstants.INTAKE_MOTOR_ID, MotorType.kBrushless);
testMotor.setIdleMode(IdleMode.kCoast);
}
public void testIN(){
testMotor.set(0.2);
}
public void testOUT(){
testMotor.set(-0.2);
}
public void testSTOP(){
testMotor.set(0);
}
}

0 comments on commit ac2fe69

Please sign in to comment.