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

@@ -113,7 +113,7 @@ public class FRCNetComm extends JNIWrapper {
public static final int kResourceType_ADXRS450 = 54;
public static final int kResourceType_RevSPARK = 55;
public static final int kResourceType_MindsensorsSD540 = 56;
public static final int kResourceType_DigitalFilter = 57;
public static final int kResourceType_DigitalGlitchFilter = 57;
public static final int kResourceType_ADIS16448 = 58;
public static final int kResourceType_PDP = 59;
public static final int kResourceType_PCM = 60;
@@ -127,6 +127,17 @@ public class FRCNetComm extends JNIWrapper {
public static final int kResourceType_CTRE_future4 = 68;
public static final int kResourceType_CTRE_future5 = 69;
public static final int kResourceType_CTRE_future6 = 70;
public static final int kResourceType_LinearFilter = 71;
public static final int kResourceType_XboxController = 72;
public static final int kResourceType_UsbCamera = 73;
public static final int kResourceType_NavX = 74;
public static final int kResourceType_Pixy = 75;
public static final int kResourceType_Pixy2 = 76;
public static final int kResourceType_ScanseSweep = 77;
public static final int kResourceType_Shuffleboard = 78;
public static final int kResourceType_CAN = 79;
public static final int kResourceType_DigilentDMC60 = 80;
public static final int kResourceType_PWMVictorSPX = 81;
}
/**
@@ -149,6 +160,9 @@ public class FRCNetComm extends JNIWrapper {
public static final int kFramework_Iterative = 1;
public static final int kFramework_Simple = 2;
public static final int kFramework_CommandControl = 3;
public static final int kFramework_Timed = 4;
public static final int kFramework_ROS = 5;
public static final int kFramework_RobotBuilder = 6;
public static final int kRobotDrive_ArcadeStandard = 1;
public static final int kRobotDrive_ArcadeButtonSpin = 2;
@@ -156,6 +170,13 @@ public class FRCNetComm extends JNIWrapper {
public static final int kRobotDrive_Tank = 4;
public static final int kRobotDrive_MecanumPolar = 5;
public static final int kRobotDrive_MecanumCartesian = 6;
public static final int kRobotDrive2_DifferentialArcade = 7;
public static final int kRobotDrive2_DifferentialTank = 8;
public static final int kRobotDrive2_DifferentialCurvature = 9;
public static final int kRobotDrive2_MecanumCartesian = 10;
public static final int kRobotDrive2_MecanumPolar = 11;
public static final int kRobotDrive2_KilloughCartesian = 12;
public static final int kRobotDrive2_KilloughPolar = 13;
public static final int kDriverStationCIO_Analog = 1;
public static final int kDriverStationCIO_DigitalIn = 2;

View File

@@ -1,4 +1,3 @@
#ifndef __UsageReporting_h__
#define __UsageReporting_h__
@@ -77,7 +76,7 @@ namespace nUsageReporting
kResourceType_ADXRS450,
kResourceType_RevSPARK,
kResourceType_MindsensorsSD540,
kResourceType_DigitalFilter,
kResourceType_DigitalGlitchFilter,
kResourceType_ADIS16448,
kResourceType_PDP,
kResourceType_PCM, // 60
@@ -91,6 +90,17 @@ namespace nUsageReporting
kResourceType_CTRE_future4,
kResourceType_CTRE_future5,
kResourceType_CTRE_future6, // 70
kResourceType_LinearFilter,
kResourceType_XboxController,
kResourceType_UsbCamera,
kResourceType_NavX,
kResourceType_Pixy,
kResourceType_Pixy2,
kResourceType_ScanseSweep,
kResourceType_Shuffleboard,
kResourceType_CAN,
kResourceType_DigilentDMC60, // 80
kResourceType_PWMVictorSPX,
} tResourceType;
typedef enum
@@ -107,6 +117,9 @@ namespace nUsageReporting
kFramework_Iterative = 1,
kFramework_Simple = 2,
kFramework_CommandControl = 3,
kFramework_Timed = 4,
kFramework_ROS = 5,
kFramework_RobotBuilder = 6,
kRobotDrive_ArcadeStandard = 1,
kRobotDrive_ArcadeButtonSpin = 2,
@@ -114,6 +127,13 @@ namespace nUsageReporting
kRobotDrive_Tank = 4,
kRobotDrive_MecanumPolar = 5,
kRobotDrive_MecanumCartesian = 6,
kRobotDrive2_DifferentialArcade = 7,
kRobotDrive2_DifferentialTank = 8,
kRobotDrive2_DifferentialCurvature = 9,
kRobotDrive2_MecanumCartesian = 10,
kRobotDrive2_MecanumPolar = 11,
kRobotDrive2_KilloughCartesian = 12,
kRobotDrive2_KilloughPolar = 13,
kDriverStationCIO_Analog = 1,
kDriverStationCIO_DigitalIn = 2,
@@ -140,8 +160,8 @@ namespace nUsageReporting
} tInstances;
/**
* Reports the usage of a resource of interest.
*
* Report the usage of a resource of interest.
*
* @param resource one of the values in the tResourceType above (max value 51).
* @param instanceNumber an index that identifies the resource instance.
* @param context an optional additional context number for some cases (such as module number). Set to 0 to omit.

View File

@@ -21,7 +21,7 @@ CAN::CAN(int deviceId) {
return;
}
// HAL_Report(HALUsageReporting::kResourceType_CAN, deviceId);
HAL_Report(HALUsageReporting::kResourceType_CAN, deviceId);
}
CAN::~CAN() {

View File

@@ -31,6 +31,6 @@ DMC60::DMC60(int channel) : PWMSpeedController(channel) {
SetSpeed(0.0);
SetZeroLatch();
// HAL_Report(HALUsageReporting::kResourceType_VictorSP, GetChannel());
HAL_Report(HALUsageReporting::kResourceType_DigilentDMC60, GetChannel());
SetName("DMC60", GetChannel());
}

View File

@@ -35,7 +35,8 @@ DigitalGlitchFilter::DigitalGlitchFilter() {
m_channelIndex = std::distance(m_filterAllocated.begin(), index);
*index = true;
HAL_Report(HALUsageReporting::kResourceType_DigitalFilter, m_channelIndex);
HAL_Report(HALUsageReporting::kResourceType_DigitalGlitchFilter,
m_channelIndex);
SetName("DigitalGlitchFilter", m_channelIndex);
}

View File

@@ -29,6 +29,6 @@ PWMVictorSPX::PWMVictorSPX(int channel) : PWMSpeedController(channel) {
SetSpeed(0.0);
SetZeroLatch();
// HAL_Report(HALUsageReporting::kResourceType_PWMVictorSPX, GetChannel());
HAL_Report(HALUsageReporting::kResourceType_PWMVictorSPX, GetChannel());
SetName("PWMVictorSPX", GetChannel());
}

View File

@@ -29,7 +29,7 @@ namespace {
class WPILibCameraServerShared : public frc::CameraServerShared {
public:
void ReportUsbCamera(int id) override {
HAL_Report(HALUsageReporting::kResourceType_PCVideoServer, id);
HAL_Report(HALUsageReporting::kResourceType_UsbCamera, id);
}
void ReportAxisCamera(int id) override {
HAL_Report(HALUsageReporting::kResourceType_AxisCamera, id);

View File

@@ -48,10 +48,8 @@ TimedRobot::TimedRobot(double period) : IterativeRobotBase(period) {
m_notifier = HAL_InitializeNotifier(&status);
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
// HAL_Report(HALUsageReporting::kResourceType_Framework,
// HALUsageReporting::kFramework_Periodic);
HAL_Report(HALUsageReporting::kResourceType_Framework,
HALUsageReporting::kFramework_Iterative);
HALUsageReporting::kFramework_Timed);
}
TimedRobot::~TimedRobot() {

View File

@@ -12,8 +12,7 @@
using namespace frc;
XboxController::XboxController(int port) : GenericHID(port) {
// HAL_Report(HALUsageReporting::kResourceType_XboxController, port);
HAL_Report(HALUsageReporting::kResourceType_Joystick, port);
HAL_Report(HALUsageReporting::kResourceType_XboxController, port);
}
double XboxController::GetX(JoystickHand hand) const {

View File

@@ -32,7 +32,7 @@ void DifferentialDrive::ArcadeDrive(double xSpeed, double zRotation,
static bool reported = false;
if (!reported) {
HAL_Report(HALUsageReporting::kResourceType_RobotDrive, 2,
HALUsageReporting::kRobotDrive_ArcadeStandard);
HALUsageReporting::kRobotDrive2_DifferentialArcade);
reported = true;
}
@@ -86,8 +86,8 @@ void DifferentialDrive::CurvatureDrive(double xSpeed, double zRotation,
bool isQuickTurn) {
static bool reported = false;
if (!reported) {
// HAL_Report(HALUsageReporting::kResourceType_RobotDrive, 2,
// HALUsageReporting::kRobotDrive_Curvature);
HAL_Report(HALUsageReporting::kResourceType_RobotDrive, 2,
HALUsageReporting::kRobotDrive2_DifferentialCurvature);
reported = true;
}
@@ -160,7 +160,7 @@ void DifferentialDrive::TankDrive(double leftSpeed, double rightSpeed,
static bool reported = false;
if (!reported) {
HAL_Report(HALUsageReporting::kResourceType_RobotDrive, 2,
HALUsageReporting::kRobotDrive_Tank);
HALUsageReporting::kRobotDrive2_DifferentialTank);
reported = true;
}

View File

@@ -47,8 +47,8 @@ KilloughDrive::KilloughDrive(SpeedController& leftMotor,
void KilloughDrive::DriveCartesian(double ySpeed, double xSpeed,
double zRotation, double gyroAngle) {
if (!reported) {
// HAL_Report(HALUsageReporting::kResourceType_RobotDrive, 3,
// HALUsageReporting::kRobotDrive_KilloughCartesian);
HAL_Report(HALUsageReporting::kResourceType_RobotDrive, 3,
HALUsageReporting::kRobotDrive2_KilloughCartesian);
reported = true;
}
@@ -79,8 +79,8 @@ void KilloughDrive::DriveCartesian(double ySpeed, double xSpeed,
void KilloughDrive::DrivePolar(double magnitude, double angle,
double zRotation) {
if (!reported) {
// HAL_Report(HALUsageReporting::kResourceType_RobotDrive, 3,
// HALUsageReporting::kRobotDrive_KilloughPolar);
HAL_Report(HALUsageReporting::kResourceType_RobotDrive, 3,
HALUsageReporting::kRobotDrive2_KilloughPolar);
reported = true;
}

View File

@@ -41,7 +41,7 @@ void MecanumDrive::DriveCartesian(double ySpeed, double xSpeed,
double zRotation, double gyroAngle) {
if (!reported) {
HAL_Report(HALUsageReporting::kResourceType_RobotDrive, 4,
HALUsageReporting::kRobotDrive_MecanumCartesian);
HALUsageReporting::kRobotDrive2_MecanumCartesian);
reported = true;
}
@@ -77,7 +77,7 @@ void MecanumDrive::DrivePolar(double magnitude, double angle,
double zRotation) {
if (!reported) {
HAL_Report(HALUsageReporting::kResourceType_RobotDrive, 4,
HALUsageReporting::kRobotDrive_MecanumPolar);
HALUsageReporting::kRobotDrive2_MecanumPolar);
reported = true;
}

View File

@@ -10,6 +10,8 @@
#include <cassert>
#include <cmath>
#include <hal/HAL.h>
using namespace frc;
LinearDigitalFilter::LinearDigitalFilter(PIDSource& source,
@@ -19,7 +21,11 @@ LinearDigitalFilter::LinearDigitalFilter(PIDSource& source,
m_inputs(ffGains.size()),
m_outputs(fbGains.size()),
m_inputGains(ffGains),
m_outputGains(fbGains) {}
m_outputGains(fbGains) {
static int instances = 0;
instances++;
HAL_Report(HALUsageReporting::kResourceType_LinearFilter, instances);
}
LinearDigitalFilter::LinearDigitalFilter(std::shared_ptr<PIDSource> source,
wpi::ArrayRef<double> ffGains,
@@ -28,7 +34,11 @@ LinearDigitalFilter::LinearDigitalFilter(std::shared_ptr<PIDSource> source,
m_inputs(ffGains.size()),
m_outputs(fbGains.size()),
m_inputGains(ffGains),
m_outputGains(fbGains) {}
m_outputGains(fbGains) {
static int instances = 0;
instances++;
HAL_Report(HALUsageReporting::kResourceType_LinearFilter, instances);
}
LinearDigitalFilter LinearDigitalFilter::SinglePoleIIR(PIDSource& source,
double timeConstant,

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);
}
/**