Files
allwpilib/wpimath/src/main/native/cpp/kinematics/struct/DifferentialDriveKinematicsStruct.cpp

25 lines
867 B
C++
Raw Normal View History

// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
2025-11-07 19:56:21 -05:00
#include "wpi/math/kinematics/struct/DifferentialDriveKinematicsStruct.hpp"
namespace {
constexpr size_t kTrackwidthOff = 0;
} // namespace
2025-11-07 20:00:05 -05:00
using StructType = wpi::util::Struct<wpi::math::DifferentialDriveKinematics>;
2025-11-07 20:00:05 -05:00
wpi::math::DifferentialDriveKinematics StructType::Unpack(
std::span<const uint8_t> data) {
2025-11-07 20:00:05 -05:00
return wpi::math::DifferentialDriveKinematics{
2025-11-07 20:01:58 -05:00
wpi::units::meter_t{
wpi::util::UnpackStruct<double, kTrackwidthOff>(data)},
};
}
void StructType::Pack(std::span<uint8_t> data,
2025-11-07 20:00:05 -05:00
const wpi::math::DifferentialDriveKinematics& value) {
wpi::util::PackStruct<kTrackwidthOff>(data, value.trackwidth.value());
}