-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDriving.java
More file actions
60 lines (46 loc) · 1.82 KB
/
Driving.java
File metadata and controls
60 lines (46 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package org.usfirst.frc.team6351.robot.commands;
import edu.wpi.first.wpilibj.command.Command;
import org.usfirst.frc.team6351.robot.Robot;
import org.usfirst.frc.team6351.robot.RobotMap;
/**
* An example command. You can replace me with your own command.
*/
public class Driving extends Command {
public Driving() {
// Use requires() here to declare subsystem dependencies
requires(Robot.driveTrain);
}
// Called just before this Command runs the first time
@Override
protected void initialize() {
}
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
double forward = Robot.m_oi.theStickOfJoy.getRawAxis(RobotMap.Controller1_Right_Trigger);
double backward = Robot.m_oi.theStickOfJoy.getRawAxis(RobotMap.Controller1_Left_Trigger);
double speed = backward - forward;
double turn = Robot.m_oi.theStickOfJoy.getRawAxis(RobotMap.Controller1_Left_X_Axis);
Robot.driveTrain.bot.arcadeDrive(speed, turn);
}
// Make this return true when this Command no longer needs to run execute()
@Override
protected boolean isFinished() {
return false;
}
// Called once after isFinished returns true
@Override
protected void end() {
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
@Override
protected void interrupted() {
}
}