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

@@ -14,7 +14,7 @@ class Command;
class ButtonScheduler {
public:
ButtonScheduler(bool last, Trigger *button, Command *orders);
virtual ~ButtonScheduler() {}
virtual ~ButtonScheduler() = default;
virtual void Execute() = 0;
void Start();

View File

@@ -16,7 +16,7 @@ class Command;
class CancelButtonScheduler : public ButtonScheduler {
public:
CancelButtonScheduler(bool last, Trigger *button, Command *orders);
virtual ~CancelButtonScheduler() {}
virtual ~CancelButtonScheduler() = default;
virtual void Execute();
private:

View File

@@ -16,7 +16,7 @@ class Command;
class HeldButtonScheduler : public ButtonScheduler {
public:
HeldButtonScheduler(bool last, Trigger *button, Command *orders);
virtual ~HeldButtonScheduler() {}
virtual ~HeldButtonScheduler() = default;
virtual void Execute();
};

View File

@@ -12,9 +12,9 @@
class InternalButton : public Button {
public:
InternalButton();
InternalButton() = default;
InternalButton(bool inverted);
virtual ~InternalButton() {}
virtual ~InternalButton() = default;
void SetInverted(bool inverted);
void SetPressed(bool pressed);
@@ -22,8 +22,8 @@ class InternalButton : public Button {
virtual bool Get();
private:
bool m_pressed;
bool m_inverted;
bool m_pressed = false;
bool m_inverted = false;
};
#endif

View File

@@ -14,7 +14,7 @@
class JoystickButton : public Button {
public:
JoystickButton(GenericHID *joystick, int buttonNumber);
virtual ~JoystickButton() {}
virtual ~JoystickButton() = default;
virtual bool Get();

View File

@@ -15,7 +15,7 @@ class NetworkButton : public Button {
public:
NetworkButton(const char *tableName, const char *field);
NetworkButton(ITable *table, const char *field);
virtual ~NetworkButton() {}
virtual ~NetworkButton() = default;
virtual bool Get();

View File

@@ -16,7 +16,7 @@ class Command;
class PressedButtonScheduler : public ButtonScheduler {
public:
PressedButtonScheduler(bool last, Trigger *button, Command *orders);
virtual ~PressedButtonScheduler() {}
virtual ~PressedButtonScheduler() = default;
virtual void Execute();
};

View File

@@ -16,7 +16,7 @@ class Command;
class ReleasedButtonScheduler : public ButtonScheduler {
public:
ReleasedButtonScheduler(bool last, Trigger *button, Command *orders);
virtual ~ReleasedButtonScheduler() {}
virtual ~ReleasedButtonScheduler() = default;
virtual void Execute();
};

View File

@@ -16,7 +16,7 @@ class Command;
class ToggleButtonScheduler : public ButtonScheduler {
public:
ToggleButtonScheduler(bool last, Trigger *button, Command *orders);
virtual ~ToggleButtonScheduler() {}
virtual ~ToggleButtonScheduler() = default;
virtual void Execute();
private:

View File

@@ -31,8 +31,8 @@ class Command;
*/
class Trigger : public Sendable {
public:
Trigger();
virtual ~Trigger() {}
Trigger() = default;
virtual ~Trigger() = default;
bool Grab();
virtual bool Get() = 0;
void WhenActive(Command *command);
@@ -46,7 +46,7 @@ class Trigger : public Sendable {
virtual std::string GetSmartDashboardType() const;
protected:
ITable *m_table;
ITable *m_table = nullptr;
};
#endif

View File

@@ -139,28 +139,39 @@ class Command : public ErrorBase, public NamedSendable, public ITableListener {
/** The name of this command */
std::string m_name;
/** The time since this command was initialized */
double m_startTime;
double m_startTime = -1;
/** The time (in seconds) before this command "times out" (or -1 if no
* timeout) */
double m_timeout;
/** Whether or not this command has been initialized */
bool m_initialized;
bool m_initialized = false;
/** The requirements (or null if no requirements) */
SubsystemSet m_requirements;
/** Whether or not it is running */
bool m_running;
bool m_running = false;
/** Whether or not it is interruptible*/
bool m_interruptible;
bool m_interruptible = true;
/** Whether or not it has been canceled */
bool m_canceled;
bool m_canceled = false;
/** Whether or not it has been locked */
bool m_locked;
bool m_locked = false;
/** Whether this command should run when the robot is disabled */
bool m_runWhenDisabled;
bool m_runWhenDisabled = false;
/** The {@link CommandGroup} this is in */
CommandGroup *m_parent;
int m_commandID;
CommandGroup *m_parent = nullptr;
int m_commandID = m_commandCounter++;
static int m_commandCounter;
public:
@@ -172,7 +183,7 @@ class Command : public ErrorBase, public NamedSendable, public ITableListener {
EntryValue value, bool isNew);
protected:
ITable *m_table;
ITable *m_table = nullptr;
};
#endif

View File

@@ -36,9 +36,9 @@
*/
class CommandGroup : public Command {
public:
CommandGroup();
CommandGroup() = default;
CommandGroup(const char *name);
virtual ~CommandGroup();
virtual ~CommandGroup() = default;
void AddSequential(Command *command);
void AddSequential(Command *command, double timeout);
@@ -61,14 +61,14 @@ class CommandGroup : public Command {
private:
void CancelConflicts(Command *command);
typedef std::vector<CommandGroupEntry> CommandVector;
/** The commands in this group (stored in entries) */
CommandVector m_commands;
typedef std::list<CommandGroupEntry> CommandList;
std::vector<CommandGroupEntry> m_commands;
/** The active children in this group (stored in entries) */
CommandList m_children;
std::list<CommandGroupEntry> m_children;
/** The current command, -1 signifies that none have been run */
int m_currentCommandIndex;
int m_currentCommandIndex = -1;
};
#endif

View File

@@ -18,14 +18,13 @@ class CommandGroupEntry {
kSequence_BranchChild
} Sequence;
CommandGroupEntry();
CommandGroupEntry(Command *command, Sequence state);
CommandGroupEntry(Command *command, Sequence state, double timeout);
CommandGroupEntry() = default;
CommandGroupEntry(Command *command, Sequence state, double timeout = -1.0);
bool IsTimedOut() const;
double m_timeout;
Command *m_command;
Sequence m_state;
Command *m_command = nullptr;
Sequence m_state = kSequence_InSequence;
};
#endif

View File

@@ -14,7 +14,7 @@
class PrintCommand : public Command {
public:
PrintCommand(const char *message);
virtual ~PrintCommand() {}
virtual ~PrintCommand() = default;
protected:
virtual void Initialize();

View File

@@ -52,20 +52,20 @@ class Scheduler : public ErrorBase, public NamedSendable {
static Scheduler *_instance;
Command::SubsystemSet m_subsystems;
MUTEX_ID m_buttonsLock;
MUTEX_ID m_buttonsLock = nullptr;
typedef std::vector<ButtonScheduler *> ButtonVector;
ButtonVector m_buttons;
typedef std::vector<Command *> CommandVector;
MUTEX_ID m_additionsLock;
MUTEX_ID m_additionsLock = nullptr;
CommandVector m_additions;
typedef std::set<Command *> CommandSet;
CommandSet m_commands;
bool m_adding;
bool m_enabled;
StringArray *commands;
NumberArray *ids;
NumberArray *toCancel;
ITable *m_table;
bool m_runningCommandsChanged;
bool m_adding = false;
bool m_enabled = true;
StringArray *commands = nullptr;
NumberArray *ids = nullptr;
NumberArray *toCancel = nullptr;
ITable *m_table = nullptr;
bool m_runningCommandsChanged = false;
};
#endif

View File

@@ -13,7 +13,7 @@
class StartCommand : public Command {
public:
StartCommand(Command *commandToStart);
virtual ~StartCommand() {}
virtual ~StartCommand() = default;
protected:
virtual void Initialize();

View File

@@ -19,7 +19,7 @@ class Subsystem : public ErrorBase, public NamedSendable {
public:
Subsystem(const char *name);
virtual ~Subsystem() {}
virtual ~Subsystem() = default;
void SetDefaultCommand(Command *command);
Command *GetDefaultCommand();
@@ -30,11 +30,11 @@ class Subsystem : public ErrorBase, public NamedSendable {
private:
void ConfirmCommand();
Command *m_currentCommand;
bool m_currentCommandChanged;
Command *m_defaultCommand;
Command *m_currentCommand = nullptr;
bool m_currentCommandChanged = true;
Command *m_defaultCommand = nullptr;
std::string m_name;
bool m_initializedDefaultCommand;
bool m_initializedDefaultCommand = false;
public:
virtual std::string GetName();
@@ -43,7 +43,7 @@ class Subsystem : public ErrorBase, public NamedSendable {
virtual std::string GetSmartDashboardType() const;
protected:
ITable *m_table;
ITable *m_table = nullptr;
};
#endif

View File

@@ -14,7 +14,7 @@ class WaitCommand : public Command {
public:
WaitCommand(double timeout);
WaitCommand(const char *name, double timeout);
virtual ~WaitCommand() {}
virtual ~WaitCommand() = default;
protected:
virtual void Initialize();

View File

@@ -14,7 +14,7 @@ class WaitForChildren : public Command {
public:
WaitForChildren(double timeout);
WaitForChildren(const char *name, double timeout);
virtual ~WaitForChildren() {}
virtual ~WaitForChildren() = default;
protected:
virtual void Initialize();

View File

@@ -14,7 +14,7 @@ class WaitUntilCommand : public Command {
public:
WaitUntilCommand(double time);
WaitUntilCommand(const char *name, double time);
virtual ~WaitUntilCommand() {}
virtual ~WaitUntilCommand() = default;
protected:
virtual void Initialize();

View File

@@ -20,7 +20,7 @@
*/
class Controller {
public:
virtual ~Controller(){};
virtual ~Controller() = default;
/**
* Allows the control loop to run

View File

@@ -21,7 +21,6 @@ class Error {
typedef int32_t Code;
Error();
~Error();
void Clone(Error& error);
Code GetCode() const;
const char* GetMessage() const;
@@ -41,13 +40,13 @@ class Error {
private:
void Report();
Code m_code;
Code m_code = 0;
std::string m_message;
std::string m_filename;
std::string m_function;
uint32_t m_lineNumber;
const ErrorBase* m_originatingObject;
double m_timestamp;
uint32_t m_lineNumber = 0;
const ErrorBase* m_originatingObject = nullptr;
double m_timestamp = 0.0;
static bool m_suspendOnErrorEnabled;
DISALLOW_COPY_AND_ASSIGN(Error);

View File

@@ -51,7 +51,8 @@
class ErrorBase {
// TODO: Consider initializing instance variables and cleanup in destructor
public:
virtual ~ErrorBase();
ErrorBase();
virtual ~ErrorBase() = default;
virtual Error& GetError();
virtual const Error& GetError() const;
virtual void SetErrnoError(const char* contextMessage, const char* filename,
@@ -82,7 +83,6 @@ class ErrorBase {
// TODO: Replace globalError with a global list of all errors.
static MUTEX_ID _globalErrorMutex;
static Error _globalError;
ErrorBase();
private:
DISALLOW_COPY_AND_ASSIGN(ErrorBase);

View File

@@ -14,7 +14,7 @@ class GenericHID {
public:
enum JoystickHand { kLeftHand = 0, kRightHand = 1 };
virtual ~GenericHID() {}
virtual ~GenericHID() = default;
virtual float GetX(JoystickHand hand = kRightHand) const = 0;
virtual float GetY(JoystickHand hand = kRightHand) const = 0;

View File

@@ -7,7 +7,7 @@
class HLUsageReportingInterface {
public:
virtual ~HLUsageReportingInterface(){};
virtual ~HLUsageReportingInterface() = default;
virtual void ReportScheduler() = 0;
virtual void ReportSmartDashboard() = 0;
};

View File

@@ -12,7 +12,7 @@ struct LiveWindowComponent {
std::string name;
bool isSensor;
LiveWindowComponent() {}
LiveWindowComponent() = default;
LiveWindowComponent(std::string subsystem, std::string name, bool isSensor) {
this->subsystem = subsystem;
this->name = name;
@@ -46,7 +46,7 @@ class LiveWindow {
protected:
LiveWindow();
virtual ~LiveWindow();
virtual ~LiveWindow() = default;
private:
void UpdateValues();
@@ -61,8 +61,8 @@ class LiveWindow {
Scheduler *m_scheduler;
bool m_enabled;
bool m_firstTime;
bool m_enabled = false;
bool m_firstTime = true;
};
#endif

View File

@@ -35,11 +35,11 @@ class Notifier : public ErrorBase {
void DeleteFromQueue(); // delete this Notifier from the timer queue
TimerEventHandler m_handler; // address of the handler
void *m_param; // a parameter to pass to the handler
double m_period; // the relative time (either periodic or single)
double m_expirationTime; // absolute expiration time for the current event
Notifier *m_nextEvent; // next Nofifier event
bool m_periodic; // true if this is a periodic event
bool m_queued; // indicates if this entry is queued
double m_period = 0; // the relative time (either periodic or single)
double m_expirationTime = 0; // absolute expiration time for the current event
Notifier *m_nextEvent = nullptr; // next Nofifier event
bool m_periodic = false; // true if this is a periodic event
bool m_queued = false; // indicates if this entry is queued
SEMAPHORE_ID m_handlerSemaphore; // held by interrupt manager task while
// handler call is in progress

View File

@@ -66,24 +66,28 @@ class PIDController : public LiveWindowSendable,
float m_I; // factor for "integral" control
float m_D; // factor for "derivative" control
float m_F; // factor for "feed forward" control
float m_maximumOutput; // |maximum output|
float m_minimumOutput; // |minimum output|
float m_maximumInput; // maximum input - limit setpoint to this
float m_minimumInput; // minimum input - limit setpoint to this
bool m_continuous; // do the endpoints wrap around? eg. Absolute encoder
bool m_enabled; // is the pid controller enabled
float m_maximumOutput = 1.0; // |maximum output|
float m_minimumOutput = -1.0; // |minimum output|
float m_maximumInput = 0; // maximum input - limit setpoint to this
float m_minimumInput = 0; // minimum input - limit setpoint to this
bool m_continuous = false; // do the endpoints wrap around? eg. Absolute encoder
bool m_enabled = false; // is the pid controller enabled
bool m_destruct; // should the calculate thread stop running
float m_prevError; // the prior sensor input (used to compute velocity)
double m_totalError; // the sum of the errors for use in the integral calc
enum { kAbsoluteTolerance, kPercentTolerance, kNoTolerance } m_toleranceType;
float m_tolerance; // the percetage or absolute error that is considered on
float m_prevError = 0; // the prior sensor input (used to compute velocity)
double m_totalError = 0; // the sum of the errors for use in the integral calc
enum {
kAbsoluteTolerance,
kPercentTolerance,
kNoTolerance
} m_toleranceType = kNoTolerance;
float m_tolerance = 0.05; // the percetage or absolute error that is considered on
// target
float m_setpoint;
float m_setpoint = 0;
float m_error;
float m_result;
float m_result = 0;
float m_period;
MUTEX_ID m_semaphore;
MUTEX_ID m_semaphore = 0;
PIDSource *m_pidInput;
PIDOutput *m_pidOutput;
@@ -103,7 +107,7 @@ class PIDController : public LiveWindowSendable,
virtual void StopLiveWindowMode() override;
protected:
ITable *m_table;
ITable *m_table = nullptr;
virtual void Calculate();
DISALLOW_COPY_AND_ASSIGN(PIDController);

View File

@@ -7,7 +7,7 @@
class RobotStateInterface {
public:
virtual ~RobotStateInterface(){};
virtual ~RobotStateInterface() = default;
virtual bool IsDisabled() const = 0;
virtual bool IsEnabled() const = 0;
virtual bool IsOperatorControl() const = 0;

View File

@@ -19,7 +19,7 @@
class SensorBase : public ErrorBase {
public:
SensorBase();
virtual ~SensorBase();
virtual ~SensorBase() = default;
static void DeleteSingletons();
static uint32_t GetDefaultSolenoidModule() { return 0; }

View File

@@ -32,8 +32,7 @@
*/
class SendableChooser : public Sendable {
public:
SendableChooser();
virtual ~SendableChooser(){};
virtual ~SendableChooser() = default;
void AddObject(const char *name, void *object);
void AddDefault(const char *name, void *object);

View File

@@ -40,9 +40,7 @@ class SmartDashboard : public SensorBase {
static void RetrieveValue(std::string keyName, ComplexData &value);
private:
SmartDashboard();
virtual ~SmartDashboard();
DISALLOW_COPY_AND_ASSIGN(SmartDashboard);
virtual ~SmartDashboard() = default;
/** The {@link NetworkTable} used by {@link SmartDashboard} */
static ITable *m_table;

View File

@@ -44,7 +44,7 @@ class Task : public ErrorBase {
private:
FUNCPTR m_function;
char* m_taskName;
TASK m_taskID;
TASK m_taskID = NULL_TASK;
uint32_t m_stackSize;
int m_priority;
bool HandleError(STATUS results);

View File

@@ -43,9 +43,9 @@ class Timer {
static constexpr double kRolloverTime = (1ll << 32) / 1e6;
private:
double m_startTime;
double m_accumulatedTime;
bool m_running;
MUTEX_ID m_semaphore;
double m_startTime = 0.0;
double m_accumulatedTime = 0.0;
bool m_running = false;
MUTEX_ID m_semaphore = nullptr;
DISALLOW_COPY_AND_ASSIGN(Timer);
};

View File

@@ -10,7 +10,7 @@
*/
class Accelerometer {
public:
virtual ~Accelerometer(){};
virtual ~Accelerometer() = default;
enum Range { kRange_2G = 0, kRange_4G = 1, kRange_8G = 2, kRange_16G = 3 };

View File

@@ -15,7 +15,7 @@
*/
class Potentiometer : public PIDSource {
public:
virtual ~Potentiometer(){};
virtual ~Potentiometer() = default;
/**
* Common interface for getting the current value of a potentiometer.
*

View File

@@ -7,8 +7,6 @@
#include "Buttons/InternalButton.h"
InternalButton::InternalButton() : m_pressed(false), m_inverted(false) {}
InternalButton::InternalButton(bool inverted)
: m_pressed(inverted), m_inverted(inverted) {}

View File

@@ -13,8 +13,6 @@
#include "Buttons/ToggleButtonScheduler.h"
#include "Buttons/CancelButtonScheduler.h"
Trigger::Trigger() { m_table = nullptr; }
bool Trigger::Grab() {
if (Get())
return true;

View File

@@ -20,18 +20,8 @@ static const char *kIsParented = "isParented";
int Command::m_commandCounter = 0;
void Command::InitCommand(const char *name, double timeout) {
m_commandID = m_commandCounter++;
m_timeout = timeout;
m_locked = false;
m_startTime = -1;
m_initialized = false;
m_running = false;
m_interruptible = true;
m_canceled = false;
m_runWhenDisabled = false;
m_parent = nullptr;
m_name = name == nullptr ? std::string() : name;
m_table = nullptr;
}
/**

View File

@@ -8,20 +8,11 @@
#include "Commands/CommandGroup.h"
#include "WPIErrors.h"
/**
* Creates a new {@link CommandGroup CommandGroup}.
*/
CommandGroup::CommandGroup() { m_currentCommandIndex = -1; }
/**
* Creates a new {@link CommandGroup CommandGroup} with the given name.
* @param name the name for this command group
*/
CommandGroup::CommandGroup(const char *name) : Command(name) {
m_currentCommandIndex = -1;
}
CommandGroup::~CommandGroup() {}
CommandGroup::CommandGroup(const char *name) : Command(name) {}
/**
* Adds a new {@link Command Command} to the group. The {@link Command Command}

View File

@@ -9,12 +9,6 @@
#include "Commands/Command.h"
CommandGroupEntry::CommandGroupEntry()
: m_timeout(-1.0), m_command(nullptr), m_state(kSequence_InSequence) {}
CommandGroupEntry::CommandGroupEntry(Command *command, Sequence state)
: m_timeout(-1.0), m_command(command), m_state(state) {}
CommandGroupEntry::CommandGroupEntry(Command *command, Sequence state,
double timeout)
: m_timeout(timeout), m_command(command), m_state(state) {}

View File

@@ -18,19 +18,11 @@
Scheduler *Scheduler::_instance = nullptr;
Scheduler::Scheduler()
: m_buttonsLock(nullptr), m_additionsLock(nullptr), m_adding(false) {
Scheduler::Scheduler() {
m_buttonsLock = initializeMutexNormal();
m_additionsLock = initializeMutexNormal();
HLUsageReporting::ReportScheduler();
m_table = nullptr;
m_enabled = true;
m_runningCommandsChanged = false;
toCancel = nullptr;
commands = nullptr;
ids = nullptr;
}
Scheduler::~Scheduler() {

View File

@@ -15,14 +15,9 @@
* Creates a subsystem with the given name
* @param name the name of the subsystem
*/
Subsystem::Subsystem(const char *name)
: m_currentCommand(nullptr),
m_defaultCommand(nullptr),
m_initializedDefaultCommand(false) {
Subsystem::Subsystem(const char *name) {
m_name = name;
Scheduler::GetInstance()->RegisterSubsystem(this);
m_table = nullptr;
m_currentCommandChanged = true;
}
/**
* Initialize the default command for this subsystem

View File

@@ -19,10 +19,7 @@
#include "Utility.h"
bool Error::m_suspendOnErrorEnabled = false;
Error::Error()
: m_code(0), m_lineNumber(0), m_originatingObject(nullptr), m_timestamp(0.0) {}
Error::~Error() {}
Error::Error() {}
void Error::Clone(Error& error) {
m_code = error.m_code;

View File

@@ -21,8 +21,6 @@ Error ErrorBase::_globalError;
*/
ErrorBase::ErrorBase() {}
ErrorBase::~ErrorBase() {}
/**
* @brief Retrieve the current error.
* Get the current error information associated with this sensor.

View File

@@ -20,7 +20,6 @@ LiveWindow *LiveWindow::GetInstance() {
* Allocate the necessary tables.
*/
LiveWindow::LiveWindow() {
m_enabled = false;
m_liveWindowTable = NetworkTable::GetTable("LiveWindow");
m_statusTable = m_liveWindowTable->GetSubTable("~STATUS~");
m_scheduler = Scheduler::GetInstance();
@@ -52,8 +51,6 @@ void LiveWindow::SetEnabled(bool enabled) {
m_statusTable->PutBoolean("LW Enabled", m_enabled);
}
LiveWindow::~LiveWindow() {}
/**
* Add a Sensor associated with the subsystem and with call it by the given
* name.

View File

@@ -14,8 +14,6 @@ static const char *kDefault = "default";
static const char *kOptions = "options";
static const char *kSelected = "selected";
SendableChooser::SendableChooser() { m_defaultChoice = ""; }
/**
* Adds the given object to the list of options. On the {@link SmartDashboard}
* on the desktop,

View File

@@ -51,7 +51,7 @@ class ADXL345_I2C : public Accelerometer,
public:
explicit ADXL345_I2C(Port port, Range range = kRange_2G);
virtual ~ADXL345_I2C();
virtual ~ADXL345_I2C() = default;
// Accelerometer interface
virtual void SetRange(Range range) override;
@@ -69,8 +69,6 @@ class ADXL345_I2C : public Accelerometer,
virtual void StartLiveWindowMode() override {}
virtual void StopLiveWindowMode() override {}
protected:
// I2C* m_i2c;
private:
ITable *m_table;
};

View File

@@ -43,9 +43,9 @@ class AnalogAccelerometer : public SensorBase,
void InitAccelerometer();
AnalogInput *m_AnalogInput;
float m_voltsPerG;
float m_zeroGVoltage;
float m_voltsPerG = 1.0;
float m_zeroGVoltage = 2.5;
bool m_allocatedChannel;
ITable *m_table;
ITable *m_table = nullptr;
};

View File

@@ -80,5 +80,5 @@ class AnalogInput : public SensorBase,
void *m_port;
int64_t m_accumulatorOffset;
ITable *m_table;
ITable *m_table = nullptr;
};

View File

@@ -34,5 +34,5 @@ class AnalogOutput : public SensorBase, public LiveWindowSendable {
uint32_t m_channel;
void *m_port;
ITable *m_table;
ITable *m_table = nullptr;
};

View File

@@ -19,7 +19,7 @@ class BuiltInAccelerometer : public Accelerometer,
public LiveWindowSendable {
public:
BuiltInAccelerometer(Range range = kRange_8G);
virtual ~BuiltInAccelerometer();
virtual ~BuiltInAccelerometer() = default;
// Accelerometer interface
virtual void SetRange(Range range) override;
@@ -35,5 +35,5 @@ class BuiltInAccelerometer : public Accelerometer,
virtual void StopLiveWindowMode() override {}
private:
ITable *m_table;
ITable *m_table = nullptr;
};

View File

@@ -16,6 +16,7 @@
#include "LiveWindow/LiveWindowSendable.h"
#include "tables/ITable.h"
#include "NetworkCommunication/CANSessionMux.h"
#include "CAN/can_proto.h"
#include <atomic>
#include <mutex>
@@ -170,64 +171,64 @@ class CANJaguar : public MotorSafety,
mutable std::recursive_mutex m_mutex;
uint8_t m_deviceNumber;
float m_value;
float m_value = 0.0f;
// Parameters/configuration
ControlMode m_controlMode;
uint8_t m_speedReference;
uint8_t m_positionReference;
double m_p;
double m_i;
double m_d;
NeutralMode m_neutralMode;
uint16_t m_encoderCodesPerRev;
uint16_t m_potentiometerTurns;
LimitMode m_limitMode;
double m_forwardLimit;
double m_reverseLimit;
double m_maxOutputVoltage;
double m_voltageRampRate;
float m_faultTime;
uint8_t m_speedReference = LM_REF_NONE;
uint8_t m_positionReference = LM_REF_NONE;
double m_p = 0.0;
double m_i = 0.0;
double m_d = 0.0;
NeutralMode m_neutralMode = kNeutralMode_Jumper;
uint16_t m_encoderCodesPerRev = 0;
uint16_t m_potentiometerTurns = 0;
LimitMode m_limitMode = kLimitMode_SwitchInputsOnly;
double m_forwardLimit = 0.0;
double m_reverseLimit = 0.0;
double m_maxOutputVoltage = 30.0;
double m_voltageRampRate = 0.0;
float m_faultTime = 0.0f;
// Which parameters have been verified since they were last set?
bool m_controlModeVerified;
bool m_speedRefVerified;
bool m_posRefVerified;
bool m_pVerified;
bool m_iVerified;
bool m_dVerified;
bool m_neutralModeVerified;
bool m_encoderCodesPerRevVerified;
bool m_potentiometerTurnsVerified;
bool m_forwardLimitVerified;
bool m_reverseLimitVerified;
bool m_limitModeVerified;
bool m_maxOutputVoltageVerified;
bool m_voltageRampRateVerified;
bool m_faultTimeVerified;
bool m_controlModeVerified = false; // Needs to be verified because it's set in the constructor
bool m_speedRefVerified = true;
bool m_posRefVerified = true;
bool m_pVerified = true;
bool m_iVerified = true;
bool m_dVerified = true;
bool m_neutralModeVerified = true;
bool m_encoderCodesPerRevVerified = true;
bool m_potentiometerTurnsVerified = true;
bool m_forwardLimitVerified = true;
bool m_reverseLimitVerified = true;
bool m_limitModeVerified = true;
bool m_maxOutputVoltageVerified = true;
bool m_voltageRampRateVerified = true;
bool m_faultTimeVerified = true;
// Status data
mutable float m_busVoltage;
mutable float m_outputVoltage;
mutable float m_outputCurrent;
mutable float m_temperature;
mutable double m_position;
mutable double m_speed;
mutable uint8_t m_limits;
mutable uint16_t m_faults;
uint32_t m_firmwareVersion;
uint8_t m_hardwareVersion;
mutable float m_busVoltage = 0.0f;
mutable float m_outputVoltage = 0.0f;
mutable float m_outputCurrent = 0.0f;
mutable float m_temperature = 0.0f;
mutable double m_position = 0.0;
mutable double m_speed = 0.0;
mutable uint8_t m_limits = 0x00;
mutable uint16_t m_faults = 0x0000;
uint32_t m_firmwareVersion = 0;
uint8_t m_hardwareVersion = 0;
// Which periodic status messages have we received at least once?
mutable std::atomic<bool> m_receivedStatusMessage0;
mutable std::atomic<bool> m_receivedStatusMessage1;
mutable std::atomic<bool> m_receivedStatusMessage2;
mutable std::atomic<bool> m_receivedStatusMessage0{false};
mutable std::atomic<bool> m_receivedStatusMessage1{false};
mutable std::atomic<bool> m_receivedStatusMessage2{false};
bool m_controlEnabled;
void verify();
MotorSafetyHelper *m_safetyHelper;
MotorSafetyHelper *m_safetyHelper = nullptr;
void ValueChanged(ITable *source, const std::string &key, EntryValue value,
bool isNew) override;
@@ -238,9 +239,9 @@ class CANJaguar : public MotorSafety,
void InitTable(ITable *subTable) override;
ITable *GetTable() const override;
ITable *m_table;
ITable *m_table = nullptr;
private:
void InitCANJaguar();
bool m_isInverted;
bool m_isInverted = false;
};

View File

@@ -183,14 +183,14 @@ class CANTalon : public MotorSafety,
int m_deviceNumber;
CanTalonSRX *m_impl;
MotorSafetyHelper *m_safetyHelper;
int m_profile; // Profile from CANTalon to use. Set to zero until we can
// actually test this.
int m_profile = 0; // Profile from CANTalon to use. Set to zero until we can
// actually test this.
bool m_controlEnabled;
ControlMode m_controlMode;
bool m_controlEnabled = true;
ControlMode m_controlMode = kPercentVbus;
TalonControlMode m_sendMode;
double m_setPoint;
double m_setPoint = 0;
static const unsigned int kDelayForSolicitedSignalsUs = 4000;
/**
* Fixup the sendMode so Set() serializes the correct demand value.

View File

@@ -19,9 +19,9 @@ class Compressor : public SensorBase,
public LiveWindowSendable,
public ITableListener {
public:
explicit Compressor(uint8_t pcmID);
Compressor();
virtual ~Compressor();
// Default PCM ID is 0
explicit Compressor(uint8_t pcmID = GetDefaultSolenoidModule());
virtual ~Compressor() = default;
void Start();
void Stop();
@@ -55,10 +55,9 @@ class Compressor : public SensorBase,
void *m_pcm_pointer;
private:
void InitCompressor(uint8_t module);
void SetCompressor(bool on);
ITable *m_table;
ITable *m_table = nullptr;
};
#endif /* Compressor_H_ */

View File

@@ -83,15 +83,15 @@ class Counter : public SensorBase,
ITable *GetTable() const override;
protected:
DigitalSource *m_upSource; ///< What makes the counter count up.
DigitalSource *m_downSource; ///< What makes the counter count down.
void *m_counter; ///< The FPGA counter object.
DigitalSource *m_upSource = nullptr; ///< What makes the counter count up.
DigitalSource *m_downSource = nullptr; ///< What makes the counter count down.
void *m_counter = nullptr; ///< The FPGA counter object.
private:
void InitCounter(Mode mode = kTwoPulse);
bool m_allocatedUpSource; ///< Was the upSource allocated locally?
bool m_allocatedDownSource; ///< Was the downSource allocated locally?
uint32_t m_index; ///< The index of this counter.
bool m_allocatedUpSource = false; ///< Was the upSource allocated locally?
bool m_allocatedDownSource = false; ///< Was the downSource allocated locally?
uint32_t m_index = 0; ///< The index of this counter.
ITable *m_table;
ITable *m_table = nullptr;
};

View File

@@ -20,7 +20,7 @@ class CounterBase {
public:
enum EncodingType { k1X, k2X, k4X };
virtual ~CounterBase() {}
virtual ~CounterBase() = default;
virtual int32_t Get() const = 0;
virtual void Reset() = 0;
virtual double GetPeriod() const = 0;

View File

@@ -43,5 +43,5 @@ class DigitalInput : public DigitalSource, public LiveWindowSendable {
uint32_t m_channel;
bool m_lastValue;
ITable *m_table;
ITable *m_table = nullptr;
};

View File

@@ -51,5 +51,5 @@ class DigitalOutput : public DigitalSource,
uint32_t m_channel;
void *m_pwmGenerator;
ITable *m_table;
ITable *m_table = nullptr;
};

View File

@@ -20,7 +20,7 @@
*/
class DigitalSource : public InterruptableSensorBase {
public:
virtual ~DigitalSource();
virtual ~DigitalSource() = default;
virtual uint32_t GetChannelForRouting() const = 0;
virtual uint32_t GetModuleForRouting() const = 0;
virtual bool GetAnalogTriggerForRouting() const = 0;

View File

@@ -49,5 +49,5 @@ class DoubleSolenoid : public SolenoidBase,
uint8_t m_forwardMask; ///< The mask for the forward channel.
uint8_t m_reverseMask; ///< The mask for the reverse channel.
ITable* m_table;
ITable* m_table = nullptr;
};

View File

@@ -97,15 +97,15 @@ class DriverStation : public SensorBase, public RobotStateInterface {
HALJoystickPOVs m_joystickPOVs[kJoystickPorts];
HALJoystickButtons m_joystickButtons[kJoystickPorts];
HALJoystickDescriptor m_joystickDescriptor[kJoystickPorts];
Task m_task;
SEMAPHORE_ID m_newControlData;
MULTIWAIT_ID m_packetDataAvailableMultiWait;
Task m_task{"DriverStation", (FUNCPTR)DriverStation::InitTask};
SEMAPHORE_ID m_newControlData = 0;
MULTIWAIT_ID m_packetDataAvailableMultiWait = 0;
MUTEX_ID m_packetDataAvailableMutex;
MULTIWAIT_ID m_waitForDataSem;
MULTIWAIT_ID m_waitForDataSem = 0;
MUTEX_ID m_waitForDataMutex;
bool m_userInDisabled;
bool m_userInAutonomous;
bool m_userInTeleop;
bool m_userInTest;
double m_nextMessageTime;
bool m_userInDisabled = false;
bool m_userInAutonomous = false;
bool m_userInTeleop = false;
bool m_userInTest = false;
double m_nextMessageTime = 0;
};

View File

@@ -96,14 +96,14 @@ class Encoder : public SensorBase,
DigitalSource *m_bSource; // the B phase of the quad encoder
bool m_allocatedASource; // was the A source allocated locally?
bool m_allocatedBSource; // was the B source allocated locally?
void *m_encoder;
int32_t m_index; // The encoder's FPGA index.
double m_distancePerPulse; // distance of travel for each encoder tick
Counter *m_counter; // Counter object for 1x and 2x encoding
EncodingType m_encodingType; // Encoding type
int32_t m_encodingScale; // 1x, 2x, or 4x, per the encodingType
void *m_encoder = nullptr;
int32_t m_index = 0; // The encoder's FPGA index.
double m_distancePerPulse = 1.0; // distance of travel for each encoder tick
Counter *m_counter = nullptr; // Counter object for 1x and 2x encoding
EncodingType m_encodingType; // Encoding type
int32_t m_encodingScale; // 1x, 2x, or 4x, per the encodingType
PIDSourceParameter
m_pidSource; // Encoder parameter that sources a PID controller
m_pidSource = kDistance; // Encoder parameter that sources a PID controller
ITable *m_table;
ITable *m_table = nullptr;
};

View File

@@ -23,7 +23,7 @@ class GearTooth : public Counter {
GearTooth(uint32_t channel, bool directionSensitive = false);
GearTooth(DigitalSource *source, bool directionSensitive = false);
GearTooth(DigitalSource &source, bool directionSensitive = false);
virtual ~GearTooth();
virtual ~GearTooth() = default;
void EnableDirectionSensing(bool directionSensitive);
virtual std::string GetSmartDashboardType() const override;

View File

@@ -68,5 +68,5 @@ class Gyro : public SensorBase, public PIDSource, public LiveWindowSendable {
uint32_t m_center;
PIDSourceParameter m_pidSource;
ITable *m_table;
ITable *m_table = nullptr;
};

View File

@@ -20,7 +20,7 @@ class InterruptableSensorBase : public SensorBase {
};
InterruptableSensorBase();
virtual ~InterruptableSensorBase();
virtual ~InterruptableSensorBase() = default;
virtual uint32_t GetChannelForRouting() const = 0;
virtual uint32_t GetModuleForRouting() const = 0;
virtual bool GetAnalogTriggerForRouting() const = 0;
@@ -42,7 +42,7 @@ class InterruptableSensorBase : public SensorBase {
virtual void SetUpSourceEdge(bool risingEdge, bool fallingEdge);
protected:
void *m_interrupt;
void *m_interrupt = nullptr;
uint32_t m_interruptIndex;
void AllocateInterrupts(bool watcher);

View File

@@ -72,12 +72,12 @@ class IterativeRobot : public RobotBase {
protected:
virtual void Prestart();
virtual ~IterativeRobot();
virtual ~IterativeRobot() = default;
IterativeRobot();
private:
bool m_disabledInitialized;
bool m_autonomousInitialized;
bool m_teleopInitialized;
bool m_testInitialized;
bool m_disabledInitialized = false;
bool m_autonomousInitialized = false;
bool m_teleopInitialized = false;
bool m_testInitialized = false;
};

View File

@@ -16,7 +16,7 @@
class Jaguar : public SafePWM, public SpeedController {
public:
explicit Jaguar(uint32_t channel);
virtual ~Jaguar();
virtual ~Jaguar() = default;
virtual void Set(float value, uint8_t syncGroup = 0) override;
virtual float Get() const override;
virtual void Disable() override;
@@ -27,5 +27,5 @@ class Jaguar : public SafePWM, public SpeedController {
private:
void InitJaguar();
bool m_isInverted;
bool m_isInverted = false;
};

View File

@@ -104,13 +104,13 @@ class Joystick : public GenericHID, public ErrorBase {
DISALLOW_COPY_AND_ASSIGN(Joystick);
void InitJoystick(uint32_t numAxisTypes, uint32_t numButtonTypes);
DriverStation *m_ds;
DriverStation *m_ds = nullptr;
uint32_t m_port;
uint32_t *m_axes;
uint32_t *m_buttons;
uint32_t m_outputs;
uint16_t m_leftRumble;
uint16_t m_rightRumble;
uint32_t *m_axes = nullptr;
uint32_t *m_buttons = nullptr;
uint32_t m_outputs = 0;
uint16_t m_leftRumble = 0;
uint16_t m_rightRumble = 0;
};
#endif

View File

@@ -106,7 +106,7 @@ class PWM : public SensorBase,
void InitTable(ITable* subTable) override;
ITable* GetTable() const override;
ITable* m_table;
ITable* m_table = nullptr;
private:
void InitPWM(uint32_t channel);

View File

@@ -40,7 +40,7 @@ class PowerDistributionPanel : public SensorBase, public LiveWindowSendable {
ITable *GetTable() const override;
private:
ITable *m_table;
ITable *m_table = nullptr;
uint8_t m_module;
};

View File

@@ -85,11 +85,11 @@ class Preferences : public ErrorBase, public ITableListener {
static Preferences *_instance;
/** The semaphore for accessing the file */
MUTEX_ID m_fileLock;
MUTEX_ID m_fileLock = nullptr;
/** The semaphore for beginning reads and writes to the file */
SEMAPHORE_ID m_fileOpStarted;
SEMAPHORE_ID m_fileOpStarted = nullptr;
/** The semaphore for reading from the table */
MUTEX_ID m_tableLock;
MUTEX_ID m_tableLock = nullptr;
typedef std::map<std::string, std::string> StringMap;
/** The actual values (String->String) */
StringMap m_values;

View File

@@ -47,7 +47,7 @@ class Relay : public SensorBase,
void InitTable(ITable* subTable) override;
ITable* GetTable() const override;
ITable* m_table;
ITable* m_table = nullptr;
private:
void InitRelay();

View File

@@ -61,8 +61,8 @@ class RobotBase {
virtual void Prestart();
Task *m_task;
DriverStation *m_ds;
Task *m_task = nullptr;
DriverStation *m_ds = nullptr;
private:
static RobotBase *m_instance;

View File

@@ -97,15 +97,15 @@ class RobotDrive : public MotorSafety, public ErrorBase {
void RotateVector(double &x, double &y, double angle);
static const int32_t kMaxNumberOfMotors = 4;
float m_sensitivity;
double m_maxOutput;
float m_sensitivity = 0.5;
double m_maxOutput = 1.0;
bool m_deleteSpeedControllers;
SpeedController *m_frontLeftMotor;
SpeedController *m_frontRightMotor;
SpeedController *m_rearLeftMotor;
SpeedController *m_rearRightMotor;
MotorSafetyHelper *m_safetyHelper;
uint8_t m_syncGroup;
SpeedController *m_frontLeftMotor = nullptr;
SpeedController *m_frontRightMotor = nullptr;
SpeedController *m_rearLeftMotor = nullptr;
SpeedController *m_rearRightMotor = nullptr;
MotorSafetyHelper *m_safetyHelper = nullptr;
uint8_t m_syncGroup = 0;
private:
int32_t GetNumMotors() {

View File

@@ -11,7 +11,7 @@
class SampleRobot : public RobotBase {
public:
SampleRobot();
virtual ~SampleRobot() {}
virtual ~SampleRobot() = default;
virtual void RobotInit();
virtual void Disabled();
virtual void Autonomous();

View File

@@ -62,9 +62,9 @@ class SerialPort : public ErrorBase {
void Reset();
private:
uint32_t m_resourceManagerHandle;
uint32_t m_portHandle;
bool m_consoleModeEnabled;
uint32_t m_resourceManagerHandle = 0;
uint32_t m_portHandle = 0;
bool m_consoleModeEnabled = false;
uint8_t m_port;
DISALLOW_COPY_AND_ASSIGN(SerialPort);

View File

@@ -37,7 +37,7 @@ class Servo : public SafePWM {
void InitTable(ITable* subTable) override;
ITable* GetTable() const override;
ITable* m_table;
ITable* m_table = nullptr;
private:
void InitServo();

View File

@@ -41,5 +41,5 @@ class Solenoid : public SolenoidBase,
void InitSolenoid();
uint32_t m_channel; ///< The channel on the module to control.
ITable* m_table;
ITable* m_table = nullptr;
};

View File

@@ -18,7 +18,7 @@
*/
class SolenoidBase : public SensorBase {
public:
virtual ~SolenoidBase();
virtual ~SolenoidBase() = default;
uint8_t GetAll(int module = 0) const;
uint8_t GetPCMSolenoidBlackList(int module) const;

View File

@@ -14,7 +14,7 @@
*/
class SpeedController : public PIDOutput {
public:
virtual ~SpeedController() {}
virtual ~SpeedController() = default;
/**
* Common interface for setting the speed of a speed controller.
*

View File

@@ -16,7 +16,7 @@
class Talon : public SafePWM, public SpeedController {
public:
explicit Talon(uint32_t channel);
virtual ~Talon();
virtual ~Talon() = default;
virtual void Set(float value, uint8_t syncGroup = 0) override;
virtual float Get() const override;
virtual void Disable() override;
@@ -27,5 +27,5 @@ class Talon : public SafePWM, public SpeedController {
private:
void InitTalon();
bool m_isInverted;
bool m_isInverted = false;
};

View File

@@ -17,7 +17,7 @@
class TalonSRX : public SafePWM, public SpeedController {
public:
explicit TalonSRX(uint32_t channel);
virtual ~TalonSRX();
virtual ~TalonSRX() = default;
virtual void Set(float value, uint8_t syncGroup = 0) override;
virtual float Get() const override;
virtual void Disable() override;
@@ -28,5 +28,5 @@ class TalonSRX : public SafePWM, public SpeedController {
private:
void InitTalonSRX();
bool m_isInverted;
bool m_isInverted = false;
};

View File

@@ -36,26 +36,30 @@ class USBCamera : public ErrorBase {
static constexpr char const *ATTR_BR_VALUE =
"CameraAttributes::Brightness::Value";
// Constants for the manual and auto types
static constexpr char const* AUTO = "Auto";
static constexpr char const* MANUAL = "Manual";
protected:
IMAQdxSession m_id;
IMAQdxSession m_id = 0;
std::string m_name;
bool m_useJpeg;
bool m_active;
bool m_open;
bool m_active = false;
bool m_open = false;
std::recursive_mutex m_mutex;
unsigned int m_width;
unsigned int m_height;
double m_fps;
std::string m_whiteBalance;
unsigned int m_whiteBalanceValue;
bool m_whiteBalanceValuePresent;
std::string m_exposure;
unsigned int m_exposureValue;
bool m_exposureValuePresent;
unsigned int m_brightness;
bool m_needSettingsUpdate;
unsigned int m_width = 320;
unsigned int m_height = 240;
double m_fps = 30;
std::string m_whiteBalance = AUTO;
unsigned int m_whiteBalanceValue = 0;
bool m_whiteBalanceValuePresent = false;
std::string m_exposure = MANUAL;
unsigned int m_exposureValue = 50;
bool m_exposureValuePresent = false;
unsigned int m_brightness = 80;
bool m_needSettingsUpdate = true;
unsigned int GetJpegSize(void *buffer, unsigned int buffSize);

View File

@@ -90,5 +90,5 @@ class Ultrasonic : public SensorBase,
Ultrasonic *m_nextSensor;
DistanceUnit m_units;
ITable *m_table;
ITable *m_table = nullptr;
};

View File

@@ -19,7 +19,7 @@
class Victor : public SafePWM, public SpeedController {
public:
explicit Victor(uint32_t channel);
virtual ~Victor();
virtual ~Victor() = default;
virtual void Set(float value, uint8_t syncGroup = 0) override;
virtual float Get() const override;
virtual void Disable() override;
@@ -31,5 +31,5 @@ class Victor : public SafePWM, public SpeedController {
private:
void InitVictor();
bool m_isInverted;
bool m_isInverted = false;
};

View File

@@ -16,7 +16,7 @@
class VictorSP : public SafePWM, public SpeedController {
public:
explicit VictorSP(uint32_t channel);
virtual ~VictorSP();
virtual ~VictorSP() = default;
virtual void Set(float value, uint8_t syncGroup = 0) override;
virtual float Get() const override;
virtual void Disable() override;
@@ -28,5 +28,5 @@ class VictorSP : public SafePWM, public SpeedController {
private:
void InitVictorSP();
bool m_isInverted;
bool m_isInverted = false;
};

View File

@@ -89,27 +89,27 @@ class AxisCamera : public ErrorBase {
private:
std::thread m_captureThread;
std::string m_cameraHost;
int m_cameraSocket;
int m_cameraSocket = -1;
std::mutex m_captureMutex;
std::mutex m_imageDataMutex;
std::vector<uint8_t> m_imageData;
bool m_freshImage;
bool m_freshImage = false;
int m_brightness;
WhiteBalance m_whiteBalance;
int m_colorLevel;
ExposureControl m_exposureControl;
int m_exposurePriority;
int m_maxFPS;
Resolution m_resolution;
int m_compression;
Rotation m_rotation;
bool m_parametersDirty;
bool m_streamDirty;
int m_brightness = 50;
WhiteBalance m_whiteBalance = kWhiteBalance_Automatic;
int m_colorLevel = 50;
ExposureControl m_exposureControl = kExposureControl_Automatic;
int m_exposurePriority = 50;
int m_maxFPS = 0;
Resolution m_resolution = kResolution_640x480;
int m_compression = 50;
Rotation m_rotation = kRotation_0;
bool m_parametersDirty = true;
bool m_streamDirty = true;
std::mutex m_parametersMutex;
bool m_done;
bool m_done = false;
void Capture();
void ReadImagesFromCamera();

View File

@@ -19,7 +19,7 @@
class BinaryImage : public MonoImage {
public:
BinaryImage();
virtual ~BinaryImage();
virtual ~BinaryImage() = default;
int GetNumberParticles();
ParticleAnalysisReport GetParticleAnalysisReport(int particleNumber);
void GetParticleAnalysisReport(int particleNumber,

View File

@@ -13,7 +13,7 @@
class ColorImage : public ImageBase {
public:
ColorImage(ImageType type);
virtual ~ColorImage();
virtual ~ColorImage() = default;
BinaryImage *ThresholdRGB(int redLow, int redHigh, int greenLow,
int greenHigh, int blueLow, int blueHigh);
BinaryImage *ThresholdHSL(int hueLow, int hueHigh, int saturationLow,

View File

@@ -15,5 +15,5 @@ class HSLImage : public ColorImage {
public:
HSLImage();
HSLImage(const char *fileName);
virtual ~HSLImage();
virtual ~HSLImage() = default;
};

View File

@@ -13,7 +13,7 @@
class MonoImage : public ImageBase {
public:
MonoImage();
virtual ~MonoImage();
virtual ~MonoImage() = default;
std::vector<EllipseMatch> *DetectEllipses(
EllipseDescriptor *ellipseDescriptor, CurveOptions *curveOptions,

View File

@@ -15,5 +15,5 @@ class RGBImage : public ColorImage {
public:
RGBImage();
RGBImage(const char *fileName);
virtual ~RGBImage();
virtual ~RGBImage() = default;
};

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;

Some files were not shown because too many files have changed in this diff Show More