From 1f7c7680006e75930c02d3f8ee550f5784a39607 Mon Sep 17 00:00:00 2001 From: Joseph Eng Date: Thu, 18 Jul 2024 11:52:12 -0700 Subject: [PATCH] Make public final values in feedforwards private and add getters --- .../first/math/controller/ArmFeedforward.java | 44 +++++++++++++++++-- .../math/controller/ElevatorFeedforward.java | 44 +++++++++++++++++-- .../controller/SimpleMotorFeedforward.java | 44 +++++++++++++++++-- .../controller/proto/ArmFeedforwardProto.java | 8 ++-- .../proto/ElevatorFeedforwardProto.java | 8 ++-- .../struct/ArmFeedforwardStruct.java | 8 ++-- .../struct/ElevatorFeedforwardStruct.java | 8 ++-- .../controller/proto/ArmFeedforwardProto.cpp | 8 ++-- .../proto/ElevatorFeedforwardProto.cpp | 8 ++-- .../struct/ArmFeedforwardStruct.cpp | 8 ++-- .../struct/ElevatorFeedforwardStruct.cpp | 8 ++-- .../include/frc/controller/ArmFeedforward.h | 37 ++++++++++++++-- .../frc/controller/ElevatorFeedforward.h | 37 ++++++++++++++-- .../frc/controller/SimpleMotorFeedforward.h | 36 +++++++++++++-- .../proto/ArmFeedforwardProtoTest.java | 8 ++-- .../proto/ElevatorFeedforwardProtoTest.java | 8 ++-- .../struct/ArmFeedforwardStructTest.java | 8 ++-- .../struct/ElevatorFeedforwardStructTest.java | 8 ++-- .../proto/ArmFeedforwardProtoTest.cpp | 8 ++-- .../proto/ElevatorFeedforwardProtoTest.cpp | 8 ++-- .../struct/ArmFeedforwardStructTest.cpp | 8 ++-- .../struct/ElevatorFeedforwardStructTest.cpp | 8 ++-- 22 files changed, 282 insertions(+), 88 deletions(-) diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/ArmFeedforward.java b/wpimath/src/main/java/edu/wpi/first/math/controller/ArmFeedforward.java index 32464ece107..c62b00b9dec 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/ArmFeedforward.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/ArmFeedforward.java @@ -16,16 +16,16 @@ */ public class ArmFeedforward implements ProtobufSerializable, StructSerializable { /** The static gain, in volts. */ - public final double ks; + private final double ks; /** The gravity gain, in volts. */ - public final double kg; + private final double kg; /** The velocity gain, in volt seconds per radian. */ - public final double kv; + private final double kv; /** The acceleration gain, in volt secondsĀ² per radian. */ - public final double ka; + private final double ka; /** Arm feedforward protobuf for serialization. */ public static final ArmFeedforwardProto proto = new ArmFeedforwardProto(); @@ -69,6 +69,42 @@ public ArmFeedforward(double ks, double kg, double kv) { this(ks, kg, kv, 0); } + /** + * Returns the static gain. + * + * @return The static gain, in volts. + */ + public double getKs() { + return ks; + } + + /** + * Returns the gravity gain. + * + * @return The gravity gain, in volts. + */ + public double getKg() { + return kg; + } + + /** + * Returns the velocity gain. + * + * @return The velocity gain, in volt seconds per radian. + */ + public double getKv() { + return kv; + } + + /** + * Returns the acceleration gain. + * + * @return The acceleration gain, in volts secondsĀ² per radian. + */ + public double getKa() { + return ka; + } + /** * Calculates the feedforward from the gains and setpoints. * diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/ElevatorFeedforward.java b/wpimath/src/main/java/edu/wpi/first/math/controller/ElevatorFeedforward.java index dc56ece26a4..0c943979c0d 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/ElevatorFeedforward.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/ElevatorFeedforward.java @@ -18,16 +18,16 @@ */ public class ElevatorFeedforward implements ProtobufSerializable, StructSerializable { /** The static gain. */ - public final double ks; + private final double ks; /** The gravity gain. */ - public final double kg; + private final double kg; /** The velocity gain. */ - public final double kv; + private final double kv; /** The acceleration gain. */ - public final double ka; + private final double ka; /** ElevatorFeedforward protobuf for serialization. */ public static final ElevatorFeedforwardProto proto = new ElevatorFeedforwardProto(); @@ -71,6 +71,42 @@ public ElevatorFeedforward(double ks, double kg, double kv) { this(ks, kg, kv, 0); } + /** + * Returns the static gain. + * + * @return The static gain. + */ + public double getKs() { + return ks; + } + + /** + * Returns the gravity gain. + * + * @return The gravity gain. + */ + public double getKg() { + return kg; + } + + /** + * Returns the velocity gain. + * + * @return The velocity gain. + */ + public double getKv() { + return kv; + } + + /** + * Returns the acceleration gain. + * + * @return The acceleration gain. + */ + public double getKa() { + return ka; + } + /** * Calculates the feedforward from the gains and setpoints. * diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/SimpleMotorFeedforward.java b/wpimath/src/main/java/edu/wpi/first/math/controller/SimpleMotorFeedforward.java index 60accdadf2b..f9f86073eeb 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/SimpleMotorFeedforward.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/SimpleMotorFeedforward.java @@ -14,16 +14,16 @@ /** A helper class that computes feedforward outputs for a simple permanent-magnet DC motor. */ public class SimpleMotorFeedforward { /** The static gain. */ - public final double ks; + private final double ks; /** The velocity gain. */ - public final double kv; + private final double kv; /** The acceleration gain. */ - public final double ka; + private final double ka; /** The period. */ - private double m_dt; + private final double m_dt; /** * Creates a new SimpleMotorFeedforward with the specified gains and period. Units of the gain @@ -80,6 +80,42 @@ public SimpleMotorFeedforward(double ks, double kv) { this(ks, kv, 0, 0.020); } + /** + * Returns the static gain. + * + * @return The static gain. + */ + public double getKs() { + return ks; + } + + /** + * Returns the velocity gain. + * + * @return The velocity gain. + */ + public double getKv() { + return kv; + } + + /** + * Returns the acceleration gain. + * + * @return The acceleration gain. + */ + public double getKa() { + return ka; + } + + /** + * Returns the period. + * + * @return The period in seconds. + */ + public double getDt() { + return m_dt; + } + /** * Calculates the feedforward from the gains and setpoints. * diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/proto/ArmFeedforwardProto.java b/wpimath/src/main/java/edu/wpi/first/math/controller/proto/ArmFeedforwardProto.java index ef3953a54d4..fe3ce5757e8 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/proto/ArmFeedforwardProto.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/proto/ArmFeedforwardProto.java @@ -32,9 +32,9 @@ public ArmFeedforward unpack(ProtobufArmFeedforward msg) { @Override public void pack(ProtobufArmFeedforward msg, ArmFeedforward value) { - msg.setKs(value.ks); - msg.setKg(value.kg); - msg.setKv(value.kv); - msg.setKa(value.ka); + msg.setKs(value.getKs()); + msg.setKg(value.getKg()); + msg.setKv(value.getKv()); + msg.setKa(value.getKa()); } } diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/proto/ElevatorFeedforwardProto.java b/wpimath/src/main/java/edu/wpi/first/math/controller/proto/ElevatorFeedforwardProto.java index 66399e1a0c2..5ccf70f669c 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/proto/ElevatorFeedforwardProto.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/proto/ElevatorFeedforwardProto.java @@ -33,9 +33,9 @@ public ElevatorFeedforward unpack(ProtobufElevatorFeedforward msg) { @Override public void pack(ProtobufElevatorFeedforward msg, ElevatorFeedforward value) { - msg.setKs(value.ks); - msg.setKg(value.kg); - msg.setKv(value.kv); - msg.setKa(value.ka); + msg.setKs(value.getKs()); + msg.setKg(value.getKg()); + msg.setKv(value.getKv()); + msg.setKa(value.getKa()); } } diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/struct/ArmFeedforwardStruct.java b/wpimath/src/main/java/edu/wpi/first/math/controller/struct/ArmFeedforwardStruct.java index de72fea1bd8..1f967bc0ac4 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/struct/ArmFeedforwardStruct.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/struct/ArmFeedforwardStruct.java @@ -40,9 +40,9 @@ public ArmFeedforward unpack(ByteBuffer bb) { @Override public void pack(ByteBuffer bb, ArmFeedforward value) { - bb.putDouble(value.ks); - bb.putDouble(value.kg); - bb.putDouble(value.kv); - bb.putDouble(value.ka); + bb.putDouble(value.getKs()); + bb.putDouble(value.getKg()); + bb.putDouble(value.getKv()); + bb.putDouble(value.getKa()); } } diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/struct/ElevatorFeedforwardStruct.java b/wpimath/src/main/java/edu/wpi/first/math/controller/struct/ElevatorFeedforwardStruct.java index f8b55595304..06e2126668a 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/struct/ElevatorFeedforwardStruct.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/struct/ElevatorFeedforwardStruct.java @@ -40,9 +40,9 @@ public ElevatorFeedforward unpack(ByteBuffer bb) { @Override public void pack(ByteBuffer bb, ElevatorFeedforward value) { - bb.putDouble(value.ks); - bb.putDouble(value.kg); - bb.putDouble(value.kv); - bb.putDouble(value.ka); + bb.putDouble(value.getKs()); + bb.putDouble(value.getKg()); + bb.putDouble(value.getKv()); + bb.putDouble(value.getKa()); } } diff --git a/wpimath/src/main/native/cpp/controller/proto/ArmFeedforwardProto.cpp b/wpimath/src/main/native/cpp/controller/proto/ArmFeedforwardProto.cpp index 8258ca337d4..2742e73f4a8 100644 --- a/wpimath/src/main/native/cpp/controller/proto/ArmFeedforwardProto.cpp +++ b/wpimath/src/main/native/cpp/controller/proto/ArmFeedforwardProto.cpp @@ -27,8 +27,8 @@ frc::ArmFeedforward wpi::Protobuf::Unpack( void wpi::Protobuf::Pack( google::protobuf::Message* msg, const frc::ArmFeedforward& value) { auto m = static_cast(msg); - m->set_ks(value.kS.value()); - m->set_kg(value.kG.value()); - m->set_kv(value.kV.value()); - m->set_ka(value.kA.value()); + m->set_ks(value.getKs().value()); + m->set_kg(value.getKg().value()); + m->set_kv(value.getKv().value()); + m->set_ka(value.getKa().value()); } diff --git a/wpimath/src/main/native/cpp/controller/proto/ElevatorFeedforwardProto.cpp b/wpimath/src/main/native/cpp/controller/proto/ElevatorFeedforwardProto.cpp index b72e9f2634b..963c7ac8d31 100644 --- a/wpimath/src/main/native/cpp/controller/proto/ElevatorFeedforwardProto.cpp +++ b/wpimath/src/main/native/cpp/controller/proto/ElevatorFeedforwardProto.cpp @@ -27,8 +27,8 @@ frc::ElevatorFeedforward wpi::Protobuf::Unpack( void wpi::Protobuf::Pack( google::protobuf::Message* msg, const frc::ElevatorFeedforward& value) { auto m = static_cast(msg); - m->set_ks(value.kS()); - m->set_kg(value.kG()); - m->set_kv(value.kV()); - m->set_ka(value.kA()); + m->set_ks(value.getKs().value()); + m->set_kg(value.getKg().value()); + m->set_kv(value.getKv().value()); + m->set_ka(value.getKa().value()); } diff --git a/wpimath/src/main/native/cpp/controller/struct/ArmFeedforwardStruct.cpp b/wpimath/src/main/native/cpp/controller/struct/ArmFeedforwardStruct.cpp index 6b0070cb1e1..27deced145f 100644 --- a/wpimath/src/main/native/cpp/controller/struct/ArmFeedforwardStruct.cpp +++ b/wpimath/src/main/native/cpp/controller/struct/ArmFeedforwardStruct.cpp @@ -26,8 +26,8 @@ frc::ArmFeedforward StructType::Unpack(std::span data) { void StructType::Pack(std::span data, const frc::ArmFeedforward& value) { - wpi::PackStruct(data, value.kS()); - wpi::PackStruct(data, value.kG()); - wpi::PackStruct(data, value.kV()); - wpi::PackStruct(data, value.kA()); + wpi::PackStruct(data, value.getKs().value()); + wpi::PackStruct(data, value.getKg().value()); + wpi::PackStruct(data, value.getKv().value()); + wpi::PackStruct(data, value.getKa().value()); } diff --git a/wpimath/src/main/native/cpp/controller/struct/ElevatorFeedforwardStruct.cpp b/wpimath/src/main/native/cpp/controller/struct/ElevatorFeedforwardStruct.cpp index ff28357bbba..0c1a0ef578b 100644 --- a/wpimath/src/main/native/cpp/controller/struct/ElevatorFeedforwardStruct.cpp +++ b/wpimath/src/main/native/cpp/controller/struct/ElevatorFeedforwardStruct.cpp @@ -26,8 +26,8 @@ frc::ElevatorFeedforward StructType::Unpack(std::span data) { void StructType::Pack(std::span data, const frc::ElevatorFeedforward& value) { - wpi::PackStruct(data, value.kS()); - wpi::PackStruct(data, value.kG()); - wpi::PackStruct(data, value.kV()); - wpi::PackStruct(data, value.kA()); + wpi::PackStruct(data, value.getKs().value()); + wpi::PackStruct(data, value.getKg().value()); + wpi::PackStruct(data, value.getKv().value()); + wpi::PackStruct(data, value.getKa().value()); } diff --git a/wpimath/src/main/native/include/frc/controller/ArmFeedforward.h b/wpimath/src/main/native/include/frc/controller/ArmFeedforward.h index 28713003c9d..cc32bfa7efa 100644 --- a/wpimath/src/main/native/include/frc/controller/ArmFeedforward.h +++ b/wpimath/src/main/native/include/frc/controller/ArmFeedforward.h @@ -192,17 +192,46 @@ class WPILIB_DLLEXPORT ArmFeedforward { return MaxAchievableAcceleration(-maxVoltage, angle, velocity); } + /** + * Returns the static gain. + * + * @return The static gain. + */ + units::volt_t getKs() const { return kS; } + + /** + * Returns the gravity gain. + * + * @return The gravity gain. + */ + units::volt_t getKg() const { return kG; } + + /** + * Returns the velocity gain. + * + * @return The velocity gain. + */ + units::unit_t getKv() const { return kV; } + + /** + * Returns the acceleration gain. + * + * @return The acceleration gain. + */ + units::unit_t getKa() const { return kA; } + + private: /// The static gain, in volts. - const units::volt_t kS; + units::volt_t kS; /// The gravity gain, in volts. - const units::volt_t kG; + units::volt_t kG; /// The velocity gain, in volt seconds per radian. - const units::unit_t kV; + units::unit_t kV; /// The acceleration gain, in volt secondsĀ² per radian. - const units::unit_t kA; + units::unit_t kA; }; } // namespace frc diff --git a/wpimath/src/main/native/include/frc/controller/ElevatorFeedforward.h b/wpimath/src/main/native/include/frc/controller/ElevatorFeedforward.h index 07a0499a53c..1a26f57c261 100644 --- a/wpimath/src/main/native/include/frc/controller/ElevatorFeedforward.h +++ b/wpimath/src/main/native/include/frc/controller/ElevatorFeedforward.h @@ -182,17 +182,46 @@ class ElevatorFeedforward { return MaxAchievableAcceleration(-maxVoltage, velocity); } + /** + * Returns the static gain. + * + * @return The static gain. + */ + units::volt_t getKs() const { return kS; } + + /** + * Returns the gravity gain. + * + * @return The gravity gain. + */ + units::volt_t getKg() const { return kG; } + + /** + * Returns the velocity gain. + * + * @return The velocity gain. + */ + units::unit_t getKv() const { return kV; } + + /** + * Returns the acceleration gain. + * + * @return The acceleration gain. + */ + units::unit_t getKa() const { return kA; } + + private: /// The static gain. - const units::volt_t kS; + units::volt_t kS; /// The gravity gain. - const units::volt_t kG; + units::volt_t kG; /// The velocity gain. - const units::unit_t kV; + units::unit_t kV; /// The acceleration gain. - const units::unit_t kA; + units::unit_t kA; }; } // namespace frc diff --git a/wpimath/src/main/native/include/frc/controller/SimpleMotorFeedforward.h b/wpimath/src/main/native/include/frc/controller/SimpleMotorFeedforward.h index 1ae1af3df35..69d474b0437 100644 --- a/wpimath/src/main/native/include/frc/controller/SimpleMotorFeedforward.h +++ b/wpimath/src/main/native/include/frc/controller/SimpleMotorFeedforward.h @@ -245,16 +245,44 @@ class SimpleMotorFeedforward { return MaxAchievableAcceleration(-maxVoltage, velocity); } + /** + * Returns the static gain. + * + * @return The static gain. + */ + units::volt_t getKs() const { return kS; } + + /** + * Returns the velocity gain. + * + * @return The velocity gain. + */ + units::unit_t getKv() const { return kV; } + + /** + * Returns the acceleration gain. + * + * @return The acceleration gain. + */ + units::unit_t getKa() const { return kA; } + + /** + * Returns the period. + * + * @return The period. + */ + units::volt_t getDt() const { return m_dt; } + + private: /** The static gain. */ - const units::volt_t kS; + units::volt_t kS; /** The velocity gain. */ - const units::unit_t kV; + units::unit_t kV; /** The acceleration gain. */ - const units::unit_t kA; + units::unit_t kA; - private: /** The period. */ units::second_t m_dt; }; diff --git a/wpimath/src/test/java/edu/wpi/first/math/controller/proto/ArmFeedforwardProtoTest.java b/wpimath/src/test/java/edu/wpi/first/math/controller/proto/ArmFeedforwardProtoTest.java index 5c036d5e5f4..b3c151476fa 100644 --- a/wpimath/src/test/java/edu/wpi/first/math/controller/proto/ArmFeedforwardProtoTest.java +++ b/wpimath/src/test/java/edu/wpi/first/math/controller/proto/ArmFeedforwardProtoTest.java @@ -19,9 +19,9 @@ void testRoundtrip() { ArmFeedforward.proto.pack(proto, DATA); ArmFeedforward data = ArmFeedforward.proto.unpack(proto); - assertEquals(DATA.ks, data.ks); - assertEquals(DATA.kg, data.kg); - assertEquals(DATA.kv, data.kv); - assertEquals(DATA.ka, data.ka); + assertEquals(DATA.getKs(), data.getKs()); + assertEquals(DATA.getKg(), data.getKg()); + assertEquals(DATA.getKv(), data.getKv()); + assertEquals(DATA.getKa(), data.getKa()); } } diff --git a/wpimath/src/test/java/edu/wpi/first/math/controller/proto/ElevatorFeedforwardProtoTest.java b/wpimath/src/test/java/edu/wpi/first/math/controller/proto/ElevatorFeedforwardProtoTest.java index e624afff74e..fd2711935e6 100644 --- a/wpimath/src/test/java/edu/wpi/first/math/controller/proto/ElevatorFeedforwardProtoTest.java +++ b/wpimath/src/test/java/edu/wpi/first/math/controller/proto/ElevatorFeedforwardProtoTest.java @@ -19,9 +19,9 @@ void testRoundtrip() { ElevatorFeedforward.proto.pack(proto, DATA); ElevatorFeedforward data = ElevatorFeedforward.proto.unpack(proto); - assertEquals(DATA.ks, data.ks); - assertEquals(DATA.kg, data.kg); - assertEquals(DATA.kv, data.kv); - assertEquals(DATA.ka, data.ka); + assertEquals(DATA.getKs(), data.getKs()); + assertEquals(DATA.getKg(), data.getKg()); + assertEquals(DATA.getKv(), data.getKv()); + assertEquals(DATA.getKa(), data.getKa()); } } diff --git a/wpimath/src/test/java/edu/wpi/first/math/controller/struct/ArmFeedforwardStructTest.java b/wpimath/src/test/java/edu/wpi/first/math/controller/struct/ArmFeedforwardStructTest.java index 42a452dbe7e..256a78d2419 100644 --- a/wpimath/src/test/java/edu/wpi/first/math/controller/struct/ArmFeedforwardStructTest.java +++ b/wpimath/src/test/java/edu/wpi/first/math/controller/struct/ArmFeedforwardStructTest.java @@ -22,9 +22,9 @@ void testRoundtrip() { buffer.rewind(); ArmFeedforward data = ArmFeedforward.struct.unpack(buffer); - assertEquals(DATA.ks, data.ks); - assertEquals(DATA.kg, data.kg); - assertEquals(DATA.kv, data.kv); - assertEquals(DATA.ka, data.ka); + assertEquals(DATA.getKs(), data.getKs()); + assertEquals(DATA.getKg(), data.getKg()); + assertEquals(DATA.getKv(), data.getKv()); + assertEquals(DATA.getKa(), data.getKa()); } } diff --git a/wpimath/src/test/java/edu/wpi/first/math/controller/struct/ElevatorFeedforwardStructTest.java b/wpimath/src/test/java/edu/wpi/first/math/controller/struct/ElevatorFeedforwardStructTest.java index a5a83520de5..53de2d1daf3 100644 --- a/wpimath/src/test/java/edu/wpi/first/math/controller/struct/ElevatorFeedforwardStructTest.java +++ b/wpimath/src/test/java/edu/wpi/first/math/controller/struct/ElevatorFeedforwardStructTest.java @@ -22,9 +22,9 @@ void testRoundtrip() { buffer.rewind(); ElevatorFeedforward data = ElevatorFeedforward.struct.unpack(buffer); - assertEquals(DATA.ks, data.ks); - assertEquals(DATA.kg, data.kg); - assertEquals(DATA.kv, data.kv); - assertEquals(DATA.ka, data.ka); + assertEquals(DATA.getKs(), data.getKs()); + assertEquals(DATA.getKg(), data.getKg()); + assertEquals(DATA.getKv(), data.getKv()); + assertEquals(DATA.getKa(), data.getKa()); } } diff --git a/wpimath/src/test/native/cpp/controller/proto/ArmFeedforwardProtoTest.cpp b/wpimath/src/test/native/cpp/controller/proto/ArmFeedforwardProtoTest.cpp index b0e57c78d29..3f15a32fc3d 100644 --- a/wpimath/src/test/native/cpp/controller/proto/ArmFeedforwardProtoTest.cpp +++ b/wpimath/src/test/native/cpp/controller/proto/ArmFeedforwardProtoTest.cpp @@ -26,8 +26,8 @@ TEST(ArmFeedforwardProtoTest, Roundtrip) { ProtoType::Pack(proto, kExpectedData); ArmFeedforward unpacked_data = ProtoType::Unpack(*proto); - EXPECT_EQ(kExpectedData.kS.value(), unpacked_data.kS.value()); - EXPECT_EQ(kExpectedData.kG.value(), unpacked_data.kG.value()); - EXPECT_EQ(kExpectedData.kV.value(), unpacked_data.kV.value()); - EXPECT_EQ(kExpectedData.kA.value(), unpacked_data.kA.value()); + EXPECT_EQ(kExpectedData.getKs().value(), unpacked_data.getKs().value()); + EXPECT_EQ(kExpectedData.getKg().value(), unpacked_data.getKg().value()); + EXPECT_EQ(kExpectedData.getKv().value(), unpacked_data.getKv().value()); + EXPECT_EQ(kExpectedData.getKa().value(), unpacked_data.getKa().value()); } diff --git a/wpimath/src/test/native/cpp/controller/proto/ElevatorFeedforwardProtoTest.cpp b/wpimath/src/test/native/cpp/controller/proto/ElevatorFeedforwardProtoTest.cpp index 115a3dcf8b6..93a17c19ec3 100644 --- a/wpimath/src/test/native/cpp/controller/proto/ElevatorFeedforwardProtoTest.cpp +++ b/wpimath/src/test/native/cpp/controller/proto/ElevatorFeedforwardProtoTest.cpp @@ -27,8 +27,8 @@ TEST(ElevatorFeedforwardProtoTest, Roundtrip) { ProtoType::Pack(proto, kExpectedData); ElevatorFeedforward unpacked_data = ProtoType::Unpack(*proto); - EXPECT_EQ(kExpectedData.kS.value(), unpacked_data.kS.value()); - EXPECT_EQ(kExpectedData.kG.value(), unpacked_data.kG.value()); - EXPECT_EQ(kExpectedData.kV.value(), unpacked_data.kV.value()); - EXPECT_EQ(kExpectedData.kA.value(), unpacked_data.kA.value()); + EXPECT_EQ(kExpectedData.getKs().value(), unpacked_data.getKs().value()); + EXPECT_EQ(kExpectedData.getKg().value(), unpacked_data.getKg().value()); + EXPECT_EQ(kExpectedData.getKv().value(), unpacked_data.getKv().value()); + EXPECT_EQ(kExpectedData.getKa().value(), unpacked_data.getKa().value()); } diff --git a/wpimath/src/test/native/cpp/controller/struct/ArmFeedforwardStructTest.cpp b/wpimath/src/test/native/cpp/controller/struct/ArmFeedforwardStructTest.cpp index a76f52585a8..62df540ac05 100644 --- a/wpimath/src/test/native/cpp/controller/struct/ArmFeedforwardStructTest.cpp +++ b/wpimath/src/test/native/cpp/controller/struct/ArmFeedforwardStructTest.cpp @@ -26,8 +26,8 @@ TEST(ArmFeedforwardStructTest, Roundtrip) { ArmFeedforward unpacked_data = StructType::Unpack(buffer); - EXPECT_EQ(kExpectedData.kS.value(), unpacked_data.kS.value()); - EXPECT_EQ(kExpectedData.kG.value(), unpacked_data.kG.value()); - EXPECT_EQ(kExpectedData.kV.value(), unpacked_data.kV.value()); - EXPECT_EQ(kExpectedData.kA.value(), unpacked_data.kA.value()); + EXPECT_EQ(kExpectedData.getKs().value(), unpacked_data.getKs().value()); + EXPECT_EQ(kExpectedData.getKg().value(), unpacked_data.getKg().value()); + EXPECT_EQ(kExpectedData.getKv().value(), unpacked_data.getKv().value()); + EXPECT_EQ(kExpectedData.getKa().value(), unpacked_data.getKa().value()); } diff --git a/wpimath/src/test/native/cpp/controller/struct/ElevatorFeedforwardStructTest.cpp b/wpimath/src/test/native/cpp/controller/struct/ElevatorFeedforwardStructTest.cpp index 2e5c43a2310..c969fd92257 100644 --- a/wpimath/src/test/native/cpp/controller/struct/ElevatorFeedforwardStructTest.cpp +++ b/wpimath/src/test/native/cpp/controller/struct/ElevatorFeedforwardStructTest.cpp @@ -27,8 +27,8 @@ TEST(ElevatorFeedforwardStructTest, Roundtrip) { ElevatorFeedforward unpacked_data = StructType::Unpack(buffer); - EXPECT_EQ(kExpectedData.kS.value(), unpacked_data.kS.value()); - EXPECT_EQ(kExpectedData.kG.value(), unpacked_data.kG.value()); - EXPECT_EQ(kExpectedData.kV.value(), unpacked_data.kV.value()); - EXPECT_EQ(kExpectedData.kA.value(), unpacked_data.kA.value()); + EXPECT_EQ(kExpectedData.getKs().value(), unpacked_data.getKs().value()); + EXPECT_EQ(kExpectedData.getKg().value(), unpacked_data.getKg().value()); + EXPECT_EQ(kExpectedData.getKv().value(), unpacked_data.getKv().value()); + EXPECT_EQ(kExpectedData.getKa().value(), unpacked_data.getKa().value()); }