Skip to content
This repository was archived by the owner on Sep 14, 2019. It is now read-only.

Commit 536e792

Browse files
committed
got PIDSourceAverage back
bc .gitignore stuff from testing-no-auto
1 parent 5ffaed1 commit 536e792

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package org.usfirst.frc.team199.Robot2018.autonomous;
2+
3+
import edu.wpi.first.wpilibj.PIDSource;
4+
import edu.wpi.first.wpilibj.PIDSourceType;
5+
6+
public class PIDSourceAverage implements PIDSource {
7+
8+
private PIDSource lSrc;
9+
private PIDSource rSrc;
10+
private PIDSourceType type;
11+
12+
public PIDSourceAverage(PIDSource leftSource, PIDSource rightSource) {
13+
lSrc = leftSource;
14+
rSrc = rightSource;
15+
if (leftSource.getPIDSourceType().equals(rightSource.getPIDSourceType())) {
16+
type = leftSource.getPIDSourceType();
17+
} else {
18+
throw new IllegalArgumentException();
19+
}
20+
}
21+
22+
@Override
23+
public void setPIDSourceType(PIDSourceType pidSource) {
24+
type = pidSource;
25+
}
26+
27+
@Override
28+
public PIDSourceType getPIDSourceType() {
29+
return type;
30+
}
31+
32+
@Override
33+
public double pidGet() {
34+
return (lSrc.pidGet() + rSrc.pidGet()) / 2;
35+
}
36+
37+
}

0 commit comments

Comments
 (0)