SCRIPT namespace replacements

This commit is contained in:
PJ Reiniger
2025-11-07 20:00:05 -05:00
committed by Peter Johnson
parent ae6c043632
commit 9aca8e0fd6
2622 changed files with 22275 additions and 22275 deletions

View File

@@ -6,11 +6,11 @@
#include "wpi/math/util/MathShared.hpp"
using namespace frc;
using namespace wpi::math;
DifferentialDriveOdometry::DifferentialDriveOdometry(
const Rotation2d& gyroAngle, units::meter_t leftDistance,
units::meter_t rightDistance, const Pose2d& initialPose)
const Rotation2d& gyroAngle, wpi::units::meter_t leftDistance,
wpi::units::meter_t rightDistance, const Pose2d& initialPose)
: Odometry(m_kinematicsImpl, gyroAngle, {leftDistance, rightDistance},
initialPose) {
wpi::math::MathSharedStore::ReportUsage("DifferentialDriveOdometry", "");

View File

@@ -6,11 +6,11 @@
#include "wpi/math/util/MathShared.hpp"
using namespace frc;
using namespace wpi::math;
DifferentialDriveOdometry3d::DifferentialDriveOdometry3d(
const Rotation3d& gyroAngle, units::meter_t leftDistance,
units::meter_t rightDistance, const Pose3d& initialPose)
const Rotation3d& gyroAngle, wpi::units::meter_t leftDistance,
wpi::units::meter_t rightDistance, const Pose3d& initialPose)
: Odometry3d(m_kinematicsImpl, gyroAngle, {leftDistance, rightDistance},
initialPose) {
wpi::math::MathSharedStore::ReportUsage("DifferentialDriveOdometry3d", "");

View File

@@ -4,7 +4,7 @@
#include "wpi/math/kinematics/MecanumDriveKinematics.hpp"
using namespace frc;
using namespace wpi::math;
MecanumDriveWheelSpeeds MecanumDriveKinematics::ToWheelSpeeds(
const ChassisSpeeds& chassisSpeeds,
@@ -28,10 +28,10 @@ MecanumDriveWheelSpeeds MecanumDriveKinematics::ToWheelSpeeds(
Eigen::Vector4d wheelsVector = m_inverseKinematics * chassisSpeedsVector;
MecanumDriveWheelSpeeds wheelSpeeds;
wheelSpeeds.frontLeft = units::meters_per_second_t{wheelsVector(0)};
wheelSpeeds.frontRight = units::meters_per_second_t{wheelsVector(1)};
wheelSpeeds.rearLeft = units::meters_per_second_t{wheelsVector(2)};
wheelSpeeds.rearRight = units::meters_per_second_t{wheelsVector(3)};
wheelSpeeds.frontLeft = wpi::units::meters_per_second_t{wheelsVector(0)};
wheelSpeeds.frontRight = wpi::units::meters_per_second_t{wheelsVector(1)};
wheelSpeeds.rearLeft = wpi::units::meters_per_second_t{wheelsVector(2)};
wheelSpeeds.rearRight = wpi::units::meters_per_second_t{wheelsVector(3)};
return wheelSpeeds;
}
@@ -44,9 +44,9 @@ ChassisSpeeds MecanumDriveKinematics::ToChassisSpeeds(
Eigen::Vector3d chassisSpeedsVector =
m_forwardKinematics.solve(wheelSpeedsVector);
return {units::meters_per_second_t{chassisSpeedsVector(0)}, // NOLINT
units::meters_per_second_t{chassisSpeedsVector(1)},
units::radians_per_second_t{chassisSpeedsVector(2)}};
return {wpi::units::meters_per_second_t{chassisSpeedsVector(0)}, // NOLINT
wpi::units::meters_per_second_t{chassisSpeedsVector(1)},
wpi::units::radians_per_second_t{chassisSpeedsVector(2)}};
}
Twist2d MecanumDriveKinematics::ToTwist2d(
@@ -60,8 +60,8 @@ Twist2d MecanumDriveKinematics::ToTwist2d(
Eigen::Vector3d twistVector = m_forwardKinematics.solve(wheelDeltasVector);
return {units::meter_t{twistVector(0)}, units::meter_t{twistVector(1)},
units::radian_t{twistVector(2)}};
return {wpi::units::meter_t{twistVector(0)}, wpi::units::meter_t{twistVector(1)},
wpi::units::radian_t{twistVector(2)}};
}
Twist2d MecanumDriveKinematics::ToTwist2d(
@@ -72,8 +72,8 @@ Twist2d MecanumDriveKinematics::ToTwist2d(
Eigen::Vector3d twistVector = m_forwardKinematics.solve(wheelDeltasVector);
return {units::meter_t{twistVector(0)}, units::meter_t{twistVector(1)},
units::radian_t{twistVector(2)}};
return {wpi::units::meter_t{twistVector(0)}, wpi::units::meter_t{twistVector(1)},
wpi::units::radian_t{twistVector(2)}};
}
void MecanumDriveKinematics::SetInverseKinematics(Translation2d fl,

View File

@@ -6,7 +6,7 @@
#include "wpi/math/util/MathShared.hpp"
using namespace frc;
using namespace wpi::math;
MecanumDriveOdometry::MecanumDriveOdometry(
MecanumDriveKinematics kinematics, const Rotation2d& gyroAngle,

View File

@@ -6,7 +6,7 @@
#include "wpi/math/util/MathShared.hpp"
using namespace frc;
using namespace wpi::math;
MecanumDriveOdometry3d::MecanumDriveOdometry3d(
MecanumDriveKinematics kinematics, const Rotation3d& gyroAngle,

View File

@@ -4,9 +4,9 @@
#include "wpi/math/kinematics/SwerveDriveKinematics.hpp"
namespace frc {
namespace wpi::math {
template class EXPORT_TEMPLATE_DEFINE(WPILIB_DLLEXPORT)
SwerveDriveKinematics<4>;
} // namespace frc
} // namespace wpi::math

View File

@@ -4,8 +4,8 @@
#include "wpi/math/kinematics/SwerveDriveOdometry.hpp"
namespace frc {
namespace wpi::math {
template class EXPORT_TEMPLATE_DEFINE(WPILIB_DLLEXPORT) SwerveDriveOdometry<4>;
} // namespace frc
} // namespace wpi::math

View File

@@ -4,9 +4,9 @@
#include "wpi/math/kinematics/SwerveDriveOdometry3d.hpp"
namespace frc {
namespace wpi::math {
template class EXPORT_TEMPLATE_DEFINE(WPILIB_DLLEXPORT)
SwerveDriveOdometry3d<4>;
} // namespace frc
} // namespace wpi::math

View File

@@ -6,22 +6,22 @@
#include "wpimath/protobuf/kinematics.npb.h"
std::optional<frc::ChassisSpeeds> wpi::Protobuf<frc::ChassisSpeeds>::Unpack(
std::optional<wpi::math::ChassisSpeeds> wpi::util::Protobuf<wpi::math::ChassisSpeeds>::Unpack(
InputStream& stream) {
wpi_proto_ProtobufChassisSpeeds msg;
if (!stream.Decode(msg)) {
return {};
}
return frc::ChassisSpeeds{
units::meters_per_second_t{msg.vx},
units::meters_per_second_t{msg.vy},
units::radians_per_second_t{msg.omega},
return wpi::math::ChassisSpeeds{
wpi::units::meters_per_second_t{msg.vx},
wpi::units::meters_per_second_t{msg.vy},
wpi::units::radians_per_second_t{msg.omega},
};
}
bool wpi::Protobuf<frc::ChassisSpeeds>::Pack(OutputStream& stream,
const frc::ChassisSpeeds& value) {
bool wpi::util::Protobuf<wpi::math::ChassisSpeeds>::Pack(OutputStream& stream,
const wpi::math::ChassisSpeeds& value) {
wpi_proto_ProtobufChassisSpeeds msg{
.vx = value.vx.value(),
.vy = value.vy.value(),

View File

@@ -6,20 +6,20 @@
#include "wpimath/protobuf/kinematics.npb.h"
std::optional<frc::DifferentialDriveKinematics>
wpi::Protobuf<frc::DifferentialDriveKinematics>::Unpack(InputStream& stream) {
std::optional<wpi::math::DifferentialDriveKinematics>
wpi::util::Protobuf<wpi::math::DifferentialDriveKinematics>::Unpack(InputStream& stream) {
wpi_proto_ProtobufDifferentialDriveKinematics msg;
if (!stream.Decode(msg)) {
return {};
}
return frc::DifferentialDriveKinematics{
units::meter_t{msg.trackwidth},
return wpi::math::DifferentialDriveKinematics{
wpi::units::meter_t{msg.trackwidth},
};
}
bool wpi::Protobuf<frc::DifferentialDriveKinematics>::Pack(
OutputStream& stream, const frc::DifferentialDriveKinematics& value) {
bool wpi::util::Protobuf<wpi::math::DifferentialDriveKinematics>::Pack(
OutputStream& stream, const wpi::math::DifferentialDriveKinematics& value) {
wpi_proto_ProtobufDifferentialDriveKinematics msg{
.trackwidth = value.trackwidth.value(),
};

View File

@@ -6,21 +6,21 @@
#include "wpimath/protobuf/kinematics.npb.h"
std::optional<frc::DifferentialDriveWheelPositions> wpi::Protobuf<
frc::DifferentialDriveWheelPositions>::Unpack(InputStream& stream) {
std::optional<wpi::math::DifferentialDriveWheelPositions> wpi::util::Protobuf<
wpi::math::DifferentialDriveWheelPositions>::Unpack(InputStream& stream) {
wpi_proto_ProtobufDifferentialDriveWheelPositions msg;
if (!stream.Decode(msg)) {
return {};
}
return frc::DifferentialDriveWheelPositions{
units::meter_t{msg.left},
units::meter_t{msg.right},
return wpi::math::DifferentialDriveWheelPositions{
wpi::units::meter_t{msg.left},
wpi::units::meter_t{msg.right},
};
}
bool wpi::Protobuf<frc::DifferentialDriveWheelPositions>::Pack(
OutputStream& stream, const frc::DifferentialDriveWheelPositions& value) {
bool wpi::util::Protobuf<wpi::math::DifferentialDriveWheelPositions>::Pack(
OutputStream& stream, const wpi::math::DifferentialDriveWheelPositions& value) {
wpi_proto_ProtobufDifferentialDriveWheelPositions msg{
.left = value.left.value(),
.right = value.right.value(),

View File

@@ -6,21 +6,21 @@
#include "wpimath/protobuf/kinematics.npb.h"
std::optional<frc::DifferentialDriveWheelSpeeds>
wpi::Protobuf<frc::DifferentialDriveWheelSpeeds>::Unpack(InputStream& stream) {
std::optional<wpi::math::DifferentialDriveWheelSpeeds>
wpi::util::Protobuf<wpi::math::DifferentialDriveWheelSpeeds>::Unpack(InputStream& stream) {
wpi_proto_ProtobufDifferentialDriveWheelSpeeds msg;
if (!stream.Decode(msg)) {
return {};
}
return frc::DifferentialDriveWheelSpeeds{
units::meters_per_second_t{msg.left},
units::meters_per_second_t{msg.right},
return wpi::math::DifferentialDriveWheelSpeeds{
wpi::units::meters_per_second_t{msg.left},
wpi::units::meters_per_second_t{msg.right},
};
}
bool wpi::Protobuf<frc::DifferentialDriveWheelSpeeds>::Pack(
OutputStream& stream, const frc::DifferentialDriveWheelSpeeds& value) {
bool wpi::util::Protobuf<wpi::math::DifferentialDriveWheelSpeeds>::Pack(
OutputStream& stream, const wpi::math::DifferentialDriveWheelSpeeds& value) {
wpi_proto_ProtobufDifferentialDriveWheelSpeeds msg{
.left = value.left.value(),
.right = value.right.value(),

View File

@@ -7,12 +7,12 @@
#include "wpi/util/protobuf/ProtobufCallbacks.hpp"
#include "wpimath/protobuf/kinematics.npb.h"
std::optional<frc::MecanumDriveKinematics>
wpi::Protobuf<frc::MecanumDriveKinematics>::Unpack(InputStream& stream) {
wpi::UnpackCallback<frc::Translation2d> frontLeft;
wpi::UnpackCallback<frc::Translation2d> frontRight;
wpi::UnpackCallback<frc::Translation2d> rearLeft;
wpi::UnpackCallback<frc::Translation2d> rearRight;
std::optional<wpi::math::MecanumDriveKinematics>
wpi::util::Protobuf<wpi::math::MecanumDriveKinematics>::Unpack(InputStream& stream) {
wpi::util::UnpackCallback<wpi::math::Translation2d> frontLeft;
wpi::util::UnpackCallback<wpi::math::Translation2d> frontRight;
wpi::util::UnpackCallback<wpi::math::Translation2d> rearLeft;
wpi::util::UnpackCallback<wpi::math::Translation2d> rearRight;
wpi_proto_ProtobufMecanumDriveKinematics msg{
.front_left = frontLeft.Callback(),
.front_right = frontRight.Callback(),
@@ -33,7 +33,7 @@ wpi::Protobuf<frc::MecanumDriveKinematics>::Unpack(InputStream& stream) {
return {};
}
return frc::MecanumDriveKinematics{
return wpi::math::MecanumDriveKinematics{
ifrontLeft[0],
ifrontRight[0],
irearLeft[0],
@@ -41,12 +41,12 @@ wpi::Protobuf<frc::MecanumDriveKinematics>::Unpack(InputStream& stream) {
};
}
bool wpi::Protobuf<frc::MecanumDriveKinematics>::Pack(
OutputStream& stream, const frc::MecanumDriveKinematics& value) {
wpi::PackCallback frontLeft{&value.GetFrontLeft()};
wpi::PackCallback frontRight{&value.GetFrontRight()};
wpi::PackCallback rearLeft{&value.GetRearLeft()};
wpi::PackCallback rearRight{&value.GetRearRight()};
bool wpi::util::Protobuf<wpi::math::MecanumDriveKinematics>::Pack(
OutputStream& stream, const wpi::math::MecanumDriveKinematics& value) {
wpi::util::PackCallback frontLeft{&value.GetFrontLeft()};
wpi::util::PackCallback frontRight{&value.GetFrontRight()};
wpi::util::PackCallback rearLeft{&value.GetRearLeft()};
wpi::util::PackCallback rearRight{&value.GetRearRight()};
wpi_proto_ProtobufMecanumDriveKinematics msg{
.front_left = frontLeft.Callback(),
.front_right = frontRight.Callback(),

View File

@@ -6,23 +6,23 @@
#include "wpimath/protobuf/kinematics.npb.h"
std::optional<frc::MecanumDriveWheelPositions>
wpi::Protobuf<frc::MecanumDriveWheelPositions>::Unpack(InputStream& stream) {
std::optional<wpi::math::MecanumDriveWheelPositions>
wpi::util::Protobuf<wpi::math::MecanumDriveWheelPositions>::Unpack(InputStream& stream) {
wpi_proto_ProtobufMecanumDriveWheelPositions msg;
if (!stream.Decode(msg)) {
return {};
}
return frc::MecanumDriveWheelPositions{
units::meter_t{msg.front_left},
units::meter_t{msg.front_right},
units::meter_t{msg.rear_left},
units::meter_t{msg.rear_right},
return wpi::math::MecanumDriveWheelPositions{
wpi::units::meter_t{msg.front_left},
wpi::units::meter_t{msg.front_right},
wpi::units::meter_t{msg.rear_left},
wpi::units::meter_t{msg.rear_right},
};
}
bool wpi::Protobuf<frc::MecanumDriveWheelPositions>::Pack(
OutputStream& stream, const frc::MecanumDriveWheelPositions& value) {
bool wpi::util::Protobuf<wpi::math::MecanumDriveWheelPositions>::Pack(
OutputStream& stream, const wpi::math::MecanumDriveWheelPositions& value) {
wpi_proto_ProtobufMecanumDriveWheelPositions msg{
.front_left = value.frontLeft.value(),
.front_right = value.frontRight.value(),

View File

@@ -6,23 +6,23 @@
#include "wpimath/protobuf/kinematics.npb.h"
std::optional<frc::MecanumDriveWheelSpeeds>
wpi::Protobuf<frc::MecanumDriveWheelSpeeds>::Unpack(InputStream& stream) {
std::optional<wpi::math::MecanumDriveWheelSpeeds>
wpi::util::Protobuf<wpi::math::MecanumDriveWheelSpeeds>::Unpack(InputStream& stream) {
wpi_proto_ProtobufMecanumDriveWheelSpeeds msg;
if (!stream.Decode(msg)) {
return {};
}
return frc::MecanumDriveWheelSpeeds{
units::meters_per_second_t{msg.front_left},
units::meters_per_second_t{msg.front_right},
units::meters_per_second_t{msg.rear_left},
units::meters_per_second_t{msg.rear_right},
return wpi::math::MecanumDriveWheelSpeeds{
wpi::units::meters_per_second_t{msg.front_left},
wpi::units::meters_per_second_t{msg.front_right},
wpi::units::meters_per_second_t{msg.rear_left},
wpi::units::meters_per_second_t{msg.rear_right},
};
}
bool wpi::Protobuf<frc::MecanumDriveWheelSpeeds>::Pack(
OutputStream& stream, const frc::MecanumDriveWheelSpeeds& value) {
bool wpi::util::Protobuf<wpi::math::MecanumDriveWheelSpeeds>::Pack(
OutputStream& stream, const wpi::math::MecanumDriveWheelSpeeds& value) {
wpi_proto_ProtobufMecanumDriveWheelSpeeds msg{
.front_left = value.frontLeft.value(),
.front_right = value.frontRight.value(),

View File

@@ -7,9 +7,9 @@
#include "wpi/util/protobuf/ProtobufCallbacks.hpp"
#include "wpimath/protobuf/kinematics.npb.h"
std::optional<frc::SwerveModulePosition>
wpi::Protobuf<frc::SwerveModulePosition>::Unpack(InputStream& stream) {
wpi::UnpackCallback<frc::Rotation2d> angle;
std::optional<wpi::math::SwerveModulePosition>
wpi::util::Protobuf<wpi::math::SwerveModulePosition>::Unpack(InputStream& stream) {
wpi::util::UnpackCallback<wpi::math::Rotation2d> angle;
wpi_proto_ProtobufSwerveModulePosition msg{
.distance = 0,
.angle = angle.Callback(),
@@ -24,15 +24,15 @@ wpi::Protobuf<frc::SwerveModulePosition>::Unpack(InputStream& stream) {
return {};
}
return frc::SwerveModulePosition{
units::meter_t{msg.distance},
return wpi::math::SwerveModulePosition{
wpi::units::meter_t{msg.distance},
iangle[0],
};
}
bool wpi::Protobuf<frc::SwerveModulePosition>::Pack(
OutputStream& stream, const frc::SwerveModulePosition& value) {
wpi::PackCallback angle{&value.angle};
bool wpi::util::Protobuf<wpi::math::SwerveModulePosition>::Pack(
OutputStream& stream, const wpi::math::SwerveModulePosition& value) {
wpi::util::PackCallback angle{&value.angle};
wpi_proto_ProtobufSwerveModulePosition msg{
.distance = value.distance.value(),
.angle = angle.Callback(),

View File

@@ -7,9 +7,9 @@
#include "wpi/util/protobuf/ProtobufCallbacks.hpp"
#include "wpimath/protobuf/kinematics.npb.h"
std::optional<frc::SwerveModuleState>
wpi::Protobuf<frc::SwerveModuleState>::Unpack(InputStream& stream) {
wpi::UnpackCallback<frc::Rotation2d> angle;
std::optional<wpi::math::SwerveModuleState>
wpi::util::Protobuf<wpi::math::SwerveModuleState>::Unpack(InputStream& stream) {
wpi::util::UnpackCallback<wpi::math::Rotation2d> angle;
wpi_proto_ProtobufSwerveModuleState msg{
.speed = 0,
.angle = angle.Callback(),
@@ -24,15 +24,15 @@ wpi::Protobuf<frc::SwerveModuleState>::Unpack(InputStream& stream) {
return {};
}
return frc::SwerveModuleState{
units::meters_per_second_t{msg.speed},
return wpi::math::SwerveModuleState{
wpi::units::meters_per_second_t{msg.speed},
iangle[0],
};
}
bool wpi::Protobuf<frc::SwerveModuleState>::Pack(
OutputStream& stream, const frc::SwerveModuleState& value) {
wpi::PackCallback angle{&value.angle};
bool wpi::util::Protobuf<wpi::math::SwerveModuleState>::Pack(
OutputStream& stream, const wpi::math::SwerveModuleState& value) {
wpi::util::PackCallback angle{&value.angle};
wpi_proto_ProtobufSwerveModuleState msg{
.speed = value.speed.value(),
.angle = angle.Callback(),

View File

@@ -10,19 +10,19 @@ constexpr size_t kVyOff = kVxOff + 8;
constexpr size_t kOmegaOff = kVyOff + 8;
} // namespace
using StructType = wpi::Struct<frc::ChassisSpeeds>;
using StructType = wpi::util::Struct<wpi::math::ChassisSpeeds>;
frc::ChassisSpeeds StructType::Unpack(std::span<const uint8_t> data) {
return frc::ChassisSpeeds{
units::meters_per_second_t{wpi::UnpackStruct<double, kVxOff>(data)},
units::meters_per_second_t{wpi::UnpackStruct<double, kVyOff>(data)},
units::radians_per_second_t{wpi::UnpackStruct<double, kOmegaOff>(data)},
wpi::math::ChassisSpeeds StructType::Unpack(std::span<const uint8_t> data) {
return wpi::math::ChassisSpeeds{
wpi::units::meters_per_second_t{wpi::util::UnpackStruct<double, kVxOff>(data)},
wpi::units::meters_per_second_t{wpi::util::UnpackStruct<double, kVyOff>(data)},
wpi::units::radians_per_second_t{wpi::util::UnpackStruct<double, kOmegaOff>(data)},
};
}
void StructType::Pack(std::span<uint8_t> data,
const frc::ChassisSpeeds& value) {
wpi::PackStruct<kVxOff>(data, value.vx.value());
wpi::PackStruct<kVyOff>(data, value.vy.value());
wpi::PackStruct<kOmegaOff>(data, value.omega.value());
const wpi::math::ChassisSpeeds& value) {
wpi::util::PackStruct<kVxOff>(data, value.vx.value());
wpi::util::PackStruct<kVyOff>(data, value.vy.value());
wpi::util::PackStruct<kOmegaOff>(data, value.omega.value());
}

View File

@@ -8,16 +8,16 @@ namespace {
constexpr size_t kTrackwidthOff = 0;
} // namespace
using StructType = wpi::Struct<frc::DifferentialDriveKinematics>;
using StructType = wpi::util::Struct<wpi::math::DifferentialDriveKinematics>;
frc::DifferentialDriveKinematics StructType::Unpack(
wpi::math::DifferentialDriveKinematics StructType::Unpack(
std::span<const uint8_t> data) {
return frc::DifferentialDriveKinematics{
units::meter_t{wpi::UnpackStruct<double, kTrackwidthOff>(data)},
return wpi::math::DifferentialDriveKinematics{
wpi::units::meter_t{wpi::util::UnpackStruct<double, kTrackwidthOff>(data)},
};
}
void StructType::Pack(std::span<uint8_t> data,
const frc::DifferentialDriveKinematics& value) {
wpi::PackStruct<kTrackwidthOff>(data, value.trackwidth.value());
const wpi::math::DifferentialDriveKinematics& value) {
wpi::util::PackStruct<kTrackwidthOff>(data, value.trackwidth.value());
}

View File

@@ -9,18 +9,18 @@ constexpr size_t kLeftOff = 0;
constexpr size_t kRightOff = kLeftOff + 8;
} // namespace
using StructType = wpi::Struct<frc::DifferentialDriveWheelPositions>;
using StructType = wpi::util::Struct<wpi::math::DifferentialDriveWheelPositions>;
frc::DifferentialDriveWheelPositions StructType::Unpack(
wpi::math::DifferentialDriveWheelPositions StructType::Unpack(
std::span<const uint8_t> data) {
return frc::DifferentialDriveWheelPositions{
units::meter_t{wpi::UnpackStruct<double, kLeftOff>(data)},
units::meter_t{wpi::UnpackStruct<double, kRightOff>(data)},
return wpi::math::DifferentialDriveWheelPositions{
wpi::units::meter_t{wpi::util::UnpackStruct<double, kLeftOff>(data)},
wpi::units::meter_t{wpi::util::UnpackStruct<double, kRightOff>(data)},
};
}
void StructType::Pack(std::span<uint8_t> data,
const frc::DifferentialDriveWheelPositions& value) {
wpi::PackStruct<kLeftOff>(data, value.left.value());
wpi::PackStruct<kRightOff>(data, value.right.value());
const wpi::math::DifferentialDriveWheelPositions& value) {
wpi::util::PackStruct<kLeftOff>(data, value.left.value());
wpi::util::PackStruct<kRightOff>(data, value.right.value());
}

View File

@@ -9,18 +9,18 @@ constexpr size_t kLeftOff = 0;
constexpr size_t kRightOff = kLeftOff + 8;
} // namespace
using StructType = wpi::Struct<frc::DifferentialDriveWheelSpeeds>;
using StructType = wpi::util::Struct<wpi::math::DifferentialDriveWheelSpeeds>;
frc::DifferentialDriveWheelSpeeds StructType::Unpack(
wpi::math::DifferentialDriveWheelSpeeds StructType::Unpack(
std::span<const uint8_t> data) {
return frc::DifferentialDriveWheelSpeeds{
units::meters_per_second_t{wpi::UnpackStruct<double, kLeftOff>(data)},
units::meters_per_second_t{wpi::UnpackStruct<double, kRightOff>(data)},
return wpi::math::DifferentialDriveWheelSpeeds{
wpi::units::meters_per_second_t{wpi::util::UnpackStruct<double, kLeftOff>(data)},
wpi::units::meters_per_second_t{wpi::util::UnpackStruct<double, kRightOff>(data)},
};
}
void StructType::Pack(std::span<uint8_t> data,
const frc::DifferentialDriveWheelSpeeds& value) {
wpi::PackStruct<kLeftOff>(data, value.left.value());
wpi::PackStruct<kRightOff>(data, value.right.value());
const wpi::math::DifferentialDriveWheelSpeeds& value) {
wpi::util::PackStruct<kLeftOff>(data, value.left.value());
wpi::util::PackStruct<kRightOff>(data, value.right.value());
}

View File

@@ -7,28 +7,28 @@
namespace {
constexpr size_t kFrontLeftOff = 0;
constexpr size_t kFrontRightOff =
kFrontLeftOff + wpi::GetStructSize<frc::Translation2d>();
kFrontLeftOff + wpi::util::GetStructSize<wpi::math::Translation2d>();
constexpr size_t kRearLeftOff =
kFrontRightOff + wpi::GetStructSize<frc::Translation2d>();
kFrontRightOff + wpi::util::GetStructSize<wpi::math::Translation2d>();
constexpr size_t kRearRightOff =
kRearLeftOff + wpi::GetStructSize<frc::Translation2d>();
kRearLeftOff + wpi::util::GetStructSize<wpi::math::Translation2d>();
} // namespace
using StructType = wpi::Struct<frc::MecanumDriveKinematics>;
using StructType = wpi::util::Struct<wpi::math::MecanumDriveKinematics>;
frc::MecanumDriveKinematics StructType::Unpack(std::span<const uint8_t> data) {
return frc::MecanumDriveKinematics{
wpi::UnpackStruct<frc::Translation2d, kFrontLeftOff>(data),
wpi::UnpackStruct<frc::Translation2d, kFrontRightOff>(data),
wpi::UnpackStruct<frc::Translation2d, kRearLeftOff>(data),
wpi::UnpackStruct<frc::Translation2d, kRearRightOff>(data),
wpi::math::MecanumDriveKinematics StructType::Unpack(std::span<const uint8_t> data) {
return wpi::math::MecanumDriveKinematics{
wpi::util::UnpackStruct<wpi::math::Translation2d, kFrontLeftOff>(data),
wpi::util::UnpackStruct<wpi::math::Translation2d, kFrontRightOff>(data),
wpi::util::UnpackStruct<wpi::math::Translation2d, kRearLeftOff>(data),
wpi::util::UnpackStruct<wpi::math::Translation2d, kRearRightOff>(data),
};
}
void StructType::Pack(std::span<uint8_t> data,
const frc::MecanumDriveKinematics& value) {
wpi::PackStruct<kFrontLeftOff>(data, value.GetFrontLeft());
wpi::PackStruct<kFrontRightOff>(data, value.GetFrontRight());
wpi::PackStruct<kRearLeftOff>(data, value.GetRearLeft());
wpi::PackStruct<kRearRightOff>(data, value.GetRearRight());
const wpi::math::MecanumDriveKinematics& value) {
wpi::util::PackStruct<kFrontLeftOff>(data, value.GetFrontLeft());
wpi::util::PackStruct<kFrontRightOff>(data, value.GetFrontRight());
wpi::util::PackStruct<kRearLeftOff>(data, value.GetRearLeft());
wpi::util::PackStruct<kRearRightOff>(data, value.GetRearRight());
}

View File

@@ -11,22 +11,22 @@ constexpr size_t kRearLeftOff = kFrontRightOff + 8;
constexpr size_t kRearRightOff = kRearLeftOff + 8;
} // namespace
using StructType = wpi::Struct<frc::MecanumDriveWheelPositions>;
using StructType = wpi::util::Struct<wpi::math::MecanumDriveWheelPositions>;
frc::MecanumDriveWheelPositions StructType::Unpack(
wpi::math::MecanumDriveWheelPositions StructType::Unpack(
std::span<const uint8_t> data) {
return frc::MecanumDriveWheelPositions{
units::meter_t{wpi::UnpackStruct<double, kFrontLeftOff>(data)},
units::meter_t{wpi::UnpackStruct<double, kFrontRightOff>(data)},
units::meter_t{wpi::UnpackStruct<double, kRearLeftOff>(data)},
units::meter_t{wpi::UnpackStruct<double, kRearRightOff>(data)},
return wpi::math::MecanumDriveWheelPositions{
wpi::units::meter_t{wpi::util::UnpackStruct<double, kFrontLeftOff>(data)},
wpi::units::meter_t{wpi::util::UnpackStruct<double, kFrontRightOff>(data)},
wpi::units::meter_t{wpi::util::UnpackStruct<double, kRearLeftOff>(data)},
wpi::units::meter_t{wpi::util::UnpackStruct<double, kRearRightOff>(data)},
};
}
void StructType::Pack(std::span<uint8_t> data,
const frc::MecanumDriveWheelPositions& value) {
wpi::PackStruct<kFrontLeftOff>(data, value.frontLeft.value());
wpi::PackStruct<kFrontRightOff>(data, value.frontRight.value());
wpi::PackStruct<kRearLeftOff>(data, value.rearLeft.value());
wpi::PackStruct<kRearRightOff>(data, value.rearRight.value());
const wpi::math::MecanumDriveWheelPositions& value) {
wpi::util::PackStruct<kFrontLeftOff>(data, value.frontLeft.value());
wpi::util::PackStruct<kFrontRightOff>(data, value.frontRight.value());
wpi::util::PackStruct<kRearLeftOff>(data, value.rearLeft.value());
wpi::util::PackStruct<kRearRightOff>(data, value.rearRight.value());
}

View File

@@ -11,24 +11,24 @@ constexpr size_t kRearLeftOff = kFrontRightOff + 8;
constexpr size_t kRearRightOff = kRearLeftOff + 8;
} // namespace
using StructType = wpi::Struct<frc::MecanumDriveWheelSpeeds>;
using StructType = wpi::util::Struct<wpi::math::MecanumDriveWheelSpeeds>;
frc::MecanumDriveWheelSpeeds StructType::Unpack(std::span<const uint8_t> data) {
return frc::MecanumDriveWheelSpeeds{
units::meters_per_second_t{
wpi::UnpackStruct<double, kFrontLeftOff>(data)},
units::meters_per_second_t{
wpi::UnpackStruct<double, kFrontRightOff>(data)},
units::meters_per_second_t{wpi::UnpackStruct<double, kRearLeftOff>(data)},
units::meters_per_second_t{
wpi::UnpackStruct<double, kRearRightOff>(data)},
wpi::math::MecanumDriveWheelSpeeds StructType::Unpack(std::span<const uint8_t> data) {
return wpi::math::MecanumDriveWheelSpeeds{
wpi::units::meters_per_second_t{
wpi::util::UnpackStruct<double, kFrontLeftOff>(data)},
wpi::units::meters_per_second_t{
wpi::util::UnpackStruct<double, kFrontRightOff>(data)},
wpi::units::meters_per_second_t{wpi::util::UnpackStruct<double, kRearLeftOff>(data)},
wpi::units::meters_per_second_t{
wpi::util::UnpackStruct<double, kRearRightOff>(data)},
};
}
void StructType::Pack(std::span<uint8_t> data,
const frc::MecanumDriveWheelSpeeds& value) {
wpi::PackStruct<kFrontLeftOff>(data, value.frontLeft.value());
wpi::PackStruct<kFrontRightOff>(data, value.frontRight.value());
wpi::PackStruct<kRearLeftOff>(data, value.rearLeft.value());
wpi::PackStruct<kRearRightOff>(data, value.rearRight.value());
const wpi::math::MecanumDriveWheelSpeeds& value) {
wpi::util::PackStruct<kFrontLeftOff>(data, value.frontLeft.value());
wpi::util::PackStruct<kFrontRightOff>(data, value.frontRight.value());
wpi::util::PackStruct<kRearLeftOff>(data, value.rearLeft.value());
wpi::util::PackStruct<kRearRightOff>(data, value.rearRight.value());
}

View File

@@ -9,17 +9,17 @@ constexpr size_t kDistanceOff = 0;
constexpr size_t kAngleOff = kDistanceOff + 8;
} // namespace
using StructType = wpi::Struct<frc::SwerveModulePosition>;
using StructType = wpi::util::Struct<wpi::math::SwerveModulePosition>;
frc::SwerveModulePosition StructType::Unpack(std::span<const uint8_t> data) {
return frc::SwerveModulePosition{
units::meter_t{wpi::UnpackStruct<double, kDistanceOff>(data)},
wpi::UnpackStruct<frc::Rotation2d, kAngleOff>(data),
wpi::math::SwerveModulePosition StructType::Unpack(std::span<const uint8_t> data) {
return wpi::math::SwerveModulePosition{
wpi::units::meter_t{wpi::util::UnpackStruct<double, kDistanceOff>(data)},
wpi::util::UnpackStruct<wpi::math::Rotation2d, kAngleOff>(data),
};
}
void StructType::Pack(std::span<uint8_t> data,
const frc::SwerveModulePosition& value) {
wpi::PackStruct<kDistanceOff>(data, value.distance.value());
wpi::PackStruct<kAngleOff>(data, value.angle);
const wpi::math::SwerveModulePosition& value) {
wpi::util::PackStruct<kDistanceOff>(data, value.distance.value());
wpi::util::PackStruct<kAngleOff>(data, value.angle);
}

View File

@@ -9,17 +9,17 @@ constexpr size_t kSpeedOff = 0;
constexpr size_t kAngleOff = kSpeedOff + 8;
} // namespace
using StructType = wpi::Struct<frc::SwerveModuleState>;
using StructType = wpi::util::Struct<wpi::math::SwerveModuleState>;
frc::SwerveModuleState StructType::Unpack(std::span<const uint8_t> data) {
return frc::SwerveModuleState{
units::meters_per_second_t{wpi::UnpackStruct<double, kSpeedOff>(data)},
wpi::UnpackStruct<frc::Rotation2d, kAngleOff>(data),
wpi::math::SwerveModuleState StructType::Unpack(std::span<const uint8_t> data) {
return wpi::math::SwerveModuleState{
wpi::units::meters_per_second_t{wpi::util::UnpackStruct<double, kSpeedOff>(data)},
wpi::util::UnpackStruct<wpi::math::Rotation2d, kAngleOff>(data),
};
}
void StructType::Pack(std::span<uint8_t> data,
const frc::SwerveModuleState& value) {
wpi::PackStruct<kSpeedOff>(data, value.speed.value());
wpi::PackStruct<kAngleOff>(data, value.angle);
const wpi::math::SwerveModuleState& value) {
wpi::util::PackStruct<kSpeedOff>(data, value.speed.value());
wpi::util::PackStruct<kAngleOff>(data, value.angle);
}