mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Also update copyright to include "and other WPILib contributors" and clarify license referral language to not be restricted to FIRST teams.
78 lines
1.9 KiB
C++
78 lines
1.9 KiB
C++
// 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/simulation/CallbackStore.h"
|
|
|
|
namespace frc {
|
|
|
|
class AnalogTrigger;
|
|
|
|
namespace sim {
|
|
|
|
/**
|
|
* Class to control a simulated analog trigger.
|
|
*/
|
|
class AnalogTriggerSim {
|
|
public:
|
|
/**
|
|
* Constructs from an AnalogTrigger object.
|
|
*
|
|
* @param analogTrigger AnalogTrigger to simulate
|
|
*/
|
|
explicit AnalogTriggerSim(const AnalogTrigger& analogTrigger);
|
|
|
|
/**
|
|
* Creates an AnalogTriggerSim for an analog input channel.
|
|
*
|
|
* @param channel analog input channel
|
|
* @return Simulated object
|
|
* @throws std::out_of_range if no AnalogTrigger is configured for that
|
|
* channel
|
|
*/
|
|
static AnalogTriggerSim CreateForChannel(int channel);
|
|
|
|
/**
|
|
* Creates an AnalogTriggerSim for a simulated index.
|
|
* The index is incremented for each simulated AnalogTrigger.
|
|
*
|
|
* @param index simulator index
|
|
* @return Simulated object
|
|
*/
|
|
static AnalogTriggerSim CreateForIndex(int index);
|
|
|
|
std::unique_ptr<CallbackStore> RegisterInitializedCallback(
|
|
NotifyCallback callback, bool initialNotify);
|
|
|
|
bool GetInitialized() const;
|
|
|
|
void SetInitialized(bool initialized);
|
|
|
|
std::unique_ptr<CallbackStore> RegisterTriggerLowerBoundCallback(
|
|
NotifyCallback callback, bool initialNotify);
|
|
|
|
double GetTriggerLowerBound() const;
|
|
|
|
void SetTriggerLowerBound(double triggerLowerBound);
|
|
|
|
std::unique_ptr<CallbackStore> RegisterTriggerUpperBoundCallback(
|
|
NotifyCallback callback, bool initialNotify);
|
|
|
|
double GetTriggerUpperBound() const;
|
|
|
|
void SetTriggerUpperBound(double triggerUpperBound);
|
|
|
|
void ResetData();
|
|
|
|
private:
|
|
explicit AnalogTriggerSim(int index) : m_index{index} {}
|
|
|
|
int m_index;
|
|
};
|
|
} // namespace sim
|
|
} // namespace frc
|