added arm code. probably wont work
This commit is contained in:
parent
77ae642c9b
commit
1542373e40
BIN
src/org/usfirst/frc/team2059/robot/.OI.java.swp
Normal file
BIN
src/org/usfirst/frc/team2059/robot/.OI.java.swp
Normal file
Binary file not shown.
BIN
src/org/usfirst/frc/team2059/robot/.Robot.java.swp
Normal file
BIN
src/org/usfirst/frc/team2059/robot/.Robot.java.swp
Normal file
Binary file not shown.
@ -24,6 +24,7 @@ public class OI {
|
|||||||
}
|
}
|
||||||
// Print log when button 1 pressed
|
// Print log when button 1 pressed
|
||||||
joystickButtons[0][0].whenPressed(new LogEncoder());
|
joystickButtons[0][0].whenPressed(new LogEncoder());
|
||||||
|
// joystickButtons[1][0].whenPressed(new
|
||||||
}
|
}
|
||||||
public Joystick[] getJoysticks() {
|
public Joystick[] getJoysticks() {
|
||||||
return joysticks;
|
return joysticks;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package org.usfirst.frc.team2059.robot;
|
package org.usfirst.frc.team2059.robot;
|
||||||
public class RobotMap {
|
public class RobotMap {
|
||||||
//Drive
|
//Drive
|
||||||
public static int driveLeftMotorOne = 0;
|
public static int driveLeftMotorOne = 1;
|
||||||
public static int driveLeftMotorTwo = 1;
|
public static int driveLeftMotorTwo = 2;
|
||||||
public static int driveRightMotorOne = 2;
|
public static int driveRightMotorOne = 3;
|
||||||
public static int driveRightMotorTwo = 3;
|
public static int driveRightMotorTwo = 4;
|
||||||
public static int driveRightEncoder = 0;
|
public static int driveRightEncoder = 0;
|
||||||
public static int driveLeftEncoder = 1;
|
public static int driveLeftEncoder = 1;
|
||||||
//Arm
|
//Arm
|
||||||
|
Binary file not shown.
BIN
src/org/usfirst/frc/team2059/robot/commands/.Drive.java.swp
Normal file
BIN
src/org/usfirst/frc/team2059/robot/commands/.Drive.java.swp
Normal file
Binary file not shown.
BIN
src/org/usfirst/frc/team2059/robot/commands/.MoveArm.java.swp
Normal file
BIN
src/org/usfirst/frc/team2059/robot/commands/.MoveArm.java.swp
Normal file
Binary file not shown.
@ -1,13 +1,16 @@
|
|||||||
package org.usfirst.frc.team2059.robot.commands;
|
package org.usfirst.frc.team2059.robot.commands;
|
||||||
import org.usfirst.frc.team2059.robot.subsystems.DriveBase;
|
import org.usfirst.frc.team2059.robot.subsystems.DriveBase;
|
||||||
import org.usfirst.frc.team2059.robot.subsystems.EncoderBase;
|
import org.usfirst.frc.team2059.robot.subsystems.EncoderBase;
|
||||||
|
import org.usfirst.frc.team2059.robot.subsystems.MainArm;
|
||||||
import edu.wpi.first.wpilibj.command.Command;
|
import edu.wpi.first.wpilibj.command.Command;
|
||||||
public abstract class CommandBase extends Command {
|
public abstract class CommandBase extends Command {
|
||||||
protected static EncoderBase encoderBase;
|
protected static EncoderBase encoderBase;
|
||||||
protected static DriveBase driveBase;
|
protected static DriveBase driveBase;
|
||||||
|
protected static MainArm mainArm;
|
||||||
public static void init() {
|
public static void init() {
|
||||||
encoderBase = new EncoderBase();
|
encoderBase = new EncoderBase();
|
||||||
driveBase = new DriveBase();
|
driveBase = new DriveBase();
|
||||||
|
mainArm = new MainArm();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// vim: sw=2:ts=2:sts=2
|
// vim: sw=2:ts=2:sts=2
|
||||||
|
32
src/org/usfirst/frc/team2059/robot/commands/MoveArm.java
Normal file
32
src/org/usfirst/frc/team2059/robot/commands/MoveArm.java
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package org.usfirst.frc.team2059.robot.commands;
|
||||||
|
import org.usfirst.frc.team2059.robot.commands.CommandBase;
|
||||||
|
import org.usfirst.frc.team2059.robot.Robot;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class MoveArm extends CommandBase {
|
||||||
|
double speed;
|
||||||
|
public MoveArm(double s) {
|
||||||
|
requires(mainArm);
|
||||||
|
speed=s;
|
||||||
|
}
|
||||||
|
// Called just before this Command runs the first time
|
||||||
|
protected void initialize() {
|
||||||
|
}
|
||||||
|
// Called repeatedly when this Command is scheduled to run
|
||||||
|
protected void execute() {
|
||||||
|
mainArm.moveArm(speed);
|
||||||
|
}
|
||||||
|
// Make this return true when this Command no longer needs to run execute()
|
||||||
|
protected boolean isFinished() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Called once after isFinished returns true
|
||||||
|
protected void end() {
|
||||||
|
}
|
||||||
|
// Called when another command which requires one or more of the same
|
||||||
|
// subsystems is scheduled to run
|
||||||
|
protected void interrupted() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// vim: sw=2:ts=2:sts=2
|
Binary file not shown.
BIN
src/org/usfirst/frc/team2059/robot/subsystems/.MainArm.java.swp
Normal file
BIN
src/org/usfirst/frc/team2059/robot/subsystems/.MainArm.java.swp
Normal file
Binary file not shown.
@ -2,12 +2,12 @@ package org.usfirst.frc.team2059.robot.subsystems;
|
|||||||
import org.usfirst.frc.team2059.robot.RobotMap;
|
import org.usfirst.frc.team2059.robot.RobotMap;
|
||||||
import org.usfirst.frc.team2059.robot.commands.Drive;
|
import org.usfirst.frc.team2059.robot.commands.Drive;
|
||||||
import edu.wpi.first.wpilibj.command.Subsystem;
|
import edu.wpi.first.wpilibj.command.Subsystem;
|
||||||
import edu.wpi.first.wpilibj.Talon;
|
import edu.wpi.first.wpilibj.CANTalon;
|
||||||
public class DriveBase extends Subsystem {
|
public class DriveBase extends Subsystem {
|
||||||
Talon leftMotorOne = new Talon(RobotMap.driveLeftMotorOne);
|
CANTalon leftMotorOne = new CANTalon(RobotMap.driveLeftMotorOne);
|
||||||
Talon leftMotorTwo = new Talon(RobotMap.driveLeftMotorTwo);
|
CANTalon leftMotorTwo = new CANTalon(RobotMap.driveLeftMotorTwo);
|
||||||
Talon rightMotorOne = new Talon(RobotMap.driveRightMotorOne);
|
CANTalon rightMotorOne = new CANTalon(RobotMap.driveRightMotorOne);
|
||||||
Talon rightMotorTwo = new Talon(RobotMap.driveRightMotorTwo);
|
CANTalon rightMotorTwo = new CANTalon(RobotMap.driveRightMotorTwo);
|
||||||
public void initDefaultCommand() {
|
public void initDefaultCommand() {
|
||||||
setDefaultCommand(new Drive());
|
setDefaultCommand(new Drive());
|
||||||
}
|
}
|
||||||
|
17
src/org/usfirst/frc/team2059/robot/subsystems/MainArm.java
Normal file
17
src/org/usfirst/frc/team2059/robot/subsystems/MainArm.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package org.usfirst.frc.team2059.robot.subsystems;
|
||||||
|
import org.usfirst.frc.team2059.robot.RobotMap;
|
||||||
|
import org.usfirst.frc.team2059.robot.commands.Drive;
|
||||||
|
import edu.wpi.first.wpilibj.command.Subsystem;
|
||||||
|
import edu.wpi.first.wpilibj.CANTalon;
|
||||||
|
public class MainArm extends Subsystem {
|
||||||
|
CANTalon armMotorLeft = new CANTalon(RobotMap.armLeftMotor);
|
||||||
|
CANTalon armMotorRight = new CANTalon(RobotMap.armRightMotor);
|
||||||
|
public void initDefaultCommand() {
|
||||||
|
setDefaultCommand(new Drive());
|
||||||
|
}
|
||||||
|
public void moveArm(double speed){
|
||||||
|
armMotorLeft.set(speed);
|
||||||
|
armMotorRight.set(-speed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// vim: sw=2:ts=2:sts=2
|
Loading…
Reference in New Issue
Block a user