// 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. #include "frc/kinematics/struct/MecanumDriveWheelPositionsStruct.h" namespace { constexpr size_t kFrontLeftOff = 0; constexpr size_t kFrontRightOff = kFrontLeftOff + 8; constexpr size_t kRearLeftOff = kFrontRightOff + 8; constexpr size_t kRearRightOff = kRearLeftOff + 8; } // namespace using StructType = wpi::Struct; frc::MecanumDriveWheelPositions StructType::Unpack( std::span data) { return frc::MecanumDriveWheelPositions{ units::meter_t{wpi::UnpackStruct(data)}, units::meter_t{wpi::UnpackStruct(data)}, units::meter_t{wpi::UnpackStruct(data)}, units::meter_t{wpi::UnpackStruct(data)}, }; } void StructType::Pack(std::span data, const frc::MecanumDriveWheelPositions& value) { wpi::PackStruct(data, value.frontLeft.value()); wpi::PackStruct(data, value.frontRight.value()); wpi::PackStruct(data, value.rearLeft.value()); wpi::PackStruct(data, value.rearRight.value()); }