2013-12-15 18:30:16 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2015-06-25 15:07:55 -04:00
|
|
|
/* Copyright (c) FIRST 2011. All Rights Reserved.
|
|
|
|
|
*/
|
2013-12-15 18:30:16 -05:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#include "Commands/PIDSubsystem.h"
|
|
|
|
|
#include "PIDController.h"
|
|
|
|
|
#include "float.h"
|
|
|
|
|
|
|
|
|
|
/**
|
2015-06-25 15:07:55 -04:00
|
|
|
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d
|
|
|
|
|
* values.
|
2013-12-15 18:30:16 -05:00
|
|
|
* @param name the name
|
|
|
|
|
* @param p the proportional value
|
|
|
|
|
* @param i the integral value
|
|
|
|
|
* @param d the derivative value
|
|
|
|
|
*/
|
2015-06-30 15:01:20 -04:00
|
|
|
PIDSubsystem::PIDSubsystem(const std::string &name, double p, double i, double d)
|
2015-06-25 15:07:55 -04:00
|
|
|
: Subsystem(name) {
|
2015-07-24 19:19:40 -04:00
|
|
|
m_controller = std::make_shared<PIDController>(p, i, d, this, this);
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-06-25 15:07:55 -04:00
|
|
|
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d
|
|
|
|
|
* values.
|
2013-12-15 18:30:16 -05:00
|
|
|
* @param name the name
|
|
|
|
|
* @param p the proportional value
|
|
|
|
|
* @param i the integral value
|
|
|
|
|
* @param d the derivative value
|
|
|
|
|
* @param f the feedforward value
|
|
|
|
|
*/
|
2015-06-30 15:01:20 -04:00
|
|
|
PIDSubsystem::PIDSubsystem(const std::string &name, double p, double i, double d,
|
2015-06-25 15:07:55 -04:00
|
|
|
double f)
|
|
|
|
|
: Subsystem(name) {
|
artf4154: Get rid of raw pointers in C++.
This deals with the majority of the user-facing code
in wpilibC++Devices and a substantial portion of it in
wpilibC++. wpilibC++Sim and wpilibC++IntegrationTests
are untouched except where it is necessary to make them
work with the rest of the libraries.
There is still a lot to do in the following areas:
-The HAL (which we may not want to touch at all).
-The I2C, Serial, and SPI interfaces in wpilibC++Devices,
which I haven't gotten around to doing yet.
-Most wpilibC++Devices classes have void* pointers
for interacting with the HAL.
-InterruptableSensorBase passes a void *params for
the interrupt handler.
-I haven't converted all the const char* to std::strings.
-There are plenty of other cases of raw pointers still
existing.
-This doesn't fall directly under raw pointer stuff,
but move syntax and rvalue references could be introduced
in many places.
-I haven't touched vision code.
-The Resource classes conflict (one is in the hal, the other
in wpilibC++). Someone should figure out a more
permanent fix (eg, just renaming them), then doing
what I did (making a new namespace for one of them,
essentially the same as renaming it).
A few other things:
-I created a NullDeleter class which is marked as deprecated.
What this does is it can be passed as the deleter to a
std::shared_ptr so that when you are converting raw pointers
to shared_ptrs the shared_ptr doesn't do any deletion if
someone else owns the raw pointer. This should only be
used in making old raw pointer UIs.
-I had to alter the build.gradle so that it did not
emit errors when deprecated functions called deprecated
functions. Unfortunately, gradle doesn't appear to be
actually printing out gcc warnigns for some reason.
The best way I have found to fix this is to patch
the toolchains (https://bitbucket.org/byteit101/toolchain-builder/pull-request/5/make-gcc-not-throw-warnings-for-nested/diff)
so that a deprecated function calling a deprecated
function is fine but a non-deprecated function calling
a deprecated function will throw a warning (which we
then elevate with -Werror). I believe that clang
deals with this properly, although I have not
tried it myself.
Change-Id: Ib8090c66893576fe73654f4e9d268f9d37be06a2
2015-06-30 15:01:20 -04:00
|
|
|
m_controller = std::make_unique<PIDController>(p, i, d, f, this, this);
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-06-25 15:07:55 -04:00
|
|
|
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d
|
|
|
|
|
* values. It will also space the time
|
2013-12-15 18:30:16 -05:00
|
|
|
* between PID loop calculations to be equal to the given period.
|
|
|
|
|
* @param name the name
|
|
|
|
|
* @param p the proportional value
|
|
|
|
|
* @param i the integral value
|
|
|
|
|
* @param d the derivative value
|
|
|
|
|
* @param f the feedfoward value
|
|
|
|
|
* @param period the time (in seconds) between calculations
|
|
|
|
|
*/
|
2015-06-30 15:01:20 -04:00
|
|
|
PIDSubsystem::PIDSubsystem(const std::string &name, double p, double i, double d,
|
2015-06-25 15:07:55 -04:00
|
|
|
double f, double period)
|
|
|
|
|
: Subsystem(name) {
|
artf4154: Get rid of raw pointers in C++.
This deals with the majority of the user-facing code
in wpilibC++Devices and a substantial portion of it in
wpilibC++. wpilibC++Sim and wpilibC++IntegrationTests
are untouched except where it is necessary to make them
work with the rest of the libraries.
There is still a lot to do in the following areas:
-The HAL (which we may not want to touch at all).
-The I2C, Serial, and SPI interfaces in wpilibC++Devices,
which I haven't gotten around to doing yet.
-Most wpilibC++Devices classes have void* pointers
for interacting with the HAL.
-InterruptableSensorBase passes a void *params for
the interrupt handler.
-I haven't converted all the const char* to std::strings.
-There are plenty of other cases of raw pointers still
existing.
-This doesn't fall directly under raw pointer stuff,
but move syntax and rvalue references could be introduced
in many places.
-I haven't touched vision code.
-The Resource classes conflict (one is in the hal, the other
in wpilibC++). Someone should figure out a more
permanent fix (eg, just renaming them), then doing
what I did (making a new namespace for one of them,
essentially the same as renaming it).
A few other things:
-I created a NullDeleter class which is marked as deprecated.
What this does is it can be passed as the deleter to a
std::shared_ptr so that when you are converting raw pointers
to shared_ptrs the shared_ptr doesn't do any deletion if
someone else owns the raw pointer. This should only be
used in making old raw pointer UIs.
-I had to alter the build.gradle so that it did not
emit errors when deprecated functions called deprecated
functions. Unfortunately, gradle doesn't appear to be
actually printing out gcc warnigns for some reason.
The best way I have found to fix this is to patch
the toolchains (https://bitbucket.org/byteit101/toolchain-builder/pull-request/5/make-gcc-not-throw-warnings-for-nested/diff)
so that a deprecated function calling a deprecated
function is fine but a non-deprecated function calling
a deprecated function will throw a warning (which we
then elevate with -Werror). I believe that clang
deals with this properly, although I have not
tried it myself.
Change-Id: Ib8090c66893576fe73654f4e9d268f9d37be06a2
2015-06-30 15:01:20 -04:00
|
|
|
m_controller = std::make_unique<PIDController>(p, i, d, f, this, this, period);
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-06-25 15:07:55 -04:00
|
|
|
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d
|
|
|
|
|
* values.
|
2013-12-15 18:30:16 -05:00
|
|
|
* It will use the class name as its name.
|
|
|
|
|
* @param p the proportional value
|
|
|
|
|
* @param i the integral value
|
|
|
|
|
* @param d the derivative value
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
PIDSubsystem::PIDSubsystem(double p, double i, double d)
|
|
|
|
|
: Subsystem("PIDSubsystem") {
|
artf4154: Get rid of raw pointers in C++.
This deals with the majority of the user-facing code
in wpilibC++Devices and a substantial portion of it in
wpilibC++. wpilibC++Sim and wpilibC++IntegrationTests
are untouched except where it is necessary to make them
work with the rest of the libraries.
There is still a lot to do in the following areas:
-The HAL (which we may not want to touch at all).
-The I2C, Serial, and SPI interfaces in wpilibC++Devices,
which I haven't gotten around to doing yet.
-Most wpilibC++Devices classes have void* pointers
for interacting with the HAL.
-InterruptableSensorBase passes a void *params for
the interrupt handler.
-I haven't converted all the const char* to std::strings.
-There are plenty of other cases of raw pointers still
existing.
-This doesn't fall directly under raw pointer stuff,
but move syntax and rvalue references could be introduced
in many places.
-I haven't touched vision code.
-The Resource classes conflict (one is in the hal, the other
in wpilibC++). Someone should figure out a more
permanent fix (eg, just renaming them), then doing
what I did (making a new namespace for one of them,
essentially the same as renaming it).
A few other things:
-I created a NullDeleter class which is marked as deprecated.
What this does is it can be passed as the deleter to a
std::shared_ptr so that when you are converting raw pointers
to shared_ptrs the shared_ptr doesn't do any deletion if
someone else owns the raw pointer. This should only be
used in making old raw pointer UIs.
-I had to alter the build.gradle so that it did not
emit errors when deprecated functions called deprecated
functions. Unfortunately, gradle doesn't appear to be
actually printing out gcc warnigns for some reason.
The best way I have found to fix this is to patch
the toolchains (https://bitbucket.org/byteit101/toolchain-builder/pull-request/5/make-gcc-not-throw-warnings-for-nested/diff)
so that a deprecated function calling a deprecated
function is fine but a non-deprecated function calling
a deprecated function will throw a warning (which we
then elevate with -Werror). I believe that clang
deals with this properly, although I have not
tried it myself.
Change-Id: Ib8090c66893576fe73654f4e9d268f9d37be06a2
2015-06-30 15:01:20 -04:00
|
|
|
m_controller = std::make_unique<PIDController>(p, i, d, this, this);
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-06-25 15:07:55 -04:00
|
|
|
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d
|
|
|
|
|
* values.
|
2013-12-15 18:30:16 -05:00
|
|
|
* It will use the class name as its name.
|
|
|
|
|
* @param p the proportional value
|
|
|
|
|
* @param i the integral value
|
|
|
|
|
* @param d the derivative value
|
|
|
|
|
* @param f the feedforward value
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
PIDSubsystem::PIDSubsystem(double p, double i, double d, double f)
|
|
|
|
|
: Subsystem("PIDSubsystem") {
|
artf4154: Get rid of raw pointers in C++.
This deals with the majority of the user-facing code
in wpilibC++Devices and a substantial portion of it in
wpilibC++. wpilibC++Sim and wpilibC++IntegrationTests
are untouched except where it is necessary to make them
work with the rest of the libraries.
There is still a lot to do in the following areas:
-The HAL (which we may not want to touch at all).
-The I2C, Serial, and SPI interfaces in wpilibC++Devices,
which I haven't gotten around to doing yet.
-Most wpilibC++Devices classes have void* pointers
for interacting with the HAL.
-InterruptableSensorBase passes a void *params for
the interrupt handler.
-I haven't converted all the const char* to std::strings.
-There are plenty of other cases of raw pointers still
existing.
-This doesn't fall directly under raw pointer stuff,
but move syntax and rvalue references could be introduced
in many places.
-I haven't touched vision code.
-The Resource classes conflict (one is in the hal, the other
in wpilibC++). Someone should figure out a more
permanent fix (eg, just renaming them), then doing
what I did (making a new namespace for one of them,
essentially the same as renaming it).
A few other things:
-I created a NullDeleter class which is marked as deprecated.
What this does is it can be passed as the deleter to a
std::shared_ptr so that when you are converting raw pointers
to shared_ptrs the shared_ptr doesn't do any deletion if
someone else owns the raw pointer. This should only be
used in making old raw pointer UIs.
-I had to alter the build.gradle so that it did not
emit errors when deprecated functions called deprecated
functions. Unfortunately, gradle doesn't appear to be
actually printing out gcc warnigns for some reason.
The best way I have found to fix this is to patch
the toolchains (https://bitbucket.org/byteit101/toolchain-builder/pull-request/5/make-gcc-not-throw-warnings-for-nested/diff)
so that a deprecated function calling a deprecated
function is fine but a non-deprecated function calling
a deprecated function will throw a warning (which we
then elevate with -Werror). I believe that clang
deals with this properly, although I have not
tried it myself.
Change-Id: Ib8090c66893576fe73654f4e9d268f9d37be06a2
2015-06-30 15:01:20 -04:00
|
|
|
m_controller = std::make_unique<PIDController>(p, i, d, f, this, this);
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-06-25 15:07:55 -04:00
|
|
|
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d
|
|
|
|
|
* values.
|
2013-12-15 18:30:16 -05:00
|
|
|
* It will use the class name as its name.
|
|
|
|
|
* It will also space the time
|
|
|
|
|
* between PID loop calculations to be equal to the given period.
|
|
|
|
|
* @param p the proportional value
|
|
|
|
|
* @param i the integral value
|
|
|
|
|
* @param d the derivative value
|
|
|
|
|
* @param f the feedforward value
|
|
|
|
|
* @param period the time (in seconds) between calculations
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
PIDSubsystem::PIDSubsystem(double p, double i, double d, double f,
|
|
|
|
|
double period)
|
|
|
|
|
: Subsystem("PIDSubsystem") {
|
artf4154: Get rid of raw pointers in C++.
This deals with the majority of the user-facing code
in wpilibC++Devices and a substantial portion of it in
wpilibC++. wpilibC++Sim and wpilibC++IntegrationTests
are untouched except where it is necessary to make them
work with the rest of the libraries.
There is still a lot to do in the following areas:
-The HAL (which we may not want to touch at all).
-The I2C, Serial, and SPI interfaces in wpilibC++Devices,
which I haven't gotten around to doing yet.
-Most wpilibC++Devices classes have void* pointers
for interacting with the HAL.
-InterruptableSensorBase passes a void *params for
the interrupt handler.
-I haven't converted all the const char* to std::strings.
-There are plenty of other cases of raw pointers still
existing.
-This doesn't fall directly under raw pointer stuff,
but move syntax and rvalue references could be introduced
in many places.
-I haven't touched vision code.
-The Resource classes conflict (one is in the hal, the other
in wpilibC++). Someone should figure out a more
permanent fix (eg, just renaming them), then doing
what I did (making a new namespace for one of them,
essentially the same as renaming it).
A few other things:
-I created a NullDeleter class which is marked as deprecated.
What this does is it can be passed as the deleter to a
std::shared_ptr so that when you are converting raw pointers
to shared_ptrs the shared_ptr doesn't do any deletion if
someone else owns the raw pointer. This should only be
used in making old raw pointer UIs.
-I had to alter the build.gradle so that it did not
emit errors when deprecated functions called deprecated
functions. Unfortunately, gradle doesn't appear to be
actually printing out gcc warnigns for some reason.
The best way I have found to fix this is to patch
the toolchains (https://bitbucket.org/byteit101/toolchain-builder/pull-request/5/make-gcc-not-throw-warnings-for-nested/diff)
so that a deprecated function calling a deprecated
function is fine but a non-deprecated function calling
a deprecated function will throw a warning (which we
then elevate with -Werror). I believe that clang
deals with this properly, although I have not
tried it myself.
Change-Id: Ib8090c66893576fe73654f4e9d268f9d37be06a2
2015-06-30 15:01:20 -04:00
|
|
|
m_controller = std::make_unique<PIDController>(p, i, d, f, this, this, period);
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Enables the internal {@link PIDController}
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
void PIDSubsystem::Enable() { m_controller->Enable(); }
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2014-08-05 14:02:11 -04:00
|
|
|
/**
|
2013-12-15 18:30:16 -05:00
|
|
|
* Disables the internal {@link PIDController}
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
void PIDSubsystem::Disable() { m_controller->Disable(); }
|
2013-12-15 18:30:16 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the {@link PIDController} used by this {@link PIDSubsystem}.
|
|
|
|
|
* Use this if you would like to fine tune the pid loop.
|
|
|
|
|
*
|
|
|
|
|
* @return the {@link PIDController} used by this {@link PIDSubsystem}
|
|
|
|
|
*/
|
2015-07-24 19:19:40 -04:00
|
|
|
std::shared_ptr<PIDController> PIDSubsystem::GetPIDController() {
|
|
|
|
|
return m_controller;
|
|
|
|
|
}
|
2013-12-15 18:30:16 -05:00
|
|
|
|
|
|
|
|
/**
|
2015-06-25 15:07:55 -04:00
|
|
|
* Sets the setpoint to the given value. If {@link PIDCommand#SetRange(double,
|
|
|
|
|
* double) SetRange(...)}
|
2013-12-15 18:30:16 -05:00
|
|
|
* was called,
|
|
|
|
|
* then the given setpoint
|
|
|
|
|
* will be trimmed to fit within the range.
|
|
|
|
|
* @param setpoint the new setpoint
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
void PIDSubsystem::SetSetpoint(double setpoint) {
|
|
|
|
|
m_controller->SetSetpoint(setpoint);
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Adds the given value to the setpoint.
|
|
|
|
|
* If {@link PIDCommand#SetRange(double, double) SetRange(...)} was used,
|
|
|
|
|
* then the bounds will still be honored by this method.
|
|
|
|
|
* @param deltaSetpoint the change in the setpoint
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
void PIDSubsystem::SetSetpointRelative(double deltaSetpoint) {
|
|
|
|
|
SetSetpoint(GetSetpoint() + deltaSetpoint);
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return the current setpoint
|
|
|
|
|
* @return The current setpoint
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
double PIDSubsystem::GetSetpoint() { return m_controller->GetSetpoint(); }
|
2013-12-15 18:30:16 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the maximum and minimum values expected from the input.
|
2014-08-05 14:02:11 -04:00
|
|
|
*
|
2013-12-15 18:30:16 -05:00
|
|
|
* @param minimumInput the minimum value expected from the input
|
|
|
|
|
* @param maximumInput the maximum value expected from the output
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
void PIDSubsystem::SetInputRange(float minimumInput, float maximumInput) {
|
|
|
|
|
m_controller->SetInputRange(minimumInput, maximumInput);
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
2014-08-05 14:02:11 -04:00
|
|
|
/**
|
|
|
|
|
* Sets the maximum and minimum values to write.
|
|
|
|
|
*
|
|
|
|
|
* @param minimumOutput the minimum value to write to the output
|
|
|
|
|
* @param maximumOutput the maximum value to write to the output
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
void PIDSubsystem::SetOutputRange(float minimumOutput, float maximumOutput) {
|
|
|
|
|
m_controller->SetOutputRange(minimumOutput, maximumOutput);
|
2014-08-05 14:02:11 -04:00
|
|
|
}
|
|
|
|
|
|
2013-12-15 18:30:16 -05:00
|
|
|
/*
|
|
|
|
|
* Set the absolute error which is considered tolerable for use with
|
|
|
|
|
* OnTarget.
|
|
|
|
|
* @param percentage error which is tolerable
|
|
|
|
|
*/
|
|
|
|
|
void PIDSubsystem::SetAbsoluteTolerance(float absValue) {
|
2015-06-25 15:07:55 -04:00
|
|
|
m_controller->SetAbsoluteTolerance(absValue);
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Set the percentage error which is considered tolerable for use with
|
|
|
|
|
* OnTarget.
|
|
|
|
|
* @param percentage error which is tolerable
|
|
|
|
|
*/
|
|
|
|
|
void PIDSubsystem::SetPercentTolerance(float percent) {
|
2015-06-25 15:07:55 -04:00
|
|
|
m_controller->SetPercentTolerance(percent);
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Return true if the error is within the percentage of the total input range,
|
|
|
|
|
* determined by SetTolerance. This asssumes that the maximum and minimum input
|
2015-06-25 15:07:55 -04:00
|
|
|
* were set using SetInput. Use OnTarget() in the IsFinished() method of
|
|
|
|
|
* commands
|
2013-12-15 18:30:16 -05:00
|
|
|
* that use this subsystem.
|
2014-08-05 14:02:11 -04:00
|
|
|
*
|
2015-06-25 15:07:55 -04:00
|
|
|
* 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.
|
2014-08-05 14:02:11 -04:00
|
|
|
*
|
2015-06-25 15:07:55 -04:00
|
|
|
* @return true if the error is within the percentage tolerance of the input
|
|
|
|
|
* range
|
2013-12-15 18:30:16 -05:00
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
bool PIDSubsystem::OnTarget() const { return m_controller->OnTarget(); }
|
2013-12-15 18:30:16 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the current position
|
|
|
|
|
* @return the current position
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
double PIDSubsystem::GetPosition() { return ReturnPIDInput(); }
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2015-07-14 20:37:52 -07:00
|
|
|
/**
|
|
|
|
|
* Returns the current rate
|
|
|
|
|
* @return the current rate
|
|
|
|
|
*/
|
|
|
|
|
double PIDSubsystem::GetRate() { return ReturnPIDInput(); }
|
|
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
void PIDSubsystem::PIDWrite(float output) { UsePIDOutput(output); }
|
2013-12-15 18:30:16 -05:00
|
|
|
|
Revert changes preventing old user code from compiling.
I'm not 100% sure whether we want these, but they are a quick
find and replace to do.
Basically, there are two primary things that we have done
this summer that break existing user code:
-Changing GetInstance() calls to return references instead
of pointers. This forces users to change from doing something
like LiveWindow::GetInstance()->AddSensor() to LiveWindow::GetInstance().AddSensor().
-Making PIDGet() and related calls const, forcing users to change
the function signatures wherever they override them.
The GetInstance() calls don't really matter to me either way,
especially since there are no real ownership issues going on there,
unlike the rest of the smart pointer-related changes.
For the const stuff, it is certainly more correct to mandate that
user PIDGet() functions be const and the such, but at the same time,
I'm not sure that there is any strong need for it, and the errors
generated are not the most helpful. While this wouldn't necessarily
be an issue for more experienced teams or completely new teams (who
don't have any old code to be reusing), it may cause issues for more
average teams who aren't familiar with the intricacies of C++ anything.
Change-Id: I6e7007982069292ea70e6d0fc8ca40203340df1b
2015-07-24 19:19:40 -04:00
|
|
|
double PIDSubsystem::PIDGet() { return ReturnPIDInput(); }
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
std::string PIDSubsystem::GetSmartDashboardType() const { return "PIDCommand"; }
|
2015-07-29 16:48:04 -04:00
|
|
|
void PIDSubsystem::InitTable(std::shared_ptr<ITable> table) {
|
2015-06-25 15:07:55 -04:00
|
|
|
m_controller->InitTable(table);
|
|
|
|
|
Subsystem::InitTable(table);
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|