[wpimath] Struct cleanup (#6011)

This commit is contained in:
Joseph Eng
2023-12-04 22:40:18 -08:00
committed by GitHub
parent 90757b9e90
commit 14c3ade155
32 changed files with 95 additions and 49 deletions

View File

@@ -11,12 +11,16 @@
template <>
struct WPILIB_DLLEXPORT wpi::Struct<frc::ArmFeedforward> {
static constexpr std::string_view kTypeString = "struct:ArmFeedforward";
static constexpr size_t kSize = 32;
static constexpr std::string_view kSchema =
"double ks;double kg;double kv;double ka";
static constexpr std::string_view GetTypeString() {
return "struct:ArmFeedforward";
}
static constexpr size_t GetSize() { return 32; }
static constexpr std::string_view GetSchema() {
return "double ks;double kg;double kv;double ka";
}
static frc::ArmFeedforward Unpack(std::span<const uint8_t, kSize> data);
static void Pack(std::span<uint8_t, kSize> data,
const frc::ArmFeedforward& value);
static frc::ArmFeedforward Unpack(std::span<const uint8_t> data);
static void Pack(std::span<uint8_t> data, const frc::ArmFeedforward& value);
};
static_assert(wpi::StructSerializable<frc::ArmFeedforward>);

View File

@@ -11,13 +11,18 @@
template <>
struct WPILIB_DLLEXPORT wpi::Struct<frc::DifferentialDriveWheelVoltages> {
static constexpr std::string_view kTypeString =
"struct:DifferentialDriveWheelVoltages";
static constexpr size_t kSize = 16;
static constexpr std::string_view kSchema = "double left;double right";
static constexpr std::string_view GetTypeString() {
return "struct:DifferentialDriveWheelVoltages";
}
static constexpr size_t GetSize() { return 16; }
static constexpr std::string_view GetSchema() {
return "double left;double right";
}
static frc::DifferentialDriveWheelVoltages Unpack(
std::span<const uint8_t, kSize> data);
static void Pack(std::span<uint8_t, kSize> data,
std::span<const uint8_t> data);
static void Pack(std::span<uint8_t> data,
const frc::DifferentialDriveWheelVoltages& value);
};
static_assert(wpi::StructSerializable<frc::DifferentialDriveWheelVoltages>);

View File

@@ -11,12 +11,17 @@
template <>
struct WPILIB_DLLEXPORT wpi::Struct<frc::ElevatorFeedforward> {
static constexpr std::string_view kTypeString = "struct:ElevatorFeedforward";
static constexpr size_t kSize = 32;
static constexpr std::string_view kSchema =
"double ks;double kg;double kv;double ka";
static constexpr std::string_view GetTypeString() {
return "struct:ElevatorFeedforward";
}
static constexpr size_t GetSize() { return 32; }
static constexpr std::string_view GetSchema() {
return "double ks;double kg;double kv;double ka";
}
static frc::ElevatorFeedforward Unpack(std::span<const uint8_t, kSize> data);
static void Pack(std::span<uint8_t, kSize> data,
static frc::ElevatorFeedforward Unpack(std::span<const uint8_t> data);
static void Pack(std::span<uint8_t> data,
const frc::ElevatorFeedforward& value);
};
static_assert(wpi::StructSerializable<frc::ElevatorFeedforward>);