Update UsageReporting enums and their uses for 2019 (#1218)

This commit is contained in:
Tyler Veness
2018-07-25 19:58:05 -07:00
committed by Peter Johnson
parent 8aac46542d
commit d54c2665dc
24 changed files with 111 additions and 51 deletions

View File

@@ -10,6 +10,8 @@ package edu.wpi.first.wpilibj;
import java.io.Closeable;
import edu.wpi.first.wpilibj.hal.CANAPIJNI;
import edu.wpi.first.wpilibj.hal.FRCNetComm.tResourceType;
import edu.wpi.first.wpilibj.hal.HAL;
/**
* High level class for interfacing with CAN devices conforming to
@@ -34,6 +36,7 @@ public class CAN implements Closeable {
*/
public CAN(int deviceId) {
m_handle = CANAPIJNI.initializeCAN(kTeamManufacturer, deviceId, kTeamDeviceType);
HAL.report(tResourceType.kResourceType_CAN, deviceId);
}
/**

View File

@@ -7,8 +7,8 @@
package edu.wpi.first.wpilibj;
//import edu.wpi.first.wpilibj.hal.FRCNetComm.tResourceType;
//import edu.wpi.first.wpilibj.hal.HAL;
import edu.wpi.first.wpilibj.hal.FRCNetComm.tResourceType;
import edu.wpi.first.wpilibj.hal.HAL;
/**
* Digilent DMC 60 Speed Controller.
@@ -38,7 +38,7 @@ public class DMC60 extends PWMSpeedController {
setSpeed(0.0);
setZeroLatch();
//HAL.report(tResourceType.kResourceType_VictorSP, getChannel());
HAL.report(tResourceType.kResourceType_DigilentDMC60, getChannel());
setName("DMC60", getChannel());
}
}

View File

@@ -33,7 +33,7 @@ public class DigitalGlitchFilter extends SendableBase {
if (index != m_filterAllocated.length) {
m_channelIndex = index;
m_filterAllocated[index] = true;
HAL.report(tResourceType.kResourceType_DigitalFilter,
HAL.report(tResourceType.kResourceType_DigitalGlitchFilter,
m_channelIndex, 0);
setName("DigitalGlitchFilter", index);
}

View File

@@ -7,8 +7,8 @@
package edu.wpi.first.wpilibj;
//import edu.wpi.first.wpilibj.hal.FRCNetComm.tResourceType;
//import edu.wpi.first.wpilibj.hal.HAL;
import edu.wpi.first.wpilibj.hal.FRCNetComm.tResourceType;
import edu.wpi.first.wpilibj.hal.HAL;
/**
* Cross the Road Electronics (CTRE) Victor SPX Speed Controller with PWM control.
@@ -39,7 +39,7 @@ public class PWMVictorSPX extends PWMSpeedController {
setSpeed(0.0);
setZeroLatch();
//HAL.report(tResourceType.kResourceType_PWMVictorSPX, getChannel());
HAL.report(tResourceType.kResourceType_PWMVictorSPX, getChannel());
setName("PWMVictorSPX", getChannel());
}
}

View File

@@ -46,7 +46,7 @@ public abstract class RobotBase implements AutoCloseable {
@Override
public void reportUsbCamera(int id) {
HAL.report(tResourceType.kResourceType_PCVideoServer, id);
HAL.report(tResourceType.kResourceType_UsbCamera, id);
}
@Override

View File

@@ -46,8 +46,7 @@ public class TimedRobot extends IterativeRobotBase {
protected TimedRobot(double period) {
super(period);
// HAL.report(tResourceType.kResourceType_Framework, tInstances.kFramework_Periodic);
HAL.report(tResourceType.kResourceType_Framework, tInstances.kFramework_Iterative);
HAL.report(tResourceType.kResourceType_Framework, tInstances.kFramework_Timed);
}
@Override

View File

@@ -50,8 +50,7 @@ public class XboxController extends GenericHID {
public XboxController(final int port) {
super(port);
// HAL.report(tResourceType.kResourceType_XboxController, port);
HAL.report(tResourceType.kResourceType_Joystick, port);
HAL.report(tResourceType.kResourceType_XboxController, port);
}
/**

View File

@@ -145,7 +145,8 @@ public class DifferentialDrive extends RobotDriveBase {
@SuppressWarnings("ParameterName")
public void arcadeDrive(double xSpeed, double zRotation, boolean squaredInputs) {
if (!m_reported) {
HAL.report(tResourceType.kResourceType_RobotDrive, 2, tInstances.kRobotDrive_ArcadeStandard);
HAL.report(tResourceType.kResourceType_RobotDrive, 2,
tInstances.kRobotDrive2_DifferentialArcade);
m_reported = true;
}
@@ -210,7 +211,8 @@ public class DifferentialDrive extends RobotDriveBase {
@SuppressWarnings({"ParameterName", "PMD.CyclomaticComplexity"})
public void curvatureDrive(double xSpeed, double zRotation, boolean isQuickTurn) {
if (!m_reported) {
// HAL.report(tResourceType.kResourceType_RobotDrive, 2, tInstances.kRobotDrive_Curvature);
HAL.report(tResourceType.kResourceType_RobotDrive, 2,
tInstances.kRobotDrive2_DifferentialCurvature);
m_reported = true;
}
@@ -300,7 +302,8 @@ public class DifferentialDrive extends RobotDriveBase {
*/
public void tankDrive(double leftSpeed, double rightSpeed, boolean squaredInputs) {
if (!m_reported) {
HAL.report(tResourceType.kResourceType_RobotDrive, 2, tInstances.kRobotDrive_Tank);
HAL.report(tResourceType.kResourceType_RobotDrive, 2,
tInstances.kRobotDrive2_DifferentialTank);
m_reported = true;
}

View File

@@ -8,10 +8,10 @@
package edu.wpi.first.wpilibj.drive;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.hal.FRCNetComm.tInstances;
import edu.wpi.first.wpilibj.hal.FRCNetComm.tResourceType;
import edu.wpi.first.wpilibj.hal.HAL;
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
// import edu.wpi.first.wpilibj.hal.FRCNetComm.tInstances;
// import edu.wpi.first.wpilibj.hal.FRCNetComm.tResourceType;
// import edu.wpi.first.wpilibj.hal.HAL;
/**
* A class for driving Killough drive platforms.
@@ -136,8 +136,8 @@ public class KilloughDrive extends RobotDriveBase {
public void driveCartesian(double ySpeed, double xSpeed, double zRotation,
double gyroAngle) {
if (!m_reported) {
// HAL.report(tResourceType.kResourceType_RobotDrive, 3,
// tInstances.kRobotDrive_KilloughCartesian);
HAL.report(tResourceType.kResourceType_RobotDrive, 3,
tInstances.kRobotDrive2_KilloughCartesian);
m_reported = true;
}
@@ -179,8 +179,8 @@ public class KilloughDrive extends RobotDriveBase {
@SuppressWarnings("ParameterName")
public void drivePolar(double magnitude, double angle, double zRotation) {
if (!m_reported) {
// HAL.report(tResourceType.kResourceType_RobotDrive, 3,
// tInstances.kRobotDrive_KilloughPolar);
HAL.report(tResourceType.kResourceType_RobotDrive, 3,
tInstances.kRobotDrive2_KilloughPolar);
m_reported = true;
}

View File

@@ -119,7 +119,7 @@ public class MecanumDrive extends RobotDriveBase {
public void driveCartesian(double ySpeed, double xSpeed, double zRotation, double gyroAngle) {
if (!m_reported) {
HAL.report(tResourceType.kResourceType_RobotDrive, 4,
tInstances.kRobotDrive_MecanumCartesian);
tInstances.kRobotDrive2_MecanumCartesian);
m_reported = true;
}
@@ -165,7 +165,7 @@ public class MecanumDrive extends RobotDriveBase {
@SuppressWarnings("ParameterName")
public void drivePolar(double magnitude, double angle, double zRotation) {
if (!m_reported) {
HAL.report(tResourceType.kResourceType_RobotDrive, 4, tInstances.kRobotDrive_MecanumPolar);
HAL.report(tResourceType.kResourceType_RobotDrive, 4, tInstances.kRobotDrive2_MecanumPolar);
m_reported = true;
}

View File

@@ -11,6 +11,8 @@ import java.util.Arrays;
import edu.wpi.first.wpilibj.CircularBuffer;
import edu.wpi.first.wpilibj.PIDSource;
import edu.wpi.first.wpilibj.hal.FRCNetComm.tResourceType;
import edu.wpi.first.wpilibj.hal.HAL;
/**
* This class implements a linear, digital filter. All types of FIR and IIR filters are supported.
@@ -50,6 +52,8 @@ import edu.wpi.first.wpilibj.PIDSource;
* to make sure PIDGet() gets called at the desired, constant frequency!
*/
public class LinearDigitalFilter extends Filter {
private static int instances;
private final CircularBuffer m_inputs;
private final CircularBuffer m_outputs;
private final double[] m_inputGains;
@@ -69,6 +73,9 @@ public class LinearDigitalFilter extends Filter {
m_outputs = new CircularBuffer(fbGains.length);
m_inputGains = Arrays.copyOf(ffGains, ffGains.length);
m_outputGains = Arrays.copyOf(fbGains, fbGains.length);
instances++;
HAL.report(tResourceType.kResourceType_LinearFilter, instances);
}
/**