10#include "units/length.h"
16template <
class Distance>
17 requires units::length_unit<Distance> || units::angle_unit<Distance>
20 return "SimpleMotorFeedforward";
22 static constexpr size_t GetSize() {
return 32; }
24 return "double ks;double kv;double ka;double dt";
28 std::span<const uint8_t> data) {
30 units::unit<std::ratio<1>, units::traits::base_unit_of<Distance>>;
32 constexpr size_t kKsOff = 0;
33 constexpr size_t kKvOff = kKsOff + 8;
34 constexpr size_t kKaOff = kKvOff + 8;
35 constexpr size_t kDtOff = kKaOff + 8;
37 units::unit_t<typename BaseFeedforward::kv_unit>{
39 units::unit_t<typename BaseFeedforward::ka_unit>{
44 static void Pack(std::span<uint8_t> data,
47 units::unit<std::ratio<1>, units::traits::base_unit_of<Distance>>;
49 constexpr size_t kKsOff = 0;
50 constexpr size_t kKvOff = kKsOff + 8;
51 constexpr size_t kKaOff = kKvOff + 8;
52 constexpr size_t kDtOff = kKaOff + 8;
55 data, units::unit_t<typename BaseFeedforward::kv_unit>{value.
GetKv()}
58 data, units::unit_t<typename BaseFeedforward::ka_unit>{value.
GetKa()}
A helper class that computes feedforward voltages for a simple permanent-magnet DC motor.
Definition SimpleMotorFeedforward.h:24
constexpr units::unit_t< ka_unit > GetKa() const
Returns the acceleration gain.
Definition SimpleMotorFeedforward.h:221
constexpr units::volt_t GetKs() const
Returns the static gain.
Definition SimpleMotorFeedforward.h:207
constexpr units::unit_t< kv_unit > GetKv() const
Returns the velocity gain.
Definition SimpleMotorFeedforward.h:214
constexpr units::second_t GetDt() const
Returns the period.
Definition SimpleMotorFeedforward.h:228
Specifies that a type is capable of raw struct serialization and deserialization.
Definition Struct.h:69
Definition SystemServer.h:9
T UnpackStruct(std::span< const uint8_t > data, const I &... info)
Unpack a serialized struct.
Definition Struct.h:138
void PackStruct(std::span< uint8_t > data, T &&value, const I &... info)
Pack a serialized struct.
Definition Struct.h:200
static constexpr std::string_view GetSchema()
Definition SimpleMotorFeedforwardStruct.h:23
static void Pack(std::span< uint8_t > data, const frc::SimpleMotorFeedforward< Distance > &value)
Definition SimpleMotorFeedforwardStruct.h:44
static constexpr std::string_view GetTypeName()
Definition SimpleMotorFeedforwardStruct.h:19
static frc::SimpleMotorFeedforward< Distance > Unpack(std::span< const uint8_t > data)
Definition SimpleMotorFeedforwardStruct.h:27
static constexpr size_t GetSize()
Definition SimpleMotorFeedforwardStruct.h:22
Struct serialization template.
Definition Struct.h:39