Skip to content

Commit 4289d7f

Browse files
committed
Add drive direction isInverted property to Wheel
1 parent 8b9c09d commit 4289d7f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ buildscript {
1212

1313
configure(subprojects) {
1414
group = 'org.strykeforce.thirdcoast'
15-
version = '19.1.0'
15+
version = '19.1.1'
1616

1717
apply plugin: 'java-library'
1818
apply plugin: 'idea'

swerve/src/main/java/org/strykeforce/thirdcoast/swerve/Wheel.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class Wheel {
3535
private final TalonSRX driveTalon;
3636
private final TalonSRX azimuthTalon;
3737
protected DoubleConsumer driver;
38+
private boolean isInverted = false;
3839

3940
/**
4041
* This constructs a wheel with supplied azimuth and drive talons.
@@ -81,6 +82,7 @@ public void set(double azimuth, double drive) {
8182

8283
// minimize azimuth rotation, reversing drive if necessary
8384
if (Math.abs(azimuthError) > 0.25 * TICKS) {
85+
isInverted = true;
8486
azimuthError -= Math.copySign(0.5 * TICKS, azimuthError);
8587
drive = -drive;
8688
}
@@ -190,6 +192,10 @@ public double getDriveSetpointMax() {
190192
return driveSetpointMax;
191193
}
192194

195+
public boolean isInverted() {
196+
return isInverted;
197+
}
198+
193199
@Override
194200
public String toString() {
195201
return "Wheel{"

0 commit comments

Comments
 (0)