[hal, wpilib] Remove analog accumulator and analog gyro (#7697)

The 2 high level classes were temporarily kept to keep the examples compiling. We will remove those when we have the interface into the built in IMU.
This commit is contained in:
Thad House
2025-01-17 12:58:31 -08:00
committed by GitHub
parent 92f0a3c961
commit f80874dd4b
76 changed files with 33 additions and 3886 deletions

View File

@@ -1,75 +0,0 @@
// 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.
#include "frc/simulation/AnalogGyroSim.h"
#include <memory>
#include <hal/simulation/AnalogGyroData.h>
#include "frc/AnalogGyro.h"
#include "frc/AnalogInput.h"
using namespace frc;
using namespace frc::sim;
AnalogGyroSim::AnalogGyroSim(const AnalogGyro& gyro)
: m_index{gyro.GetAnalogInput()->GetChannel()} {}
AnalogGyroSim::AnalogGyroSim(int channel) : m_index{channel} {}
std::unique_ptr<CallbackStore> AnalogGyroSim::RegisterAngleCallback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
m_index, -1, callback, &HALSIM_CancelAnalogGyroAngleCallback);
store->SetUid(HALSIM_RegisterAnalogGyroAngleCallback(
m_index, &CallbackStoreThunk, store.get(), initialNotify));
return store;
}
double AnalogGyroSim::GetAngle() const {
return HALSIM_GetAnalogGyroAngle(m_index);
}
void AnalogGyroSim::SetAngle(double angle) {
HALSIM_SetAnalogGyroAngle(m_index, angle);
}
std::unique_ptr<CallbackStore> AnalogGyroSim::RegisterRateCallback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
m_index, -1, callback, &HALSIM_CancelAnalogGyroRateCallback);
store->SetUid(HALSIM_RegisterAnalogGyroRateCallback(
m_index, &CallbackStoreThunk, store.get(), initialNotify));
return store;
}
double AnalogGyroSim::GetRate() const {
return HALSIM_GetAnalogGyroRate(m_index);
}
void AnalogGyroSim::SetRate(double rate) {
HALSIM_SetAnalogGyroRate(m_index, rate);
}
std::unique_ptr<CallbackStore> AnalogGyroSim::RegisterInitializedCallback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
m_index, -1, callback, &HALSIM_CancelAnalogGyroInitializedCallback);
store->SetUid(HALSIM_RegisterAnalogGyroInitializedCallback(
m_index, &CallbackStoreThunk, store.get(), initialNotify));
return store;
}
bool AnalogGyroSim::GetInitialized() const {
return HALSIM_GetAnalogGyroInitialized(m_index);
}
void AnalogGyroSim::SetInitialized(bool initialized) {
HALSIM_SetAnalogGyroInitialized(m_index, initialized);
}
void AnalogGyroSim::ResetData() {
HALSIM_ResetAnalogGyroData(m_index);
}

View File

@@ -86,95 +86,6 @@ void AnalogInputSim::SetVoltage(double voltage) {
HALSIM_SetAnalogInVoltage(m_index, voltage);
}
std::unique_ptr<CallbackStore>
AnalogInputSim::RegisterAccumulatorInitializedCallback(NotifyCallback callback,
bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
m_index, -1, callback,
&HALSIM_CancelAnalogInAccumulatorInitializedCallback);
store->SetUid(HALSIM_RegisterAnalogInAccumulatorInitializedCallback(
m_index, &CallbackStoreThunk, store.get(), initialNotify));
return store;
}
bool AnalogInputSim::GetAccumulatorInitialized() const {
return HALSIM_GetAnalogInAccumulatorInitialized(m_index);
}
void AnalogInputSim::SetAccumulatorInitialized(bool accumulatorInitialized) {
HALSIM_SetAnalogInAccumulatorInitialized(m_index, accumulatorInitialized);
}
std::unique_ptr<CallbackStore> AnalogInputSim::RegisterAccumulatorValueCallback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
m_index, -1, callback, &HALSIM_CancelAnalogInAccumulatorValueCallback);
store->SetUid(HALSIM_RegisterAnalogInAccumulatorValueCallback(
m_index, &CallbackStoreThunk, store.get(), initialNotify));
return store;
}
int64_t AnalogInputSim::GetAccumulatorValue() const {
return HALSIM_GetAnalogInAccumulatorValue(m_index);
}
void AnalogInputSim::SetAccumulatorValue(int64_t accumulatorValue) {
HALSIM_SetAnalogInAccumulatorValue(m_index, accumulatorValue);
}
std::unique_ptr<CallbackStore> AnalogInputSim::RegisterAccumulatorCountCallback(
NotifyCallback callback, bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
m_index, -1, callback, &HALSIM_CancelAnalogInAccumulatorCountCallback);
store->SetUid(HALSIM_RegisterAnalogInAccumulatorCountCallback(
m_index, &CallbackStoreThunk, store.get(), initialNotify));
return store;
}
int64_t AnalogInputSim::GetAccumulatorCount() const {
return HALSIM_GetAnalogInAccumulatorCount(m_index);
}
void AnalogInputSim::SetAccumulatorCount(int64_t accumulatorCount) {
HALSIM_SetAnalogInAccumulatorCount(m_index, accumulatorCount);
}
std::unique_ptr<CallbackStore>
AnalogInputSim::RegisterAccumulatorCenterCallback(NotifyCallback callback,
bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
m_index, -1, callback, &HALSIM_CancelAnalogInAccumulatorCenterCallback);
store->SetUid(HALSIM_RegisterAnalogInAccumulatorCenterCallback(
m_index, &CallbackStoreThunk, store.get(), initialNotify));
return store;
}
int AnalogInputSim::GetAccumulatorCenter() const {
return HALSIM_GetAnalogInAccumulatorCenter(m_index);
}
void AnalogInputSim::SetAccumulatorCenter(int accumulatorCenter) {
HALSIM_SetAnalogInAccumulatorCenter(m_index, accumulatorCenter);
}
std::unique_ptr<CallbackStore>
AnalogInputSim::RegisterAccumulatorDeadbandCallback(NotifyCallback callback,
bool initialNotify) {
auto store = std::make_unique<CallbackStore>(
m_index, -1, callback, &HALSIM_CancelAnalogInAccumulatorDeadbandCallback);
store->SetUid(HALSIM_RegisterAnalogInAccumulatorDeadbandCallback(
m_index, &CallbackStoreThunk, store.get(), initialNotify));
return store;
}
int AnalogInputSim::GetAccumulatorDeadband() const {
return HALSIM_GetAnalogInAccumulatorDeadband(m_index);
}
void AnalogInputSim::SetAccumulatorDeadband(int accumulatorDeadband) {
HALSIM_SetAnalogInAccumulatorDeadband(m_index, accumulatorDeadband);
}
void AnalogInputSim::ResetData() {
HALSIM_ResetAnalogInData(m_index);
}