-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRobotOperation.java
More file actions
94 lines (76 loc) · 2.12 KB
/
RobotOperation.java
File metadata and controls
94 lines (76 loc) · 2.12 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package org.scotsbots.robotbase;
import org.scotsbots.robotbase.utils.Gamepad;
import edu.wpi.first.wpilibj.PIDController;
import edu.wpi.first.wpilibj.PIDOutput;
import edu.wpi.first.wpilibj.PIDSource;
import edu.wpi.first.wpilibj.PIDSourceType;
import edu.wpi.first.wpilibj.Timer;
/**
* Static class for basic robot operation calls.
* @author Domenic
*
*/
public class RobotOperation
{
public static PIDController encoderControl = new PIDController(.1, .003,0, new PIDSource()
{
@Override
public void setPIDSourceType(PIDSourceType pidSource)
{
// TODO Auto-generated method stub
}
@Override
public PIDSourceType getPIDSourceType()
{
// TODO Auto-generated method stub
return null;
}
@Override
public double pidGet()
{
// TODO Auto-generated method stub
return 0;
}
}, new PIDOutput()
{
public void pidWrite(double d)
{
Robot.bot.drivetrain.tankDrive(-d * 0.66, -d * 0.66);
}
});
/**
* Drives tank drive.
* @param joystickSet 0 - Only gamepads, 1 - attacks and gamepad
*/
public static void driveTank(int joystickSet)
{
driveTank(joystickSet, 1);
}
/**
* Drives in tank, multiplies speed by speed ratio.
* @param joystickSet 0 - Only gamepads, 1 - attacks and gamepad
* @param speedRatio range of motor power
*/
public static void driveTank(int joystickSet, double speedRatio)
{
if(joystickSet == 0)
{
Robot.bot.drivetrain.tankDrive(Gamepad.primaryGamepad.getLeftY() * speedRatio, Gamepad.primaryGamepad.getRightY() * speedRatio, true);
//87
}
if(joystickSet == 1)
{
//double leftThrottle = ((1-Gamepad.primaryLeftAttackJoystick.getZ()) * .35) + .65;
//double rightThrottle = ((1-Gamepad.primaryRightAttackJoystick.getZ()) * .35) + .65;
Robot.bot.drivetrain.tankDrive(Gamepad.primaryLeftAttackJoystick.getY() * speedRatio, Gamepad.primaryRightAttackJoystick.getY() * speedRatio, true);
}
// Timer.delay(0.005); // wait 5ms to avoid hogging CPU cycles
}
public static void reset()
{
// TODO Auto-generated method stub
}
public static void initialize()
{
// TODO Auto-generated method stub
}};