artf4107: Uniform initialization syntax introduced

Change-Id: I452b4794d757a0817589ec62b75eda7fbdd74904
This commit is contained in:
Tyler Veness
2015-06-24 01:06:29 -07:00
parent b1befed14f
commit 368ad30d37
179 changed files with 379 additions and 831 deletions

View File

@@ -35,14 +35,6 @@ ADXL345_I2C::ADXL345_I2C(Port port, Range range) : I2C(port, kAddress) {
LiveWindow::GetInstance()->AddSensor("ADXL345_I2C", port, this);
}
/**
* Destructor.
*/
ADXL345_I2C::~ADXL345_I2C() {
// delete m_i2c;
// m_i2c = nullptr;
}
/** {@inheritdoc} */
void ADXL345_I2C::SetRange(Range range) {
Write(kDataFormatRegister, kDataFormat_FullRes | (uint8_t)range);

View File

@@ -14,9 +14,6 @@
* Common function for initializing the accelerometer.
*/
void AnalogAccelerometer::InitAccelerometer() {
m_table = nullptr;
m_voltsPerG = 1.0;
m_zeroGVoltage = 2.5;
HALReport(HALUsageReporting::kResourceType_Accelerometer,
m_AnalogInput->GetChannel());
LiveWindow::GetInstance()->AddSensor("Accelerometer",

View File

@@ -21,7 +21,6 @@ const uint32_t AnalogInput::kAccumulatorChannels[] = {0, 1};
* Common initialization.
*/
void AnalogInput::InitAnalogInput(uint32_t channel) {
m_table = nullptr;
char buf[64];
Resource::CreateResourceObject(&inputs, kAnalogInputs);

View File

@@ -13,8 +13,6 @@
static Resource *outputs = nullptr;
void AnalogOutput::InitAnalogOutput(uint32_t channel) {
m_table = nullptr;
Resource::CreateResourceObject(&outputs, kAnalogOutputs);
char buf[64];

View File

@@ -13,7 +13,7 @@
* Constructor.
* @param range The range the accelerometer will measure
*/
BuiltInAccelerometer::BuiltInAccelerometer(Range range) : m_table(0) {
BuiltInAccelerometer::BuiltInAccelerometer(Range range) {
SetRange(range);
HALReport(HALUsageReporting::kResourceType_Accelerometer, 0, 0,
@@ -21,8 +21,6 @@ BuiltInAccelerometer::BuiltInAccelerometer(Range range) : m_table(0) {
LiveWindow::GetInstance()->AddSensor((std::string) "BuiltInAccel", 0, this);
}
BuiltInAccelerometer::~BuiltInAccelerometer() {}
/** {@inheritdoc} */
void BuiltInAccelerometer::SetRange(Range range) {
if (range == kRange_16G) {

View File

@@ -8,7 +8,6 @@
#include "Timer.h"
#define tNIRIO_i32 int
#include "NetworkCommunication/CANSessionMux.h"
#include "CAN/can_proto.h"
//#include "NetworkCommunication/UsageReporting.h"
#include "WPIErrors.h"
#include <cstdio>
@@ -73,57 +72,8 @@ static int32_t sendMessageHelper(uint32_t messageID, const uint8_t *data,
* Common initialization code called by all constructors.
*/
void CANJaguar::InitCANJaguar() {
m_table = nullptr;
m_safetyHelper = new MotorSafetyHelper(this);
m_value = 0.0f;
m_speedReference = LM_REF_NONE;
m_positionReference = LM_REF_NONE;
m_p = 0.0;
m_i = 0.0;
m_d = 0.0;
m_busVoltage = 0.0f;
m_outputVoltage = 0.0f;
m_outputCurrent = 0.0f;
m_temperature = 0.0f;
m_position = 0.0;
m_speed = 0.0;
m_limits = 0x00;
m_faults = 0x0000;
m_firmwareVersion = 0;
m_hardwareVersion = 0;
m_neutralMode = kNeutralMode_Jumper;
m_encoderCodesPerRev = 0;
m_potentiometerTurns = 0;
m_limitMode = kLimitMode_SwitchInputsOnly;
m_forwardLimit = 0.0;
m_reverseLimit = 0.0;
m_maxOutputVoltage = 30.0;
m_voltageRampRate = 0.0;
m_faultTime = 0.0f;
// Parameters only need to be verified if they are set
m_controlModeVerified =
false; // Needs to be verified because it's set in the constructor
m_speedRefVerified = true;
m_posRefVerified = true;
m_pVerified = true;
m_iVerified = true;
m_dVerified = true;
m_neutralModeVerified = true;
m_encoderCodesPerRevVerified = true;
m_potentiometerTurnsVerified = true;
m_limitModeVerified = true;
m_forwardLimitVerified = true;
m_reverseLimitVerified = true;
m_maxOutputVoltageVerified = true;
m_voltageRampRateVerified = true;
m_faultTimeVerified = true;
m_receivedStatusMessage0 = false;
m_receivedStatusMessage1 = false;
m_receivedStatusMessage2 = false;
bool receivedFirmwareVersion = false;
uint8_t dataBuffer[8];
uint8_t dataSize;
@@ -197,7 +147,6 @@ void CANJaguar::InitCANJaguar() {
default:
break;
}
m_isInverted = false;
HALReport(HALUsageReporting::kResourceType_CANJaguar, m_deviceNumber,
m_controlMode);
LiveWindow::GetInstance()->AddActuator("CANJaguar", m_deviceNumber, this);
@@ -228,9 +177,7 @@ void CANJaguar::InitCANJaguar() {
* @see CANJaguar#SetVoltageMode(QuadEncoderTag, int)
*/
CANJaguar::CANJaguar(uint8_t deviceNumber)
: m_deviceNumber(deviceNumber),
m_maxOutputVoltage(kApproxBusVoltage),
m_safetyHelper(nullptr) {
: m_deviceNumber(deviceNumber) {
char buf[64];
snprintf(buf, 64, "CANJaguar device number %d", m_deviceNumber);
Resource::CreateResourceObject(&allocated, 63);

View File

@@ -15,11 +15,7 @@
CANTalon::CANTalon(int deviceNumber)
: m_deviceNumber(deviceNumber),
m_impl(new CanTalonSRX(deviceNumber)),
m_safetyHelper(new MotorSafetyHelper(this)),
m_profile(0),
m_controlEnabled(true),
m_controlMode(kPercentVbus),
m_setPoint(0) {
m_safetyHelper(new MotorSafetyHelper(this)) {
ApplyControlMode(m_controlMode);
m_impl->SetProfileSlotSelect(m_profile);
m_isInverted = false;

View File

@@ -5,28 +5,15 @@
#include "Compressor.h"
#include "WPIErrors.h"
void Compressor::InitCompressor(uint8_t pcmID) {
m_table = nullptr;
m_pcm_pointer = initializeCompressor(pcmID);
SetClosedLoopControl(true);
}
/**
* Constructor
*
* Uses the default PCM ID (0)
*/
Compressor::Compressor() { InitCompressor(GetDefaultSolenoidModule()); }
/**
* Constructor
*
* @param module The PCM ID to use (0-62)
*/
Compressor::Compressor(uint8_t pcmID) { InitCompressor(pcmID); }
Compressor::~Compressor() {}
Compressor::Compressor(uint8_t pcmID) {
m_pcm_pointer = initializeCompressor(pcmID);
SetClosedLoopControl(true);
}
/**
* Starts closed-loop control. Note that closed loop control is enabled by

View File

@@ -21,18 +21,10 @@
* @param mode The counter mode
*/
void Counter::InitCounter(Mode mode) {
m_table = nullptr;
int32_t status = 0;
m_index = 0;
m_counter = initializeCounter(mode, &m_index, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
m_upSource = nullptr;
m_downSource = nullptr;
m_allocatedUpSource = false;
m_allocatedDownSource = false;
SetMaxPeriod(.5);
HALReport(HALUsageReporting::kResourceType_Counter, m_index, mode);
@@ -46,7 +38,7 @@ void Counter::InitCounter(Mode mode) {
*
* The counter will start counting immediately.
*/
Counter::Counter() : m_upSource(nullptr), m_downSource(nullptr), m_counter(nullptr) {
Counter::Counter() {
InitCounter();
}
@@ -62,8 +54,7 @@ Counter::Counter() : m_upSource(nullptr), m_downSource(nullptr), m_counter(nullp
* @param source A pointer to the existing DigitalSource object. It will be set
* as the Up Source.
*/
Counter::Counter(DigitalSource *source)
: m_upSource(nullptr), m_downSource(nullptr), m_counter(nullptr) {
Counter::Counter(DigitalSource *source) {
InitCounter();
SetUpSource(source);
ClearDownSource();
@@ -81,8 +72,7 @@ Counter::Counter(DigitalSource *source)
* @param source A reference to the existing DigitalSource object. It will be
* set as the Up Source.
*/
Counter::Counter(DigitalSource &source)
: m_upSource(nullptr), m_downSource(nullptr), m_counter(nullptr) {
Counter::Counter(DigitalSource &source) {
InitCounter();
SetUpSource(&source);
ClearDownSource();
@@ -96,8 +86,7 @@ Counter::Counter(DigitalSource &source)
* @param channel The DIO channel to use as the up source. 0-9 are on-board,
* 10-25 are on the MXP
*/
Counter::Counter(int32_t channel)
: m_upSource(nullptr), m_downSource(nullptr), m_counter(nullptr) {
Counter::Counter(int32_t channel) {
InitCounter();
SetUpSource(channel);
ClearDownSource();
@@ -111,8 +100,7 @@ Counter::Counter(int32_t channel)
* The counter will start counting immediately.
* @param trigger The pointer to the existing AnalogTrigger object.
*/
Counter::Counter(AnalogTrigger *trigger)
: m_upSource(nullptr), m_downSource(nullptr), m_counter(nullptr) {
Counter::Counter(AnalogTrigger *trigger) {
InitCounter();
SetUpSource(trigger->CreateOutput(kState));
ClearDownSource();
@@ -127,8 +115,7 @@ Counter::Counter(AnalogTrigger *trigger)
* The counter will start counting immediately.
* @param trigger The reference to the existing AnalogTrigger object.
*/
Counter::Counter(AnalogTrigger &trigger)
: m_upSource(nullptr), m_downSource(nullptr), m_counter(nullptr) {
Counter::Counter(AnalogTrigger &trigger) {
InitCounter();
SetUpSource(trigger.CreateOutput(kState));
ClearDownSource();
@@ -145,8 +132,7 @@ Counter::Counter(AnalogTrigger &trigger)
*/
Counter::Counter(EncodingType encodingType, DigitalSource *upSource,
DigitalSource *downSource, bool inverted)
: m_upSource(nullptr), m_downSource(nullptr), m_counter(nullptr) {
DigitalSource *downSource, bool inverted) {
if (encodingType != k1X && encodingType != k2X) {
wpi_setWPIErrorWithContext(
ParameterOutOfRange,

View File

@@ -17,7 +17,6 @@
* constructors.
*/
void DigitalInput::InitDigitalInput(uint32_t channel) {
m_table = nullptr;
char buf[64];
if (!CheckDigitalChannel(channel)) {

View File

@@ -15,7 +15,6 @@
* constructors.
*/
void DigitalOutput::InitDigitalOutput(uint32_t channel) {
m_table = nullptr;
char buf[64];
if (!CheckDigitalChannel(channel)) {

View File

@@ -1,13 +0,0 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.
*/
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
/*----------------------------------------------------------------------------*/
#include "DigitalSource.h"
/**
* DigitalSource destructor.
*/
DigitalSource::~DigitalSource() {}

View File

@@ -13,7 +13,6 @@
* Common function to implement constructor behaviour.
*/
void DoubleSolenoid::InitSolenoid() {
m_table = nullptr;
char buf[64];
if (!CheckSolenoidModule(m_moduleNumber)) {
snprintf(buf, 64, "Solenoid Module %d", m_moduleNumber);

View File

@@ -35,16 +35,7 @@ DriverStation* DriverStation::m_instance = nullptr;
*
* This is only called once the first time GetInstance() is called
*/
DriverStation::DriverStation()
: m_task("DriverStation", (FUNCPTR)DriverStation::InitTask),
m_newControlData(0),
m_packetDataAvailableMultiWait(0),
m_waitForDataSem(0),
m_userInDisabled(false),
m_userInAutonomous(false),
m_userInTeleop(false),
m_userInTest(false),
m_nextMessageTime(0) {
DriverStation::DriverStation() {
// All joysticks should default to having zero axes, povs and buttons, so
// uninitialized memory doesn't get sent to speed controllers.
for (unsigned int i = 0; i < kJoystickPorts; i++) {

View File

@@ -31,9 +31,7 @@
* or be double (2x) the spec'd count.
*/
void Encoder::InitEncoder(bool reverseDirection, EncodingType encodingType) {
m_table = nullptr;
m_encodingType = encodingType;
m_index = 0;
switch (encodingType) {
case k4X: {
m_encodingScale = 4;
@@ -69,8 +67,6 @@ void Encoder::InitEncoder(bool reverseDirection, EncodingType encodingType) {
wpi_setErrorWithContext(-1, "Invalid encodingType argument");
break;
}
m_distancePerPulse = 1.0;
m_pidSource = kDistance;
HALReport(HALUsageReporting::kResourceType_Encoder, m_index, encodingType);
LiveWindow::GetInstance()->AddSensor("Encoder",
@@ -101,8 +97,7 @@ void Encoder::InitEncoder(bool reverseDirection, EncodingType encodingType) {
* or be double (2x) the spec'd count.
*/
Encoder::Encoder(uint32_t aChannel, uint32_t bChannel, bool reverseDirection,
EncodingType encodingType)
: m_encoder(nullptr), m_counter(nullptr) {
EncodingType encodingType) {
m_aSource = new DigitalInput(aChannel);
m_bSource = new DigitalInput(bChannel);
InitEncoder(reverseDirection, encodingType);
@@ -136,8 +131,7 @@ Encoder::Encoder(uint32_t aChannel, uint32_t bChannel, bool reverseDirection,
* or be double (2x) the spec'd count.
*/
Encoder::Encoder(DigitalSource *aSource, DigitalSource *bSource,
bool reverseDirection, EncodingType encodingType)
: m_encoder(nullptr), m_counter(nullptr) {
bool reverseDirection, EncodingType encodingType) {
m_aSource = aSource;
m_bSource = bSource;
m_allocatedASource = false;
@@ -174,8 +168,7 @@ Encoder::Encoder(DigitalSource *aSource, DigitalSource *bSource,
* or be double (2x) the spec'd count.
*/
Encoder::Encoder(DigitalSource &aSource, DigitalSource &bSource,
bool reverseDirection, EncodingType encodingType)
: m_encoder(nullptr), m_counter(nullptr) {
bool reverseDirection, EncodingType encodingType) {
m_aSource = &aSource;
m_bSource = &bSource;
m_allocatedASource = false;

View File

@@ -61,9 +61,4 @@ GearTooth::GearTooth(DigitalSource &source, bool directionSensitive)
EnableDirectionSensing(directionSensitive);
}
/**
* Free the resources associated with a gear tooth sensor.
*/
GearTooth::~GearTooth() {}
std::string GearTooth::GetSmartDashboardType() const { return "GearTooth"; }

View File

@@ -31,7 +31,6 @@ constexpr float Gyro::kDefaultVoltsPerDegreePerSecond;
* rest before the competition starts.
*/
void Gyro::InitGyro() {
m_table = nullptr;
if (!m_analog->IsAccumulatorChannel()) {
wpi_setWPIErrorWithContext(ParameterOutOfRange,
" channel (must be accumulator channel)");

View File

@@ -12,12 +12,9 @@
Resource *InterruptableSensorBase::m_interrupts = nullptr;
InterruptableSensorBase::InterruptableSensorBase() {
m_interrupt = nullptr;
Resource::CreateResourceObject(&m_interrupts, interrupt_kNumSystems);
}
InterruptableSensorBase::~InterruptableSensorBase() {}
/**
* Request one of the 8 interrupts asynchronously on this digital input.
* Request interrupts in asynchronous mode where the user's interrupt handler

View File

@@ -16,23 +16,6 @@
constexpr double IterativeRobot::kDefaultPeriod;
/**
* Constructor for RobotIterativeBase
*
* The constructor initializes the instance variables for the robot to indicate
* the status of initialization for disabled, autonomous, teleop, and test code.
*/
IterativeRobot::IterativeRobot()
: m_disabledInitialized(false),
m_autonomousInitialized(false),
m_teleopInitialized(false),
m_testInitialized(false) {}
/**
* Free the resources for a RobotIterativeBase class.
*/
IterativeRobot::~IterativeRobot() {}
void IterativeRobot::Prestart() {
// Don't immediately say that the robot's ready to be enabled.
// See below.

View File

@@ -29,7 +29,6 @@ void Jaguar::InitJaguar() {
HALReport(HALUsageReporting::kResourceType_Jaguar, GetChannel());
LiveWindow::GetInstance()->AddActuator("Jaguar", GetChannel(), this);
m_isInverted = false;
}
/**
@@ -39,8 +38,6 @@ void Jaguar::InitJaguar() {
*/
Jaguar::Jaguar(uint32_t channel) : SafePWM(channel) { InitJaguar(); }
Jaguar::~Jaguar() {}
/**
* Set the PWM value.
*

View File

@@ -30,13 +30,7 @@ static bool joySticksInitialized = false;
* (0-5).
*/
Joystick::Joystick(uint32_t port)
: m_ds(nullptr),
m_port(port),
m_axes(nullptr),
m_buttons(nullptr),
m_outputs(0),
m_leftRumble(0),
m_rightRumble(0) {
: m_port(port) {
InitJoystick(kNumAxisTypes, kNumButtonTypes);
m_axes[kXAxis] = kDefaultXAxis;
@@ -63,7 +57,7 @@ Joystick::Joystick(uint32_t port)
*/
Joystick::Joystick(uint32_t port, uint32_t numAxisTypes,
uint32_t numButtonTypes)
: m_ds(nullptr), m_port(port), m_axes(nullptr), m_buttons(nullptr) {
: m_port(port) {
InitJoystick(numAxisTypes, numButtonTypes);
}

View File

@@ -26,11 +26,6 @@ Notifier::Notifier(TimerEventHandler handler, void *param) {
wpi_setWPIErrorWithContext(NullParameter, "handler must not be nullptr");
m_handler = handler;
m_param = param;
m_periodic = false;
m_expirationTime = 0;
m_period = 0;
m_nextEvent = nullptr;
m_queued = false;
m_handlerSemaphore = initializeSemaphore(SEMAPHORE_FULL);
{
Synchronized sync(queueSemaphore);

View File

@@ -33,8 +33,7 @@ static const char *kEnabled = "enabled";
* integral and differental terms. The default is 50ms.
*/
PIDController::PIDController(float Kp, float Ki, float Kd, PIDSource *source,
PIDOutput *output, float period)
: m_semaphore(0) {
PIDOutput *output, float period) {
Initialize(Kp, Ki, Kd, 0.0f, source, output, period);
}
@@ -50,16 +49,13 @@ PIDController::PIDController(float Kp, float Ki, float Kd, PIDSource *source,
* integral and differental terms. The default is 50ms.
*/
PIDController::PIDController(float Kp, float Ki, float Kd, float Kf,
PIDSource *source, PIDOutput *output, float period)
: m_semaphore(0) {
PIDSource *source, PIDOutput *output, float period) {
Initialize(Kp, Ki, Kd, Kf, source, output, period);
}
void PIDController::Initialize(float Kp, float Ki, float Kd, float Kf,
PIDSource *source, PIDOutput *output,
float period) {
m_table = nullptr;
m_semaphore = initializeMutexNormal();
m_controlLoop = new Notifier(PIDController::CallCalculate, this);
@@ -69,22 +65,6 @@ void PIDController::Initialize(float Kp, float Ki, float Kd, float Kf,
m_D = Kd;
m_F = Kf;
m_maximumOutput = 1.0;
m_minimumOutput = -1.0;
m_maximumInput = 0;
m_minimumInput = 0;
m_continuous = false;
m_enabled = false;
m_setpoint = 0;
m_prevError = 0;
m_totalError = 0;
m_tolerance = .05;
m_result = 0;
m_pidInput = source;
m_pidOutput = output;
m_period = period;
@@ -94,8 +74,6 @@ void PIDController::Initialize(float Kp, float Ki, float Kd, float Kf,
static int32_t instances = 0;
instances++;
HALReport(HALUsageReporting::kResourceType_PIDController, instances);
m_toleranceType = kNoTolerance;
}
/**

View File

@@ -30,7 +30,6 @@ const int32_t PWM::kPwmDisabled;
* port
*/
void PWM::InitPWM(uint32_t channel) {
m_table = nullptr;
char buf[64];
if (!CheckPWMChannel(channel)) {

View File

@@ -16,7 +16,7 @@ PowerDistributionPanel::PowerDistributionPanel() : PowerDistributionPanel(0) {}
* Initialize the PDP.
*/
PowerDistributionPanel::PowerDistributionPanel(uint8_t module)
: m_table(nullptr), m_module(module) {
: m_module(module) {
initializePDP(m_module);
}

View File

@@ -28,10 +28,7 @@ static const char *kValueSuffix = "\"\n";
Preferences *Preferences::_instance = nullptr;
Preferences::Preferences()
: m_fileLock(nullptr),
m_fileOpStarted(nullptr),
m_tableLock(nullptr),
m_readTask("PreferencesReadTask", (FUNCPTR)Preferences::InitReadTask),
: m_readTask("PreferencesReadTask", (FUNCPTR)Preferences::InitReadTask),
m_writeTask("PreferencesWriteTask", (FUNCPTR)Preferences::InitWriteTask) {
m_fileLock = initializeMutexRecursive();
m_fileOpStarted = initializeSemaphore(SEMAPHORE_EMPTY);

View File

@@ -25,7 +25,6 @@ static Resource *relayChannels = nullptr;
* lines at 0v.
*/
void Relay::InitRelay() {
m_table = nullptr;
char buf[64];
Resource::CreateResourceObject(&relayChannels,
dio_kNumSystems * kRelayChannels * 2);

View File

@@ -52,7 +52,7 @@ void RobotBase::robotSetup(RobotBase *robot) {
* nice to put this code into it's own task that loads on boot so ensure that it
* runs.
*/
RobotBase::RobotBase() : m_task(nullptr), m_ds(nullptr) {
RobotBase::RobotBase() {
m_ds = DriverStation::GetInstance();
RobotState::SetImplementation(DriverStation::GetInstance());
HLUsageReporting::SetImplementation(new HardwareHLReporting());

View File

@@ -37,15 +37,8 @@ const int32_t RobotDrive::kMaxNumberOfMotors;
* robot drive.
*/
void RobotDrive::InitRobotDrive() {
m_frontLeftMotor = nullptr;
m_frontRightMotor = nullptr;
m_rearRightMotor = nullptr;
m_rearLeftMotor = nullptr;
m_sensitivity = 0.5;
m_maxOutput = 1.0;
m_safetyHelper = new MotorSafetyHelper(this);
m_safetyHelper->SetSafetyEnabled(true);
m_syncGroup = 0;
}
/**

View File

@@ -54,11 +54,6 @@ SensorBase::SensorBase() {
}
}
/**
* Frees the resources for a SensorBase.
*/
SensorBase::~SensorBase() {}
/**
* Add sensor to the singleton list.
* Add this sensor to the list of singletons that need to be deleted when

View File

@@ -27,7 +27,7 @@
*/
SerialPort::SerialPort(uint32_t baudRate, Port port, uint8_t dataBits,
SerialPort::Parity parity, SerialPort::StopBits stopBits)
: m_resourceManagerHandle(0), m_portHandle(0), m_consoleModeEnabled(false) {
{
int32_t status = 0;
m_port = port;

View File

@@ -24,7 +24,6 @@ constexpr float Servo::kDefaultMinServoPWM;
* well as the minimum and maximum PWM values supported by the servo.
*/
void Servo::InitServo() {
m_table = nullptr;
SetBounds(kDefaultMaxServoPWM, 0.0, 0.0, 0.0, kDefaultMinServoPWM);
SetPeriodMultiplier(kPeriodMultiplier_4X);

View File

@@ -14,7 +14,6 @@
* Common function to implement constructor behavior.
*/
void Solenoid::InitSolenoid() {
m_table = nullptr;
char buf[64];
if (!CheckSolenoidModule(m_moduleNumber)) {
snprintf(buf, 64, "Solenoid Module %d", m_moduleNumber);

View File

@@ -27,11 +27,6 @@ SolenoidBase::SolenoidBase(uint8_t moduleNumber)
}
}
/**
* Destructor.
*/
SolenoidBase::~SolenoidBase() {}
/**
* Set the value of a solenoid.
*

View File

@@ -36,7 +36,6 @@ void Talon::InitTalon() {
HALReport(HALUsageReporting::kResourceType_Talon, GetChannel());
LiveWindow::GetInstance()->AddActuator("Talon", GetChannel(), this);
m_isInverted = false;
}
/**
@@ -46,8 +45,6 @@ void Talon::InitTalon() {
*/
Talon::Talon(uint32_t channel) : SafePWM(channel) { InitTalon(); }
Talon::~Talon() {}
/**
* Set the PWM value.
*

View File

@@ -35,7 +35,6 @@ void TalonSRX::InitTalonSRX() {
HALReport(HALUsageReporting::kResourceType_TalonSRX, GetChannel());
LiveWindow::GetInstance()->AddActuator("TalonSRX", GetChannel(), this);
m_isInverted = false;
}
/**
@@ -45,8 +44,6 @@ void TalonSRX::InitTalonSRX() {
*/
TalonSRX::TalonSRX(uint32_t channel) : SafePWM(channel) { InitTalonSRX(); }
TalonSRX::~TalonSRX() {}
/**
* Set the PWM value.
*

View File

@@ -25,7 +25,6 @@ const uint32_t Task::kDefaultPriority;
*/
Task::Task(const char* name, FUNCPTR function, int32_t priority,
uint32_t stackSize) {
m_taskID = NULL_TASK;
m_function = function;
m_priority = priority;
m_stackSize = stackSize;

View File

@@ -59,11 +59,7 @@ double GetTime() {
* not running and
* must be started.
*/
Timer::Timer()
: m_startTime(0.0),
m_accumulatedTime(0.0),
m_running(false),
m_semaphore(nullptr) {
Timer::Timer() {
// Creates a semaphore to control access to critical regions.
// Initially 'open'
m_semaphore = initializeMutexNormal();

View File

@@ -19,10 +19,6 @@
wpi_setImaqErrorWithContext(error, #funName); \
}
// Constants for the manual and auto types
static const std::string AUTO = "Auto";
static const std::string MANUAL = "Manual";
/**
* Helper function to determine the size of a jpeg. The general structure of
* how to parse a jpeg for length can be found in this stackoverflow article:
@@ -76,23 +72,8 @@ unsigned int USBCamera::GetJpegSize(void* buffer, unsigned int buffSize) {
}
USBCamera::USBCamera(std::string name, bool useJpeg)
: m_id(0),
m_name(name),
m_useJpeg(useJpeg),
m_active(false),
m_open(false),
m_mutex(),
m_width(320),
m_height(240),
m_fps(30),
m_whiteBalance(AUTO),
m_whiteBalanceValue(0),
m_whiteBalanceValuePresent(false),
m_exposure(MANUAL),
m_exposureValue(50),
m_exposureValuePresent(false),
m_brightness(80),
m_needSettingsUpdate(true) {}
: m_name(name),
m_useJpeg(useJpeg) {}
void USBCamera::OpenCamera() {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
@@ -188,10 +169,10 @@ void USBCamera::UpdateSettings() {
if (m_whiteBalance.compare(AUTO) == 0) {
SAFE_IMAQ_CALL(IMAQdxSetAttribute, m_id, ATTR_WB_MODE,
IMAQdxValueTypeString, AUTO.c_str());
IMAQdxValueTypeString, AUTO);
} else {
SAFE_IMAQ_CALL(IMAQdxSetAttribute, m_id, ATTR_WB_MODE,
IMAQdxValueTypeString, MANUAL.c_str());
IMAQdxValueTypeString, MANUAL);
if (m_whiteBalanceValuePresent)
SAFE_IMAQ_CALL(IMAQdxSetAttribute, m_id, ATTR_WB_VALUE,
IMAQdxValueTypeU32, m_whiteBalanceValue);
@@ -203,7 +184,7 @@ void USBCamera::UpdateSettings() {
std::string("AutoAperaturePriority").c_str());
} else {
SAFE_IMAQ_CALL(IMAQdxSetAttribute, m_id, ATTR_EX_MODE,
IMAQdxValueTypeString, MANUAL.c_str());
IMAQdxValueTypeString, MANUAL);
if (m_exposureValuePresent) {
double minv = 0.0;
double maxv = 0.0;
@@ -218,7 +199,7 @@ void USBCamera::UpdateSettings() {
}
SAFE_IMAQ_CALL(IMAQdxSetAttribute, m_id, ATTR_BR_MODE, IMAQdxValueTypeString,
MANUAL.c_str());
MANUAL);
double minv = 0.0;
double maxv = 0.0;
SAFE_IMAQ_CALL(IMAQdxGetAttributeMinimum, m_id, ATTR_BR_VALUE,

View File

@@ -66,7 +66,6 @@ void Ultrasonic::UltrasonicChecker() {
* restored.
*/
void Ultrasonic::Initialize() {
m_table = nullptr;
bool originalMode = m_automaticEnabled;
if (m_semaphore == nullptr) m_semaphore = initializeSemaphore(SEMAPHORE_FULL);
SetAutomaticMode(false); // kill task when adding a new sensor

View File

@@ -39,7 +39,6 @@ void Victor::InitVictor() {
LiveWindow::GetInstance()->AddActuator("Victor", GetChannel(), this);
HALReport(HALUsageReporting::kResourceType_Victor, GetChannel());
m_isInverted = false;
}
/**
@@ -49,8 +48,6 @@ void Victor::InitVictor() {
*/
Victor::Victor(uint32_t channel) : SafePWM(channel) { InitVictor(); }
Victor::~Victor() {}
/**
* Set the PWM value.
*

View File

@@ -36,7 +36,6 @@ void VictorSP::InitVictorSP() {
HALReport(HALUsageReporting::kResourceType_VictorSP, GetChannel());
LiveWindow::GetInstance()->AddActuator("VictorSP", GetChannel(), this);
m_isInverted = false;
}
/**
@@ -46,8 +45,6 @@ void VictorSP::InitVictorSP() {
*/
VictorSP::VictorSP(uint32_t channel) : SafePWM(channel) { InitVictorSP(); }
VictorSP::~VictorSP() {}
/**
* Set the PWM value.
*

View File

@@ -43,21 +43,7 @@ static const std::string kRotationStrings[] = {
* @param cameraHost The host to find the camera at, typically an IP address
*/
AxisCamera::AxisCamera(std::string const &cameraHost)
: m_cameraHost(cameraHost),
m_cameraSocket(-1),
m_freshImage(false),
m_brightness(50),
m_whiteBalance(kWhiteBalance_Automatic),
m_colorLevel(50),
m_exposureControl(kExposureControl_Automatic),
m_exposurePriority(50),
m_maxFPS(0),
m_resolution(kResolution_640x480),
m_compression(50),
m_rotation(kRotation_0),
m_parametersDirty(true),
m_streamDirty(true),
m_done(false) {
: m_cameraHost(cameraHost) {
m_captureThread = std::thread(&AxisCamera::Capture, this);
}

View File

@@ -11,10 +11,6 @@
using namespace std;
BinaryImage::BinaryImage() : MonoImage() {}
BinaryImage::~BinaryImage() {}
/**
* Get then number of particles for the image.
* @returns the number of particles found for the image.

View File

@@ -10,8 +10,6 @@
ColorImage::ColorImage(ImageType type) : ImageBase(type) {}
ColorImage::~ColorImage() {}
/**
* Perform a threshold operation on a ColorImage.
* Perform a threshold operation on a ColorImage using the ColorMode supplied

View File

@@ -19,5 +19,3 @@ HSLImage::HSLImage(const char *fileName) : ColorImage(IMAQ_IMAGE_HSL) {
int success = imaqReadFile(m_imaqImage, fileName, nullptr, nullptr);
wpi_setImaqErrorWithContext(success, "Imaq ReadFile error");
}
HSLImage::~HSLImage() {}

View File

@@ -11,8 +11,6 @@ using namespace std;
MonoImage::MonoImage() : ImageBase(IMAQ_IMAGE_U8) {}
MonoImage::~MonoImage() {}
/**
* Look for ellipses in an image.
* Given some input parameters, look for any number of ellipses in an image.

View File

@@ -19,5 +19,3 @@ RGBImage::RGBImage(const char *fileName) : ColorImage(IMAQ_IMAGE_RGB) {
int success = imaqReadFile(m_imaqImage, fileName, nullptr, nullptr);
wpi_setImaqErrorWithContext(success, "Imaq ReadFile error");
}
RGBImage::~RGBImage() {}