Skip to content

Commit

Permalink
Use the average of the sticks if driving straight.
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Gleason committed Jun 27, 2017
1 parent 9fa07cc commit 772d29b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public abstract class TankOI implements UnidirectionalOI {
public abstract double getLeftThrottle();

/**
* Get the throttle for the right side og the drive.
* Get the throttle for the right side of the drive.
*
* @return percent of max speed for right motor cluster from [-1.0, 1.0]
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,30 @@ public SimpleTankOI(@NotNull @JsonProperty(required = true) MappedThrottle leftT
}

/**
* @return throttle to the left motor cluster [-1, 1]
* Get the throttle for the left side of the drive.
*
* @return percent of max speed for left motor cluster from [-1.0, 1.0]
*/
@Override
public double getLeftThrottle() {
//If the driver is trying to drive straight, use the average of the two sticks.
if (commandingStraight()){
return (leftThrottle.getValue()+rightThrottle.getValue())/2.;
}
return leftThrottle.getValue();
}

/**
* @return throttle to the right motor cluster [-1, 1]
* Get the throttle for the right side of the drive.
*
* @return percent of max speed for right motor cluster from [-1.0, 1.0]
*/
@Override
public double getRightThrottle() {
//If the driver is trying to drive straight, use the average of the two sticks.
if (commandingStraight()){
return (leftThrottle.getValue()+rightThrottle.getValue())/2.;
}
return rightThrottle.getValue();
}

Expand Down

0 comments on commit 772d29b

Please sign in to comment.