Skip to content

Commit

Permalink
added all tutorial projects
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfabroa committed Dec 22, 2017
1 parent 2326d25 commit 4098519
Show file tree
Hide file tree
Showing 696 changed files with 19,604 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path=""/>
<classpathentry kind="output" path=""/>
</classpath>
Empty file added .metadata/.lock
Empty file.
Binary file added .metadata/.mylyn/.taskListIndex/segments_1
Binary file not shown.
Empty file.
1 change: 1 addition & 0 deletions .metadata/.plugins/org.eclipse.cdt.make.core/specs.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions .metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.usfirst.frc.team4001.robot;

/**
* The RobotMap is a mapping from the ports sensors and actuators are wired into
* to a variable name. This provides flexibility changing wiring, makes checking
* the wiring easier and significantly reduces the number of magic numbers
* floating around.
*/
public class RobotMap {
// For example to map the left and right motors, you could define the
// following variables to use with your drivetrain subsystem.
// public static int leftMotor = 1;
// public static int rightMotor = 2;

// If you are using multiple modules, make sure to define both the port
// number and the module. For example you with a rangefinder:
// public static int rangefinderPort = 1;
// public static int rangefinderModule = 1;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package org.usfirst.frc.team4001.robot;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
public class Robot extends IterativeRobot {
Victor LeftDrive = new Victor (3);
Victor RightDrive = new Victor (1);
Victor Shooter = new Victor (0);
Joystick driverstick = new Joystick(0);
Encoder shooterencoder = new Encoder(6, 7, false, Encoder.EncodingType.k4X);
double LeftStickValue;
double RightStickValue;
int shootersetpoint = 2000;// the rpm rate of the shooter encoder
@Override
public void robotInit() {
}
@Override
public void autonomousInit() {
}
@Override
public void autonomousPeriodic() {
}
@Override
public void teleopPeriodic() {
//Drive train tank
LeftStickValue = driverstick.getRawAxis(1);
RightStickValue = driverstick.getRawAxis(5);
LeftDrive.set(-LeftStickValue);
RightDrive.set(RightStickValue);
System.out.println("shooter rpm " + shooterencoder.getRate() + "set" +shootersetpoint);
if((driverstick.getRawButton(4)) && shooterencoder.getRate() > shootersetpoint ) {
Shooter.set(-0.2);
}else if((driverstick.getRawButton(4)) && shooterencoder.getRate() < shootersetpoint ) {
Shooter.set(-.8);
}else{
Shooter.set(0.0);}

}
@Override
public void testPeriodic() {
LiveWindow.run();
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.usfirst.frc.team4001.robot;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
public class Robot extends IterativeRobot {
Victor LeftDrive = new Victor (3);
Victor RightDrive = new Victor (1);
Victor Shooter = new Victor (0);
Joystick driverstick = new Joystick(0);
Encoder shooterencoder = new Encoder(6, 7, false, Encoder.EncodingType.k4X);
double LeftStickValue;
double RightStickValue;
int shootersetpoint = 2000;// the rpm rate of the shooter encoder
@Override
public void robotInit() {
}
@Override
public void autonomousInit() {
}
@Override
public void autonomousPeriodic() {
}
@Override
public void teleopPeriodic() {
//Drive train tank
LeftStickValue = driverstick.getRawAxis(1);
RightStickValue = driverstick.getRawAxis(5);
LeftDrive.set(-LeftStickValue);
RightDrive.set(RightStickValue);
System.out.println("shooter rpm " + shooterencoder.getRate());
if((driverstick.getRawButton(4)) && shooterencoder.getRate() < shootersetpoint ) {
Shooter.set(0.8);
}else{
Shooter.set(0.0);}

}
@Override
public void testPeriodic() {
LiveWindow.run();
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package org.usfirst.frc.team4001.robot;

import edu.wpi.first.wpilibj.AnalogGyro;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;

/**
* This is a sample program to demonstrate how to use a gyro sensor to make a
* robot drive straight. This program uses a joystick to drive forwards and
* backwards while the gyro is used for direction keeping.
*/
public class Robot extends IterativeRobot {
private static final double kAngleSetpoint = 0.0;
private static final double kP = 0.005; // propotional turning constant

// gyro calibration constant, may need to be adjusted;
// gyro value of 360 is set to correspond to one full revolution
private static final double kVoltsPerDegreePerSecond = 0.0128;

private static final int kLeftMotorPort = 0;
private static final int kRightMotorPort = 1;
private static final int kGyroPort = 0;
private static final int kJoystickPort = 0;

private RobotDrive myRobot = new RobotDrive(kLeftMotorPort, kRightMotorPort);
private AnalogGyro gyro = new AnalogGyro(kGyroPort);
private Joystick joystick = new Joystick(kJoystickPort);

@Override
public void robotInit() {
gyro.setSensitivity(kVoltsPerDegreePerSecond);
}

/**
* The motor speed is set from the joystick while the RobotDrive turning
* value is assigned from the error between the setpoint and the gyro angle.
*/
@Override
public void teleopPeriodic() {
double turningValue = (kAngleSetpoint - gyro.getAngle()) * kP;
// Invert the direction of the turn if we are going backwards
turningValue = Math.copySign(turningValue, joystick.getY());
myRobot.drive(joystick.getY(), turningValue);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package org.usfirst.frc.team4001.robot;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
public class Robot extends IterativeRobot {
Victor LeftDrive = new Victor (3);
Victor RightDrive = new Victor (1);
Victor Shooter = new Victor (0);
Joystick driverstick = new Joystick(0);
Encoder shooterencoder = new Encoder(6, 7, false, Encoder.EncodingType.k4X);
double LeftStickValue;
double RightStickValue;
int shootersetpoint = 200;// the rpm rate of the shooter encoder
@Override
public void robotInit() {
}
@Override
public void autonomousInit() {
}
@Override
public void autonomousPeriodic() {
}
@Override
public void teleopPeriodic() {
//Drive train tank
LeftStickValue = driverstick.getRawAxis(1);
RightStickValue = driverstick.getRawAxis(5);
LeftDrive.set(-LeftStickValue);
RightDrive.set(RightStickValue);
System.out.println("shooter rpm " + shooterencoder.getRate());
if((driverstick.getRawButton(4)) && shooterencoder.getRate() < shootersetpoint ) {
Shooter.set(0.8);
}else if((driverstick.getRawButton(4)) && shooterencoder.getRate() > shootersetpoint ) {
Shooter.set(0.0);
}else{
Shooter.set(0.0);}

}
@Override
public void testPeriodic() {
LiveWindow.run();
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package org.usfirst.frc.team4001.robot;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
public class Robot extends IterativeRobot {
Victor LeftDrive = new Victor (3);
Victor RightDrive = new Victor (1);
Victor Shooter = new Victor (0);
Joystick driverstick = new Joystick(0);
Encoder shooterencoder = new Encoder(6, 7, false, Encoder.EncodingType.k4X);
double LeftStickValue;
double RightStickValue;
int shootersetpoint = 2000;// the rpm rate of the shooter encoder
@Override
public void robotInit() {
}
@Override
public void autonomousInit() {
}
@Override
public void autonomousPeriodic() {
}
@Override
public void teleopPeriodic() {
//Drive train tank
LeftStickValue = driverstick.getRawAxis(1);
RightStickValue = driverstick.getRawAxis(5);
LeftDrive.set(-LeftStickValue);
RightDrive.set(RightStickValue);
System.out.println("shooter rpm " + shooterencoder.getRate());
if((driverstick.getRawButton(4)) && shooterencoder.getRate() < shootersetpoint ) {
Shooter.set(0.8);
}else if((driverstick.getRawButton(4)) && shooterencoder.getRate() > shootersetpoint ) {
Shooter.set(0.0);

}else{
Shooter.set(0.0);}

}
@Override
public void testPeriodic() {
LiveWindow.run();
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package org.usfirst.frc.team4001.robot;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
public class Robot extends IterativeRobot {
Victor LeftDrive = new Victor (0);
Victor RightDrive = new Victor (1);
Victor Armmotor = new Victor (2);
Joystick driverstick = new Joystick(0);
double LeftStickValue;
double RightStickValue;
DigitalInput LimitSwitch1 = new DigitalInput(9);
@Override
public void robotInit() {
}
@Override
public void autonomousInit() {
}
@Override
public void autonomousPeriodic() {
}
@Override
public void teleopPeriodic() {
//Drive train tank
LeftStickValue = driverstick.getRawAxis(0);
RightStickValue = driverstick.getRawAxis(1);
LeftDrive.set(-LeftStickValue);
RightDrive.set(RightStickValue);
// Arm motor with limit switch
if(LimitSwitch1.get())
{ Armmotor.set(0.8); }
else if (driverstick.getRawButton(1))
{ Armmotor.set(0.8); }
else if (driverstick.getRawButton(2))
{ Armmotor.set(-0.8); }
else { Armmotor.set(0);}
}
@Override
public void testPeriodic() {
LiveWindow.run();
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package org.usfirst.frc.team4001.robot;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
public class Robot extends IterativeRobot {
Victor LeftDrive = new Victor (3);
Victor RightDrive = new Victor (1);
Victor Shooter = new Victor (0);
Joystick driverstick = new Joystick(0);
Encoder shooterencoder = new Encoder(6, 7, false, Encoder.EncodingType.k4X);
double LeftStickValue;
double RightStickValue;
int shootersetpoint = 200;// the rpm rate of the shooter encoder
@Override
public void robotInit() {
}
@Override
public void autonomousInit() {
}
@Override
public void autonomousPeriodic() {
}
@Override
public void teleopPeriodic() {
//Drive train tank
LeftStickValue = driverstick.getRawAxis(1);
RightStickValue = driverstick.getRawAxis(5);
LeftDrive.set(-LeftStickValue);
RightDrive.set(RightStickValue);
System.out.println("shooter rpm " + shooterencoder.getRate());
if((driverstick.getRawButton(4)) && shooterencoder.getRate() > shootersetpoint ) {
Shooter.set(0.0);
}else if((driverstick.getRawButton(4)) && shooterencoder.getRate() < shootersetpoint ) {
Shooter.set(.2);
}else{
Shooter.set(0.0);}

}
@Override
public void testPeriodic() {
LiveWindow.run();
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package org.usfirst.frc.team4001.robot;

import edu.wpi.first.wpilibj.buttons.Button;

import org.usfirst.frc.team4001.robot.commands.ExampleCommand;

/**
* This class is the glue that binds the controls on the physical operator
* interface to the commands and command groups that allow control of the robot.
*/
public class OI {
//// CREATING BUTTONS
// One type of button is a joystick button which is any button on a
//// joystick.
// You create one by telling it which joystick it's on and which button
// number it is.
// Joystick stick = new Joystick(port);
// Button button = new JoystickButton(stick, buttonNumber);

// There are a few additional built in buttons you can use. Additionally,
// by subclassing Button you can create custom triggers and bind those to
// commands the same as any other Button.

//// TRIGGERING COMMANDS WITH BUTTONS
// Once you have a button, it's trivial to bind it to a button in one of
// three ways:

// Start the command when the button is pressed and let it run the command
// until it is finished as determined by it's isFinished method.
// button.whenPressed(new ExampleCommand());

// Run the command while the button is being held down and interrupt it once
// the button is released.
// button.whileHeld(new ExampleCommand());

// Start the command when the button is released and let it run the command
// until it is finished as determined by it's isFinished method.
// button.whenReleased(new ExampleCommand());
}
Loading

0 comments on commit 4098519

Please sign in to comment.