9#include "wpi/units/length.hpp"
17template <
class Distance>
18 requires wpi::units::length_unit<Distance> || wpi::units::angle_unit<Distance>
26 static std::optional<wpi::math::SimpleMotorFeedforward<Distance>>
Unpack(
29 wpi::units::unit<std::ratio<1>,
30 wpi::units::traits::base_unit_of<Distance>>;
38 wpi::units::volt_t{msg.
ks},
39 wpi::units::unit_t<typename BaseFeedforward::kv_unit>{msg.
kv},
40 wpi::units::unit_t<typename BaseFeedforward::ka_unit>{msg.
ka},
41 wpi::units::second_t{msg.
dt},
48 wpi::units::unit<std::ratio<1>,
49 wpi::units::traits::base_unit_of<Distance>>;
52 .ks = value.
GetKs().value(),
54 wpi::units::unit_t<typename BaseFeedforward::kv_unit>{value.
GetKv()}
57 wpi::units::unit_t<typename BaseFeedforward::ka_unit>{value.
GetKa()}
59 .dt = wpi::units::second_t{value.
GetDt()}.value(),
A helper class that computes feedforward voltages for a simple permanent-magnet DC motor.
Definition SimpleMotorFeedforward.hpp:24
constexpr wpi::units::second_t GetDt() const
Returns the period.
Definition SimpleMotorFeedforward.hpp:234
constexpr wpi::units::volt_t GetKs() const
Returns the static gain.
Definition SimpleMotorFeedforward.hpp:213
constexpr wpi::units::unit_t< kv_unit > GetKv() const
Returns the velocity gain.
Definition SimpleMotorFeedforward.hpp:220
constexpr wpi::units::unit_t< ka_unit > GetKa() const
Returns the acceleration gain.
Definition SimpleMotorFeedforward.hpp:227
Class for wrapping a nanopb ostream.
Definition Protobuf.hpp:119
bool Encode(const typename Protobuf< std::remove_cvref_t< T > >::MessageStruct &msg)
Decodes a protobuf.
Definition Protobuf.hpp:211
struct _wpi_proto_ProtobufSimpleMotorFeedforward wpi_proto_ProtobufSimpleMotorFeedforward
Definition CvSource.hpp:15
double kv
Definition controller.npb.h:59
double ks
Definition controller.npb.h:58
double ka
Definition controller.npb.h:60
double dt
Definition controller.npb.h:61
static std::optional< wpi::math::SimpleMotorFeedforward< Distance > > Unpack(InputStream &stream)
Definition SimpleMotorFeedforwardProto.hpp:26
wpi::util::ProtoOutputStream< wpi::math::SimpleMotorFeedforward< Distance > > OutputStream
Definition SimpleMotorFeedforwardProto.hpp:23
static bool Pack(OutputStream &stream, const wpi::math::SimpleMotorFeedforward< Distance > &value)
Definition SimpleMotorFeedforwardProto.hpp:45
wpi_proto_ProtobufSimpleMotorFeedforward MessageStruct
Definition SimpleMotorFeedforwardProto.hpp:20
wpi::util::ProtoInputStream< wpi::math::SimpleMotorFeedforward< Distance > > InputStream
Definition SimpleMotorFeedforwardProto.hpp:21
Protobuf serialization template.
Definition Protobuf.hpp:36