mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Updated Gradle to 4.0.1 (#573)
New PMD checks required modifying PIDController
This commit is contained in:
committed by
Peter Johnson
parent
bfd224278b
commit
432c03bf63
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id 'net.ltgt.errorprone' version '0.0.8'
|
||||
id 'net.ltgt.errorprone' version '0.0.10'
|
||||
id 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin' version '1.6'
|
||||
}
|
||||
|
||||
@@ -65,6 +65,6 @@ apply from: 'cppSettings.gradle'
|
||||
apply from: 'ni-libraries/ni-libraries.gradle'
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
gradleVersion = '3.3'
|
||||
gradleVersion = '4.0.1'
|
||||
distributionType = Wrapper.DistributionType.ALL
|
||||
}
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Wed Mar 22 22:37:01 EDT 2017
|
||||
#Mon Jul 10 13:30:04 EDT 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.1-all.zip
|
||||
|
||||
6
gradlew
vendored
6
gradlew
vendored
@@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
@@ -155,7 +155,7 @@ if $cygwin ; then
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save ( ) {
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
|
||||
@@ -591,13 +591,12 @@ void PIDController::InitTable(std::shared_ptr<ITable> subtable) {
|
||||
* @return Error for continuous inputs.
|
||||
*/
|
||||
double PIDController::GetContinuousError(double error) const {
|
||||
if (m_continuous) {
|
||||
if (std::fabs(error) > (m_maximumInput - m_minimumInput) / 2) {
|
||||
if (error > 0) {
|
||||
return error - (m_maximumInput - m_minimumInput);
|
||||
} else {
|
||||
return error + (m_maximumInput - m_minimumInput);
|
||||
}
|
||||
if (m_continuous &&
|
||||
std::fabs(error) > (m_maximumInput - m_minimumInput) / 2) {
|
||||
if (error > 0) {
|
||||
return error - (m_maximumInput - m_minimumInput);
|
||||
} else {
|
||||
return error + (m_maximumInput - m_minimumInput);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,6 @@ import edu.wpi.first.wpilibj.tables.ITable;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Hashtable;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Singleton class for creating and keeping camera servers.
|
||||
@@ -220,50 +218,6 @@ public class CameraServer {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
private static PixelFormat pixelFormatFromString(String pixelFormatStr) {
|
||||
switch (pixelFormatStr) {
|
||||
case "MJPEG":
|
||||
case "mjpeg":
|
||||
case "JPEG":
|
||||
case "jpeg":
|
||||
return PixelFormat.kMJPEG;
|
||||
case "YUYV":
|
||||
case "yuyv":
|
||||
return PixelFormat.kYUYV;
|
||||
case "RGB565":
|
||||
case "rgb565":
|
||||
return PixelFormat.kRGB565;
|
||||
case "BGR":
|
||||
case "bgr":
|
||||
return PixelFormat.kBGR;
|
||||
case "GRAY":
|
||||
case "Gray":
|
||||
case "gray":
|
||||
return PixelFormat.kGray;
|
||||
default:
|
||||
return PixelFormat.kUnknown;
|
||||
}
|
||||
}
|
||||
|
||||
private static final Pattern reMode =
|
||||
Pattern.compile("(?<width>[0-9]+)\\s*x\\s*(?<height>[0-9]+)\\s+(?<format>.*?)\\s+"
|
||||
+ "(?<fps>[0-9.]+)\\s*fps");
|
||||
|
||||
/// Construct a video mode from a string description.
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
private static VideoMode videoModeFromString(String modeStr) {
|
||||
Matcher matcher = reMode.matcher(modeStr);
|
||||
if (!matcher.matches()) {
|
||||
return new VideoMode(PixelFormat.kUnknown, 0, 0, 0);
|
||||
}
|
||||
PixelFormat pixelFormat = pixelFormatFromString(matcher.group("format"));
|
||||
int width = Integer.parseInt(matcher.group("width"));
|
||||
int height = Integer.parseInt(matcher.group("height"));
|
||||
int fps = (int) Double.parseDouble(matcher.group("fps"));
|
||||
return new VideoMode(pixelFormat, width, height, fps);
|
||||
}
|
||||
|
||||
/// Provide string description of video mode.
|
||||
/// The returned string is "{width}x{height} {format} {fps} fps".
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
|
||||
@@ -63,8 +63,6 @@ public class PIDController implements PIDInterface, LiveWindowSendable, Controll
|
||||
protected PIDOutput m_pidOutput;
|
||||
java.util.Timer m_controlLoop;
|
||||
Timer m_setpointTimer;
|
||||
private boolean m_freed = false;
|
||||
private boolean m_usingPercentTolerance;
|
||||
|
||||
/**
|
||||
* Tolerance is the type of tolerance used to specify if the PID controller is on target.
|
||||
@@ -95,8 +93,8 @@ public class PIDController implements PIDInterface, LiveWindowSendable, Controll
|
||||
|
||||
@Override
|
||||
public boolean onTarget() {
|
||||
return isAvgErrorValid() && (Math.abs(getAvgError()) < m_percentage / 100 * (m_maximumInput
|
||||
- m_minimumInput));
|
||||
return isAvgErrorValid() && Math.abs(getAvgError()) < m_percentage / 100 * (m_maximumInput
|
||||
- m_minimumInput);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +226,6 @@ public class PIDController implements PIDInterface, LiveWindowSendable, Controll
|
||||
public void free() {
|
||||
m_controlLoop.cancel();
|
||||
synchronized (this) {
|
||||
m_freed = true;
|
||||
m_pidOutput = null;
|
||||
m_pidInput = null;
|
||||
m_controlLoop = null;
|
||||
@@ -704,13 +701,11 @@ public class PIDController implements PIDInterface, LiveWindowSendable, Controll
|
||||
if (getSetpoint() != (Double) value) {
|
||||
setSetpoint((Double) value);
|
||||
}
|
||||
} else if (key.equals("enabled")) {
|
||||
if (isEnabled() != (Boolean) value) {
|
||||
if ((Boolean) value) {
|
||||
enable();
|
||||
} else {
|
||||
disable();
|
||||
}
|
||||
} else if (key.equals("enabled") && isEnabled() != (Boolean) value) {
|
||||
if ((Boolean) value) {
|
||||
enable();
|
||||
} else {
|
||||
disable();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -741,13 +736,11 @@ public class PIDController implements PIDInterface, LiveWindowSendable, Controll
|
||||
* @return Error for continuous inputs.
|
||||
*/
|
||||
protected double getContinuousError(double error) {
|
||||
if (m_continuous) {
|
||||
if (Math.abs(error) > (m_maximumInput - m_minimumInput) / 2) {
|
||||
if (error > 0) {
|
||||
return error - (m_maximumInput - m_minimumInput);
|
||||
} else {
|
||||
return error + (m_maximumInput - m_minimumInput);
|
||||
}
|
||||
if (m_continuous && Math.abs(error) > (m_maximumInput - m_minimumInput) / 2) {
|
||||
if (error > 0) {
|
||||
return error - (m_maximumInput - m_minimumInput);
|
||||
} else {
|
||||
return error + (m_maximumInput - m_minimumInput);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user