Major formatting changes (breaks diffs). No code changes.

The changes made in this commit do not affect any actual code,
    they are purely aesthetic. I ran clang-format with google style
    over all .h/.cpp files in wpilibc that weren't in wpilibC++Sim
    or gtest, and the eclipse formatter over all of the Java files
    using the Google eclipse formatting configuration.

Change-Id: I9627bca0bc103c398ecc1c5ba17467193291ae63
This commit is contained in:
James Kuszmaul
2015-06-25 15:07:55 -04:00
parent bd64d9a7ef
commit 7eb8550bdb
470 changed files with 89798 additions and 77287 deletions

View File

@@ -1,5 +1,6 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2011. All Rights Reserved. */
/* Copyright (c) FIRST 2011. All Rights Reserved.
*/
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
/*----------------------------------------------------------------------------*/
@@ -9,34 +10,36 @@
#include "float.h"
/**
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d values.
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d
* values.
* @param name the name
* @param p the proportional value
* @param i the integral value
* @param d the derivative value
*/
PIDSubsystem::PIDSubsystem(const char *name, double p, double i, double d) :
Subsystem(name)
{
m_controller = new PIDController(p, i, d, this, this);
PIDSubsystem::PIDSubsystem(const char *name, double p, double i, double d)
: Subsystem(name) {
m_controller = new PIDController(p, i, d, this, this);
}
/**
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d values.
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d
* values.
* @param name the name
* @param p the proportional value
* @param i the integral value
* @param d the derivative value
* @param f the feedforward value
*/
PIDSubsystem::PIDSubsystem(const char *name, double p, double i, double d, double f) :
Subsystem(name)
{
m_controller = new PIDController(p, i, d, f, this, this);
PIDSubsystem::PIDSubsystem(const char *name, double p, double i, double d,
double f)
: Subsystem(name) {
m_controller = new PIDController(p, i, d, f, this, this);
}
/**
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d values. It will also space the time
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d
* values. It will also space the time
* between PID loop calculations to be equal to the given period.
* @param name the name
* @param p the proportional value
@@ -45,42 +48,42 @@ PIDSubsystem::PIDSubsystem(const char *name, double p, double i, double d, doubl
* @param f the feedfoward value
* @param period the time (in seconds) between calculations
*/
PIDSubsystem::PIDSubsystem(const char *name, double p, double i, double d, double f,
double period) :
Subsystem(name)
{
m_controller = new PIDController(p, i, d, f, this, this, period);
PIDSubsystem::PIDSubsystem(const char *name, double p, double i, double d,
double f, double period)
: Subsystem(name) {
m_controller = new PIDController(p, i, d, f, this, this, period);
}
/**
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d values.
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d
* values.
* It will use the class name as its name.
* @param p the proportional value
* @param i the integral value
* @param d the derivative value
*/
PIDSubsystem::PIDSubsystem(double p, double i, double d) :
Subsystem("PIDSubsystem")
{
m_controller = new PIDController(p, i, d, this, this);
PIDSubsystem::PIDSubsystem(double p, double i, double d)
: Subsystem("PIDSubsystem") {
m_controller = new PIDController(p, i, d, this, this);
}
/**
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d values.
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d
* values.
* 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
*/
PIDSubsystem::PIDSubsystem(double p, double i, double d, double f) :
Subsystem("PIDSubsystem")
{
m_controller = new PIDController(p, i, d, f, this, this);
PIDSubsystem::PIDSubsystem(double p, double i, double d, double f)
: Subsystem("PIDSubsystem") {
m_controller = new PIDController(p, i, d, f, this, this);
}
/**
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d values.
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d
* values.
* 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.
@@ -90,33 +93,23 @@ PIDSubsystem::PIDSubsystem(double p, double i, double d, double f) :
* @param f the feedforward value
* @param period the time (in seconds) between calculations
*/
PIDSubsystem::PIDSubsystem(double p, double i, double d, double f, double period) :
Subsystem("PIDSubsystem")
{
m_controller = new PIDController(p, i, d, f, this, this, period);
PIDSubsystem::PIDSubsystem(double p, double i, double d, double f,
double period)
: Subsystem("PIDSubsystem") {
m_controller = new PIDController(p, i, d, f, this, this, period);
}
PIDSubsystem::~PIDSubsystem()
{
delete m_controller;
}
PIDSubsystem::~PIDSubsystem() { delete m_controller; }
/**
* Enables the internal {@link PIDController}
*/
void PIDSubsystem::Enable()
{
m_controller->Enable();
}
void PIDSubsystem::Enable() { m_controller->Enable(); }
/**
* Disables the internal {@link PIDController}
*/
void PIDSubsystem::Disable()
{
m_controller->Disable();
}
void PIDSubsystem::Disable() { m_controller->Disable(); }
/**
* Returns the {@link PIDController} used by this {@link PIDSubsystem}.
@@ -124,21 +117,18 @@ void PIDSubsystem::Disable()
*
* @return the {@link PIDController} used by this {@link PIDSubsystem}
*/
PIDController *PIDSubsystem::GetPIDController()
{
return m_controller;
}
PIDController *PIDSubsystem::GetPIDController() { return m_controller; }
/**
* Sets the setpoint to the given value. If {@link PIDCommand#SetRange(double, double) SetRange(...)}
* Sets the setpoint to the given value. If {@link PIDCommand#SetRange(double,
* double) SetRange(...)}
* was called,
* then the given setpoint
* will be trimmed to fit within the range.
* @param setpoint the new setpoint
*/
void PIDSubsystem::SetSetpoint(double setpoint)
{
m_controller->SetSetpoint(setpoint);
void PIDSubsystem::SetSetpoint(double setpoint) {
m_controller->SetSetpoint(setpoint);
}
/**
@@ -147,19 +137,15 @@ void PIDSubsystem::SetSetpoint(double setpoint)
* then the bounds will still be honored by this method.
* @param deltaSetpoint the change in the setpoint
*/
void PIDSubsystem::SetSetpointRelative(double deltaSetpoint)
{
SetSetpoint(GetSetpoint() + deltaSetpoint);
void PIDSubsystem::SetSetpointRelative(double deltaSetpoint) {
SetSetpoint(GetSetpoint() + deltaSetpoint);
}
/**
* Return the current setpoint
* @return The current setpoint
*/
double PIDSubsystem::GetSetpoint()
{
return m_controller->GetSetpoint();
}
double PIDSubsystem::GetSetpoint() { return m_controller->GetSetpoint(); }
/**
* Sets the maximum and minimum values expected from the input.
@@ -167,9 +153,8 @@ double PIDSubsystem::GetSetpoint()
* @param minimumInput the minimum value expected from the input
* @param maximumInput the maximum value expected from the output
*/
void PIDSubsystem::SetInputRange(float minimumInput, float maximumInput)
{
m_controller->SetInputRange(minimumInput, maximumInput);
void PIDSubsystem::SetInputRange(float minimumInput, float maximumInput) {
m_controller->SetInputRange(minimumInput, maximumInput);
}
/**
@@ -178,9 +163,8 @@ void PIDSubsystem::SetInputRange(float minimumInput, float maximumInput)
* @param minimumOutput the minimum value to write to the output
* @param maximumOutput the maximum value to write to the output
*/
void PIDSubsystem::SetOutputRange(float minimumOutput, float maximumOutput)
{
m_controller->SetOutputRange(minimumOutput, maximumOutput);
void PIDSubsystem::SetOutputRange(float minimumOutput, float maximumOutput) {
m_controller->SetOutputRange(minimumOutput, maximumOutput);
}
/*
@@ -189,7 +173,7 @@ void PIDSubsystem::SetOutputRange(float minimumOutput, float maximumOutput)
* @param percentage error which is tolerable
*/
void PIDSubsystem::SetAbsoluteTolerance(float absValue) {
m_controller->SetAbsoluteTolerance(absValue);
m_controller->SetAbsoluteTolerance(absValue);
}
/*
@@ -198,49 +182,38 @@ void PIDSubsystem::SetAbsoluteTolerance(float absValue) {
* @param percentage error which is tolerable
*/
void PIDSubsystem::SetPercentTolerance(float percent) {
m_controller->SetPercentTolerance(percent);
m_controller->SetPercentTolerance(percent);
}
/*
* 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
* were set using SetInput. Use OnTarget() in the IsFinished() method of commands
* were set using SetInput. Use OnTarget() in the IsFinished() method of
* commands
* that use this subsystem.
*
* 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.
* 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.
*
* @return true if the error is within the percentage tolerance of the input range
* @return true if the error is within the percentage tolerance of the input
* range
*/
bool PIDSubsystem::OnTarget() const
{
return m_controller->OnTarget();
}
bool PIDSubsystem::OnTarget() const { return m_controller->OnTarget(); }
/**
* Returns the current position
* @return the current position
*/
double PIDSubsystem::GetPosition()
{
return ReturnPIDInput();
}
double PIDSubsystem::GetPosition() { return ReturnPIDInput(); }
void PIDSubsystem::PIDWrite(float output)
{
UsePIDOutput(output);
}
void PIDSubsystem::PIDWrite(float output) { UsePIDOutput(output); }
double PIDSubsystem::PIDGet() const
{
return ReturnPIDInput();
}
double PIDSubsystem::PIDGet() const { return ReturnPIDInput(); }
std::string PIDSubsystem::GetSmartDashboardType() const {
return "PIDCommand";
}
void PIDSubsystem::InitTable(ITable* table){
m_controller->InitTable(table);
Subsystem::InitTable(table);
std::string PIDSubsystem::GetSmartDashboardType() const { return "PIDCommand"; }
void PIDSubsystem::InitTable(ITable *table) {
m_controller->InitTable(table);
Subsystem::InitTable(table);
}