mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[wpilib] Add Pneumatics sim classes (#4033)
This commit is contained in:
@@ -8,17 +8,14 @@
|
||||
|
||||
#include "frc/PneumaticsBase.h"
|
||||
#include "frc/simulation/CallbackStore.h"
|
||||
#include "frc/simulation/PneumaticsBaseSim.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class Compressor;
|
||||
|
||||
namespace sim {
|
||||
namespace frc::sim {
|
||||
|
||||
/**
|
||||
* Class to control a simulated Pneumatic Control Module (PCM).
|
||||
*/
|
||||
class CTREPCMSim {
|
||||
class CTREPCMSim : public PneumaticsBaseSim {
|
||||
public:
|
||||
/**
|
||||
* Constructs with the default PCM module number (CAN ID).
|
||||
@@ -34,81 +31,28 @@ class CTREPCMSim {
|
||||
|
||||
explicit CTREPCMSim(const PneumaticsBase& pneumatics);
|
||||
|
||||
/**
|
||||
* Register a callback to be run when a solenoid is initialized on a channel.
|
||||
*
|
||||
* @param callback the callback
|
||||
* @param initialNotify should the callback be run with the initial state
|
||||
* @return the CallbackStore object associated with this callback
|
||||
*/
|
||||
~CTREPCMSim() override = default;
|
||||
|
||||
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterInitializedCallback(
|
||||
NotifyCallback callback, bool initialNotify);
|
||||
NotifyCallback callback, bool initialNotify) override;
|
||||
|
||||
/**
|
||||
* Check if a solenoid has been initialized on a specific channel.
|
||||
*
|
||||
* @return true if initialized
|
||||
*/
|
||||
bool GetInitialized() const;
|
||||
bool GetInitialized() const override;
|
||||
|
||||
/**
|
||||
* Define whether a solenoid has been initialized on a specific channel.
|
||||
*
|
||||
* @param solenoidInitialized is there a solenoid initialized on that channel
|
||||
*/
|
||||
void SetInitialized(bool solenoidInitialized);
|
||||
void SetInitialized(bool initialized) override;
|
||||
|
||||
/**
|
||||
* Register a callback to be run when the solenoid output on a channel
|
||||
* changes.
|
||||
*
|
||||
* @param channel the channel to monitor
|
||||
* @param callback the callback
|
||||
* @param initialNotify should the callback be run with the initial value
|
||||
* @return the CallbackStore object associated with this callback
|
||||
*/
|
||||
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterSolenoidOutputCallback(
|
||||
int channel, NotifyCallback callback, bool initialNotify);
|
||||
int channel, NotifyCallback callback, bool initialNotify) override;
|
||||
|
||||
/**
|
||||
* Check the solenoid output on a specific channel.
|
||||
*
|
||||
* @param channel the channel to check
|
||||
* @return the solenoid output
|
||||
*/
|
||||
bool GetSolenoidOutput(int channel) const;
|
||||
bool GetSolenoidOutput(int channel) const override;
|
||||
|
||||
/**
|
||||
* Change the solenoid output on a specific channel.
|
||||
*
|
||||
* @param channel the channel to check
|
||||
* @param solenoidOutput the new solenoid output
|
||||
*/
|
||||
void SetSolenoidOutput(int channel, bool solenoidOutput);
|
||||
void SetSolenoidOutput(int channel, bool solenoidOutput) override;
|
||||
|
||||
/**
|
||||
* Register a callback to be run when the compressor activates.
|
||||
*
|
||||
* @param callback the callback
|
||||
* @param initialNotify whether to run the callback with the initial state
|
||||
* @return the CallbackStore object associated with this callback
|
||||
*/
|
||||
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterCompressorOnCallback(
|
||||
NotifyCallback callback, bool initialNotify);
|
||||
NotifyCallback callback, bool initialNotify) override;
|
||||
|
||||
/**
|
||||
* Check if the compressor is on.
|
||||
*
|
||||
* @return true if the compressor is active
|
||||
*/
|
||||
bool GetCompressorOn() const;
|
||||
bool GetCompressorOn() const override;
|
||||
|
||||
/**
|
||||
* Set whether the compressor is active.
|
||||
*
|
||||
* @param compressorOn the new value
|
||||
*/
|
||||
void SetCompressorOn(bool compressorOn);
|
||||
void SetCompressorOn(bool compressorOn) override;
|
||||
|
||||
/**
|
||||
* Register a callback to be run whenever the closed loop state changes.
|
||||
@@ -145,21 +89,21 @@ class CTREPCMSim {
|
||||
* @return the CallbackStore object associated with this callback
|
||||
*/
|
||||
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterPressureSwitchCallback(
|
||||
NotifyCallback callback, bool initialNotify);
|
||||
NotifyCallback callback, bool initialNotify) override;
|
||||
|
||||
/**
|
||||
* Check the value of the pressure switch.
|
||||
*
|
||||
* @return the pressure switch value
|
||||
*/
|
||||
bool GetPressureSwitch() const;
|
||||
bool GetPressureSwitch() const override;
|
||||
|
||||
/**
|
||||
* Set the value of the pressure switch.
|
||||
*
|
||||
* @param pressureSwitch the new value
|
||||
*/
|
||||
void SetPressureSwitch(bool pressureSwitch);
|
||||
void SetPressureSwitch(bool pressureSwitch) override;
|
||||
|
||||
/**
|
||||
* Register a callback to be run whenever the compressor current changes.
|
||||
@@ -170,43 +114,26 @@ class CTREPCMSim {
|
||||
*/
|
||||
[[nodiscard]] std::unique_ptr<CallbackStore>
|
||||
RegisterCompressorCurrentCallback(NotifyCallback callback,
|
||||
bool initialNotify);
|
||||
bool initialNotify) override;
|
||||
|
||||
/**
|
||||
* Read the compressor current.
|
||||
*
|
||||
* @return the current of the compressor connected to this module
|
||||
*/
|
||||
double GetCompressorCurrent() const;
|
||||
double GetCompressorCurrent() const override;
|
||||
|
||||
/**
|
||||
* Set the compressor current.
|
||||
*
|
||||
* @param compressorCurrent the new compressor current
|
||||
*/
|
||||
void SetCompressorCurrent(double compressorCurrent);
|
||||
void SetCompressorCurrent(double compressorCurrent) override;
|
||||
|
||||
/**
|
||||
* Get the current value of all solenoid outputs.
|
||||
*
|
||||
* @return the solenoid outputs (1 bit per output)
|
||||
*/
|
||||
uint8_t GetAllSolenoidOutputs() const;
|
||||
uint8_t GetAllSolenoidOutputs() const override;
|
||||
|
||||
/**
|
||||
* Change all of the solenoid outputs.
|
||||
*
|
||||
* @param outputs the new solenoid outputs (1 bit per output)
|
||||
*/
|
||||
void SetAllSolenoidOutputs(uint8_t outputs);
|
||||
void SetAllSolenoidOutputs(uint8_t outputs) override;
|
||||
|
||||
/**
|
||||
* Reset all simulation data for this object.
|
||||
*/
|
||||
void ResetData();
|
||||
|
||||
private:
|
||||
int m_index;
|
||||
void ResetData() override;
|
||||
};
|
||||
} // namespace sim
|
||||
} // namespace frc
|
||||
} // namespace frc::sim
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "frc/DoubleSolenoid.h"
|
||||
#include "frc/PneumaticsModuleType.h"
|
||||
#include "frc/simulation/PneumaticsBaseSim.h"
|
||||
|
||||
namespace frc::sim {
|
||||
|
||||
class DoubleSolenoidSim {
|
||||
public:
|
||||
DoubleSolenoidSim(std::shared_ptr<PneumaticsBaseSim> moduleSim, int fwd,
|
||||
int rev);
|
||||
DoubleSolenoidSim(int module, PneumaticsModuleType type, int fwd, int rev);
|
||||
DoubleSolenoidSim(PneumaticsModuleType type, int fwd, int rev);
|
||||
|
||||
DoubleSolenoid::Value Get() const;
|
||||
void Set(DoubleSolenoid::Value output);
|
||||
|
||||
std::shared_ptr<PneumaticsBaseSim> GetModuleSim() const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<PneumaticsBaseSim> m_module;
|
||||
int m_fwd;
|
||||
int m_rev;
|
||||
};
|
||||
|
||||
} // namespace frc::sim
|
||||
@@ -0,0 +1,183 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "frc/PneumaticsBase.h"
|
||||
#include "frc/PneumaticsModuleType.h"
|
||||
#include "frc/simulation/CallbackStore.h"
|
||||
|
||||
namespace frc::sim {
|
||||
|
||||
class PneumaticsBaseSim {
|
||||
public:
|
||||
virtual ~PneumaticsBaseSim() = default;
|
||||
|
||||
static std::shared_ptr<PneumaticsBaseSim> GetForType(
|
||||
int module, PneumaticsModuleType type);
|
||||
|
||||
/**
|
||||
* Check whether the PCM/PH has been initialized.
|
||||
*
|
||||
* @return true if initialized
|
||||
*/
|
||||
virtual bool GetInitialized() const = 0;
|
||||
|
||||
/**
|
||||
* Define whether the PCM/PH has been initialized.
|
||||
*
|
||||
* @param initialized true for initialized
|
||||
*/
|
||||
virtual void SetInitialized(bool initialized) = 0;
|
||||
|
||||
/**
|
||||
* Register a callback to be run when the PCM/PH is initialized.
|
||||
*
|
||||
* @param callback the callback
|
||||
* @param initialNotify whether to run the callback with the initial state
|
||||
* @return the {@link CallbackStore} object associated with this callback.
|
||||
* Save a reference to this object; it being deconstructed cancels the
|
||||
* callback.
|
||||
*/
|
||||
[[nodiscard]] virtual std::unique_ptr<CallbackStore>
|
||||
RegisterInitializedCallback(NotifyCallback callback, bool initialNotify) = 0;
|
||||
|
||||
/**
|
||||
* Check if the compressor is on.
|
||||
*
|
||||
* @return true if the compressor is active
|
||||
*/
|
||||
virtual bool GetCompressorOn() const = 0;
|
||||
|
||||
/**
|
||||
* Set whether the compressor is active.
|
||||
*
|
||||
* @param compressorOn the new value
|
||||
*/
|
||||
virtual void SetCompressorOn(bool compressorOn) = 0;
|
||||
|
||||
/**
|
||||
* Register a callback to be run when the compressor activates.
|
||||
*
|
||||
* @param callback the callback
|
||||
* @param initialNotify whether to run the callback with the initial state
|
||||
* @return the {@link CallbackStore} object associated with this callback.
|
||||
* Save a reference to this object; it being deconstructed cancels the
|
||||
* callback.
|
||||
*/
|
||||
[[nodiscard]] virtual std::unique_ptr<CallbackStore>
|
||||
RegisterCompressorOnCallback(NotifyCallback callback, bool initialNotify) = 0;
|
||||
|
||||
/**
|
||||
* Check the solenoid output on a specific channel.
|
||||
*
|
||||
* @param channel the channel to check
|
||||
* @return the solenoid output
|
||||
*/
|
||||
virtual bool GetSolenoidOutput(int channel) const = 0;
|
||||
|
||||
/**
|
||||
* Change the solenoid output on a specific channel.
|
||||
*
|
||||
* @param channel the channel to check
|
||||
* @param solenoidOutput the new solenoid output
|
||||
*/
|
||||
virtual void SetSolenoidOutput(int channel, bool solenoidOutput) = 0;
|
||||
|
||||
/**
|
||||
* Register a callback to be run when the solenoid output on a channel
|
||||
* changes.
|
||||
*
|
||||
* @param channel the channel to monitor
|
||||
* @param callback the callback
|
||||
* @param initialNotify should the callback be run with the initial value
|
||||
* @return the {@link CallbackStore} object associated with this callback.
|
||||
* Save a reference to this object; it being deconstructed cancels the
|
||||
* callback.
|
||||
*/
|
||||
[[nodiscard]] virtual std::unique_ptr<CallbackStore>
|
||||
RegisterSolenoidOutputCallback(int channel, NotifyCallback callback,
|
||||
bool initialNotify) = 0;
|
||||
|
||||
/**
|
||||
* Check the value of the pressure switch.
|
||||
*
|
||||
* @return the pressure switch value
|
||||
*/
|
||||
virtual bool GetPressureSwitch() const = 0;
|
||||
|
||||
/**
|
||||
* Set the value of the pressure switch.
|
||||
*
|
||||
* @param pressureSwitch the new value
|
||||
*/
|
||||
virtual void SetPressureSwitch(bool pressureSwitch) = 0;
|
||||
|
||||
/**
|
||||
* Register a callback to be run whenever the pressure switch value changes.
|
||||
*
|
||||
* @param callback the callback
|
||||
* @param initialNotify whether the callback should be called with the initial
|
||||
* value
|
||||
* @return the {@link CallbackStore} object associated with this callback.
|
||||
* Save a reference to this object; it being deconstructed cancels the
|
||||
* callback.
|
||||
*/
|
||||
[[nodiscard]] virtual std::unique_ptr<CallbackStore>
|
||||
RegisterPressureSwitchCallback(NotifyCallback callback,
|
||||
bool initialNotify) = 0;
|
||||
|
||||
/**
|
||||
* Read the compressor current.
|
||||
*
|
||||
* @return the current of the compressor connected to this module
|
||||
*/
|
||||
virtual double GetCompressorCurrent() const = 0;
|
||||
|
||||
/**
|
||||
* Set the compressor current.
|
||||
*
|
||||
* @param compressorCurrent the new compressor current
|
||||
*/
|
||||
virtual void SetCompressorCurrent(double compressorCurrent) = 0;
|
||||
|
||||
/**
|
||||
* Register a callback to be run whenever the compressor current changes.
|
||||
*
|
||||
* @param callback the callback
|
||||
* @param initialNotify whether to call the callback with the initial state
|
||||
* @return the {@link CallbackStore} object associated with this callback.
|
||||
* Save a reference to this object; it being deconstructed cancels the
|
||||
* callback.
|
||||
*/
|
||||
[[nodiscard]] virtual std::unique_ptr<CallbackStore>
|
||||
RegisterCompressorCurrentCallback(NotifyCallback callback,
|
||||
bool initialNotify) = 0;
|
||||
|
||||
/**
|
||||
* Get the current value of all solenoid outputs.
|
||||
*
|
||||
* @return the solenoid outputs (1 bit per output)
|
||||
*/
|
||||
virtual uint8_t GetAllSolenoidOutputs() const = 0;
|
||||
|
||||
/**
|
||||
* Change all of the solenoid outputs.
|
||||
*
|
||||
* @param outputs the new solenoid outputs (1 bit per output)
|
||||
*/
|
||||
virtual void SetAllSolenoidOutputs(uint8_t outputs) = 0;
|
||||
|
||||
/** Reset all simulation data for this object. */
|
||||
virtual void ResetData() = 0;
|
||||
|
||||
protected:
|
||||
const int m_index;
|
||||
explicit PneumaticsBaseSim(const PneumaticsBase& module);
|
||||
explicit PneumaticsBaseSim(const int index);
|
||||
};
|
||||
|
||||
} // namespace frc::sim
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "frc/PneumaticsBase.h"
|
||||
#include "frc/simulation/CallbackStore.h"
|
||||
#include "frc/simulation/PneumaticsBaseSim.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
@@ -18,7 +19,7 @@ namespace sim {
|
||||
/**
|
||||
* Class to control a simulated Pneumatic Control Module (PCM).
|
||||
*/
|
||||
class REVPHSim {
|
||||
class REVPHSim : public PneumaticsBaseSim {
|
||||
public:
|
||||
/**
|
||||
* Constructs with the default PCM module number (CAN ID).
|
||||
@@ -34,81 +35,38 @@ class REVPHSim {
|
||||
|
||||
explicit REVPHSim(const PneumaticsBase& pneumatics);
|
||||
|
||||
/**
|
||||
* Register a callback to be run when a solenoid is initialized on a channel.
|
||||
*
|
||||
* @param callback the callback
|
||||
* @param initialNotify should the callback be run with the initial state
|
||||
* @return the CallbackStore object associated with this callback
|
||||
*/
|
||||
~REVPHSim() override = default;
|
||||
|
||||
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterInitializedCallback(
|
||||
NotifyCallback callback, bool initialNotify);
|
||||
NotifyCallback callback, bool initialNotify) override;
|
||||
|
||||
/**
|
||||
* Check if a solenoid has been initialized on a specific channel.
|
||||
*
|
||||
* @return true if initialized
|
||||
*/
|
||||
bool GetInitialized() const;
|
||||
bool GetInitialized() const override;
|
||||
|
||||
/**
|
||||
* Define whether a solenoid has been initialized on a specific channel.
|
||||
*
|
||||
* @param solenoidInitialized is there a solenoid initialized on that channel
|
||||
*/
|
||||
void SetInitialized(bool solenoidInitialized);
|
||||
void SetInitialized(bool solenoidInitialized) override;
|
||||
|
||||
/**
|
||||
* Register a callback to be run when the solenoid output on a channel
|
||||
* changes.
|
||||
*
|
||||
* @param channel the channel to monitor
|
||||
* @param callback the callback
|
||||
* @param initialNotify should the callback be run with the initial value
|
||||
* @return the CallbackStore object associated with this callback
|
||||
*/
|
||||
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterSolenoidOutputCallback(
|
||||
int channel, NotifyCallback callback, bool initialNotify);
|
||||
int channel, NotifyCallback callback, bool initialNotify) override;
|
||||
|
||||
/**
|
||||
* Check the solenoid output on a specific channel.
|
||||
*
|
||||
* @param channel the channel to check
|
||||
* @return the solenoid output
|
||||
*/
|
||||
bool GetSolenoidOutput(int channel) const;
|
||||
bool GetSolenoidOutput(int channel) const override;
|
||||
|
||||
/**
|
||||
* Change the solenoid output on a specific channel.
|
||||
*
|
||||
* @param channel the channel to check
|
||||
* @param solenoidOutput the new solenoid output
|
||||
*/
|
||||
void SetSolenoidOutput(int channel, bool solenoidOutput);
|
||||
void SetSolenoidOutput(int channel, bool solenoidOutput) override;
|
||||
|
||||
/**
|
||||
* Register a callback to be run when the compressor activates.
|
||||
*
|
||||
* @param callback the callback
|
||||
* @param initialNotify whether to run the callback with the initial state
|
||||
* @return the CallbackStore object associated with this callback
|
||||
*/
|
||||
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterCompressorOnCallback(
|
||||
NotifyCallback callback, bool initialNotify);
|
||||
NotifyCallback callback, bool initialNotify) override;
|
||||
|
||||
/**
|
||||
* Check if the compressor is on.
|
||||
*
|
||||
* @return true if the compressor is active
|
||||
*/
|
||||
bool GetCompressorOn() const;
|
||||
bool GetCompressorOn() const override;
|
||||
|
||||
/**
|
||||
* Set whether the compressor is active.
|
||||
*
|
||||
* @param compressorOn the new value
|
||||
*/
|
||||
void SetCompressorOn(bool compressorOn);
|
||||
void SetCompressorOn(bool compressorOn) override;
|
||||
|
||||
/**
|
||||
* Register a callback to be run whenever the closed loop state changes.
|
||||
@@ -136,77 +94,26 @@ class REVPHSim {
|
||||
*/
|
||||
void SetCompressorConfigType(int compressorConfigType);
|
||||
|
||||
/**
|
||||
* Register a callback to be run whenever the pressure switch value changes.
|
||||
*
|
||||
* @param callback the callback
|
||||
* @param initialNotify whether the callback should be called with the
|
||||
* initial value
|
||||
* @return the CallbackStore object associated with this callback
|
||||
*/
|
||||
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterPressureSwitchCallback(
|
||||
NotifyCallback callback, bool initialNotify);
|
||||
NotifyCallback callback, bool initialNotify) override;
|
||||
|
||||
/**
|
||||
* Check the value of the pressure switch.
|
||||
*
|
||||
* @return the pressure switch value
|
||||
*/
|
||||
bool GetPressureSwitch() const;
|
||||
bool GetPressureSwitch() const override;
|
||||
|
||||
/**
|
||||
* Set the value of the pressure switch.
|
||||
*
|
||||
* @param pressureSwitch the new value
|
||||
*/
|
||||
void SetPressureSwitch(bool pressureSwitch);
|
||||
void SetPressureSwitch(bool pressureSwitch) override;
|
||||
|
||||
/**
|
||||
* Register a callback to be run whenever the compressor current changes.
|
||||
*
|
||||
* @param callback the callback
|
||||
* @param initialNotify whether to call the callback with the initial state
|
||||
* @return the CallbackStore object associated with this callback
|
||||
*/
|
||||
[[nodiscard]] std::unique_ptr<CallbackStore>
|
||||
RegisterCompressorCurrentCallback(NotifyCallback callback,
|
||||
bool initialNotify);
|
||||
bool initialNotify) override;
|
||||
|
||||
/**
|
||||
* Read the compressor current.
|
||||
*
|
||||
* @return the current of the compressor connected to this module
|
||||
*/
|
||||
double GetCompressorCurrent() const;
|
||||
double GetCompressorCurrent() const override;
|
||||
|
||||
/**
|
||||
* Set the compressor current.
|
||||
*
|
||||
* @param compressorCurrent the new compressor current
|
||||
*/
|
||||
void SetCompressorCurrent(double compressorCurrent);
|
||||
void SetCompressorCurrent(double compressorCurrent) override;
|
||||
|
||||
/**
|
||||
* Get the current value of all solenoid outputs.
|
||||
*
|
||||
* @return the solenoid outputs (1 bit per output)
|
||||
*/
|
||||
uint8_t GetAllSolenoidOutputs() const;
|
||||
uint8_t GetAllSolenoidOutputs() const override;
|
||||
|
||||
/**
|
||||
* Change all of the solenoid outputs.
|
||||
*
|
||||
* @param outputs the new solenoid outputs (1 bit per output)
|
||||
*/
|
||||
void SetAllSolenoidOutputs(uint8_t outputs);
|
||||
void SetAllSolenoidOutputs(uint8_t outputs) override;
|
||||
|
||||
/**
|
||||
* Reset all simulation data for this object.
|
||||
*/
|
||||
void ResetData();
|
||||
|
||||
private:
|
||||
int m_index;
|
||||
void ResetData() override;
|
||||
};
|
||||
} // namespace sim
|
||||
} // namespace frc
|
||||
|
||||
42
wpilibc/src/main/native/include/frc/simulation/SolenoidSim.h
Normal file
42
wpilibc/src/main/native/include/frc/simulation/SolenoidSim.h
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "frc/PneumaticsModuleType.h"
|
||||
#include "frc/simulation/PneumaticsBaseSim.h"
|
||||
|
||||
namespace frc::sim {
|
||||
|
||||
class SolenoidSim {
|
||||
public:
|
||||
SolenoidSim(std::shared_ptr<PneumaticsBaseSim> moduleSim, int channel);
|
||||
SolenoidSim(int module, PneumaticsModuleType type, int channel);
|
||||
SolenoidSim(PneumaticsModuleType type, int channel);
|
||||
|
||||
bool GetOutput() const;
|
||||
void SetOutput(bool output);
|
||||
|
||||
/**
|
||||
* Register a callback to be run when the output of this solenoid has changed.
|
||||
*
|
||||
* @param callback the callback
|
||||
* @param initialNotify whether to run the callback with the initial state
|
||||
* @return the {@link CallbackStore} object associated with this callback.
|
||||
* Save a reference to this object; it being deconstructed cancels the
|
||||
* callback.
|
||||
*/
|
||||
[[nodiscard]] virtual std::unique_ptr<CallbackStore> RegisterOutputCallback(
|
||||
NotifyCallback callback, bool initialNotify);
|
||||
|
||||
std::shared_ptr<PneumaticsBaseSim> GetModuleSim() const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<PneumaticsBaseSim> m_module;
|
||||
int m_channel;
|
||||
};
|
||||
|
||||
} // namespace frc::sim
|
||||
Reference in New Issue
Block a user