mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
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
26 lines
906 B
C++
26 lines
906 B
C++
/*----------------------------------------------------------------------------*/
|
|
/* Copyright (c) FIRST 2008. All Rights Reserved.
|
|
*/
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
|
|
/*----------------------------------------------------------------------------*/
|
|
#pragma once
|
|
|
|
enum class PIDSourceType { kDisplacement, kRate };
|
|
|
|
/**
|
|
* PIDSource interface is a generic sensor source for the PID class.
|
|
* All sensors that can be used with the PID class will implement the PIDSource
|
|
* that
|
|
* returns a standard value that will be used in the PID code.
|
|
*/
|
|
class PIDSource {
|
|
public:
|
|
virtual void SetPIDSourceType(PIDSourceType pidSource);
|
|
PIDSourceType GetPIDSourceType() const;
|
|
virtual double PIDGet() = 0;
|
|
|
|
protected:
|
|
PIDSourceType m_pidSource = PIDSourceType::kDisplacement;
|
|
};
|