mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
During shared library loading, a different libLLVM can be pulled in, causing llvm symbols from dependent libraries to resolve to that library instead of this one. This has been seen in the wild with the Mesa OpenGL implementation in JavaFX applications (see wpilibsuite/shuffleboard#361). This is clearly a very breaking change. For some level of backwards compatibility, a namespace alias from llvm to wpi is performed in the "llvm" headers. Unfortunately, forward declarations of llvm classes will still break, but compilers seem to generate clear error messages in those cases ("namespace alias 'llvm' not allowed here, assuming 'wpi'"). This change also moves all the wpiutil headers to a single "wpi" subdirectory from the previously split "llvm", "support", "tcpsockets", and "udpsockets". Shim headers will be added for backwards compatibility in a later commit.
62 lines
1.9 KiB
C++
62 lines
1.9 KiB
C++
/*----------------------------------------------------------------------------*/
|
|
/* Copyright (c) 2011-2018 FIRST. 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 the root directory of */
|
|
/* the project. */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
#include <wpi/Twine.h>
|
|
|
|
#include "Commands/Command.h"
|
|
#include "PIDController.h"
|
|
#include "PIDOutput.h"
|
|
#include "PIDSource.h"
|
|
|
|
namespace frc {
|
|
|
|
class PIDCommand : public Command, public PIDOutput, public PIDSource {
|
|
public:
|
|
PIDCommand(const wpi::Twine& name, double p, double i, double d);
|
|
PIDCommand(const wpi::Twine& name, double p, double i, double d,
|
|
double period);
|
|
PIDCommand(const wpi::Twine& name, double p, double i, double d, double f,
|
|
double period);
|
|
PIDCommand(double p, double i, double d);
|
|
PIDCommand(double p, double i, double d, double period);
|
|
PIDCommand(double p, double i, double d, double f, double period);
|
|
virtual ~PIDCommand() = default;
|
|
|
|
void SetSetpointRelative(double deltaSetpoint);
|
|
|
|
// PIDOutput interface
|
|
void PIDWrite(double output) override;
|
|
|
|
// PIDSource interface
|
|
double PIDGet() override;
|
|
|
|
protected:
|
|
std::shared_ptr<PIDController> GetPIDController() const;
|
|
void _Initialize() override;
|
|
void _Interrupted() override;
|
|
void _End() override;
|
|
void SetSetpoint(double setpoint);
|
|
double GetSetpoint() const;
|
|
double GetPosition();
|
|
|
|
virtual double ReturnPIDInput() = 0;
|
|
virtual void UsePIDOutput(double output) = 0;
|
|
|
|
private:
|
|
// The internal PIDController
|
|
std::shared_ptr<PIDController> m_controller;
|
|
|
|
public:
|
|
void InitSendable(SendableBuilder& builder) override;
|
|
};
|
|
|
|
} // namespace frc
|