Skip to content

Commit adcd336

Browse files
committed
Allow using the GSpeedController without sensors
1 parent a78741a commit adcd336

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/main/java/com/thegongoliers/output/actuators/GSpeedController.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,22 @@ public class GSpeedController implements MotorController {
2424
private double mLastTime;
2525
private double mScale = 1.0;
2626

27+
/**
28+
* A speed controller with added functionality
29+
* @param speedController the underlying speed controller
30+
*/
31+
public GSpeedController(MotorController speedController, Clock clock){
32+
this(speedController, () -> 0.0, () -> 0.0, new PID(0, 0, 0), new PID(0, 0, 0), clock);
33+
}
34+
35+
/**
36+
* A speed controller with added functionality
37+
* @param speedController the underlying speed controller
38+
*/
39+
public GSpeedController(MotorController speedController){
40+
this(speedController, new RobotClock());
41+
}
42+
2743
/**
2844
* A speed controller with added functionality
2945
* @param speedController the underlying speed controller
@@ -137,7 +153,7 @@ public void set(double speed) {
137153

138154
/**
139155
* Controls the ramping of the motor. Set to 0 to disable.
140-
* @param secondsToReachFullSpeed the ramping time in seconds from 0 to full speed
156+
* @param secondsToFullSpeed the ramping time in seconds from 0 to full speed
141157
*/
142158
public void setSecondsToFullSpeed(double secondsToFullSpeed){
143159
mSecondsToFullSpeed = Math.abs(secondsToFullSpeed);

0 commit comments

Comments
 (0)