Improve const correctness.

See https://usfirst.collab.net/sf/tracker/do/viewArtifact/projects.wpilib/tracker.4_defects/artf4148

Change-Id: I47b0d5a91fd49e47e2c7348b0705e998ec815682
This commit is contained in:
Tyler Veness
2015-06-19 17:23:54 -07:00
parent c6b790cadd
commit 5598445a67
172 changed files with 1165 additions and 1140 deletions

View File

@@ -36,7 +36,7 @@ public:
TableKeyExistsWithDifferentTypeException(const std::string existingKey, NetworkTableEntryType* existingType, const char* message);
const char* what(){return "TableKeyExistsWithDifferentTypeException";};
const char* what() const noexcept {return "TableKeyExistsWithDifferentTypeException";};
virtual ~TableKeyExistsWithDifferentTypeException() throw ();
};

View File

@@ -16,7 +16,7 @@ class BadMessageException : public std::exception
public:
BadMessageException(const char* message);
~BadMessageException() throw ();
const char* what();
const char* what() const noexcept;
private:
std::string message;
};

View File

@@ -36,7 +36,7 @@ public:
*
* @return The message associated with this exception.
*/
const char* what();
const char* what() const noexcept;
/**
* Determines whether this exception indicates that an EOF

View File

@@ -14,7 +14,7 @@
class IllegalStateException : public std::exception{
public:
IllegalStateException(const char* message);
const char* what(){return message.c_str();};
const char* what() const noexcept {return message.c_str();};
~IllegalStateException() throw ();
private:
std::string message;

View File

@@ -17,7 +17,7 @@ BadMessageException::~BadMessageException() throw ()
{
}
const char* BadMessageException::what()
const char* BadMessageException::what() const noexcept
{
return message.c_str();
}

View File

@@ -13,7 +13,7 @@
IOException::IOException(const char* msg) : message(strdup(msg)), errorValue(0){}
IOException::IOException(const char* msg, int _errorValue) : message(strdup(msg)), errorValue(_errorValue){}
const char* IOException::what(){
const char* IOException::what() const noexcept {
return message;
}

View File

@@ -40,8 +40,8 @@ public:
void ToggleWhenActive(Command *command);
virtual void InitTable(ITable* table);
virtual ITable* GetTable();
virtual std::string GetSmartDashboardType();
virtual ITable* GetTable() const;
virtual std::string GetSmartDashboardType() const;
protected:
ITable* m_table;
};

View File

@@ -50,27 +50,27 @@ public:
Command(double timeout);
Command(const char *name, double timeout);
virtual ~Command();
double TimeSinceInitialized();
double TimeSinceInitialized() const;
void Requires(Subsystem *s);
bool IsCanceled();
bool IsCanceled() const;
void Start();
bool Run();
void Cancel();
bool IsRunning();
bool IsInterruptible();
bool IsRunning() const;
bool IsInterruptible() const;
void SetInterruptible(bool interruptible);
bool DoesRequire(Subsystem *subsystem);
bool DoesRequire(Subsystem *subsystem) const;
typedef std::set<Subsystem *> SubsystemSet;
SubsystemSet GetRequirements();
CommandGroup *GetGroup();
SubsystemSet GetRequirements() const;
CommandGroup *GetGroup() const;
void SetRunWhenDisabled(bool run);
bool WillRunWhenDisabled();
int GetID();
bool WillRunWhenDisabled() const;
int GetID() const;
protected:
void SetTimeout(double timeout);
bool IsTimedOut();
bool IsTimedOut() const;
bool AssertUnlocked(const char *message);
void SetParent(CommandGroup *parent);
/**
@@ -154,8 +154,8 @@ private:
public:
virtual std::string GetName();
virtual void InitTable(ITable* table);
virtual ITable* GetTable();
virtual std::string GetSmartDashboardType();
virtual ITable* GetTable() const;
virtual std::string GetSmartDashboardType() const;
virtual void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
protected:
ITable* m_table;

View File

@@ -41,8 +41,8 @@ public:
void AddSequential(Command *command, double timeout);
void AddParallel(Command *command);
void AddParallel(Command *command, double timeout);
bool IsInterruptible();
int GetSize();
bool IsInterruptible() const;
int GetSize() const;
protected:
virtual void Initialize();

View File

@@ -17,7 +17,7 @@ public:
CommandGroupEntry();
CommandGroupEntry(Command *command, Sequence state);
CommandGroupEntry(Command *command, Sequence state, double timeout);
bool IsTimedOut();
bool IsTimedOut() const;
double m_timeout;
Command *m_command;

View File

@@ -30,17 +30,17 @@ public:
virtual void PIDWrite(float output);
// PIDSource interface
virtual double PIDGet();
virtual double PIDGet() const;
protected:
PIDController *GetPIDController();
PIDController *GetPIDController() const;
virtual void _Initialize();
virtual void _Interrupted();
virtual void _End();
void SetSetpoint(double setpoint);
double GetSetpoint();
double GetPosition();
double GetSetpoint() const;
double GetPosition() const;
virtual double ReturnPIDInput() = 0;
virtual double ReturnPIDInput() const = 0;
virtual void UsePIDOutput(double output) = 0;
private:
@@ -49,7 +49,7 @@ private:
public:
virtual void InitTable(ITable* table);
virtual std::string GetSmartDashboardType();
virtual std::string GetSmartDashboardType() const;
};
#endif

View File

@@ -40,7 +40,7 @@ public:
virtual void PIDWrite(float output);
// PIDSource interface
virtual double PIDGet();
virtual double PIDGet() const;
void SetSetpoint(double setpoint);
void SetSetpointRelative(double deltaSetpoint);
void SetInputRange(float minimumInput, float maximumInput);
@@ -50,12 +50,12 @@ public:
virtual void SetAbsoluteTolerance(float absValue);
virtual void SetPercentTolerance(float percent);
virtual bool OnTarget();
virtual bool OnTarget() const;
protected:
PIDController *GetPIDController();
virtual double ReturnPIDInput() = 0;
virtual double ReturnPIDInput() const = 0;
virtual void UsePIDOutput(double output) = 0;
private:
@@ -64,7 +64,7 @@ private:
public:
virtual void InitTable(ITable* table);
virtual std::string GetSmartDashboardType();
virtual std::string GetSmartDashboardType() const;
};
#endif

View File

@@ -38,11 +38,11 @@ public:
void SetEnabled(bool enabled);
void UpdateTable();
std::string GetSmartDashboardType();
std::string GetSmartDashboardType() const;
void InitTable(ITable *subTable);
ITable * GetTable();
ITable * GetTable() const;
std::string GetName();
std::string GetType();
std::string GetType() const;
private:
Scheduler();

View File

@@ -24,7 +24,7 @@ public:
void SetDefaultCommand(Command *command);
Command *GetDefaultCommand();
void SetCurrentCommand(Command *command);
Command *GetCurrentCommand();
Command *GetCurrentCommand() const;
virtual void InitDefaultCommand();
private:
@@ -39,8 +39,8 @@ private:
public:
virtual std::string GetName();
virtual void InitTable(ITable* table);
virtual ITable* GetTable();
virtual std::string GetSmartDashboardType();
virtual ITable* GetTable() const;
virtual std::string GetSmartDashboardType() const;
protected:
ITable* m_table;
};

View File

@@ -22,17 +22,17 @@ public:
{
}
virtual float GetX(JoystickHand hand = kRightHand) = 0;
virtual float GetY(JoystickHand hand = kRightHand) = 0;
virtual float GetZ() = 0;
virtual float GetTwist() = 0;
virtual float GetThrottle() = 0;
virtual float GetRawAxis(uint32_t axis) = 0;
virtual float GetX(JoystickHand hand = kRightHand) const = 0;
virtual float GetY(JoystickHand hand = kRightHand) const = 0;
virtual float GetZ() const = 0;
virtual float GetTwist() const = 0;
virtual float GetThrottle() const = 0;
virtual float GetRawAxis(uint32_t axis) const = 0;
virtual bool GetTrigger(JoystickHand hand = kRightHand) = 0;
virtual bool GetTop(JoystickHand hand = kRightHand) = 0;
virtual bool GetBumper(JoystickHand hand = kRightHand) = 0;
virtual bool GetRawButton(uint32_t button) = 0;
virtual bool GetTrigger(JoystickHand hand = kRightHand) const = 0;
virtual bool GetTop(JoystickHand hand = kRightHand) const = 0;
virtual bool GetBumper(JoystickHand hand = kRightHand) const = 0;
virtual bool GetRawButton(uint32_t button) const = 0;
virtual int GetPOV(uint32_t pov = 0) = 0;
virtual int GetPOV(uint32_t pov = 0) const = 0;
};

View File

@@ -39,7 +39,7 @@ public:
void AddActuator(std::string type, int channel, LiveWindowSendable *component);
void AddActuator(std::string type, int module, int channel, LiveWindowSendable *component);
bool IsEnabled() { return m_enabled; }
bool IsEnabled() const { return m_enabled; }
void SetEnabled(bool enabled);
protected:

View File

@@ -29,30 +29,30 @@ public:
PIDController(float p, float i, float d, float f, PIDSource *source, PIDOutput *output,
float period = 0.05);
virtual ~PIDController();
virtual float Get();
virtual float Get() const;
virtual void SetContinuous(bool continuous = true);
virtual void SetInputRange(float minimumInput, float maximumInput);
virtual void SetOutputRange(float minimumOutput, float maximumOutput);
virtual void SetPID(float p, float i, float d);
virtual void SetPID(float p, float i, float d, float f);
virtual float GetP();
virtual float GetI();
virtual float GetD();
virtual float GetF();
virtual float GetP() const;
virtual float GetI() const;
virtual float GetD() const;
virtual float GetF() const;
virtual void SetSetpoint(float setpoint);
virtual float GetSetpoint();
virtual float GetSetpoint() const;
virtual float GetError();
virtual float GetError() const;
virtual void SetTolerance(float percent);
virtual void SetAbsoluteTolerance(float absValue);
virtual void SetPercentTolerance(float percentValue);
virtual bool OnTarget();
virtual bool OnTarget() const;
virtual void Enable();
virtual void Disable();
virtual bool IsEnabled();
virtual void Enable() override;
virtual void Disable() override;
virtual bool IsEnabled() const;
virtual void Reset();
@@ -95,8 +95,8 @@ private:
float period = 0.05);
static void CallCalculate(void *controller);
virtual ITable* GetTable();
virtual std::string GetSmartDashboardType();
virtual ITable* GetTable() const;
virtual std::string GetSmartDashboardType() const;
virtual void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
virtual void UpdateTable();
virtual void StartLiveWindowMode();

View File

@@ -14,5 +14,5 @@ class PIDSource
{
public:
enum PIDSourceParameter {kDistance, kRate, kAngle};
virtual double PIDGet() = 0;
virtual double PIDGet() const = 0;
};

View File

@@ -9,11 +9,11 @@ class RobotStateInterface
{
public:
virtual ~RobotStateInterface() {};
virtual bool IsDisabled() = 0;
virtual bool IsEnabled() = 0;
virtual bool IsOperatorControl() = 0;
virtual bool IsAutonomous() = 0;
virtual bool IsTest() = 0;
virtual bool IsDisabled() const = 0;
virtual bool IsEnabled() const = 0;
virtual bool IsOperatorControl() const = 0;
virtual bool IsAutonomous() const = 0;
virtual bool IsTest() const = 0;
};
class RobotState

View File

@@ -22,12 +22,12 @@ public:
/**
* @return the table that is currently associated with the sendable
*/
virtual ITable* GetTable() = 0;
virtual ITable* GetTable() const = 0;
/**
* @return the string representation of the named data type that will be used by the smart dashboard for this sendable
*/
virtual std::string GetSmartDashboardType() = 0;
virtual std::string GetSmartDashboardType() const = 0;
};
#endif

View File

@@ -35,8 +35,8 @@ public:
void *GetSelected();
virtual void InitTable(ITable* subtable);
virtual ITable* GetTable();
virtual std::string GetSmartDashboardType();
virtual ITable* GetTable() const;
virtual std::string GetSmartDashboardType() const;
private:
std::string m_defaultChoice;

View File

@@ -27,18 +27,18 @@ public:
bool Restart();
bool Stop();
bool IsReady();
bool IsSuspended();
bool IsReady() const;
bool IsSuspended() const;
bool Suspend();
bool Resume();
bool Verify();
bool Verify() const;
int32_t GetPriority();
bool SetPriority(int32_t priority);
const char* GetName();
TASK GetID();
const char* GetName() const;
TASK GetID() const;
private:
FUNCPTR m_function;

View File

@@ -26,7 +26,7 @@ class Timer
public:
Timer();
virtual ~Timer();
double Get();
double Get() const;
void Reset();
void Start();
void Stop();

View File

@@ -21,7 +21,7 @@ public:
*
* @return The current set speed. Value is between -1.0 and 1.0.
*/
virtual double Get() = 0;
virtual double Get() const = 0;
};
#endif

View File

@@ -59,7 +59,7 @@ void Trigger::ToggleWhenActive(Command *command) {
tbs->Start();
}
std::string Trigger::GetSmartDashboardType(){
std::string Trigger::GetSmartDashboardType() const {
return "Button";
}
@@ -70,6 +70,6 @@ void Trigger::InitTable(ITable* table){
}
}
ITable* Trigger::GetTable(){
ITable* Trigger::GetTable() const {
return m_table;
}

View File

@@ -93,7 +93,7 @@ Command::~Command()
* The ID is a unique sequence number that is incremented for each command.
* @return the ID of this command
*/
int Command::GetID() {
int Command::GetID() const {
return m_commandID;
}
@@ -115,7 +115,7 @@ void Command::SetTimeout(double timeout)
* This function will work even if there is no specified timeout.
* @return the time since this command was initialized (in seconds).
*/
double Command::TimeSinceInitialized()
double Command::TimeSinceInitialized() const
{
if (m_startTime < 0.0)
return 0.0;
@@ -239,7 +239,7 @@ void Command::StartTiming()
* If there is no timeout, this will always return false.
* @return whether the time has expired
*/
bool Command::IsTimedOut()
bool Command::IsTimedOut() const
{
return m_timeout != -1 && TimeSinceInitialized() >= m_timeout;
}
@@ -248,7 +248,7 @@ bool Command::IsTimedOut()
* Returns the requirements (as an std::set of {@link Subsystem Subsystems} pointers) of this command
* @return the requirements (as an std::set of {@link Subsystem Subsystems} pointers) of this command
*/
Command::SubsystemSet Command::GetRequirements()
Command::SubsystemSet Command::GetRequirements() const
{
return m_requirements;
}
@@ -328,7 +328,7 @@ void Command::StartRunning()
* not have yet called {@link Command#interrupted()}.
* @return whether or not the command is running
*/
bool Command::IsRunning()
bool Command::IsRunning() const
{
return m_running;
}
@@ -363,7 +363,7 @@ void Command::_Cancel()
* Returns whether or not this has been canceled.
* @return whether or not this has been canceled
*/
bool Command::IsCanceled()
bool Command::IsCanceled() const
{
return m_canceled;
}
@@ -372,7 +372,7 @@ bool Command::IsCanceled()
* Returns whether or not this command can be interrupted.
* @return whether or not this command can be interrupted
*/
bool Command::IsInterruptible()
bool Command::IsInterruptible() const
{
return m_interruptible;
}
@@ -391,7 +391,7 @@ void Command::SetInterruptible(bool interruptible)
* @param system the system
* @return whether or not the subsystem is required (false if given NULL)
*/
bool Command::DoesRequire(Subsystem *system)
bool Command::DoesRequire(Subsystem *system) const
{
return m_requirements.count(system) > 0;
}
@@ -401,7 +401,7 @@ bool Command::DoesRequire(Subsystem *system)
* Will return null if this {@link Command} is not in a group.
* @return the {@link CommandGroup} that this command is a part of (or null if not in group)
*/
CommandGroup *Command::GetGroup()
CommandGroup *Command::GetGroup() const
{
return m_parent;
}
@@ -421,7 +421,7 @@ void Command::SetRunWhenDisabled(bool run)
* Returns whether or not this {@link Command} will run when the robot is disabled, or if it will cancel itself.
* @return whether or not this {@link Command} will run when the robot is disabled, or if it will cancel itself
*/
bool Command::WillRunWhenDisabled()
bool Command::WillRunWhenDisabled() const
{
return m_runWhenDisabled;
}
@@ -435,7 +435,7 @@ std::string Command::GetName()
return m_name;
}
std::string Command::GetSmartDashboardType()
std::string Command::GetSmartDashboardType() const
{
return "Command";
}
@@ -453,7 +453,7 @@ void Command::InitTable(ITable* table)
}
}
ITable* Command::GetTable(){
ITable* Command::GetTable() const {
return m_table;
}

View File

@@ -329,7 +329,7 @@ bool CommandGroup::IsFinished()
return (unsigned)m_currentCommandIndex >= m_commands.size() && m_children.empty();
}
bool CommandGroup::IsInterruptible()
bool CommandGroup::IsInterruptible() const
{
if (!Command::IsInterruptible())
return false;
@@ -341,8 +341,8 @@ bool CommandGroup::IsInterruptible()
return false;
}
CommandList::iterator iter = m_children.begin();
for (; iter != m_children.end(); iter++)
CommandList::const_iterator iter = m_children.cbegin();
for (; iter != m_children.cend(); iter++)
{
if (!iter->m_command->IsInterruptible())
return false;
@@ -377,7 +377,7 @@ void CommandGroup::CancelConflicts(Command *command)
}
}
int CommandGroup::GetSize()
int CommandGroup::GetSize() const
{
return m_children.size();
}

View File

@@ -29,7 +29,7 @@ CommandGroupEntry::CommandGroupEntry(Command *command, Sequence state, double ti
{
}
bool CommandGroupEntry::IsTimedOut()
bool CommandGroupEntry::IsTimedOut() const
{
if (m_timeout < 0.0)
return false;

View File

@@ -72,12 +72,12 @@ void PIDCommand::PIDWrite(float output)
UsePIDOutput(output);
}
double PIDCommand::PIDGet()
double PIDCommand::PIDGet() const
{
return ReturnPIDInput();
}
PIDController *PIDCommand::GetPIDController()
PIDController *PIDCommand::GetPIDController() const
{
return m_controller;
}
@@ -87,17 +87,17 @@ void PIDCommand::SetSetpoint(double setpoint)
m_controller->SetSetpoint(setpoint);
}
double PIDCommand::GetSetpoint()
double PIDCommand::GetSetpoint() const
{
return m_controller->GetSetpoint();
}
double PIDCommand::GetPosition()
double PIDCommand::GetPosition() const
{
return ReturnPIDInput();
}
std::string PIDCommand::GetSmartDashboardType(){
std::string PIDCommand::GetSmartDashboardType() const {
return "PIDCommand";
}
void PIDCommand::InitTable(ITable* table){

View File

@@ -212,7 +212,7 @@ void PIDSubsystem::SetPercentTolerance(float percent) {
*
* @return true if the error is within the percentage tolerance of the input range
*/
bool PIDSubsystem::OnTarget()
bool PIDSubsystem::OnTarget() const
{
return m_controller->OnTarget();
}
@@ -231,13 +231,13 @@ void PIDSubsystem::PIDWrite(float output)
UsePIDOutput(output);
}
double PIDSubsystem::PIDGet()
double PIDSubsystem::PIDGet() const
{
return ReturnPIDInput();
}
std::string PIDSubsystem::GetSmartDashboardType(){
std::string PIDSubsystem::GetSmartDashboardType() const {
return "PIDCommand";
}
void PIDSubsystem::InitTable(ITable* table){

View File

@@ -277,11 +277,11 @@ std::string Scheduler::GetName() {
return "Scheduler";
}
std::string Scheduler::GetType() {
std::string Scheduler::GetType() const {
return "Scheduler";
}
std::string Scheduler::GetSmartDashboardType() {
std::string Scheduler::GetSmartDashboardType() const {
return "Scheduler";
}
@@ -296,6 +296,6 @@ void Scheduler::InitTable(ITable *subTable) {
m_table->PutValue("Cancel", *toCancel);
}
ITable * Scheduler::GetTable() {
ITable * Scheduler::GetTable() const {
return m_table;
}

View File

@@ -114,7 +114,7 @@ void Subsystem::SetCurrentCommand(Command *command)
* Returns the command which currently claims this subsystem.
* @return the command which currently claims this subsystem
*/
Command *Subsystem::GetCurrentCommand()
Command *Subsystem::GetCurrentCommand() const
{
return m_currentCommand;
}
@@ -150,7 +150,7 @@ std::string Subsystem::GetName()
return m_name;
}
std::string Subsystem::GetSmartDashboardType()
std::string Subsystem::GetSmartDashboardType() const
{
return "Subsystem";
}
@@ -174,6 +174,6 @@ void Subsystem::InitTable(ITable* table)
}
}
ITable* Subsystem::GetTable(){
ITable* Subsystem::GetTable() const {
return m_table;
}

View File

@@ -69,10 +69,10 @@ void SendableChooser::InitTable(ITable* subtable) {
}
}
ITable* SendableChooser::GetTable() {
ITable* SendableChooser::GetTable() const {
return m_table;
}
std::string SendableChooser::GetSmartDashboardType() {
std::string SendableChooser::GetSmartDashboardType() const {
return "String Chooser";
}

View File

@@ -41,20 +41,20 @@ public:
virtual ~ADXL345_I2C();
// Accelerometer interface
virtual void SetRange(Range range);
virtual double GetX();
virtual double GetY();
virtual double GetZ();
virtual void SetRange(Range range) override;
virtual double GetX() override;
virtual double GetY() override;
virtual double GetZ() override;
virtual double GetAcceleration(Axes axis);
virtual AllAxes GetAccelerations();
virtual std::string GetSmartDashboardType();
virtual void InitTable(ITable *subtable);
virtual void UpdateTable();
virtual ITable* GetTable();
virtual void StartLiveWindowMode() {}
virtual void StopLiveWindowMode() {}
virtual std::string GetSmartDashboardType() const override;
virtual void InitTable(ITable *subtable) override;
virtual void UpdateTable() override;
virtual ITable* GetTable() const override;
virtual void StartLiveWindowMode() override {}
virtual void StopLiveWindowMode() override {}
protected:
//I2C* m_i2c;

View File

@@ -45,20 +45,20 @@ public:
virtual ~ADXL345_SPI();
// Accelerometer interface
virtual void SetRange(Range range);
virtual double GetX();
virtual double GetY();
virtual double GetZ();
virtual void SetRange(Range range) override;
virtual double GetX() override;
virtual double GetY() override;
virtual double GetZ() override;
virtual double GetAcceleration(Axes axis);
virtual AllAxes GetAccelerations();
virtual std::string GetSmartDashboardType();
virtual void InitTable(ITable *subtable);
virtual void UpdateTable();
virtual ITable* GetTable();
virtual void StartLiveWindowMode() {}
virtual void StopLiveWindowMode() {}
virtual std::string GetSmartDashboardType() const override;
virtual void InitTable(ITable *subtable) override;
virtual void UpdateTable() override;
virtual ITable* GetTable() const override;
virtual void StartLiveWindowMode() override {}
virtual void StopLiveWindowMode() override {}
protected:
void Init(Range range);

View File

@@ -22,17 +22,17 @@ public:
explicit AnalogAccelerometer(AnalogInput *channel);
virtual ~AnalogAccelerometer();
float GetAcceleration();
float GetAcceleration() const;
void SetSensitivity(float sensitivity);
void SetZero(float zero);
double PIDGet();
double PIDGet() const override;
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType();
void InitTable(ITable *subTable);
ITable * GetTable();
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(ITable *subTable) override;
ITable * GetTable() const override;
private:
void InitAccelerometer();

View File

@@ -30,43 +30,43 @@ public:
explicit AnalogInput(uint32_t channel);
virtual ~AnalogInput();
int16_t GetValue();
int32_t GetAverageValue();
int16_t GetValue() const;
int32_t GetAverageValue() const;
float GetVoltage();
float GetAverageVoltage();
float GetVoltage() const;
float GetAverageVoltage() const;
uint32_t GetChannel();
uint32_t GetChannel() const;
void SetAverageBits(uint32_t bits);
uint32_t GetAverageBits();
uint32_t GetAverageBits() const;
void SetOversampleBits(uint32_t bits);
uint32_t GetOversampleBits();
uint32_t GetOversampleBits() const;
uint32_t GetLSBWeight();
int32_t GetOffset();
uint32_t GetLSBWeight() const;
int32_t GetOffset() const;
bool IsAccumulatorChannel();
bool IsAccumulatorChannel() const;
void InitAccumulator();
void SetAccumulatorInitialValue(int64_t value);
void ResetAccumulator();
void SetAccumulatorCenter(int32_t center);
void SetAccumulatorDeadband(int32_t deadband);
int64_t GetAccumulatorValue();
uint32_t GetAccumulatorCount();
void GetAccumulatorOutput(int64_t *value, uint32_t *count);
int64_t GetAccumulatorValue() const;
uint32_t GetAccumulatorCount() const;
void GetAccumulatorOutput(int64_t *value, uint32_t *count) const;
static void SetSampleRate(float samplesPerSecond);
static float GetSampleRate();
double PIDGet();
double PIDGet() const override;
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType();
void InitTable(ITable *subTable);
ITable * GetTable();
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(ITable *subTable) override;
ITable * GetTable() const override;
private:
void InitAnalogInput(uint32_t channel);

View File

@@ -21,14 +21,14 @@ public:
virtual ~AnalogOutput();
void SetVoltage(float voltage);
float GetVoltage();
float GetVoltage() const;
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType();
void InitTable(ITable *subTable);
ITable *GetTable();
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(ITable *subTable) override;
ITable *GetTable() const override;
protected:
void InitAnalogOutput(uint32_t channel);

View File

@@ -43,7 +43,7 @@ public:
*
* @return The current position of the potentiometer.
*/
virtual double Get();
virtual double Get() const override;
/**
@@ -51,26 +51,26 @@ public:
*
* @return The current reading.
*/
virtual double PIDGet();
virtual double PIDGet() const override;
/*
* Live Window code, only does anything if live window is activated.
*/
virtual std::string GetSmartDashboardType();
virtual void InitTable(ITable *subtable);
virtual void UpdateTable();
virtual ITable* GetTable();
virtual std::string GetSmartDashboardType() const override;
virtual void InitTable(ITable *subtable) override;
virtual void UpdateTable() override;
virtual ITable* GetTable() const override;
/**
* AnalogPotentiometers don't have to do anything special when entering the LiveWindow.
*/
virtual void StartLiveWindowMode() {}
virtual void StartLiveWindowMode() override {}
/**
* AnalogPotentiometers don't have to do anything special when exiting the LiveWindow.
*/
virtual void StopLiveWindowMode() {}
virtual void StopLiveWindowMode() override {}
private:
double m_fullRange, m_offset;

View File

@@ -42,12 +42,12 @@ class AnalogTriggerOutput : public DigitalSource
public:
virtual ~AnalogTriggerOutput();
bool Get();
bool Get() const;
// DigitalSource interface
virtual uint32_t GetChannelForRouting();
virtual uint32_t GetModuleForRouting();
virtual bool GetAnalogTriggerForRouting();
virtual uint32_t GetChannelForRouting() const override;
virtual uint32_t GetModuleForRouting() const override;
virtual bool GetAnalogTriggerForRouting() const override;
protected:
AnalogTriggerOutput(AnalogTrigger *trigger, AnalogTriggerType outputType);

View File

@@ -21,17 +21,17 @@ public:
virtual ~BuiltInAccelerometer();
// Accelerometer interface
virtual void SetRange(Range range);
virtual double GetX();
virtual double GetY();
virtual double GetZ();
virtual void SetRange(Range range) override;
virtual double GetX() override;
virtual double GetY() override;
virtual double GetZ() override;
virtual std::string GetSmartDashboardType();
virtual void InitTable(ITable *subtable);
virtual void UpdateTable();
virtual ITable* GetTable();
virtual void StartLiveWindowMode() {}
virtual void StopLiveWindowMode() {}
virtual std::string GetSmartDashboardType() const override;
virtual void InitTable(ITable *subtable) override;
virtual void UpdateTable() override;
virtual ITable* GetTable() const override;
virtual void StartLiveWindowMode() override {}
virtual void StopLiveWindowMode() override {}
private:
ITable *m_table;

View File

@@ -17,6 +17,8 @@
#include "tables/ITable.h"
#include "NetworkCommunication/CANSessionMux.h"
#include <atomic>
#include <mutex>
#include <utility>
/**
@@ -45,10 +47,10 @@ public:
virtual ~CANJaguar();
uint8_t getDeviceNumber() const;
uint8_t GetHardwareVersion();
uint8_t GetHardwareVersion() const;
// PIDOutput interface
virtual void PIDWrite(float output);
virtual void PIDWrite(float output) override;
// Control mode methods
void EnableControl(double encoderInitialPosition = 0.0);
@@ -76,27 +78,27 @@ public:
void SetVoltageMode(PotentiometerStruct);
// CANSpeedController interface
virtual float Get() override;
virtual float Get() const override;
virtual void Set(float value, uint8_t syncGroup=0) override;
virtual void Disable() override;
virtual void SetP(double p) override;
virtual void SetI(double i) override;
virtual void SetD(double d) override;
virtual void SetPID(double p, double i, double d) override;
virtual double GetP() override;
virtual double GetI() override;
virtual double GetD() override;
virtual float GetBusVoltage() override;
virtual float GetOutputVoltage() override;
virtual float GetOutputCurrent() override;
virtual float GetTemperature() override;
virtual double GetPosition() override;
virtual double GetSpeed() override;
virtual bool GetForwardLimitOK() override;
virtual bool GetReverseLimitOK() override;
virtual uint16_t GetFaults() override;
virtual double GetP() const override;
virtual double GetI() const override;
virtual double GetD() const override;
virtual float GetBusVoltage() const override;
virtual float GetOutputVoltage() const override;
virtual float GetOutputCurrent() const override;
virtual float GetTemperature() const override;
virtual double GetPosition() const override;
virtual double GetSpeed() const override;
virtual bool GetForwardLimitOK() const override;
virtual bool GetReverseLimitOK() const override;
virtual uint16_t GetFaults() const override;
virtual void SetVoltageRampRate(double rampRate) override;
virtual uint32_t GetFirmwareVersion() override;
virtual uint32_t GetFirmwareVersion() const override;
virtual void ConfigNeutralMode(NeutralMode mode) override;
virtual void ConfigEncoderCodesPerRev(uint16_t codesPerRev) override;
virtual void ConfigPotentiometerTurns(uint16_t turns) override;
@@ -108,44 +110,46 @@ public:
virtual void ConfigMaxOutputVoltage(double voltage) override;
virtual void ConfigFaultTime(float faultTime) override;
virtual void SetControlMode(ControlMode mode);
virtual ControlMode GetControlMode();
virtual ControlMode GetControlMode() const;
static void UpdateSyncGroup(uint8_t syncGroup);
void SetExpiration(float timeout);
float GetExpiration();
bool IsAlive();
void StopMotor();
bool IsSafetyEnabled();
void SetSafetyEnabled(bool enabled);
void GetDescription(char *desc);
uint8_t GetDeviceID();
void SetExpiration(float timeout) override;
float GetExpiration() const override;
bool IsAlive() const override;
void StopMotor() override;
bool IsSafetyEnabled() const override;
void SetSafetyEnabled(bool enabled) override;
void GetDescription(char *desc) const override;
uint8_t GetDeviceID() const;
protected:
// Control mode helpers
void SetSpeedReference(uint8_t reference);
uint8_t GetSpeedReference();
uint8_t GetSpeedReference() const;
void SetPositionReference(uint8_t reference);
uint8_t GetPositionReference();
uint8_t GetPositionReference() const;
uint8_t packPercentage(uint8_t *buffer, double value);
uint8_t packFXP8_8(uint8_t *buffer, double value);
uint8_t packFXP16_16(uint8_t *buffer, double value);
uint8_t packint16_t(uint8_t *buffer, int16_t value);
uint8_t packint32_t(uint8_t *buffer, int32_t value);
double unpackPercentage(uint8_t *buffer);
double unpackFXP8_8(uint8_t *buffer);
double unpackFXP16_16(uint8_t *buffer);
int16_t unpackint16_t(uint8_t *buffer);
int32_t unpackint32_t(uint8_t *buffer);
double unpackPercentage(uint8_t *buffer) const;
double unpackFXP8_8(uint8_t *buffer) const;
double unpackFXP16_16(uint8_t *buffer) const;
int16_t unpackint16_t(uint8_t *buffer) const;
int32_t unpackint32_t(uint8_t *buffer) const;
void sendMessage(uint32_t messageID, const uint8_t *data, uint8_t dataSize, int32_t period = CAN_SEND_PERIOD_NO_REPEAT);
void requestMessage(uint32_t messageID, int32_t period = CAN_SEND_PERIOD_NO_REPEAT);
bool getMessage(uint32_t messageID, uint32_t mask, uint8_t *data, uint8_t *dataSize);
bool getMessage(uint32_t messageID, uint32_t mask, uint8_t *data, uint8_t *dataSize) const;
void setupPeriodicStatus();
void updatePeriodicStatus();
void updatePeriodicStatus() const;
mutable std::recursive_mutex m_mutex;
uint8_t m_deviceNumber;
float m_value;
@@ -185,21 +189,21 @@ protected:
bool m_faultTimeVerified;
// Status data
float m_busVoltage;
float m_outputVoltage;
float m_outputCurrent;
float m_temperature;
double m_position;
double m_speed;
uint8_t m_limits;
uint16_t m_faults;
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;
// Which periodic status messages have we received at least once?
bool m_receivedStatusMessage0;
bool m_receivedStatusMessage1;
bool m_receivedStatusMessage2;
mutable std::atomic<bool> m_receivedStatusMessage0;
mutable std::atomic<bool> m_receivedStatusMessage1;
mutable std::atomic<bool> m_receivedStatusMessage2;
bool m_controlEnabled;
@@ -207,13 +211,13 @@ protected:
MotorSafetyHelper *m_safetyHelper;
void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType();
void InitTable(ITable *subTable);
ITable * GetTable();
void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew) override;
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(ITable *subTable) override;
ITable * GetTable() const override;
ITable *m_table;

View File

@@ -60,27 +60,27 @@ public:
kLimitMode_SrxDisableSwitchInputs = 2,
};
virtual float Get() = 0;
virtual float Get() const = 0;
virtual void Set(float value, uint8_t syncGroup=0) = 0;
virtual void Disable() = 0;
virtual void SetP(double p) = 0;
virtual void SetI(double i) = 0;
virtual void SetD(double d) = 0;
virtual void SetPID(double p, double i, double d) = 0;
virtual double GetP() = 0;
virtual double GetI() = 0;
virtual double GetD() = 0;
virtual float GetBusVoltage() = 0;
virtual float GetOutputVoltage() = 0;
virtual float GetOutputCurrent() = 0;
virtual float GetTemperature() = 0;
virtual double GetPosition() = 0;
virtual double GetSpeed() = 0;
virtual bool GetForwardLimitOK() = 0;
virtual bool GetReverseLimitOK() = 0;
virtual uint16_t GetFaults() = 0;
virtual double GetP() const = 0;
virtual double GetI() const = 0;
virtual double GetD() const = 0;
virtual float GetBusVoltage() const = 0;
virtual float GetOutputVoltage() const = 0;
virtual float GetOutputCurrent() const = 0;
virtual float GetTemperature() const = 0;
virtual double GetPosition() const = 0;
virtual double GetSpeed() const = 0;
virtual bool GetForwardLimitOK() const = 0;
virtual bool GetReverseLimitOK() const = 0;
virtual uint16_t GetFaults() const = 0;
virtual void SetVoltageRampRate(double rampRate) = 0;
virtual uint32_t GetFirmwareVersion() = 0;
virtual uint32_t GetFirmwareVersion() const = 0;
virtual void ConfigNeutralMode(NeutralMode mode) = 0;
virtual void ConfigEncoderCodesPerRev(uint16_t codesPerRev) = 0;
virtual void ConfigPotentiometerTurns(uint16_t turns) = 0;
@@ -93,5 +93,5 @@ public:
virtual void ConfigFaultTime(float faultTime) = 0;
// Hold off on interface until we figure out ControlMode enums.
// virtual void SetControlMode(ControlMode mode) = 0;
// virtual ControlMode GetControlMode() = 0;
// virtual ControlMode GetControlMode() const = 0;
};

View File

@@ -46,15 +46,15 @@ public:
// MotorSafety interface
virtual void SetExpiration(float timeout) override;
virtual float GetExpiration() override;
virtual bool IsAlive() override;
virtual float GetExpiration() const override;
virtual bool IsAlive() const override;
virtual void StopMotor() override;
virtual void SetSafetyEnabled(bool enabled) override;
virtual bool IsSafetyEnabled() override;
virtual void GetDescription(char *desc) override;
virtual bool IsSafetyEnabled() const override;
virtual void GetDescription(char *desc) const override;
// CANSpeedController interface
virtual float Get() override;
virtual float Get() const override;
virtual void Set(float value, uint8_t syncGroup=0) override;
virtual void Disable() override;
virtual void EnableControl();
@@ -65,37 +65,37 @@ public:
void SetIzone(unsigned iz);
virtual void SetPID(double p, double i, double d) override;
void SetPID(double p, double i, double d, double f);
virtual double GetP() override;
virtual double GetI() override;
virtual double GetD() override;
double GetF();
virtual float GetBusVoltage() override;
virtual float GetOutputVoltage() override;
virtual float GetOutputCurrent() override;
virtual float GetTemperature() override;
virtual double GetP() const override;
virtual double GetI() const override;
virtual double GetD() const override;
double GetF() const;
virtual float GetBusVoltage() const override;
virtual float GetOutputVoltage() const override;
virtual float GetOutputCurrent() const override;
virtual float GetTemperature() const override;
void SetPosition(double pos);
virtual double GetPosition() override;
virtual double GetSpeed() override;
virtual int GetClosedLoopError();
virtual int GetAnalogIn();
virtual int GetAnalogInRaw();
virtual int GetAnalogInVel();
virtual int GetEncPosition();
virtual int GetEncVel();
int GetPinStateQuadA();
int GetPinStateQuadB();
int GetPinStateQuadIdx();
int IsFwdLimitSwitchClosed();
int IsRevLimitSwitchClosed();
int GetNumberOfQuadIdxRises();
virtual double GetPosition() const override;
virtual double GetSpeed() const override;
virtual int GetClosedLoopError() const;
virtual int GetAnalogIn() const;
virtual int GetAnalogInRaw() const;
virtual int GetAnalogInVel() const;
virtual int GetEncPosition() const;
virtual int GetEncVel() const;
int GetPinStateQuadA() const;
int GetPinStateQuadB() const;
int GetPinStateQuadIdx() const;
int IsFwdLimitSwitchClosed() const;
int IsRevLimitSwitchClosed() const;
int GetNumberOfQuadIdxRises() const;
void SetNumberOfQuadIdxRises(int rises);
virtual bool GetForwardLimitOK() override;
virtual bool GetReverseLimitOK() override;
virtual uint16_t GetFaults() override;
uint16_t GetStickyFaults();
virtual bool GetForwardLimitOK() const override;
virtual bool GetReverseLimitOK() const override;
virtual uint16_t GetFaults() const override;
uint16_t GetStickyFaults() const;
void ClearStickyFaults();
virtual void SetVoltageRampRate(double rampRate) override;
virtual uint32_t GetFirmwareVersion() override;
virtual uint32_t GetFirmwareVersion() const override;
virtual void ConfigNeutralMode(NeutralMode mode) override;
virtual void ConfigEncoderCodesPerRev(uint16_t codesPerRev) override;
virtual void ConfigPotentiometerTurns(uint16_t turns) override;
@@ -131,26 +131,26 @@ public:
virtual void SetControlMode(ControlMode mode);
void SetFeedbackDevice(FeedbackDevice device);
void SetStatusFrameRateMs(StatusFrameRate stateFrame, int periodMs);
virtual ControlMode GetControlMode();
virtual ControlMode GetControlMode() const;
void SetSensorDirection(bool reverseSensor);
void SetCloseLoopRampRate(double rampRate);
void SelectProfileSlot(int slotIdx);
int GetIzone();
int GetIaccum();
int GetIzone() const;
int GetIaccum() const;
void ClearIaccum();
int GetBrakeEnableDuringNeutral();
int GetBrakeEnableDuringNeutral() const;
bool IsControlEnabled();
double GetSetpoint();
bool IsControlEnabled() const;
double GetSetpoint() const;
// LiveWindow stuff.
void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType();
void InitTable(ITable *subTable);
ITable * GetTable();
void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew) override;
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(ITable *subTable) override;
ITable * GetTable() const override;
private:
// Values for various modes as is sent in the CAN packets for the Talon.
enum TalonControlMode {

View File

@@ -23,29 +23,29 @@ public:
void Start();
void Stop();
bool Enabled();
bool Enabled() const;
bool GetPressureSwitchValue();
bool GetPressureSwitchValue() const;
float GetCompressorCurrent();
float GetCompressorCurrent() const;
void SetClosedLoopControl(bool on);
bool GetClosedLoopControl();
bool GetClosedLoopControl() const;
bool GetCompressorCurrentTooHighFault();
bool GetCompressorCurrentTooHighStickyFault();
bool GetCompressorShortedStickyFault();
bool GetCompressorShortedFault();
bool GetCompressorNotConnectedStickyFault();
bool GetCompressorNotConnectedFault();
bool GetCompressorCurrentTooHighFault() const;
bool GetCompressorCurrentTooHighStickyFault() const;
bool GetCompressorShortedStickyFault() const;
bool GetCompressorShortedFault() const;
bool GetCompressorNotConnectedStickyFault() const;
bool GetCompressorNotConnectedFault() const;
void ClearAllPCMStickyFaults();
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType();
void InitTable(ITable *subTable);
ITable *GetTable();
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(ITable *subTable) override;
ITable *GetTable() const override;
void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
protected:

View File

@@ -58,26 +58,27 @@ public:
void SetReverseDirection(bool reverseDirection);
// CounterBase interface
int32_t Get();
void Reset();
double GetPeriod();
void SetMaxPeriod(double maxPeriod);
int32_t Get() const override;
void Reset() override;
double GetPeriod() const override;
void SetMaxPeriod(double maxPeriod) override;
void SetUpdateWhenEmpty(bool enabled);
bool GetStopped();
bool GetDirection();
bool GetStopped() const override;
bool GetDirection() const override;
void SetSamplesToAverage(int samplesToAverage);
int GetSamplesToAverage();
uint32_t GetFPGAIndex()
int GetSamplesToAverage() const;
uint32_t GetFPGAIndex() const
{
return m_index;
}
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
virtual std::string GetSmartDashboardType();
void InitTable(ITable *subTable);
ITable * GetTable();
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
virtual std::string GetSmartDashboardType() const override;
void InitTable(ITable *subTable) override;
ITable * GetTable() const override;
protected:
DigitalSource *m_upSource; ///< What makes the counter count up.
DigitalSource *m_downSource; ///< What makes the counter count down.

View File

@@ -26,10 +26,10 @@ public:
};
virtual ~CounterBase() {}
virtual int32_t Get() = 0;
virtual int32_t Get() const = 0;
virtual void Reset() = 0;
virtual double GetPeriod() = 0;
virtual double GetPeriod() const = 0;
virtual void SetMaxPeriod(double maxPeriod) = 0;
virtual bool GetStopped() = 0;
virtual bool GetDirection() = 0;
virtual bool GetStopped() const = 0;
virtual bool GetDirection() const = 0;
};

View File

@@ -20,20 +20,20 @@ class DigitalInput : public DigitalSource, public LiveWindowSendable
public:
explicit DigitalInput(uint32_t channel);
virtual ~DigitalInput();
bool Get();
uint32_t GetChannel();
bool Get() const;
uint32_t GetChannel() const;
// Digital Source Interface
virtual uint32_t GetChannelForRouting();
virtual uint32_t GetModuleForRouting();
virtual bool GetAnalogTriggerForRouting();
virtual uint32_t GetChannelForRouting() const;
virtual uint32_t GetModuleForRouting() const;
virtual bool GetAnalogTriggerForRouting() const;
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType();
std::string GetSmartDashboardType() const;
void InitTable(ITable *subTable);
ITable * GetTable();
ITable * GetTable() const;
private:
void InitDigitalInput(uint32_t channel);

View File

@@ -20,26 +20,26 @@ public:
explicit DigitalOutput(uint32_t channel);
virtual ~DigitalOutput();
void Set(uint32_t value);
uint32_t GetChannel();
uint32_t GetChannel() const;
void Pulse(float length);
bool IsPulsing();
bool IsPulsing() const;
void SetPWMRate(float rate);
void EnablePWM(float initialDutyCycle);
void DisablePWM();
void UpdateDutyCycle(float dutyCycle);
// Digital Source Interface
virtual uint32_t GetChannelForRouting();
virtual uint32_t GetModuleForRouting();
virtual bool GetAnalogTriggerForRouting();
virtual uint32_t GetChannelForRouting() const;
virtual uint32_t GetModuleForRouting() const;
virtual bool GetAnalogTriggerForRouting() const;
virtual void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType();
std::string GetSmartDashboardType() const;
void InitTable(ITable *subTable);
ITable * GetTable();
ITable * GetTable() const;
private:
void InitDigitalOutput(uint32_t channel);

View File

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

View File

@@ -30,17 +30,17 @@ public:
DoubleSolenoid(uint8_t moduleNumber, uint32_t forwardChannel, uint32_t reverseChannel);
virtual ~DoubleSolenoid();
virtual void Set(Value value);
virtual Value Get();
bool IsFwdSolenoidBlackListed();
bool IsRevSolenoidBlackListed();
virtual Value Get() const;
bool IsFwdSolenoidBlackListed() const;
bool IsRevSolenoidBlackListed() const;
void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType();
std::string GetSmartDashboardType() const;
void InitTable(ITable *subTable);
ITable * GetTable();
ITable * GetTable() const;
private:
virtual void InitSolenoid();

View File

@@ -34,34 +34,34 @@ public:
float GetStickAxis(uint32_t stick, uint32_t axis);
int GetStickPOV(uint32_t stick, uint32_t pov);
uint32_t GetStickButtons(uint32_t stick);
uint32_t GetStickButtons(uint32_t stick) const;
bool GetStickButton(uint32_t stick, uint8_t button);
int GetStickAxisCount(uint32_t stick);
int GetStickPOVCount(uint32_t stick);
int GetStickButtonCount(uint32_t stick);
bool GetJoystickIsXbox(uint32_t stick);
int GetJoystickType(uint32_t stick);
std::string GetJoystickName(uint32_t stick);
int GetJoystickAxisType(uint32_t stick, uint8_t axis);
bool IsEnabled();
bool IsDisabled();
bool IsAutonomous();
bool IsOperatorControl();
bool IsTest();
bool IsDSAttached();
bool IsNewControlData();
bool IsFMSAttached();
bool IsSysActive();
bool IsSysBrownedOut();
int GetStickAxisCount(uint32_t stick) const;
int GetStickPOVCount(uint32_t stick) const;
int GetStickButtonCount(uint32_t stick) const;
Alliance GetAlliance();
uint32_t GetLocation();
bool GetJoystickIsXbox(uint32_t stick) const;
int GetJoystickType(uint32_t stick) const;
std::string GetJoystickName(uint32_t stick) const;
int GetJoystickAxisType(uint32_t stick, uint8_t axis) const;
bool IsEnabled() const override;
bool IsDisabled() const override;
bool IsAutonomous() const override;
bool IsOperatorControl() const override;
bool IsTest() const override;
bool IsDSAttached() const;
bool IsNewControlData() const;
bool IsFMSAttached() const;
bool IsSysActive() const;
bool IsSysBrownedOut() const;
Alliance GetAlliance() const;
uint32_t GetLocation() const;
void WaitForData();
double GetMatchTime();
float GetBatteryVoltage();
double GetMatchTime() const;
float GetBatteryVoltage() const;
/** Only to be used to tell the Driver Station what code you claim to be executing
* for diagnostic purposes only

View File

@@ -40,43 +40,44 @@ public:
virtual ~Encoder();
// CounterBase interface
int32_t Get();
int32_t GetRaw();
int32_t GetEncodingScale();
void Reset();
double GetPeriod();
void SetMaxPeriod(double maxPeriod);
bool GetStopped();
bool GetDirection();
double GetDistance();
double GetRate();
int32_t Get() const override;
int32_t GetRaw() const;
int32_t GetEncodingScale() const;
void Reset() override;
double GetPeriod() const override;
void SetMaxPeriod(double maxPeriod) override;
bool GetStopped() const override;
bool GetDirection() const override;
double GetDistance() const;
double GetRate() const;
void SetMinRate(double minRate);
void SetDistancePerPulse(double distancePerPulse);
void SetReverseDirection(bool reverseDirection);
void SetSamplesToAverage(int samplesToAverage);
int GetSamplesToAverage();
int GetSamplesToAverage() const;
void SetPIDSourceParameter(PIDSourceParameter pidSource);
double PIDGet();
double PIDGet() const override;
void SetIndexSource(uint32_t channel, IndexingType type = kResetOnRisingEdge);
void SetIndexSource(DigitalSource *source, IndexingType type = kResetOnRisingEdge);
void SetIndexSource(DigitalSource &source, IndexingType type = kResetOnRisingEdge);
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType();
void InitTable(ITable *subTable);
ITable * GetTable();
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(ITable *subTable) override;
ITable * GetTable() const override;
int32_t GetFPGAIndex()
int32_t GetFPGAIndex() const
{
return m_index;
}
private:
void InitEncoder(bool _reverseDirection, EncodingType encodingType);
double DecodingScaleFactor();
double DecodingScaleFactor() const;
DigitalSource *m_aSource; // the A phase of the quad encoder
DigitalSource *m_bSource; // the B phase of the quad encoder

View File

@@ -24,5 +24,5 @@ public:
virtual ~GearTooth();
void EnableDirectionSensing(bool directionSensitive);
virtual std::string GetSmartDashboardType();
virtual std::string GetSmartDashboardType() const override;
};

View File

@@ -34,8 +34,8 @@ public:
explicit Gyro(AnalogInput *channel);
explicit Gyro(AnalogInput &channel);
virtual ~Gyro();
virtual float GetAngle();
virtual double GetRate();
virtual float GetAngle() const;
virtual double GetRate() const;
void SetSensitivity(float voltsPerDegreePerSecond);
void SetDeadband(float volts);
void SetPIDSourceParameter(PIDSourceParameter pidSource);
@@ -43,14 +43,14 @@ public:
void InitGyro();
// PIDSource interface
double PIDGet();
double PIDGet() const override;
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType();
void InitTable(ITable *subTable);
ITable * GetTable();
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(ITable *subTable) override;
ITable * GetTable() const override;
protected:
AnalogInput *m_analog;

View File

@@ -21,9 +21,9 @@ public:
InterruptableSensorBase();
virtual ~InterruptableSensorBase();
virtual uint32_t GetChannelForRouting() = 0;
virtual uint32_t GetModuleForRouting() = 0;
virtual bool GetAnalogTriggerForRouting() = 0;
virtual uint32_t GetChannelForRouting() const = 0;
virtual uint32_t GetModuleForRouting() const = 0;
virtual bool GetAnalogTriggerForRouting() const = 0;
virtual void RequestInterrupts(InterruptHandlerFunction handler, void *param); ///< Asynchronus handler version.
virtual void RequestInterrupts(); ///< Synchronus Wait version.
virtual void CancelInterrupts(); ///< Free up the underlying chipobject functions.

View File

@@ -18,10 +18,10 @@ public:
explicit Jaguar(uint32_t channel);
virtual ~Jaguar();
virtual void Set(float value, uint8_t syncGroup = 0);
virtual float Get();
virtual float Get() const;
virtual void Disable();
virtual void PIDWrite(float output);
virtual void PIDWrite(float output) override;
private:
void InitJaguar();

View File

@@ -50,37 +50,37 @@ public:
Joystick(uint32_t port, uint32_t numAxisTypes, uint32_t numButtonTypes);
virtual ~Joystick();
uint32_t GetAxisChannel(AxisType axis);
uint32_t GetAxisChannel(AxisType axis) const;
void SetAxisChannel(AxisType axis, uint32_t channel);
virtual float GetX(JoystickHand hand = kRightHand);
virtual float GetY(JoystickHand hand = kRightHand);
virtual float GetZ();
virtual float GetTwist();
virtual float GetThrottle();
virtual float GetAxis(AxisType axis);
float GetRawAxis(uint32_t axis);
virtual float GetX(JoystickHand hand = kRightHand) const override;
virtual float GetY(JoystickHand hand = kRightHand) const override;
virtual float GetZ() const override;
virtual float GetTwist() const override;
virtual float GetThrottle() const override;
virtual float GetAxis(AxisType axis) const;
float GetRawAxis(uint32_t axis) const override;
virtual bool GetTrigger(JoystickHand hand = kRightHand);
virtual bool GetTop(JoystickHand hand = kRightHand);
virtual bool GetBumper(JoystickHand hand = kRightHand);
virtual bool GetRawButton(uint32_t button);
virtual int GetPOV(uint32_t pov = 0);
bool GetButton(ButtonType button);
virtual bool GetTrigger(JoystickHand hand = kRightHand) const override;
virtual bool GetTop(JoystickHand hand = kRightHand) const override;
virtual bool GetBumper(JoystickHand hand = kRightHand) const override;
virtual bool GetRawButton(uint32_t button) const override;
virtual int GetPOV(uint32_t pov = 0) const override;
bool GetButton(ButtonType button) const;
static Joystick* GetStickForPort(uint32_t port);
virtual float GetMagnitude();
virtual float GetDirectionRadians();
virtual float GetDirectionDegrees();
virtual float GetMagnitude() const;
virtual float GetDirectionRadians() const;
virtual float GetDirectionDegrees() const;
bool GetIsXbox();
Joystick::HIDType GetType();
std::string GetName();
int GetAxisType(uint8_t axis);
bool GetIsXbox() const;
Joystick::HIDType GetType() const;
std::string GetName() const;
int GetAxisType(uint8_t axis) const;
int GetAxisCount();
int GetButtonCount();
int GetPOVCount();
int GetAxisCount() const;
int GetButtonCount() const;
int GetPOVCount() const;
void SetRumble(RumbleType type, float value);
void SetOutput(uint8_t outputNumber, bool value);

View File

@@ -11,10 +11,10 @@ class MotorSafety
{
public:
virtual void SetExpiration(float timeout) = 0;
virtual float GetExpiration() = 0;
virtual bool IsAlive() = 0;
virtual float GetExpiration() const = 0;
virtual bool IsAlive() const = 0;
virtual void StopMotor() = 0;
virtual void SetSafetyEnabled(bool enabled) = 0;
virtual bool IsSafetyEnabled() = 0;
virtual void GetDescription(char *desc) = 0;
virtual bool IsSafetyEnabled() const = 0;
virtual void GetDescription(char *desc) const = 0;
};

View File

@@ -17,17 +17,17 @@ public:
~MotorSafetyHelper();
void Feed();
void SetExpiration(float expirationTime);
float GetExpiration();
bool IsAlive();
float GetExpiration() const;
bool IsAlive() const;
void Check();
void SetSafetyEnabled(bool enabled);
bool IsSafetyEnabled();
bool IsSafetyEnabled() const;
static void CheckMotors();
private:
double m_expiration; // the expiration time for this object
bool m_enabled; // true if motor safety is enabled for this motor
double m_stopTime; // the FPGA clock value when this motor has expired
ReentrantSemaphore m_syncMutex; // protect accesses to the state for this object
mutable ReentrantSemaphore m_syncMutex; // protect accesses to the state for this object
MotorSafety *m_safeObject; // the object that is using the helper
MotorSafetyHelper *m_nextHelper; // next object in the list of MotorSafetyHelpers
static MotorSafetyHelper *m_headHelper; // the head of the list of MotorSafetyHelper objects

View File

@@ -38,14 +38,14 @@ public:
explicit PWM(uint32_t channel);
virtual ~PWM();
virtual void SetRaw(unsigned short value);
virtual unsigned short GetRaw();
virtual unsigned short GetRaw() const;
void SetPeriodMultiplier(PeriodMultiplier mult);
void SetZeroLatch();
void EnableDeadbandElimination(bool eliminateDeadband);
void SetBounds(int32_t max, int32_t deadbandMax, int32_t center, int32_t deadbandMin,
int32_t min);
void SetBounds(double max, double deadbandMax, double center, double deadbandMin, double min);
uint32_t GetChannel()
uint32_t GetChannel() const
{
return m_channel;
}
@@ -79,9 +79,9 @@ protected:
static const int32_t kPwmDisabled = 0;
virtual void SetPosition(float pos);
virtual float GetPosition();
virtual float GetPosition() const;
virtual void SetSpeed(float speed);
virtual float GetSpeed();
virtual float GetSpeed() const;
bool m_eliminateDeadband;
int32_t m_maxPwm;
@@ -90,48 +90,48 @@ protected:
int32_t m_deadbandMinPwm;
int32_t m_minPwm;
void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType();
void InitTable(ITable *subTable);
ITable * GetTable();
void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew) override;
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(ITable *subTable) override;
ITable * GetTable() const override;
ITable *m_table;
private:
void InitPWM(uint32_t channel);
uint32_t m_channel;
int32_t GetMaxPositivePwm()
int32_t GetMaxPositivePwm() const
{
return m_maxPwm;
}
int32_t GetMinPositivePwm()
int32_t GetMinPositivePwm() const
{
return m_eliminateDeadband ? m_deadbandMaxPwm : m_centerPwm + 1;
}
int32_t GetCenterPwm()
int32_t GetCenterPwm() const
{
return m_centerPwm;
}
int32_t GetMaxNegativePwm()
int32_t GetMaxNegativePwm() const
{
return m_eliminateDeadband ? m_deadbandMinPwm : m_centerPwm - 1;
}
int32_t GetMinNegativePwm()
int32_t GetMinNegativePwm() const
{
return m_minPwm;
}
int32_t GetPositiveScaleFactor()
int32_t GetPositiveScaleFactor() const
{
return GetMaxPositivePwm() - GetMinPositivePwm();
} ///< The scale for positive speeds.
int32_t GetNegativeScaleFactor()
int32_t GetNegativeScaleFactor() const
{
return GetMaxNegativePwm() - GetMinNegativePwm();
} ///< The scale for negative speeds.
int32_t GetFullRangeScaleFactor()
int32_t GetFullRangeScaleFactor() const
{
return GetMaxPositivePwm() - GetMinNegativePwm();
} ///< The scale for positions.

View File

@@ -21,21 +21,21 @@ class PowerDistributionPanel : public SensorBase, public LiveWindowSendable {
PowerDistributionPanel();
PowerDistributionPanel(uint8_t module);
double GetVoltage();
double GetTemperature();
double GetCurrent(uint8_t channel);
double GetTotalCurrent();
double GetTotalPower();
double GetTotalEnergy();
double GetVoltage() const;
double GetTemperature() const;
double GetCurrent(uint8_t channel) const;
double GetTotalCurrent() const;
double GetTotalPower() const;
double GetTotalEnergy() const;
void ResetTotalEnergy();
void ClearStickyFaults();
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType();
void InitTable(ITable *subTable);
ITable * GetTable();
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(ITable *subTable) override;
ITable * GetTable() const override;
private:
ITable *m_table;

View File

@@ -52,7 +52,7 @@ public:
bool ContainsKey(const char *key);
void Remove(const char *key);
void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew) override;
protected:
Preferences();

View File

@@ -40,15 +40,15 @@ public:
virtual ~Relay();
void Set(Value value);
Value Get();
Value Get() const;
void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType();
void InitTable(ITable *subTable);
ITable * GetTable();
void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew) override;
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(ITable *subTable) override;
ITable * GetTable() const override;
ITable *m_table;

View File

@@ -35,12 +35,12 @@ public:
static RobotBase &getInstance();
static void setInstance(RobotBase* robot);
bool IsEnabled();
bool IsDisabled();
bool IsAutonomous();
bool IsOperatorControl();
bool IsTest();
bool IsNewDataAvailable();
bool IsEnabled() const;
bool IsDisabled() const;
bool IsAutonomous() const;
bool IsOperatorControl() const;
bool IsTest() const;
bool IsNewDataAvailable() const;
static void startRobotTask(FUNCPTR factory);
static void robotTask(FUNCPTR factory, Task *task);
virtual void StartCompetition() = 0;

View File

@@ -69,13 +69,13 @@ public:
void SetMaxOutput(double maxOutput);
void SetCANJaguarSyncGroup(uint8_t syncGroup);
void SetExpiration(float timeout);
float GetExpiration();
bool IsAlive();
void StopMotor();
bool IsSafetyEnabled();
void SetSafetyEnabled(bool enabled);
void GetDescription(char *desc);
void SetExpiration(float timeout) override;
float GetExpiration() const override;
bool IsAlive() const override;
void StopMotor() override;
bool IsSafetyEnabled() const override;
void SetSafetyEnabled(bool enabled) override;
void GetDescription(char *desc) const override;
protected:
void InitRobotDrive();

View File

@@ -24,12 +24,12 @@ public:
~SafePWM();
void SetExpiration(float timeout);
float GetExpiration();
bool IsAlive();
float GetExpiration() const;
bool IsAlive() const;
void StopMotor();
bool IsSafetyEnabled();
bool IsSafetyEnabled() const;
void SetSafetyEnabled(bool enabled);
void GetDescription(char *desc);
void GetDescription(char *desc) const;
virtual void SetSpeed(float speed);
private:

View File

@@ -21,9 +21,9 @@ public:
virtual ~Servo();
void Set(float value);
void SetOffline();
float Get();
float Get() const;
void SetAngle(float angle);
float GetAngle();
float GetAngle() const;
static float GetMaxAngle()
{
return kMaxServoAngle;
@@ -33,19 +33,19 @@ public:
return kMinServoAngle;
}
void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType();
void InitTable(ITable *subTable);
ITable * GetTable();
void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew) override;
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(ITable *subTable) override;
ITable * GetTable() const override;
ITable *m_table;
private:
void InitServo();
float GetServoAngleRange()
float GetServoAngleRange() const
{
return kMaxServoAngle - kMinServoAngle;
}

View File

@@ -22,16 +22,16 @@ public:
Solenoid(uint8_t moduleNumber, uint32_t channel);
virtual ~Solenoid();
virtual void Set(bool on);
virtual bool Get();
bool IsBlackListed();
virtual bool Get() const;
bool IsBlackListed() const;
void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType();
std::string GetSmartDashboardType() const;
void InitTable(ITable *subTable);
ITable * GetTable();
ITable * GetTable() const;
private:
void InitSolenoid();

View File

@@ -19,11 +19,11 @@ class SolenoidBase : public SensorBase
{
public:
virtual ~SolenoidBase();
uint8_t GetAll(int module = 0);
uint8_t GetPCMSolenoidBlackList(int module);
bool GetPCMSolenoidVoltageStickyFault(int module);
bool GetPCMSolenoidVoltageFault(int module);
uint8_t GetAll(int module = 0) const;
uint8_t GetPCMSolenoidBlackList(int module) const;
bool GetPCMSolenoidVoltageStickyFault(int module) const;
bool GetPCMSolenoidVoltageFault(int module) const;
void ClearAllPCMStickyFaults(int module);
protected:
explicit SolenoidBase(uint8_t pcmID);

View File

@@ -27,7 +27,7 @@ public:
*
* @return The current set speed. Value is between -1.0 and 1.0.
*/
virtual float Get() = 0;
virtual float Get() const = 0;
/**
* Common interface for disabling a motor.
*/

View File

@@ -18,10 +18,10 @@ public:
explicit Talon(uint32_t channel);
virtual ~Talon();
virtual void Set(float value, uint8_t syncGroup = 0);
virtual float Get();
virtual float Get() const;
virtual void Disable();
virtual void PIDWrite(float output);
virtual void PIDWrite(float output) override;
private:
void InitTalon();

View File

@@ -18,11 +18,11 @@ class TalonSRX : public SafePWM, public SpeedController
public:
explicit TalonSRX(uint32_t channel);
virtual ~TalonSRX();
virtual void Set(float value, uint8_t syncGroup = 0);
virtual float Get();
virtual void Disable();
virtual void Set(float value, uint8_t syncGroup = 0) override;
virtual float Get() const override;
virtual void Disable() override;
virtual void PIDWrite(float output);
virtual void PIDWrite(float output) override;
private:
void InitTalonSRX();

View File

@@ -39,11 +39,11 @@ public:
virtual ~Ultrasonic();
void Ping();
bool IsRangeValid();
bool IsRangeValid() const;
static void SetAutomaticMode(bool enabling);
double GetRangeInches();
double GetRangeMM();
bool IsEnabled()
double GetRangeInches() const;
double GetRangeMM() const;
bool IsEnabled() const
{
return m_enabled;
}
@@ -52,16 +52,16 @@ public:
m_enabled = enable;
}
double PIDGet();
double PIDGet() const override;
void SetDistanceUnits(DistanceUnit units);
DistanceUnit GetDistanceUnits();
DistanceUnit GetDistanceUnits() const;
void UpdateTable();
void StartLiveWindowMode();
void StopLiveWindowMode();
std::string GetSmartDashboardType();
void InitTable(ITable *subTable);
ITable * GetTable();
void UpdateTable() override;
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
std::string GetSmartDashboardType() const override;
void InitTable(ITable *subTable) override;
ITable * GetTable() const override;
private:
void Initialize();

View File

@@ -21,10 +21,10 @@ public:
explicit Victor(uint32_t channel);
virtual ~Victor();
virtual void Set(float value, uint8_t syncGroup = 0);
virtual float Get();
virtual float Get() const;
virtual void Disable();
virtual void PIDWrite(float output);
virtual void PIDWrite(float output) override;
private:
void InitVictor();

View File

@@ -18,10 +18,10 @@ public:
explicit VictorSP(uint32_t channel);
virtual ~VictorSP();
virtual void Set(float value, uint8_t syncGroup = 0);
virtual float Get();
virtual float Get() const;
virtual void Disable();
virtual void PIDWrite(float output);
virtual void PIDWrite(float output) override;
private:
void InitVictorSP();

View File

@@ -104,7 +104,7 @@ ADXL345_I2C::AllAxes ADXL345_I2C::GetAccelerations()
return data;
}
std::string ADXL345_I2C::GetSmartDashboardType() {
std::string ADXL345_I2C::GetSmartDashboardType() const {
return "3AxisAccelerometer";
}
@@ -121,6 +121,6 @@ void ADXL345_I2C::UpdateTable() {
}
}
ITable* ADXL345_I2C::GetTable() {
ITable* ADXL345_I2C::GetTable() const {
return m_table;
}

View File

@@ -141,7 +141,7 @@ ADXL345_SPI::AllAxes ADXL345_SPI::GetAccelerations()
return data;
}
std::string ADXL345_SPI::GetSmartDashboardType() {
std::string ADXL345_SPI::GetSmartDashboardType() const {
return "3AxisAccelerometer";
}
@@ -158,6 +158,6 @@ void ADXL345_SPI::UpdateTable() {
}
}
ITable* ADXL345_SPI::GetTable() {
ITable* ADXL345_SPI::GetTable() const {
return m_table;
}

View File

@@ -72,7 +72,7 @@ AnalogAccelerometer::~AnalogAccelerometer()
*
* @return The current acceleration of the sensor in Gs.
*/
float AnalogAccelerometer::GetAcceleration()
float AnalogAccelerometer::GetAcceleration() const
{
return (m_AnalogInput->GetAverageVoltage() - m_zeroGVoltage) / m_voltsPerG;
}
@@ -107,7 +107,7 @@ void AnalogAccelerometer::SetZero(float zero)
*
* @return The current acceleration in Gs.
*/
double AnalogAccelerometer::PIDGet()
double AnalogAccelerometer::PIDGet() const
{
return GetAcceleration();
}
@@ -124,7 +124,7 @@ void AnalogAccelerometer::StartLiveWindowMode() {
void AnalogAccelerometer::StopLiveWindowMode() {
}
std::string AnalogAccelerometer::GetSmartDashboardType() {
std::string AnalogAccelerometer::GetSmartDashboardType() const {
return "Accelerometer";
}
@@ -133,6 +133,6 @@ void AnalogAccelerometer::InitTable(ITable *subTable) {
UpdateTable();
}
ITable * AnalogAccelerometer::GetTable() {
ITable * AnalogAccelerometer::GetTable() const {
return m_table;
}

View File

@@ -75,7 +75,7 @@ AnalogInput::~AnalogInput()
* The units are in A/D converter codes. Use GetVoltage() to get the analog value in calibrated units.
* @return A sample straight from this channel.
*/
int16_t AnalogInput::GetValue()
int16_t AnalogInput::GetValue() const
{
if (StatusIsFatal()) return 0;
int32_t status = 0;
@@ -93,7 +93,7 @@ int16_t AnalogInput::GetValue()
* Use GetAverageVoltage() to get the analog value in calibrated units.
* @return A sample from the oversample and average engine for this channel.
*/
int32_t AnalogInput::GetAverageValue()
int32_t AnalogInput::GetAverageValue() const
{
if (StatusIsFatal()) return 0;
int32_t status = 0;
@@ -107,7 +107,7 @@ int32_t AnalogInput::GetAverageValue()
* The value is scaled to units of Volts using the calibrated scaling data from GetLSBWeight() and GetOffset().
* @return A scaled sample straight from this channel.
*/
float AnalogInput::GetVoltage()
float AnalogInput::GetVoltage() const
{
if (StatusIsFatal()) return 0.0f;
int32_t status = 0;
@@ -123,7 +123,7 @@ float AnalogInput::GetVoltage()
* Using averaging will cause this value to be more stable, but it will update more slowly.
* @return A scaled sample from the output of the oversample and average engine for this channel.
*/
float AnalogInput::GetAverageVoltage()
float AnalogInput::GetAverageVoltage() const
{
if (StatusIsFatal()) return 0.0f;
int32_t status = 0;
@@ -139,7 +139,7 @@ float AnalogInput::GetAverageVoltage()
*
* @return Least significant bit weight.
*/
uint32_t AnalogInput::GetLSBWeight()
uint32_t AnalogInput::GetLSBWeight() const
{
if (StatusIsFatal()) return 0;
int32_t status = 0;
@@ -155,7 +155,7 @@ uint32_t AnalogInput::GetLSBWeight()
*
* @return Offset constant.
*/
int32_t AnalogInput::GetOffset()
int32_t AnalogInput::GetOffset() const
{
if (StatusIsFatal()) return 0;
int32_t status = 0;
@@ -168,7 +168,7 @@ int32_t AnalogInput::GetOffset()
* Get the channel number.
* @return The channel number.
*/
uint32_t AnalogInput::GetChannel()
uint32_t AnalogInput::GetChannel() const
{
if (StatusIsFatal()) return 0;
return m_channel;
@@ -197,7 +197,7 @@ void AnalogInput::SetAverageBits(uint32_t bits)
*
* @return Number of bits of averaging previously configured.
*/
uint32_t AnalogInput::GetAverageBits()
uint32_t AnalogInput::GetAverageBits() const
{
int32_t status = 0;
int32_t averageBits = getAnalogAverageBits(m_port, &status);
@@ -228,7 +228,7 @@ void AnalogInput::SetOversampleBits(uint32_t bits)
*
* @return Number of bits of oversampling previously configured.
*/
uint32_t AnalogInput::GetOversampleBits()
uint32_t AnalogInput::GetOversampleBits() const
{
if (StatusIsFatal()) return 0;
int32_t status = 0;
@@ -242,7 +242,7 @@ uint32_t AnalogInput::GetOversampleBits()
*
* @return The analog input is attached to an accumulator.
*/
bool AnalogInput::IsAccumulatorChannel()
bool AnalogInput::IsAccumulatorChannel() const
{
if (StatusIsFatal()) return false;
int32_t status = 0;
@@ -335,7 +335,7 @@ void AnalogInput::SetAccumulatorDeadband(int32_t deadband)
*
* @return The 64-bit value accumulated since the last Reset().
*/
int64_t AnalogInput::GetAccumulatorValue()
int64_t AnalogInput::GetAccumulatorValue() const
{
if (StatusIsFatal()) return 0;
int32_t status = 0;
@@ -351,7 +351,7 @@ int64_t AnalogInput::GetAccumulatorValue()
*
* @return The number of times samples from the channel were accumulated.
*/
uint32_t AnalogInput::GetAccumulatorCount()
uint32_t AnalogInput::GetAccumulatorCount() const
{
if (StatusIsFatal()) return 0;
int32_t status = 0;
@@ -370,7 +370,7 @@ uint32_t AnalogInput::GetAccumulatorCount()
* @param value Pointer to the 64-bit accumulated output.
* @param count Pointer to the number of accumulation cycles.
*/
void AnalogInput::GetAccumulatorOutput(int64_t *value, uint32_t *count)
void AnalogInput::GetAccumulatorOutput(int64_t *value, uint32_t *count) const
{
if (StatusIsFatal()) return;
int32_t status = 0;
@@ -410,7 +410,7 @@ float AnalogInput::GetSampleRate()
*
* @return The average voltage.
*/
double AnalogInput::PIDGet()
double AnalogInput::PIDGet() const
{
if (StatusIsFatal()) return 0.0;
return GetAverageVoltage();
@@ -430,7 +430,7 @@ void AnalogInput::StopLiveWindowMode() {
}
std::string AnalogInput::GetSmartDashboardType() {
std::string AnalogInput::GetSmartDashboardType() const {
return "Analog Input";
}
@@ -439,6 +439,6 @@ void AnalogInput::InitTable(ITable *subTable) {
UpdateTable();
}
ITable * AnalogInput::GetTable() {
ITable * AnalogInput::GetTable() const {
return m_table;
}

View File

@@ -76,7 +76,7 @@ void AnalogOutput::SetVoltage(float voltage) {
*
* @return The value in Volts, from 0.0 to +5.0
*/
float AnalogOutput::GetVoltage() {
float AnalogOutput::GetVoltage() const {
int32_t status = 0;
float voltage = getAnalogOutput(m_port, &status);
@@ -97,7 +97,7 @@ void AnalogOutput::StartLiveWindowMode() {
void AnalogOutput::StopLiveWindowMode() {
}
std::string AnalogOutput::GetSmartDashboardType() {
std::string AnalogOutput::GetSmartDashboardType() const {
return "Analog Output";
}
@@ -106,6 +106,6 @@ void AnalogOutput::InitTable(ITable *subTable) {
UpdateTable();
}
ITable *AnalogOutput::GetTable() {
ITable *AnalogOutput::GetTable() const {
return m_table;
}

View File

@@ -59,7 +59,7 @@ AnalogPotentiometer::~AnalogPotentiometer() {
*
* @return The current position of the potentiometer (in the units used for fullRaneg and offset).
*/
double AnalogPotentiometer::Get() {
double AnalogPotentiometer::Get() const {
return (m_analog_input->GetVoltage() / ControllerPower::GetVoltage5V()) * m_fullRange + m_offset;
}
@@ -68,7 +68,7 @@ double AnalogPotentiometer::Get() {
*
* @return The current reading.
*/
double AnalogPotentiometer::PIDGet() {
double AnalogPotentiometer::PIDGet() const {
return Get();
}
@@ -76,7 +76,7 @@ double AnalogPotentiometer::PIDGet() {
/**
* @return the Smart Dashboard Type
*/
std::string AnalogPotentiometer::GetSmartDashboardType() {
std::string AnalogPotentiometer::GetSmartDashboardType() const {
return "Analog Input";
}
@@ -94,6 +94,6 @@ void AnalogPotentiometer::UpdateTable() {
}
}
ITable* AnalogPotentiometer::GetTable() {
ITable* AnalogPotentiometer::GetTable() const {
return m_table;
}

View File

@@ -41,7 +41,7 @@ AnalogTriggerOutput::~AnalogTriggerOutput()
* Get the state of the analog trigger output.
* @return The state of the analog trigger output.
*/
bool AnalogTriggerOutput::Get()
bool AnalogTriggerOutput::Get() const
{
int32_t status = 0;
bool result = getAnalogTriggerOutput(m_trigger->m_trigger, m_outputType, &status);
@@ -52,7 +52,7 @@ bool AnalogTriggerOutput::Get()
/**
* @return The value to be written to the channel field of a routing mux.
*/
uint32_t AnalogTriggerOutput::GetChannelForRouting()
uint32_t AnalogTriggerOutput::GetChannelForRouting() const
{
return (m_trigger->m_index << 2) + m_outputType;
}
@@ -60,7 +60,7 @@ uint32_t AnalogTriggerOutput::GetChannelForRouting()
/**
* @return The value to be written to the module field of a routing mux.
*/
uint32_t AnalogTriggerOutput::GetModuleForRouting()
uint32_t AnalogTriggerOutput::GetModuleForRouting() const
{
return 0;
}
@@ -68,7 +68,7 @@ uint32_t AnalogTriggerOutput::GetModuleForRouting()
/**
* @return The value to be written to the module field of a routing mux.
*/
bool AnalogTriggerOutput::GetAnalogTriggerForRouting()
bool AnalogTriggerOutput::GetAnalogTriggerForRouting() const
{
return true;
}

View File

@@ -63,7 +63,7 @@ double BuiltInAccelerometer::GetZ()
return getAccelerometerZ();
}
std::string BuiltInAccelerometer::GetSmartDashboardType() {
std::string BuiltInAccelerometer::GetSmartDashboardType() const {
return "3AxisAccelerometer";
}
@@ -80,6 +80,6 @@ void BuiltInAccelerometer::UpdateTable() {
}
}
ITable* BuiltInAccelerometer::GetTable() {
ITable* BuiltInAccelerometer::GetTable() const {
return m_table;
}

View File

@@ -374,7 +374,7 @@ void CANJaguar::Set(float outputValue, uint8_t syncGroup)
*
* @return The most recently set outputValue setpoint.
*/
float CANJaguar::Get()
float CANJaguar::Get() const
{
return m_value;
}
@@ -441,34 +441,34 @@ uint8_t CANJaguar::packint32_t(uint8_t *buffer, int32_t value)
return sizeof(int32_t);
}
double CANJaguar::unpackPercentage(uint8_t *buffer)
double CANJaguar::unpackPercentage(uint8_t *buffer) const
{
int16_t value = *((int16_t*)buffer);
value = swap16(value);
return value / 32767.0;
}
double CANJaguar::unpackFXP8_8(uint8_t *buffer)
double CANJaguar::unpackFXP8_8(uint8_t *buffer) const
{
int16_t value = *((int16_t*)buffer);
value = swap16(value);
return value / 256.0;
}
double CANJaguar::unpackFXP16_16(uint8_t *buffer)
double CANJaguar::unpackFXP16_16(uint8_t *buffer) const
{
int32_t value = *((int32_t*)buffer);
value = swap32(value);
return value / 65536.0;
}
int16_t CANJaguar::unpackint16_t(uint8_t *buffer)
int16_t CANJaguar::unpackint16_t(uint8_t *buffer) const
{
int16_t value = *((int16_t*)buffer);
return swap16(value);
}
int32_t CANJaguar::unpackint32_t(uint8_t *buffer)
int32_t CANJaguar::unpackint32_t(uint8_t *buffer) const
{
int32_t value = *((int32_t*)buffer);
return swap32(value);
@@ -516,7 +516,7 @@ void CANJaguar::requestMessage(uint32_t messageID, int32_t period)
*
* @return true if the message was found. Otherwise, no new message is available.
*/
bool CANJaguar::getMessage(uint32_t messageID, uint32_t messageMask, uint8_t *data, uint8_t *dataSize)
bool CANJaguar::getMessage(uint32_t messageID, uint32_t messageMask, uint8_t *data, uint8_t *dataSize) const
{
uint32_t targetedMessageID = messageID | m_deviceNumber;
int32_t status = 0;
@@ -580,33 +580,39 @@ void CANJaguar::setupPeriodicStatus() {
/**
* Check for new periodic status updates and unpack them into local variables
*/
void CANJaguar::updatePeriodicStatus() {
void CANJaguar::updatePeriodicStatus() const {
uint8_t data[8];
uint8_t dataSize;
// Check if a new bus voltage/output voltage/current/temperature message
// has arrived and unpack the values into the cached member variables
if(getMessage(LM_API_PSTAT_DATA_S0, CAN_MSGID_FULL_M, data, &dataSize)) {
m_mutex.lock();
m_busVoltage = unpackFXP8_8(data);
m_outputVoltage = unpackPercentage(data + 2) * m_busVoltage;
m_outputCurrent = unpackFXP8_8(data + 4);
m_temperature = unpackFXP8_8(data + 6);
m_mutex.unlock();
m_receivedStatusMessage0 = true;
}
// Check if a new position/speed message has arrived and do the same
if(getMessage(LM_API_PSTAT_DATA_S1, CAN_MSGID_FULL_M, data, &dataSize)) {
m_mutex.lock();
m_position = unpackFXP16_16(data);
m_speed = unpackFXP16_16(data + 4);
m_mutex.unlock();
m_receivedStatusMessage1 = true;
}
// Check if a new limits/faults message has arrived and do the same
if(getMessage(LM_API_PSTAT_DATA_S2, CAN_MSGID_FULL_M, data, &dataSize)) {
m_mutex.lock();
m_limits = data[0];
m_faults = data[1];
m_mutex.unlock();
m_receivedStatusMessage2 = true;
}
@@ -1094,7 +1100,7 @@ void CANJaguar::SetSpeedReference(uint8_t reference)
* @return A speed reference indicating the currently selected reference device
* for speed controller mode.
*/
uint8_t CANJaguar::GetSpeedReference()
uint8_t CANJaguar::GetSpeedReference() const
{
return m_speedReference;
}
@@ -1124,7 +1130,7 @@ void CANJaguar::SetPositionReference(uint8_t reference)
*
* @return A PositionReference indicating the currently selected reference device for position controller mode.
*/
uint8_t CANJaguar::GetPositionReference()
uint8_t CANJaguar::GetPositionReference() const
{
return m_positionReference;
}
@@ -1253,7 +1259,7 @@ void CANJaguar::SetD(double d)
*
* @return The proportional gain.
*/
double CANJaguar::GetP()
double CANJaguar::GetP() const
{
if(m_controlMode == kPercentVbus || m_controlMode == kVoltage)
{
@@ -1269,7 +1275,7 @@ double CANJaguar::GetP()
*
* @return The integral gain.
*/
double CANJaguar::GetI()
double CANJaguar::GetI() const
{
if(m_controlMode == kPercentVbus || m_controlMode == kVoltage)
{
@@ -1285,7 +1291,7 @@ double CANJaguar::GetI()
*
* @return The differential gain.
*/
double CANJaguar::GetD()
double CANJaguar::GetD() const
{
if(m_controlMode == kPercentVbus || m_controlMode == kVoltage)
{
@@ -1659,7 +1665,7 @@ void CANJaguar::SetControlMode(ControlMode controlMode)
*
* @return ControlMode that the Jag is in.
*/
CANJaguar::ControlMode CANJaguar::GetControlMode()
CANJaguar::ControlMode CANJaguar::GetControlMode() const
{
return m_controlMode;
}
@@ -1669,9 +1675,10 @@ CANJaguar::ControlMode CANJaguar::GetControlMode()
*
* @return The bus voltage in volts.
*/
float CANJaguar::GetBusVoltage()
float CANJaguar::GetBusVoltage() const
{
updatePeriodicStatus();
std::lock_guard<std::recursive_mutex> lock(m_mutex);
return m_busVoltage;
}
@@ -1681,9 +1688,10 @@ float CANJaguar::GetBusVoltage()
*
* @return The output voltage in volts.
*/
float CANJaguar::GetOutputVoltage()
float CANJaguar::GetOutputVoltage() const
{
updatePeriodicStatus();
std::lock_guard<std::recursive_mutex> lock(m_mutex);
return m_outputVoltage;
}
@@ -1693,9 +1701,10 @@ float CANJaguar::GetOutputVoltage()
*
* @return The output current in amps.
*/
float CANJaguar::GetOutputCurrent()
float CANJaguar::GetOutputCurrent() const
{
updatePeriodicStatus();
std::lock_guard<std::recursive_mutex> lock(m_mutex);
return m_outputCurrent;
}
@@ -1705,9 +1714,10 @@ float CANJaguar::GetOutputCurrent()
*
* @return The temperature of the Jaguar in degrees Celsius.
*/
float CANJaguar::GetTemperature()
float CANJaguar::GetTemperature() const
{
updatePeriodicStatus();
std::lock_guard<std::recursive_mutex> lock(m_mutex);
return m_temperature;
}
@@ -1719,9 +1729,10 @@ float CANJaguar::GetTemperature()
* @see CANJaguar#ConfigPotentiometerTurns(int)
* @see CANJaguar#ConfigEncoderCodesPerRev(int)
*/
double CANJaguar::GetPosition()
double CANJaguar::GetPosition() const
{
updatePeriodicStatus();
std::lock_guard<std::recursive_mutex> lock(m_mutex);
return m_position;
}
@@ -1731,9 +1742,10 @@ double CANJaguar::GetPosition()
*
* @return The speed of the motor in RPM based on the configured feedback.
*/
double CANJaguar::GetSpeed()
double CANJaguar::GetSpeed() const
{
updatePeriodicStatus();
std::lock_guard<std::recursive_mutex> lock(m_mutex);
return m_speed;
}
@@ -1743,9 +1755,10 @@ double CANJaguar::GetSpeed()
*
* @return The motor is allowed to turn in the forward direction when true.
*/
bool CANJaguar::GetForwardLimitOK()
bool CANJaguar::GetForwardLimitOK() const
{
updatePeriodicStatus();
std::lock_guard<std::recursive_mutex> lock(m_mutex);
return m_limits & kForwardLimit;
}
@@ -1755,9 +1768,10 @@ bool CANJaguar::GetForwardLimitOK()
*
* @return The motor is allowed to turn in the reverse direction when true.
*/
bool CANJaguar::GetReverseLimitOK()
bool CANJaguar::GetReverseLimitOK() const
{
updatePeriodicStatus();
std::lock_guard<std::recursive_mutex> lock(m_mutex);
return m_limits & kReverseLimit;
}
@@ -1771,9 +1785,10 @@ bool CANJaguar::GetReverseLimitOK()
* @see #kTemperatureFault
* @see #kGateDriverFault
*/
uint16_t CANJaguar::GetFaults()
uint16_t CANJaguar::GetFaults() const
{
updatePeriodicStatus();
std::lock_guard<std::recursive_mutex> lock(m_mutex);
return m_faults;
}
@@ -1818,7 +1833,7 @@ void CANJaguar::SetVoltageRampRate(double rampRate)
*
* @return The firmware version. 0 if the device did not respond.
*/
uint32_t CANJaguar::GetFirmwareVersion()
uint32_t CANJaguar::GetFirmwareVersion() const
{
return m_firmwareVersion;
}
@@ -1828,7 +1843,7 @@ uint32_t CANJaguar::GetFirmwareVersion()
*
* @return The hardware version. 1: Jaguar, 2: Black Jaguar
*/
uint8_t CANJaguar::GetHardwareVersion()
uint8_t CANJaguar::GetHardwareVersion() const
{
return m_hardwareVersion;
}
@@ -2030,19 +2045,19 @@ void CANJaguar::SetExpiration(float timeout)
if (m_safetyHelper) m_safetyHelper->SetExpiration(timeout);
}
float CANJaguar::GetExpiration()
float CANJaguar::GetExpiration() const
{
if (!m_safetyHelper) return 0.0;
return m_safetyHelper->GetExpiration();
}
bool CANJaguar::IsAlive()
bool CANJaguar::IsAlive() const
{
if (!m_safetyHelper) return false;
return m_safetyHelper->IsAlive();
}
bool CANJaguar::IsSafetyEnabled()
bool CANJaguar::IsSafetyEnabled() const
{
if (!m_safetyHelper) return false;
return m_safetyHelper->IsSafetyEnabled();
@@ -2053,12 +2068,12 @@ void CANJaguar::SetSafetyEnabled(bool enabled)
if (m_safetyHelper) m_safetyHelper->SetSafetyEnabled(enabled);
}
void CANJaguar::GetDescription(char *desc)
void CANJaguar::GetDescription(char *desc) const
{
sprintf(desc, "CANJaguar ID %d", m_deviceNumber);
}
uint8_t CANJaguar::GetDeviceID()
uint8_t CANJaguar::GetDeviceID() const
{
return m_deviceNumber;
}
@@ -2103,7 +2118,7 @@ void CANJaguar::StopLiveWindowMode()
}
}
std::string CANJaguar::GetSmartDashboardType()
std::string CANJaguar::GetSmartDashboardType() const
{
return "Speed Controller";
}
@@ -2114,7 +2129,7 @@ void CANJaguar::InitTable(ITable *subTable)
UpdateTable();
}
ITable * CANJaguar::GetTable()
ITable * CANJaguar::GetTable() const
{
return m_table;
}

View File

@@ -76,7 +76,7 @@ void CANTalon::PIDWrite(float output)
*
* @return The current sensor value of the Talon.
*/
float CANTalon::Get()
float CANTalon::Get() const
{
int value;
switch(m_controlMode) {
@@ -184,7 +184,7 @@ void CANTalon::EnableControl() {
/**
* @return Whether the Talon is currently enabled.
*/
bool CANTalon::IsControlEnabled() {
bool CANTalon::IsControlEnabled() const {
return m_controlEnabled;
}
@@ -322,7 +322,7 @@ void CANTalon::SetStatusFrameRateMs(StatusFrameRate stateFrame, int periodMs)
* @return double proportional constant for current profile.
* @see SelectProfileSlot to choose between the two sets of gains.
*/
double CANTalon::GetP()
double CANTalon::GetP() const
{
CanTalonSRX::param_t param = m_profile ? CanTalonSRX::eProfileParamSlot1_P : CanTalonSRX::eProfileParamSlot0_P;
// Update the info in m_impl.
@@ -343,7 +343,7 @@ double CANTalon::GetP()
* TODO documentation (see CANJaguar.cpp)
* @see SelectProfileSlot to choose between the two sets of gains.
*/
double CANTalon::GetI()
double CANTalon::GetI() const
{
CanTalonSRX::param_t param = m_profile ? CanTalonSRX::eProfileParamSlot1_I : CanTalonSRX::eProfileParamSlot0_I;
// Update the info in m_impl.
@@ -365,7 +365,7 @@ double CANTalon::GetI()
* TODO documentation (see CANJaguar.cpp)
* @see SelectProfileSlot to choose between the two sets of gains.
*/
double CANTalon::GetD()
double CANTalon::GetD() const
{
CanTalonSRX::param_t param = m_profile ? CanTalonSRX::eProfileParamSlot1_D : CanTalonSRX::eProfileParamSlot0_D;
// Update the info in m_impl.
@@ -386,7 +386,7 @@ double CANTalon::GetD()
*
* @see SelectProfileSlot to choose between the two sets of gains.
*/
double CANTalon::GetF()
double CANTalon::GetF() const
{
CanTalonSRX::param_t param = m_profile ? CanTalonSRX::eProfileParamSlot1_F : CanTalonSRX::eProfileParamSlot0_F;
// Update the info in m_impl.
@@ -406,7 +406,7 @@ double CANTalon::GetF()
/**
* @see SelectProfileSlot to choose between the two sets of gains.
*/
int CANTalon::GetIzone()
int CANTalon::GetIzone() const
{
CanTalonSRX::param_t param = m_profile ? CanTalonSRX::eProfileParamSlot1_IZone: CanTalonSRX::eProfileParamSlot0_IZone;
// Update the info in m_impl.
@@ -427,7 +427,7 @@ int CANTalon::GetIzone()
/**
* @return the current setpoint; ie, whatever was last passed to Set().
*/
double CANTalon::GetSetpoint() {
double CANTalon::GetSetpoint() const {
return m_setPoint;
}
@@ -436,7 +436,7 @@ double CANTalon::GetSetpoint() {
*
* @return The input voltage in volts.
*/
float CANTalon::GetBusVoltage()
float CANTalon::GetBusVoltage() const
{
double voltage;
CTR_Code status = m_impl->GetBatteryV(voltage);
@@ -449,7 +449,7 @@ float CANTalon::GetBusVoltage()
/**
* @return The voltage being output by the Talon, in Volts.
*/
float CANTalon::GetOutputVoltage()
float CANTalon::GetOutputVoltage() const
{
int throttle11;
CTR_Code status = m_impl->GetAppliedThrottle(throttle11);
@@ -464,7 +464,7 @@ float CANTalon::GetOutputVoltage()
/**
* Returns the current going through the Talon, in Amperes.
*/
float CANTalon::GetOutputCurrent()
float CANTalon::GetOutputCurrent() const
{
double current;
@@ -479,7 +479,7 @@ float CANTalon::GetOutputCurrent()
/**
* Returns temperature of Talon, in degrees Celsius.
*/
float CANTalon::GetTemperature()
float CANTalon::GetTemperature() const
{
double temp;
@@ -505,7 +505,7 @@ void CANTalon::SetPosition(double pos)
* When using an analog encoder (wrapping around 1023 => 0 is possible) the units are still 3.3V per 1023 units.
* When using quadrature, each unit is a quadrature edge (4X) mode.
*/
double CANTalon::GetPosition()
double CANTalon::GetPosition() const
{
int postition;
@@ -533,7 +533,7 @@ void CANTalon::SetSensorDirection(bool reverseSensor)
*
* @return the difference between the setpoint and the sensor value.
*/
int CANTalon::GetClosedLoopError() {
int CANTalon::GetClosedLoopError() const {
int error;
CTR_Code status = m_impl->GetCloseLoopErr(error);
if(status != CTR_OKAY) {
@@ -557,7 +557,7 @@ int CANTalon::GetClosedLoopError() {
* An example speed of 200 would then equate to 20% of a rotation per 100ms,
* or 10 rotations per second.
*/
double CANTalon::GetSpeed()
double CANTalon::GetSpeed() const
{
int speed;
// TODO convert from int to appropriate units (or at least document it).
@@ -577,7 +577,7 @@ double CANTalon::GetSpeed()
* the analog pin of the Talon. The upper 14 bits
* tracks the overflows and underflows (continuous sensor).
*/
int CANTalon::GetAnalogIn()
int CANTalon::GetAnalogIn() const
{
int position;
CTR_Code status = m_impl->GetAnalogInWithOv(position);
@@ -592,7 +592,7 @@ int CANTalon::GetAnalogIn()
*
* @returns The ADC (0 - 1023) on analog pin of the Talon.
*/
int CANTalon::GetAnalogInRaw()
int CANTalon::GetAnalogInRaw() const
{
return GetAnalogIn() & 0x3FF;
}
@@ -602,7 +602,7 @@ int CANTalon::GetAnalogInRaw()
*
* @returns The value (0 - 1023) on the analog pin of the Talon.
*/
int CANTalon::GetAnalogInVel()
int CANTalon::GetAnalogInVel() const
{
int vel;
CTR_Code status = m_impl->GetAnalogInVel(vel);
@@ -618,7 +618,7 @@ int CANTalon::GetAnalogInVel()
*
* @returns The value (0 - 1023) on the analog pin of the Talon.
*/
int CANTalon::GetEncPosition()
int CANTalon::GetEncPosition() const
{
int position;
CTR_Code status = m_impl->GetEncPosition(position);
@@ -634,7 +634,7 @@ int CANTalon::GetEncPosition()
*
* @returns The value (0 - 1023) on the analog pin of the Talon.
*/
int CANTalon::GetEncVel()
int CANTalon::GetEncVel() const
{
int vel;
CTR_Code status = m_impl->GetEncVel(vel);
@@ -646,7 +646,7 @@ int CANTalon::GetEncVel()
/**
* @return IO level of QUADA pin.
*/
int CANTalon::GetPinStateQuadA()
int CANTalon::GetPinStateQuadA() const
{
int retval;
CTR_Code status = m_impl->GetQuadApin(retval);
@@ -658,7 +658,7 @@ int CANTalon::GetPinStateQuadA()
/**
* @return IO level of QUADB pin.
*/
int CANTalon::GetPinStateQuadB()
int CANTalon::GetPinStateQuadB() const
{
int retval;
CTR_Code status = m_impl->GetQuadBpin(retval);
@@ -670,7 +670,7 @@ int CANTalon::GetPinStateQuadB()
/**
* @return IO level of QUAD Index pin.
*/
int CANTalon::GetPinStateQuadIdx()
int CANTalon::GetPinStateQuadIdx() const
{
int retval;
CTR_Code status = m_impl->GetQuadIdxpin(retval);
@@ -683,7 +683,7 @@ int CANTalon::GetPinStateQuadIdx()
* @return '1' iff forward limit switch is closed, 0 iff switch is open.
* This function works regardless if limit switch feature is enabled.
*/
int CANTalon::IsFwdLimitSwitchClosed()
int CANTalon::IsFwdLimitSwitchClosed() const
{
int retval;
CTR_Code status = m_impl->GetLimitSwitchClosedFor(retval); /* rename this func, '1' => open, '0' => closed */
@@ -696,7 +696,7 @@ int CANTalon::IsFwdLimitSwitchClosed()
* @return '1' iff reverse limit switch is closed, 0 iff switch is open.
* This function works regardless if limit switch feature is enabled.
*/
int CANTalon::IsRevLimitSwitchClosed()
int CANTalon::IsRevLimitSwitchClosed() const
{
int retval;
CTR_Code status = m_impl->GetLimitSwitchClosedRev(retval); /* rename this func, '1' => open, '0' => closed */
@@ -709,7 +709,7 @@ int CANTalon::IsRevLimitSwitchClosed()
* Simple accessor for tracked rise eventso index pin.
* @return number of rising edges on idx pin.
*/
int CANTalon::GetNumberOfQuadIdxRises()
int CANTalon::GetNumberOfQuadIdxRises() const
{
int rises;
CTR_Code status = m_impl->GetEncIndexRiseEvents(rises); /* rename this func, '1' => open, '0' => closed */
@@ -731,7 +731,7 @@ void CANTalon::SetNumberOfQuadIdxRises(int rises)
/**
* TODO documentation (see CANJaguar.cpp)
*/
bool CANTalon::GetForwardLimitOK()
bool CANTalon::GetForwardLimitOK() const
{
int limSwit=0;
int softLim=0;
@@ -751,7 +751,7 @@ bool CANTalon::GetForwardLimitOK()
/**
* TODO documentation (see CANJaguar.cpp)
*/
bool CANTalon::GetReverseLimitOK()
bool CANTalon::GetReverseLimitOK() const
{
int limSwit=0;
int softLim=0;
@@ -771,7 +771,7 @@ bool CANTalon::GetReverseLimitOK()
/**
* TODO documentation (see CANJaguar.cpp)
*/
uint16_t CANTalon::GetFaults()
uint16_t CANTalon::GetFaults() const
{
uint16_t retval = 0;
int val;
@@ -821,7 +821,7 @@ uint16_t CANTalon::GetFaults()
return retval;
}
uint16_t CANTalon::GetStickyFaults()
uint16_t CANTalon::GetStickyFaults() const
{
uint16_t retval = 0;
int val;
@@ -913,7 +913,7 @@ void CANTalon::SetCloseLoopRampRate(double rampRate)
/**
* @return The version of the firmware running on the Talon
*/
uint32_t CANTalon::GetFirmwareVersion()
uint32_t CANTalon::GetFirmwareVersion() const
{
int firmwareVersion;
CTR_Code status = m_impl->RequestParam(CanTalonSRX::eFirmVers);
@@ -937,7 +937,7 @@ uint32_t CANTalon::GetFirmwareVersion()
/**
* @return The accumulator for I gain.
*/
int CANTalon::GetIaccum()
int CANTalon::GetIaccum() const
{
CTR_Code status = m_impl->RequestParam(CanTalonSRX::ePidIaccum);
if(status != CTR_OKAY) {
@@ -987,7 +987,7 @@ void CANTalon::ConfigNeutralMode(NeutralMode mode)
/**
* @return nonzero if brake is enabled during neutral. Zero if coast is enabled during neutral.
*/
int CANTalon::GetBrakeEnableDuringNeutral()
int CANTalon::GetBrakeEnableDuringNeutral() const
{
int brakeEn = 0;
CTR_Code status = m_impl->GetBrakeIsEnabled(brakeEn);
@@ -1217,7 +1217,7 @@ void CANTalon::SetControlMode(CANSpeedController::ControlMode mode)
/**
* TODO documentation (see CANJaguar.cpp)
*/
CANSpeedController::ControlMode CANTalon::GetControlMode()
CANSpeedController::ControlMode CANTalon::GetControlMode() const
{
return m_controlMode;
}
@@ -1227,17 +1227,17 @@ void CANTalon::SetExpiration(float timeout)
m_safetyHelper->SetExpiration(timeout);
}
float CANTalon::GetExpiration()
float CANTalon::GetExpiration() const
{
return m_safetyHelper->GetExpiration();
}
bool CANTalon::IsAlive()
bool CANTalon::IsAlive() const
{
return m_safetyHelper->IsAlive();
}
bool CANTalon::IsSafetyEnabled()
bool CANTalon::IsSafetyEnabled() const
{
return m_safetyHelper->IsSafetyEnabled();
}
@@ -1247,7 +1247,7 @@ void CANTalon::SetSafetyEnabled(bool enabled)
m_safetyHelper->SetSafetyEnabled(enabled);
}
void CANTalon::GetDescription(char *desc)
void CANTalon::GetDescription(char *desc) const
{
sprintf(desc, "CANTalon ID %d", m_deviceNumber);
}
@@ -1292,7 +1292,7 @@ void CANTalon::StopLiveWindowMode()
}
}
std::string CANTalon::GetSmartDashboardType()
std::string CANTalon::GetSmartDashboardType() const
{
return "Speed Controller";
}
@@ -1303,7 +1303,7 @@ void CANTalon::InitTable(ITable *subTable)
UpdateTable();
}
ITable * CANTalon::GetTable()
ITable * CANTalon::GetTable() const
{
return m_table;
}

View File

@@ -52,7 +52,7 @@ void Compressor::Stop() {
* Check if compressor output is active
* @return true if the compressor is on
*/
bool Compressor::Enabled() {
bool Compressor::Enabled() const {
int32_t status = 0;
bool value;
@@ -69,7 +69,7 @@ bool Compressor::Enabled() {
* Check if the pressure switch is triggered
* @return true if pressure is low
*/
bool Compressor::GetPressureSwitchValue() {
bool Compressor::GetPressureSwitchValue() const {
int32_t status = 0;
bool value;
@@ -87,7 +87,7 @@ bool Compressor::GetPressureSwitchValue() {
* Query how much current the compressor is drawing
* @return The current through the compressor, in amps
*/
float Compressor::GetCompressorCurrent() {
float Compressor::GetCompressorCurrent() const {
int32_t status = 0;
float value;
@@ -121,7 +121,7 @@ void Compressor::SetClosedLoopControl(bool on) {
* pressure is low.
* @return True if closed loop control of the compressor is enabled. False if disabled.
*/
bool Compressor::GetClosedLoopControl() {
bool Compressor::GetClosedLoopControl() const {
int32_t status = 0;
bool value;
@@ -139,7 +139,7 @@ bool Compressor::GetClosedLoopControl() {
* @return true if PCM is in fault state : Compressor Drive is
* disabled due to compressor current being too high.
*/
bool Compressor::GetCompressorCurrentTooHighFault() {
bool Compressor::GetCompressorCurrentTooHighFault() const {
int32_t status = 0;
bool value;
@@ -157,7 +157,7 @@ bool Compressor::GetCompressorCurrentTooHighFault() {
* @return true if PCM sticky fault is set : Compressor Drive is
* disabled due to compressor current being too high.
*/
bool Compressor::GetCompressorCurrentTooHighStickyFault() {
bool Compressor::GetCompressorCurrentTooHighStickyFault() const {
int32_t status = 0;
bool value;
@@ -175,7 +175,7 @@ bool Compressor::GetCompressorCurrentTooHighStickyFault() {
* @return true if PCM sticky fault is set : Compressor output
* appears to be shorted.
*/
bool Compressor::GetCompressorShortedStickyFault() {
bool Compressor::GetCompressorShortedStickyFault() const {
int32_t status = 0;
bool value;
@@ -192,7 +192,7 @@ bool Compressor::GetCompressorShortedStickyFault() {
* @return true if PCM is in fault state : Compressor output
* appears to be shorted.
*/
bool Compressor::GetCompressorShortedFault() {
bool Compressor::GetCompressorShortedFault() const {
int32_t status = 0;
bool value;
@@ -211,7 +211,7 @@ bool Compressor::GetCompressorShortedFault() {
* appear to be wired, i.e. compressor is
* not drawing enough current.
*/
bool Compressor::GetCompressorNotConnectedStickyFault() {
bool Compressor::GetCompressorNotConnectedStickyFault() const {
int32_t status = 0;
bool value;
@@ -229,7 +229,7 @@ bool Compressor::GetCompressorNotConnectedStickyFault() {
* appear to be wired, i.e. compressor is
* not drawing enough current.
*/
bool Compressor::GetCompressorNotConnectedFault() {
bool Compressor::GetCompressorNotConnectedFault() const {
int32_t status = 0;
bool value;
@@ -273,7 +273,7 @@ void Compressor::StartLiveWindowMode() {
void Compressor::StopLiveWindowMode() {
}
std::string Compressor::GetSmartDashboardType() {
std::string Compressor::GetSmartDashboardType() const {
return "Compressor";
}
@@ -282,7 +282,7 @@ void Compressor::InitTable(ITable *subTable) {
UpdateTable();
}
ITable *Compressor::GetTable() {
ITable *Compressor::GetTable() const {
return m_table;
}

View File

@@ -474,7 +474,7 @@ void Counter::SetPulseLengthMode(float threshold)
* mechanical imperfections or as oversampling to increase resolution.
* @return SamplesToAverage The number of samples being averaged (from 1 to 127)
*/
int Counter::GetSamplesToAverage()
int Counter::GetSamplesToAverage() const
{
int32_t status = 0;
int32_t samples = getCounterSamplesToAverage(m_counter, &status);
@@ -503,7 +503,7 @@ void Counter::SetSamplesToAverage (int samplesToAverage) {
* Read the value at this instant. It may still be running, so it reflects the current value. Next
* time it is read, it might have a different value.
*/
int32_t Counter::Get()
int32_t Counter::Get() const
{
if (StatusIsFatal()) return 0;
int32_t status = 0;
@@ -531,7 +531,7 @@ void Counter::Reset()
* to determine shaft speed.
* @returns The period between the last two pulses in units of seconds.
*/
double Counter::GetPeriod()
double Counter::GetPeriod() const
{
if (StatusIsFatal()) return 0.0;
int32_t status = 0;
@@ -584,7 +584,7 @@ void Counter::SetUpdateWhenEmpty(bool enabled)
* @return Returns true if the most recent counter period exceeds the MaxPeriod value set by
* SetMaxPeriod.
*/
bool Counter::GetStopped()
bool Counter::GetStopped() const
{
if (StatusIsFatal()) return false;
int32_t status = 0;
@@ -597,7 +597,7 @@ bool Counter::GetStopped()
* The last direction the counter value changed.
* @return The last direction the counter value changed.
*/
bool Counter::GetDirection()
bool Counter::GetDirection() const
{
if (StatusIsFatal()) return false;
int32_t status = 0;
@@ -635,7 +635,7 @@ void Counter::StopLiveWindowMode() {
}
std::string Counter::GetSmartDashboardType() {
std::string Counter::GetSmartDashboardType() const {
return "Counter";
}
@@ -644,6 +644,6 @@ void Counter::InitTable(ITable *subTable) {
UpdateTable();
}
ITable * Counter::GetTable() {
ITable * Counter::GetTable() const {
return m_table;
}

View File

@@ -71,7 +71,7 @@ DigitalInput::~DigitalInput()
* Get the value from a digital input channel.
* Retrieve the value of a single digital input channel from the FPGA.
*/
bool DigitalInput::Get()
bool DigitalInput::Get() const
{
int32_t status = 0;
bool value = getDIO(m_digital_ports[m_channel], &status);
@@ -82,7 +82,7 @@ bool DigitalInput::Get()
/**
* @return The GPIO channel number that this object represents.
*/
uint32_t DigitalInput::GetChannel()
uint32_t DigitalInput::GetChannel() const
{
return m_channel;
}
@@ -90,7 +90,7 @@ uint32_t DigitalInput::GetChannel()
/**
* @return The value to be written to the channel field of a routing mux.
*/
uint32_t DigitalInput::GetChannelForRouting()
uint32_t DigitalInput::GetChannelForRouting() const
{
return GetChannel();
}
@@ -98,7 +98,7 @@ uint32_t DigitalInput::GetChannelForRouting()
/**
* @return The value to be written to the module field of a routing mux.
*/
uint32_t DigitalInput::GetModuleForRouting()
uint32_t DigitalInput::GetModuleForRouting() const
{
return 0;
}
@@ -106,7 +106,7 @@ uint32_t DigitalInput::GetModuleForRouting()
/**
* @return The value to be written to the analog trigger field of a routing mux.
*/
bool DigitalInput::GetAnalogTriggerForRouting()
bool DigitalInput::GetAnalogTriggerForRouting() const
{
return false;
}
@@ -125,7 +125,7 @@ void DigitalInput::StopLiveWindowMode() {
}
std::string DigitalInput::GetSmartDashboardType() {
std::string DigitalInput::GetSmartDashboardType() const {
return "DigitalInput";
}
@@ -134,6 +134,6 @@ void DigitalInput::InitTable(ITable *subTable) {
UpdateTable();
}
ITable * DigitalInput::GetTable() {
ITable * DigitalInput::GetTable() const {
return m_table;
}

View File

@@ -77,7 +77,7 @@ void DigitalOutput::Set(uint32_t value)
/**
* @return The GPIO channel number that this object represents.
*/
uint32_t DigitalOutput::GetChannel()
uint32_t DigitalOutput::GetChannel() const
{
return m_channel;
}
@@ -101,7 +101,7 @@ void DigitalOutput::Pulse(float length)
* Determine if the pulse is still going.
* Determine if a previously started pulse is still going.
*/
bool DigitalOutput::IsPulsing()
bool DigitalOutput::IsPulsing() const
{
if (StatusIsFatal()) return false;
@@ -202,7 +202,7 @@ void DigitalOutput::UpdateDutyCycle(float dutyCycle)
/**
* @return The value to be written to the channel field of a routing mux.
*/
uint32_t DigitalOutput::GetChannelForRouting()
uint32_t DigitalOutput::GetChannelForRouting() const
{
return GetChannel();
}
@@ -210,7 +210,7 @@ uint32_t DigitalOutput::GetChannelForRouting()
/**
* @return The value to be written to the module field of a routing mux.
*/
uint32_t DigitalOutput::GetModuleForRouting()
uint32_t DigitalOutput::GetModuleForRouting() const
{
return 0;
}
@@ -218,7 +218,7 @@ uint32_t DigitalOutput::GetModuleForRouting()
/**
* @return The value to be written to the analog trigger field of a routing mux.
*/
bool DigitalOutput::GetAnalogTriggerForRouting()
bool DigitalOutput::GetAnalogTriggerForRouting() const
{
return false;
}
@@ -242,7 +242,7 @@ void DigitalOutput::StopLiveWindowMode() {
}
}
std::string DigitalOutput::GetSmartDashboardType() {
std::string DigitalOutput::GetSmartDashboardType() const {
return "Digital Output";
}
@@ -251,6 +251,6 @@ void DigitalOutput::InitTable(ITable *subTable) {
UpdateTable();
}
ITable * DigitalOutput::GetTable() {
ITable * DigitalOutput::GetTable() const {
return m_table;
}

View File

@@ -129,7 +129,7 @@ void DoubleSolenoid::Set(Value value)
*
* @return The current value of the solenoid.
*/
DoubleSolenoid::Value DoubleSolenoid::Get()
DoubleSolenoid::Value DoubleSolenoid::Get() const
{
if (StatusIsFatal()) return kOff;
uint8_t value = GetAll(m_moduleNumber);
@@ -146,7 +146,7 @@ DoubleSolenoid::Value DoubleSolenoid::Get()
*
* @return If solenoid is disabled due to short.
*/
bool DoubleSolenoid::IsFwdSolenoidBlackListed()
bool DoubleSolenoid::IsFwdSolenoidBlackListed() const
{
int blackList = GetPCMSolenoidBlackList(m_moduleNumber);
return (blackList & m_forwardMask) ? 1 : 0;
@@ -159,7 +159,7 @@ bool DoubleSolenoid::IsFwdSolenoidBlackListed()
*
* @return If solenoid is disabled due to short.
*/
bool DoubleSolenoid::IsRevSolenoidBlackListed()
bool DoubleSolenoid::IsRevSolenoidBlackListed() const
{
int blackList = GetPCMSolenoidBlackList(m_moduleNumber);
return (blackList & m_reverseMask) ? 1 : 0;
@@ -195,7 +195,7 @@ void DoubleSolenoid::StopLiveWindowMode() {
}
}
std::string DoubleSolenoid::GetSmartDashboardType() {
std::string DoubleSolenoid::GetSmartDashboardType() const {
return "Double Solenoid";
}
@@ -204,6 +204,6 @@ void DoubleSolenoid::InitTable(ITable *subTable) {
UpdateTable();
}
ITable * DoubleSolenoid::GetTable() {
ITable * DoubleSolenoid::GetTable() const {
return m_table;
}

View File

@@ -159,7 +159,7 @@ void DriverStation::GetData()
*
* @return The battery voltage in Volts.
*/
float DriverStation::GetBatteryVoltage()
float DriverStation::GetBatteryVoltage() const
{
int32_t status = 0;
float voltage = getVinVoltage(&status);
@@ -186,7 +186,7 @@ void DriverStation::ReportJoystickUnpluggedError(std::string message) {
* @param stick The joystick port number
* @return The number of axes on the indicated joystick
*/
int DriverStation::GetStickAxisCount(uint32_t stick)
int DriverStation::GetStickAxisCount(uint32_t stick) const
{
if (stick >= kJoystickPorts)
{
@@ -204,7 +204,7 @@ int DriverStation::GetStickAxisCount(uint32_t stick)
*@param stick The joystick port number
*@return The name of the joystick at the given port
*/
std::string DriverStation::GetJoystickName(uint32_t stick)
std::string DriverStation::GetJoystickName(uint32_t stick) const
{
if (stick >= kJoystickPorts)
{
@@ -220,7 +220,7 @@ std::string DriverStation::GetJoystickName(uint32_t stick)
*@param stick The joystick port number
*@return The HID type of joystick at the given port
*/
int DriverStation::GetJoystickType(uint32_t stick)
int DriverStation::GetJoystickType(uint32_t stick) const
{
if (stick >= kJoystickPorts)
{
@@ -236,7 +236,7 @@ int DriverStation::GetJoystickType(uint32_t stick)
*@param stick The joystick port number
*@return A boolean that is true if the controller is an xbox controller.
*/
bool DriverStation::GetJoystickIsXbox(uint32_t stick)
bool DriverStation::GetJoystickIsXbox(uint32_t stick) const
{
if (stick >= kJoystickPorts)
{
@@ -252,7 +252,7 @@ bool DriverStation::GetJoystickIsXbox(uint32_t stick)
*@param stick The joystick port number and the target axis
*@return What type of axis the axis is reporting to be
*/
int DriverStation::GetJoystickAxisType(uint32_t stick, uint8_t axis)
int DriverStation::GetJoystickAxisType(uint32_t stick, uint8_t axis) const
{
if (stick >= kJoystickPorts)
{
@@ -268,7 +268,7 @@ int DriverStation::GetJoystickAxisType(uint32_t stick, uint8_t axis)
* @param stick The joystick port number
* @return The number of POVs on the indicated joystick
*/
int DriverStation::GetStickPOVCount(uint32_t stick)
int DriverStation::GetStickPOVCount(uint32_t stick) const
{
if (stick >= kJoystickPorts)
{
@@ -286,7 +286,7 @@ int DriverStation::GetStickPOVCount(uint32_t stick)
* @param stick The joystick port number
* @return The number of buttons on the indicated joystick
*/
int DriverStation::GetStickButtonCount(uint32_t stick)
int DriverStation::GetStickButtonCount(uint32_t stick) const
{
if (stick >= kJoystickPorts)
{
@@ -365,7 +365,7 @@ int DriverStation::GetStickPOV(uint32_t stick, uint32_t pov) {
* @param stick The joystick to read.
* @return The state of the buttons on the joystick.
*/
uint32_t DriverStation::GetStickButtons(uint32_t stick)
uint32_t DriverStation::GetStickButtons(uint32_t stick) const
{
if (stick >= kJoystickPorts)
{
@@ -408,7 +408,7 @@ bool DriverStation::GetStickButton(uint32_t stick, uint8_t button)
* Check if the DS has enabled the robot
* @return True if the robot is enabled and the DS is connected
*/
bool DriverStation::IsEnabled()
bool DriverStation::IsEnabled() const
{
HALControlWord controlWord;
memset(&controlWord, 0, sizeof(controlWord));
@@ -420,7 +420,7 @@ bool DriverStation::IsEnabled()
* Check if the robot is disabled
* @return True if the robot is explicitly disabled or the DS is not connected
*/
bool DriverStation::IsDisabled()
bool DriverStation::IsDisabled() const
{
HALControlWord controlWord;
memset(&controlWord, 0, sizeof(controlWord));
@@ -432,7 +432,7 @@ bool DriverStation::IsDisabled()
* Check if the DS is commanding autonomous mode
* @return True if the robot is being commanded to be in autonomous mode
*/
bool DriverStation::IsAutonomous()
bool DriverStation::IsAutonomous() const
{
HALControlWord controlWord;
memset(&controlWord, 0, sizeof(controlWord));
@@ -444,7 +444,7 @@ bool DriverStation::IsAutonomous()
* Check if the DS is commanding teleop mode
* @return True if the robot is being commanded to be in teleop mode
*/
bool DriverStation::IsOperatorControl()
bool DriverStation::IsOperatorControl() const
{
HALControlWord controlWord;
memset(&controlWord, 0, sizeof(controlWord));
@@ -456,7 +456,7 @@ bool DriverStation::IsOperatorControl()
* Check if the DS is commanding test mode
* @return True if the robot is being commanded to be in test mode
*/
bool DriverStation::IsTest()
bool DriverStation::IsTest() const
{
HALControlWord controlWord;
HALGetControlWord(&controlWord);
@@ -467,7 +467,7 @@ bool DriverStation::IsTest()
* Check if the DS is attached
* @return True if the DS is connected to the robot
*/
bool DriverStation::IsDSAttached()
bool DriverStation::IsDSAttached() const
{
HALControlWord controlWord;
memset(&controlWord, 0, sizeof(controlWord));
@@ -480,7 +480,7 @@ bool DriverStation::IsDSAttached()
* or e-stopped, the watchdog has expired, or if the roboRIO browns out.
* @return True if the FPGA outputs are enabled.
*/
bool DriverStation::IsSysActive()
bool DriverStation::IsSysActive() const
{
int32_t status = 0;
bool retVal = HALGetSystemActive(&status);
@@ -492,7 +492,7 @@ bool DriverStation::IsSysActive()
* Check if the system is browned out.
* @return True if the system is browned out
*/
bool DriverStation::IsSysBrownedOut()
bool DriverStation::IsSysBrownedOut() const
{
int32_t status = 0;
bool retVal = HALGetBrownedOut(&status);
@@ -506,7 +506,7 @@ bool DriverStation::IsSysBrownedOut()
* you will not get the get the intended behaviour.
* @return True if the control data has been updated since the last call.
*/
bool DriverStation::IsNewControlData()
bool DriverStation::IsNewControlData() const
{
return tryTakeSemaphore(m_newControlData) == 0;
}
@@ -515,7 +515,7 @@ bool DriverStation::IsNewControlData()
* Is the driver station attached to a Field Management System?
* @return True if the robot is competing on a field being controlled by a Field Management System
*/
bool DriverStation::IsFMSAttached()
bool DriverStation::IsFMSAttached() const
{
HALControlWord controlWord;
HALGetControlWord(&controlWord);
@@ -527,7 +527,7 @@ bool DriverStation::IsFMSAttached()
* This could return kRed or kBlue
* @return The Alliance enum (kRed, kBlue or kInvalid)
*/
DriverStation::Alliance DriverStation::GetAlliance()
DriverStation::Alliance DriverStation::GetAlliance() const
{
HALAllianceStationID allianceStationID;
HALGetAllianceStation(&allianceStationID);
@@ -551,7 +551,7 @@ DriverStation::Alliance DriverStation::GetAlliance()
* This could return 1, 2, or 3
* @return The location of the driver station (1-3, 0 for invalid)
*/
uint32_t DriverStation::GetLocation()
uint32_t DriverStation::GetLocation() const
{
HALAllianceStationID allianceStationID;
HALGetAllianceStation(&allianceStationID);
@@ -590,7 +590,7 @@ void DriverStation::WaitForData()
* The Practice Match function of the DS approximates the behaviour seen on the field.
* @return Time remaining in current match period (auto or teleop)
*/
double DriverStation::GetMatchTime()
double DriverStation::GetMatchTime() const
{
float matchTime;
HALGetMatchTime(&matchTime);

View File

@@ -186,7 +186,7 @@ Encoder::~Encoder()
* The encoding scale factor 1x, 2x, or 4x, per the requested encodingType.
* Used to divide raw edge counts down to spec'd counts.
*/
int32_t Encoder::GetEncodingScale() { return m_encodingScale; }
int32_t Encoder::GetEncodingScale() const { return m_encodingScale; }
/**
* Gets the raw value from the encoder.
@@ -194,7 +194,7 @@ int32_t Encoder::GetEncodingScale() { return m_encodingScale; }
* factor.
* @return Current raw count from the encoder
*/
int32_t Encoder::GetRaw()
int32_t Encoder::GetRaw() const
{
if (StatusIsFatal()) return 0;
int32_t value;
@@ -216,7 +216,7 @@ int32_t Encoder::GetRaw()
*
* @return Current count from the Encoder adjusted for the 1x, 2x, or 4x scale factor.
*/
int32_t Encoder::Get()
int32_t Encoder::Get() const
{
if (StatusIsFatal()) return 0;
return (int32_t) (GetRaw() * DecodingScaleFactor());
@@ -248,7 +248,7 @@ void Encoder::Reset()
*
* @return Period in seconds of the most recent pulse.
*/
double Encoder::GetPeriod()
double Encoder::GetPeriod() const
{
if (StatusIsFatal()) return 0.0;
if (m_counter)
@@ -299,7 +299,7 @@ void Encoder::SetMaxPeriod(double maxPeriod)
* width exceeds the MaxPeriod.
* @return True if the encoder is considered stopped.
*/
bool Encoder::GetStopped()
bool Encoder::GetStopped() const
{
if (StatusIsFatal()) return true;
if (m_counter)
@@ -319,7 +319,7 @@ bool Encoder::GetStopped()
* The last direction the encoder value changed.
* @return The last direction the encoder value changed.
*/
bool Encoder::GetDirection()
bool Encoder::GetDirection() const
{
if (StatusIsFatal()) return false;
if (m_counter)
@@ -338,7 +338,7 @@ bool Encoder::GetDirection()
/**
* The scale needed to convert a raw counter value into a number of encoder pulses.
*/
double Encoder::DecodingScaleFactor()
double Encoder::DecodingScaleFactor() const
{
if (StatusIsFatal()) return 0.0;
switch (m_encodingType)
@@ -359,7 +359,7 @@ double Encoder::DecodingScaleFactor()
*
* @return The distance driven since the last reset as scaled by the value from SetDistancePerPulse().
*/
double Encoder::GetDistance()
double Encoder::GetDistance() const
{
if (StatusIsFatal()) return 0.0;
return GetRaw() * DecodingScaleFactor() * m_distancePerPulse;
@@ -371,7 +371,7 @@ double Encoder::GetDistance()
*
* @return The current rate of the encoder.
*/
double Encoder::GetRate()
double Encoder::GetRate() const
{
if (StatusIsFatal()) return 0.0;
return (m_distancePerPulse / GetPeriod());
@@ -458,7 +458,7 @@ void Encoder::SetSamplesToAverage(int samplesToAverage)
* mechanical imperfections or as oversampling to increase resolution.
* @return SamplesToAverage The number of samples being averaged (from 1 to 127)
*/
int Encoder::GetSamplesToAverage()
int Encoder::GetSamplesToAverage() const
{
int result = 1;
int32_t status = 0;
@@ -493,7 +493,7 @@ void Encoder::SetPIDSourceParameter(PIDSourceParameter pidSource)
*
* @return The current value of the selected source parameter.
*/
double Encoder::PIDGet()
double Encoder::PIDGet() const
{
if (StatusIsFatal()) return 0.0;
switch (m_pidSource)
@@ -564,7 +564,7 @@ void Encoder::StopLiveWindowMode() {
}
std::string Encoder::GetSmartDashboardType() {
std::string Encoder::GetSmartDashboardType() const {
if (m_encodingType == k4X)
return "Quadrature Encoder";
else
@@ -576,6 +576,6 @@ void Encoder::InitTable(ITable *subTable) {
UpdateTable();
}
ITable * Encoder::GetTable() {
ITable * Encoder::GetTable() const {
return m_table;
}

View File

@@ -66,6 +66,6 @@ GearTooth::~GearTooth()
}
std::string GearTooth::GetSmartDashboardType() {
std::string GearTooth::GetSmartDashboardType() const {
return "GearTooth";
}

View File

@@ -147,7 +147,7 @@ Gyro::~Gyro()
* @return the current heading of the robot in degrees. This heading is based on integration
* of the returned rate from the gyro.
*/
float Gyro::GetAngle( void )
float Gyro::GetAngle() const
{
int64_t rawValue;
uint32_t count;
@@ -169,7 +169,7 @@ float Gyro::GetAngle( void )
*
* @return the current rate in degrees per second
*/
double Gyro::GetRate( void )
double Gyro::GetRate() const
{
return (m_analog->GetAverageValue() - ((double)m_center + m_offset)) * 1e-9 * m_analog->GetLSBWeight()
/ ((1 << m_analog->GetOversampleBits()) * m_voltsPerDegreePerSecond);
@@ -220,7 +220,7 @@ void Gyro::SetPIDSourceParameter(PIDSourceParameter pidSource)
*
* @return The PIDOutput (angle or rate, defaults to angle)
*/
double Gyro::PIDGet()
double Gyro::PIDGet() const
{
switch(m_pidSource){
case kRate:
@@ -246,7 +246,7 @@ void Gyro::StopLiveWindowMode() {
}
std::string Gyro::GetSmartDashboardType() {
std::string Gyro::GetSmartDashboardType() const {
return "Gyro";
}
@@ -255,6 +255,6 @@ void Gyro::InitTable(ITable *subTable) {
UpdateTable();
}
ITable * Gyro::GetTable() {
ITable * Gyro::GetTable() const {
return m_table;
}

View File

@@ -64,7 +64,7 @@ void Jaguar::Set(float speed, uint8_t syncGroup)
*
* @return The most recently set value for the PWM between -1.0 and 1.0.
*/
float Jaguar::Get()
float Jaguar::Get() const
{
return GetSpeed();
}

View File

@@ -110,7 +110,7 @@ Joystick::~Joystick()
* This depends on the mapping of the joystick connected to the current port.
* @param hand This parameter is ignored for the Joystick class and is only here to complete the GenericHID interface.
*/
float Joystick::GetX(JoystickHand hand)
float Joystick::GetX(JoystickHand hand) const
{
return GetRawAxis(m_axes[kXAxis]);
}
@@ -120,7 +120,7 @@ float Joystick::GetX(JoystickHand hand)
* This depends on the mapping of the joystick connected to the current port.
* @param hand This parameter is ignored for the Joystick class and is only here to complete the GenericHID interface.
*/
float Joystick::GetY(JoystickHand hand)
float Joystick::GetY(JoystickHand hand) const
{
return GetRawAxis(m_axes[kYAxis]);
}
@@ -129,7 +129,7 @@ float Joystick::GetY(JoystickHand hand)
* Get the Z value of the current joystick.
* This depends on the mapping of the joystick connected to the current port.
*/
float Joystick::GetZ()
float Joystick::GetZ() const
{
return GetRawAxis(m_axes[kZAxis]);
}
@@ -138,7 +138,7 @@ float Joystick::GetZ()
* Get the twist value of the current joystick.
* This depends on the mapping of the joystick connected to the current port.
*/
float Joystick::GetTwist()
float Joystick::GetTwist() const
{
return GetRawAxis(m_axes[kTwistAxis]);
}
@@ -147,7 +147,7 @@ float Joystick::GetTwist()
* Get the throttle value of the current joystick.
* This depends on the mapping of the joystick connected to the current port.
*/
float Joystick::GetThrottle()
float Joystick::GetThrottle() const
{
return GetRawAxis(m_axes[kThrottleAxis]);
}
@@ -158,7 +158,7 @@ float Joystick::GetThrottle()
* @param axis The axis to read, starting at 0.
* @return The value of the axis.
*/
float Joystick::GetRawAxis(uint32_t axis)
float Joystick::GetRawAxis(uint32_t axis) const
{
return m_ds->GetStickAxis(m_port, axis);
}
@@ -172,7 +172,7 @@ float Joystick::GetRawAxis(uint32_t axis)
* @param axis The axis to read.
* @return The value of the axis.
*/
float Joystick::GetAxis(AxisType axis)
float Joystick::GetAxis(AxisType axis) const
{
switch(axis)
{
@@ -195,7 +195,7 @@ float Joystick::GetAxis(AxisType axis)
* @param hand This parameter is ignored for the Joystick class and is only here to complete the GenericHID interface.
* @return The state of the trigger.
*/
bool Joystick::GetTrigger(JoystickHand hand)
bool Joystick::GetTrigger(JoystickHand hand) const
{
return GetRawButton(m_buttons[kTriggerButton]);
}
@@ -208,7 +208,7 @@ bool Joystick::GetTrigger(JoystickHand hand)
* @param hand This parameter is ignored for the Joystick class and is only here to complete the GenericHID interface.
* @return The state of the top button.
*/
bool Joystick::GetTop(JoystickHand hand)
bool Joystick::GetTop(JoystickHand hand) const
{
return GetRawButton(m_buttons[kTopButton]);
}
@@ -217,7 +217,7 @@ bool Joystick::GetTop(JoystickHand hand)
* This is not supported for the Joystick.
* This method is only here to complete the GenericHID interface.
*/
bool Joystick::GetBumper(JoystickHand hand)
bool Joystick::GetBumper(JoystickHand hand) const
{
// Joysticks don't have bumpers.
return false;
@@ -232,7 +232,7 @@ bool Joystick::GetBumper(JoystickHand hand)
* @param button The button number to be read (starting at 1)
* @return The state of the button.
**/
bool Joystick::GetRawButton(uint32_t button)
bool Joystick::GetRawButton(uint32_t button) const
{
return m_ds->GetStickButton(m_port, button);
}
@@ -243,7 +243,7 @@ bool Joystick::GetRawButton(uint32_t button)
* @param pov The index of the POV to read (starting at 0)
* @return the angle of the POV in degrees, or -1 if the POV is not pressed.
*/
int Joystick::GetPOV(uint32_t pov) {
int Joystick::GetPOV(uint32_t pov) const {
return m_ds->GetStickPOV(m_port, pov);
}
@@ -255,7 +255,7 @@ int Joystick::GetPOV(uint32_t pov) {
* @param button The type of button to read.
* @return The state of the button.
*/
bool Joystick::GetButton(ButtonType button)
bool Joystick::GetButton(ButtonType button) const
{
switch (button)
{
@@ -271,7 +271,7 @@ bool Joystick::GetButton(ButtonType button)
*
* @return the number of axis for the current joystick
*/
int Joystick::GetAxisCount()
int Joystick::GetAxisCount() const
{
return m_ds->GetStickAxisCount(m_port);
}
@@ -281,7 +281,7 @@ int Joystick::GetAxisCount()
*
* @return A boolean that is true if the joystick is an xbox controller.
*/
bool Joystick::GetIsXbox()
bool Joystick::GetIsXbox() const
{
return m_ds->GetJoystickIsXbox(m_port);
}
@@ -291,7 +291,7 @@ bool Joystick::GetIsXbox()
*
* @return the HID type of the controller.
*/
Joystick::HIDType Joystick::GetType()
Joystick::HIDType Joystick::GetType() const
{
return static_cast<HIDType>(m_ds->GetJoystickType(m_port));
}
@@ -301,12 +301,12 @@ Joystick::HIDType Joystick::GetType()
*
* @return the name of the controller.
*/
std::string Joystick::GetName()
std::string Joystick::GetName() const
{
return m_ds->GetJoystickName(m_port);
}
//int Joystick::GetAxisType(uint8_t axis)
//int Joystick::GetAxisType(uint8_t axis) const
//{
// return m_ds->GetJoystickAxisType(m_port, axis);
//}
@@ -317,7 +317,7 @@ std::string Joystick::GetName()
*
* @return the number of buttons on the current joystick
*/
int Joystick::GetButtonCount()
int Joystick::GetButtonCount() const
{
return m_ds->GetStickButtonCount(m_port);
}
@@ -327,7 +327,7 @@ int Joystick::GetButtonCount()
*
* @return then umber of POVs for the current joystick
*/
int Joystick::GetPOVCount()
int Joystick::GetPOVCount() const
{
return m_ds->GetStickPOVCount(m_port);
}
@@ -339,7 +339,7 @@ int Joystick::GetPOVCount()
* @param axis The axis to look up the channel for.
* @return The channel fr the axis.
*/
uint32_t Joystick::GetAxisChannel(AxisType axis)
uint32_t Joystick::GetAxisChannel(AxisType axis) const
{
return m_axes[axis];
}
@@ -361,7 +361,7 @@ void Joystick::SetAxisChannel(AxisType axis, uint32_t channel)
*
* @return The magnitude of the direction vector
*/
float Joystick::GetMagnitude(){
float Joystick::GetMagnitude() const {
return sqrt(pow(GetX(),2) + pow(GetY(),2) );
}
@@ -371,7 +371,7 @@ float Joystick::GetMagnitude(){
*
* @return The direction of the vector in radians
*/
float Joystick::GetDirectionRadians(){
float Joystick::GetDirectionRadians() const {
return atan2(GetX(), -GetY());
}
@@ -384,7 +384,7 @@ float Joystick::GetDirectionRadians(){
*
* @return The direction of the vector in degrees
*/
float Joystick::GetDirectionDegrees(){
float Joystick::GetDirectionDegrees() const {
return (180/acos(-1))*GetDirectionRadians();
}

View File

@@ -80,7 +80,7 @@ void MotorSafetyHelper::SetExpiration(float expirationTime)
* Retrieve the timeout value for the corresponding motor safety object.
* @return the timeout value in seconds.
*/
float MotorSafetyHelper::GetExpiration()
float MotorSafetyHelper::GetExpiration() const
{
Synchronized sync(m_syncMutex);
return m_expiration;
@@ -90,7 +90,7 @@ float MotorSafetyHelper::GetExpiration()
* Determine if the motor is still operating or has timed out.
* @return a true value if the motor is still operating normally and hasn't timed out.
*/
bool MotorSafetyHelper::IsAlive()
bool MotorSafetyHelper::IsAlive() const
{
Synchronized sync(m_syncMutex);
return !m_enabled || m_stopTime > Timer::GetFPGATimestamp();
@@ -135,7 +135,7 @@ void MotorSafetyHelper::SetSafetyEnabled(bool enabled)
* Return if the motor safety is currently enabled for this devicce.
* @return True if motor safety is enforced for this device
*/
bool MotorSafetyHelper::IsSafetyEnabled()
bool MotorSafetyHelper::IsSafetyEnabled() const
{
Synchronized sync(m_syncMutex);
return m_enabled;

View File

@@ -257,7 +257,7 @@ void PIDController::SetPID(float p, float i, float d, float f)
* Get the Proportional coefficient
* @return proportional coefficient
*/
float PIDController::GetP()
float PIDController::GetP() const
{
CRITICAL_REGION(m_semaphore)
{
@@ -270,7 +270,7 @@ float PIDController::GetP()
* Get the Integral coefficient
* @return integral coefficient
*/
float PIDController::GetI()
float PIDController::GetI() const
{
CRITICAL_REGION(m_semaphore)
{
@@ -283,7 +283,7 @@ float PIDController::GetI()
* Get the Differential coefficient
* @return differential coefficient
*/
float PIDController::GetD()
float PIDController::GetD() const
{
CRITICAL_REGION(m_semaphore)
{
@@ -296,7 +296,7 @@ float PIDController::GetD()
* Get the Feed forward coefficient
* @return Feed forward coefficient
*/
float PIDController::GetF()
float PIDController::GetF() const
{
CRITICAL_REGION(m_semaphore)
{
@@ -310,7 +310,7 @@ float PIDController::GetF()
* This is always centered on zero and constrained the the max and min outs
* @return the latest calculated output
*/
float PIDController::Get()
float PIDController::Get() const
{
float result;
CRITICAL_REGION(m_semaphore)
@@ -404,7 +404,7 @@ void PIDController::SetSetpoint(float setpoint)
* Returns the current setpoint of the PIDController
* @return the current setpoint
*/
float PIDController::GetSetpoint()
float PIDController::GetSetpoint() const
{
float setpoint;
CRITICAL_REGION(m_semaphore)
@@ -419,7 +419,7 @@ float PIDController::GetSetpoint()
* Retruns the current difference of the input from the setpoint
* @return the current error
*/
float PIDController::GetError()
float PIDController::GetError() const
{
float error;
double pidInput;
@@ -484,7 +484,7 @@ void PIDController::SetAbsoluteTolerance(float absTolerance)
* Currently this just reports on target as the actual value passes through the setpoint.
* Ideally it should be based on being within the tolerance for some period of time.
*/
bool PIDController::OnTarget()
bool PIDController::OnTarget() const
{
bool temp;
double error = GetError();
@@ -542,7 +542,7 @@ void PIDController::Disable()
/**
* Return true if PIDController is enabled.
*/
bool PIDController::IsEnabled()
bool PIDController::IsEnabled() const
{
bool enabled;
CRITICAL_REGION(m_semaphore)
@@ -569,7 +569,7 @@ void PIDController::Reset()
END_REGION;
}
std::string PIDController::GetSmartDashboardType(){
std::string PIDController::GetSmartDashboardType() const {
return "PIDController";
}
@@ -588,7 +588,7 @@ void PIDController::InitTable(ITable* table){
}
}
ITable* PIDController::GetTable(){
ITable* PIDController::GetTable() const {
return m_table;
}

View File

@@ -179,7 +179,7 @@ void PWM::SetPosition(float pos)
*
* @return The position the servo is set to between 0.0 and 1.0.
*/
float PWM::GetPosition()
float PWM::GetPosition() const
{
if (StatusIsFatal()) return 0.0;
int32_t value = GetRaw();
@@ -260,7 +260,7 @@ void PWM::SetSpeed(float speed)
*
* @return The most recently set speed between -1.0 and 1.0.
*/
float PWM::GetSpeed()
float PWM::GetSpeed() const
{
if (StatusIsFatal()) return 0.0;
int32_t value = GetRaw();
@@ -313,7 +313,7 @@ void PWM::SetRaw(unsigned short value)
*
* @return Raw PWM control value.
*/
unsigned short PWM::GetRaw()
unsigned short PWM::GetRaw() const
{
if (StatusIsFatal()) return 0;
@@ -388,7 +388,7 @@ void PWM::StopLiveWindowMode() {
}
}
std::string PWM::GetSmartDashboardType() {
std::string PWM::GetSmartDashboardType() const {
return "Speed Controller";
}
@@ -397,6 +397,6 @@ void PWM::InitTable(ITable *subTable) {
UpdateTable();
}
ITable * PWM::GetTable() {
ITable * PWM::GetTable() const {
return m_table;
}

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