mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Don't force public variables to use Hungarian notation (#8774)
People generally have expressed a dislike for the Hungarian notation used in member variables, especially in examples/templates, and our styleguide shouldn't be forced on downstream consumers, so this removes all Hungarian notation from the examples/templates. There are _some_ benefits to Hungarian for private member variables (like knowing what's a member vs. local in a PR review) so we'll keep private member variables the same for now, but public variables should no longer use Hungarian notation, since it looks much worse. A new PMD XPath rule has been added to accomplish this goal. Some other non-compliant variables were fixed for the new rule.
This commit is contained in:
@@ -18,16 +18,16 @@ public class DifferentialDriveFeedforward implements ProtobufSerializable, Struc
|
||||
private final LinearSystem<N2, N2, N2> m_plant;
|
||||
|
||||
/** The linear velocity gain in volts per (meters per second). */
|
||||
public final double m_kVLinear;
|
||||
public final double kVLinear;
|
||||
|
||||
/** The linear acceleration gain in volts per (meters per second squared). */
|
||||
public final double m_kALinear;
|
||||
public final double kALinear;
|
||||
|
||||
/** The angular velocity gain in volts per (radians per second). */
|
||||
public final double m_kVAngular;
|
||||
public final double kVAngular;
|
||||
|
||||
/** The angular acceleration gain in volts per (radians per second squared). */
|
||||
public final double m_kAAngular;
|
||||
public final double kAAngular;
|
||||
|
||||
/**
|
||||
* Creates a new DifferentialDriveFeedforward with the specified parameters.
|
||||
@@ -56,10 +56,10 @@ public class DifferentialDriveFeedforward implements ProtobufSerializable, Struc
|
||||
public DifferentialDriveFeedforward(
|
||||
double kVLinear, double kALinear, double kVAngular, double kAAngular) {
|
||||
m_plant = Models.differentialDriveFromSysId(kVLinear, kALinear, kVAngular, kAAngular);
|
||||
m_kVLinear = kVLinear;
|
||||
m_kALinear = kALinear;
|
||||
m_kVAngular = kVAngular;
|
||||
m_kAAngular = kAAngular;
|
||||
this.kVLinear = kVLinear;
|
||||
this.kALinear = kALinear;
|
||||
this.kVAngular = kVAngular;
|
||||
this.kAAngular = kAAngular;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,9 +34,9 @@ public final class DifferentialDriveFeedforwardProto
|
||||
|
||||
@Override
|
||||
public void pack(ProtobufDifferentialDriveFeedforward msg, DifferentialDriveFeedforward value) {
|
||||
msg.setKvLinear(value.m_kVLinear);
|
||||
msg.setKaLinear(value.m_kALinear);
|
||||
msg.setKvAngular(value.m_kVAngular);
|
||||
msg.setKaAngular(value.m_kAAngular);
|
||||
msg.setKvLinear(value.kVLinear);
|
||||
msg.setKaLinear(value.kALinear);
|
||||
msg.setKvAngular(value.kVAngular);
|
||||
msg.setKaAngular(value.kAAngular);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,9 +41,9 @@ public final class DifferentialDriveFeedforwardStruct
|
||||
|
||||
@Override
|
||||
public void pack(ByteBuffer bb, DifferentialDriveFeedforward value) {
|
||||
bb.putDouble(value.m_kVLinear);
|
||||
bb.putDouble(value.m_kALinear);
|
||||
bb.putDouble(value.m_kVAngular);
|
||||
bb.putDouble(value.m_kAAngular);
|
||||
bb.putDouble(value.kVLinear);
|
||||
bb.putDouble(value.kALinear);
|
||||
bb.putDouble(value.kVAngular);
|
||||
bb.putDouble(value.kAAngular);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@ bool wpi::util::Protobuf<wpi::math::DifferentialDriveFeedforward>::Pack(
|
||||
OutputStream& stream,
|
||||
const wpi::math::DifferentialDriveFeedforward& value) {
|
||||
wpi_proto_ProtobufDifferentialDriveFeedforward msg{
|
||||
.kv_linear = value.m_kVLinear.value(),
|
||||
.ka_linear = value.m_kALinear.value(),
|
||||
.kv_angular = value.m_kVAngular.value(),
|
||||
.ka_angular = value.m_kAAngular.value(),
|
||||
.kv_linear = value.kVLinear.value(),
|
||||
.ka_linear = value.kALinear.value(),
|
||||
.kv_angular = value.kVAngular.value(),
|
||||
.ka_angular = value.kAAngular.value(),
|
||||
};
|
||||
return stream.Encode(msg);
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ wpi::util::Struct<wpi::math::DifferentialDriveFeedforward>::Unpack(
|
||||
void wpi::util::Struct<wpi::math::DifferentialDriveFeedforward>::Pack(
|
||||
std::span<uint8_t> data,
|
||||
const wpi::math::DifferentialDriveFeedforward& value) {
|
||||
wpi::util::PackStruct<kKvLinearOff>(data, value.m_kVLinear.value());
|
||||
wpi::util::PackStruct<kKaLinearOff>(data, value.m_kALinear.value());
|
||||
wpi::util::PackStruct<kKvAngularOff>(data, value.m_kVAngular.value());
|
||||
wpi::util::PackStruct<kKaAngularOff>(data, value.m_kAAngular.value());
|
||||
wpi::util::PackStruct<kKvLinearOff>(data, value.kVLinear.value());
|
||||
wpi::util::PackStruct<kKaLinearOff>(data, value.kALinear.value());
|
||||
wpi::util::PackStruct<kKvAngularOff>(data, value.kVAngular.value());
|
||||
wpi::util::PackStruct<kKaAngularOff>(data, value.kAAngular.value());
|
||||
}
|
||||
|
||||
@@ -66,10 +66,10 @@ class WPILIB_DLLEXPORT DifferentialDriveFeedforward {
|
||||
decltype(1_V / 1_mps_sq) kAAngular)
|
||||
: m_plant{wpi::math::Models::DifferentialDriveFromSysId(
|
||||
kVLinear, kALinear, kVAngular, kAAngular)},
|
||||
m_kVLinear{kVLinear},
|
||||
m_kALinear{kALinear},
|
||||
m_kVAngular{kVAngular},
|
||||
m_kAAngular{kAAngular} {}
|
||||
kVLinear{kVLinear},
|
||||
kALinear{kALinear},
|
||||
kVAngular{kVAngular},
|
||||
kAAngular{kAAngular} {}
|
||||
|
||||
/**
|
||||
* Calculates the differential drive feedforward inputs given velocity
|
||||
@@ -92,10 +92,10 @@ class WPILIB_DLLEXPORT DifferentialDriveFeedforward {
|
||||
wpi::units::meters_per_second_t nextRightVelocity,
|
||||
wpi::units::second_t dt);
|
||||
|
||||
decltype(1_V / 1_mps) m_kVLinear;
|
||||
decltype(1_V / 1_mps_sq) m_kALinear;
|
||||
decltype(1_V / 1_mps) m_kVAngular;
|
||||
decltype(1_V / 1_mps_sq) m_kAAngular;
|
||||
decltype(1_V / 1_mps) kVLinear;
|
||||
decltype(1_V / 1_mps_sq) kALinear;
|
||||
decltype(1_V / 1_mps) kVAngular;
|
||||
decltype(1_V / 1_mps_sq) kAAngular;
|
||||
};
|
||||
} // namespace wpi::math
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ classes:
|
||||
- wpi::units::radians_per_second_squared
|
||||
- wpi::units::compound_unit
|
||||
attributes:
|
||||
m_kVLinear:
|
||||
m_kALinear:
|
||||
m_kVAngular:
|
||||
m_kAAngular:
|
||||
kVLinear:
|
||||
kALinear:
|
||||
kVAngular:
|
||||
kAAngular:
|
||||
methods:
|
||||
DifferentialDriveFeedforward:
|
||||
overloads:
|
||||
|
||||
@@ -22,9 +22,9 @@ class DifferentialDriveFeedforwardProtoTest
|
||||
@Override
|
||||
public void checkEquals(
|
||||
DifferentialDriveFeedforward testData, DifferentialDriveFeedforward data) {
|
||||
assertEquals(testData.m_kVLinear, data.m_kVLinear);
|
||||
assertEquals(testData.m_kALinear, data.m_kALinear);
|
||||
assertEquals(testData.m_kVAngular, data.m_kVAngular);
|
||||
assertEquals(testData.m_kAAngular, data.m_kAAngular);
|
||||
assertEquals(testData.kVLinear, data.kVLinear);
|
||||
assertEquals(testData.kALinear, data.kALinear);
|
||||
assertEquals(testData.kVAngular, data.kVAngular);
|
||||
assertEquals(testData.kAAngular, data.kAAngular);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ class DifferentialDriveFeedforwardStructTest extends StructTestBase<Differential
|
||||
@Override
|
||||
public void checkEquals(
|
||||
DifferentialDriveFeedforward testData, DifferentialDriveFeedforward data) {
|
||||
assertEquals(testData.m_kVLinear, data.m_kVLinear);
|
||||
assertEquals(testData.m_kALinear, data.m_kALinear);
|
||||
assertEquals(testData.m_kVAngular, data.m_kVAngular);
|
||||
assertEquals(testData.m_kAAngular, data.m_kAAngular);
|
||||
assertEquals(testData.kVLinear, data.kVLinear);
|
||||
assertEquals(testData.kALinear, data.kALinear);
|
||||
assertEquals(testData.kVAngular, data.kVAngular);
|
||||
assertEquals(testData.kAAngular, data.kAAngular);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ struct DifferentialDriveFeedforwardProtoTestData {
|
||||
decltype(1_V / 1_mps){4.4}, decltype(1_V / 1_mps_sq){4.5}};
|
||||
|
||||
static void CheckEq(const Type& testData, const Type& data) {
|
||||
EXPECT_EQ(testData.m_kVLinear.value(), data.m_kVLinear.value());
|
||||
EXPECT_EQ(testData.m_kALinear.value(), data.m_kALinear.value());
|
||||
EXPECT_EQ(testData.m_kVAngular.value(), data.m_kVAngular.value());
|
||||
EXPECT_EQ(testData.m_kAAngular.value(), data.m_kAAngular.value());
|
||||
EXPECT_EQ(testData.kVLinear.value(), data.kVLinear.value());
|
||||
EXPECT_EQ(testData.kALinear.value(), data.kALinear.value());
|
||||
EXPECT_EQ(testData.kVAngular.value(), data.kVAngular.value());
|
||||
EXPECT_EQ(testData.kAAngular.value(), data.kAAngular.value());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -17,10 +17,10 @@ struct DifferentialDriveFeedforwardStructTestData {
|
||||
decltype(1_V / 1_mps){4.4}, decltype(1_V / 1_mps_sq){4.5}};
|
||||
|
||||
static void CheckEq(const Type& testData, const Type& data) {
|
||||
EXPECT_EQ(testData.m_kVLinear.value(), data.m_kVLinear.value());
|
||||
EXPECT_EQ(testData.m_kALinear.value(), data.m_kALinear.value());
|
||||
EXPECT_EQ(testData.m_kVAngular.value(), data.m_kVAngular.value());
|
||||
EXPECT_EQ(testData.m_kAAngular.value(), data.m_kAAngular.value());
|
||||
EXPECT_EQ(testData.kVLinear.value(), data.kVLinear.value());
|
||||
EXPECT_EQ(testData.kALinear.value(), data.kALinear.value());
|
||||
EXPECT_EQ(testData.kVAngular.value(), data.kVAngular.value());
|
||||
EXPECT_EQ(testData.kAAngular.value(), data.kAAngular.value());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user