From cb6be490a491ddba26d0b5bbb8096f535925ac0c Mon Sep 17 00:00:00 2001 From: Adam Long Date: Tue, 19 Jul 2016 18:19:20 +0000 Subject: [PATCH] added drivebase subsystem and blank command --- .../frc/team2059/robot/commands/Drive.java | 33 +++++++++++++++++++ .../team2059/robot/subsystems/Drivebase.java | 27 +++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 src/org/usfirst/frc/team2059/robot/commands/Drive.java create mode 100644 src/org/usfirst/frc/team2059/robot/subsystems/Drivebase.java diff --git a/src/org/usfirst/frc/team2059/robot/commands/Drive.java b/src/org/usfirst/frc/team2059/robot/commands/Drive.java new file mode 100644 index 0000000..1207c09 --- /dev/null +++ b/src/org/usfirst/frc/team2059/robot/commands/Drive.java @@ -0,0 +1,33 @@ +package org.usfirst.frc.team2059.robot.commands; + +import edu.wpi.first.wpilibj.command.Command; +/** + * + */ +public class Drive extends Command { + + public Drive() { + } + + // Called just before this Command runs the first time + protected void initialize() { + } + + // Called repeatedly when this Command is scheduled to run + protected void execute() { + } + + // Make this return true when this Command no longer needs to run execute() + protected boolean isFinished() { + return false; + } + + // 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() { + } +} diff --git a/src/org/usfirst/frc/team2059/robot/subsystems/Drivebase.java b/src/org/usfirst/frc/team2059/robot/subsystems/Drivebase.java new file mode 100644 index 0000000..d4d21e8 --- /dev/null +++ b/src/org/usfirst/frc/team2059/robot/subsystems/Drivebase.java @@ -0,0 +1,27 @@ +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 Drivebase extends Subsystem { + + CANTalon leftMotorOne = new CANTalon(RobotMap.driveLeftMotorOne); + CANTalon leftMotorTwo = new CANTalon(RobotMap.driveLeftMotorTwo); + CANTalon rightMotorOne = new CANTalon(RobotMap.driveRightMotorOne); + CANTalon rightMotorTwo = new CANTalon(RobotMap.driveRightMotorOne); + + public void initDefaultCommand() { + setDefaultCommand(new Drive()); + } + + public void driveArcade(double x, double y, double z, double sensitivity){ + leftMotorOne.set(-y+(x+z)); + leftMotorTwo.set(-y+(x+z)); + rightMotorOne.set(y+(x+z)); + rightMotorTwo.set(y+(x+z)); + } +} +