Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jonathan #6

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public static class Elevator{
public static final Boolean VOLT = true;
public static final int SAT = 12;
Comment on lines 22 to 23
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These contants names aren't clear, please find more meaningful names.

public static final double TICKS_PER_METER = 2048/(Math.PI*Math.PI*0.066/10);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add units

public static final double OFFSET = 0.03;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add Units

}

}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cntrl+alt+l

20 changes: 10 additions & 10 deletions src/main/java/frc/robot/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
* call.
*/
public final class Main {
private Main() {
}
private Main() {
}

/**
* Main initialization function. Do not perform any initialization here.
*
* <p>If you change your main robot class, change the parameter type.
*/
public static void main(String... args) {
RobotBase.startRobot(Robot::new);
}
/**
* Main initialization function. Do not perform any initialization here.
*
* <p>If you change your main robot class, change the parameter type.
*/
public static void main(String... args) {
RobotBase.startRobot(Robot::new);
}
}
8 changes: 1 addition & 7 deletions src/main/java/frc/robot/Ports.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@
import com.ctre.phoenix.motorcontrol.can.TalonFX;

public class Ports {
public static class Gripper {
public static final int LEFTMOTOR = 0;
public static final int RIGHTMOTOR = 0;
public static final int SOLENOID = 0;

public static final boolean RIGHT_MOTOR_INVERTED = false;
public static final boolean LEFT_MOTOR_INVERTED = false;
}

public static class Controller {
public static final int XBOX_CONTROLLER = 0;
}
Expand Down
156 changes: 78 additions & 78 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,95 +18,95 @@
* project.
*/
public class Robot extends TimedRobot {
private Command m_autonomousCommand;
private RobotContainer m_robotContainer;
private Command m_autonomousCommand;
private RobotContainer m_robotContainer;

/**
* This function is run when the robot is first started up and should be used for any
* initialization code.
*/
@Override
public void robotInit() {
// Instantiate our RobotContainer. This will perform all our button bindings, and put our
// autonomous chooser on the dashboard.
m_robotContainer = new RobotContainer();
}
/**
* This function is run when the robot is first started up and should be used for any
* initialization code.
*/
@Override
public void robotInit() {
// Instantiate our RobotContainer. This will perform all our button bindings, and put our
// autonomous chooser on the dashboard.
m_robotContainer = new RobotContainer();
}

/**
* This function is called every robot packet, no matter the mode. Use this for items like
* diagnostics that you want ran during disabled, autonomous, teleoperated and test.
*
* <p>This runs after the mode specific periodic functions, but before
* LiveWindow and SmartDashboard integrated updating.
*/
@Override
public void robotPeriodic() {
// Runs the Scheduler. This is responsible for polling buttons, adding newly-scheduled
// commands, running already-scheduled commands, removing finished or interrupted commands,
// and running subsystem periodic() methods. This must be called from the robot's periodic
// block in order for anything in the Command-based framework to work.
CommandScheduler.getInstance().run();
}
/**
* This function is called every robot packet, no matter the mode. Use this for items like
* diagnostics that you want ran during disabled, autonomous, teleoperated and test.
*
* <p>This runs after the mode specific periodic functions, but before
* LiveWindow and SmartDashboard integrated updating.
*/
@Override
public void robotPeriodic() {
// Runs the Scheduler. This is responsible for polling buttons, adding newly-scheduled
// commands, running already-scheduled commands, removing finished or interrupted commands,
// and running subsystem periodic() methods. This must be called from the robot's periodic
// block in order for anything in the Command-based framework to work.
CommandScheduler.getInstance().run();
}

/**
* This function is called once each time the robot enters Disabled mode.
*/
@Override
public void disabledInit() {
}
/**
* This function is called once each time the robot enters Disabled mode.
*/
@Override
public void disabledInit() {
}

@Override
public void disabledPeriodic() {
}
@Override
public void disabledPeriodic() {
}

/**
* This autonomous runs the autonomous command selected by your {@link RobotContainer} class.
*/
@Override
public void autonomousInit() {
m_autonomousCommand = m_robotContainer.getAutonomousCommand();
/**
* This autonomous runs the autonomous command selected by your {@link RobotContainer} class.
*/
@Override
public void autonomousInit() {
m_autonomousCommand = m_robotContainer.getAutonomousCommand();

// schedule the autonomous command (example)
if (m_autonomousCommand != null) {
m_autonomousCommand.schedule();
// schedule the autonomous command (example)
if (m_autonomousCommand != null) {
m_autonomousCommand.schedule();
}
}
}

/**
* This function is called periodically during autonomous.
*/
@Override
public void autonomousPeriodic() {
}
/**
* This function is called periodically during autonomous.
*/
@Override
public void autonomousPeriodic() {
}

@Override
public void teleopInit() {
// This makes sure that the autonomous stops running when
// teleop starts running. If you want the autonomous to
// continue until interrupted by another command, remove
// this line or comment it out.
if (m_autonomousCommand != null) {
m_autonomousCommand.cancel();
@Override
public void teleopInit() {
// This makes sure that the autonomous stops running when
// teleop starts running. If you want the autonomous to
// continue until interrupted by another command, remove
// this line or comment it out.
if (m_autonomousCommand != null) {
m_autonomousCommand.cancel();
}
}
}

/**
* This function is called periodically during operator control.
*/
@Override
public void teleopPeriodic() {
}
/**
* This function is called periodically during operator control.
*/
@Override
public void teleopPeriodic() {
}

@Override
public void testInit() {
// Cancels all running commands at the start of test mode.
CommandScheduler.getInstance().cancelAll();
}
@Override
public void testInit() {
// Cancels all running commands at the start of test mode.
CommandScheduler.getInstance().cancelAll();
}

/**
* This function is called periodically during test mode.
*/
@Override
public void testPeriodic() {
}
/**
* This function is called periodically during test mode.
*/
@Override
public void testPeriodic() {
}
}
23 changes: 15 additions & 8 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,37 @@

package frc.robot;

import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandBase;
import edu.wpi.first.wpilibj2.command.button.JoystickButton;
import edu.wpi.first.wpilibj2.command.button.Trigger;
import frc.robot.subsystems.Elevator.Elevator;
import frc.robot.subsystems.Elevator.JoystickPower;
import frc.robot.subsystems.gripper.Gripper;
import frc.robot.subsystems.gripper.commands.Intake;
import frc.robot.subsystems.gripper.commands.Outtake;

import static frc.robot.Ports.Controller.*;
import static frc.robot.Ports.Controller.XBOX_CONTROLLER;

public class RobotContainer {
private final XboxController Xbox = new XboxController(XBOX_CONTROLLER);
private final Trigger lt = new Trigger(() -> Xbox.getTriggerAxis(GenericHID.Hand.kLeft) > 0.3);
private final Trigger rt = new Trigger(() -> Xbox.getTriggerAxis(GenericHID.Hand.kRight) > 0.3);
private final JoystickButton lb = new JoystickButton(Xbox, XboxController.Button.kBumperLeft.value);
private final JoystickButton rb = new JoystickButton(Xbox, XboxController.Button.kBumperRight.value);
private final XboxController xbox = new XboxController(XBOX_CONTROLLER);
private final Trigger lt = new Trigger(() -> xbox.getLeftTriggerAxis() > 0.3);
private final Trigger rt = new Trigger(() -> xbox.getRightTriggerAxis() > 0.3);
private final JoystickButton lb = new JoystickButton(xbox, XboxController.Button.kLeftBumper.value);
private final JoystickButton rb = new JoystickButton(xbox, XboxController.Button.kRightBumper.value);
private final Gripper gripper = Gripper.getInstance();
private final Elevator elevator = Elevator.getInstance();


public RobotContainer() {
configureButtonBindings();
<<<<<<< HEAD
=======

elevator.setDefaultCommand(new JoystickPower(elevator, ()->xbox.getRightY()));
>>>>>>> parent of 86ddd8e... Merge pull request #5 from Galaxia5987/Jonathan
}

//robot will intake when left trigger is held and outtake while right trigger is held
private void configureButtonBindings() {
lt.whileActiveContinuous(new Intake(gripper, 1));
Expand Down
66 changes: 0 additions & 66 deletions src/main/java/frc/robot/subsystems/Elevator.java

This file was deleted.

Loading