[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,48 +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 "../PortsInternal.h"
#include "AnalogGyroDataInternal.h"
using namespace hal;
namespace hal::init {
void InitializeAnalogGyroData() {
static AnalogGyroData agd[kNumAccumulators];
::hal::SimAnalogGyroData = agd;
}
} // namespace hal::init
AnalogGyroData* hal::SimAnalogGyroData;
void AnalogGyroData::ResetData() {
angle.Reset(0.0);
rate.Reset(0.0);
initialized.Reset(false);
}
extern "C" {
void HALSIM_ResetAnalogGyroData(int32_t index) {
SimAnalogGyroData[index].ResetData();
}
#define DEFINE_CAPI(TYPE, CAPINAME, LOWERNAME) \
HAL_SIMDATAVALUE_DEFINE_CAPI(TYPE, HALSIM, AnalogGyro##CAPINAME, \
SimAnalogGyroData, LOWERNAME)
DEFINE_CAPI(double, Angle, angle)
DEFINE_CAPI(double, Rate, rate)
DEFINE_CAPI(HAL_Bool, Initialized, initialized)
#define REGISTER(NAME) \
SimAnalogGyroData[index].NAME.RegisterCallback(callback, param, initialNotify)
void HALSIM_RegisterAnalogGyroAllCallbacks(int32_t index,
HAL_NotifyCallback callback,
void* param,
HAL_Bool initialNotify) {
REGISTER(angle);
REGISTER(rate);
REGISTER(initialized);
}
} // extern "C"

View File

@@ -1,25 +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.
#pragma once
#include "hal/simulation/AnalogGyroData.h"
#include "hal/simulation/SimDataValue.h"
namespace hal {
class AnalogGyroData {
HAL_SIMDATAVALUE_DEFINE_NAME(Angle)
HAL_SIMDATAVALUE_DEFINE_NAME(Rate)
HAL_SIMDATAVALUE_DEFINE_NAME(Initialized)
public:
SimDataValue<double, HAL_MakeDouble, GetAngleName> angle{0.0};
SimDataValue<double, HAL_MakeDouble, GetRateName> rate{0.0};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{
false};
virtual void ResetData();
};
extern AnalogGyroData* SimAnalogGyroData;
} // namespace hal

View File

@@ -21,11 +21,6 @@ void AnalogInData::ResetData() {
averageBits.Reset(7);
oversampleBits.Reset(0);
voltage.Reset(0.0);
accumulatorInitialized.Reset(false);
accumulatorValue.Reset(0);
accumulatorCount.Reset(0);
accumulatorCenter.Reset(0);
accumulatorDeadband.Reset(0);
}
extern "C" {
@@ -45,11 +40,6 @@ DEFINE_CAPI(HAL_Bool, Initialized, initialized)
DEFINE_CAPI(int32_t, AverageBits, averageBits)
DEFINE_CAPI(int32_t, OversampleBits, oversampleBits)
DEFINE_CAPI(double, Voltage, voltage)
DEFINE_CAPI(HAL_Bool, AccumulatorInitialized, accumulatorInitialized)
DEFINE_CAPI(int64_t, AccumulatorValue, accumulatorValue)
DEFINE_CAPI(int64_t, AccumulatorCount, accumulatorCount)
DEFINE_CAPI(int32_t, AccumulatorCenter, accumulatorCenter)
DEFINE_CAPI(int32_t, AccumulatorDeadband, accumulatorDeadband)
#define REGISTER(NAME) \
SimAnalogInData[index].NAME.RegisterCallback(callback, param, initialNotify)
@@ -61,10 +51,5 @@ void HALSIM_RegisterAnalogInAllCallbacks(int32_t index,
REGISTER(averageBits);
REGISTER(oversampleBits);
REGISTER(voltage);
REGISTER(accumulatorInitialized);
REGISTER(accumulatorValue);
REGISTER(accumulatorCount);
REGISTER(accumulatorCenter);
REGISTER(accumulatorDeadband);
}
} // extern "C"

View File

@@ -13,11 +13,6 @@ class AnalogInData {
HAL_SIMDATAVALUE_DEFINE_NAME(AverageBits)
HAL_SIMDATAVALUE_DEFINE_NAME(OversampleBits)
HAL_SIMDATAVALUE_DEFINE_NAME(Voltage)
HAL_SIMDATAVALUE_DEFINE_NAME(AccumulatorInitialized)
HAL_SIMDATAVALUE_DEFINE_NAME(AccumulatorValue)
HAL_SIMDATAVALUE_DEFINE_NAME(AccumulatorCount)
HAL_SIMDATAVALUE_DEFINE_NAME(AccumulatorCenter)
HAL_SIMDATAVALUE_DEFINE_NAME(AccumulatorDeadband)
public:
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{
@@ -26,16 +21,6 @@ class AnalogInData {
SimDataValue<int32_t, HAL_MakeInt, GetAverageBitsName> averageBits{7};
SimDataValue<int32_t, HAL_MakeInt, GetOversampleBitsName> oversampleBits{0};
SimDataValue<double, HAL_MakeDouble, GetVoltageName> voltage{0.0};
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetAccumulatorInitializedName>
accumulatorInitialized{false};
SimDataValue<int64_t, HAL_MakeLong, GetAccumulatorValueName> accumulatorValue{
0};
SimDataValue<int64_t, HAL_MakeLong, GetAccumulatorCountName> accumulatorCount{
0};
SimDataValue<int32_t, HAL_MakeInt, GetAccumulatorCenterName>
accumulatorCenter{0};
SimDataValue<int32_t, HAL_MakeInt, GetAccumulatorDeadbandName>
accumulatorDeadband{0};
virtual void ResetData();
};

View File

@@ -4,7 +4,6 @@
#include <hal/simulation/AccelerometerData.h>
#include <hal/simulation/AddressableLEDData.h>
#include <hal/simulation/AnalogGyroData.h>
#include <hal/simulation/AnalogInData.h>
#include <hal/simulation/AnalogTriggerData.h>
#include <hal/simulation/CTREPCMData.h>
@@ -32,10 +31,6 @@ extern "C" void HALSIM_ResetAllSimData(void) {
HALSIM_ResetAddressableLEDData(i);
}
for (int32_t i = 0; i < hal::kNumAccumulators; i++) {
HALSIM_ResetAnalogGyroData(i);
}
for (int32_t i = 0; i < hal::kNumAnalogInputs; i++) {
HALSIM_ResetAnalogInData(i);
}