[wpimath] Add structured data support for DifferentialDriveWheelPositions (#6412)

This commit is contained in:
DeltaDizzy
2024-03-09 12:09:02 -06:00
committed by GitHub
parent 18e57f7872
commit 7bd8c44570
12 changed files with 668 additions and 58 deletions

View File

@@ -49,3 +49,6 @@ struct WPILIB_DLLEXPORT DifferentialDriveWheelPositions {
}
};
} // namespace frc
#include "frc/kinematics/proto/DifferentialDriveWheelPositionsProto.h"
#include "frc/kinematics/struct/DifferentialDriveWheelPositionsStruct.h"

View File

@@ -0,0 +1,19 @@
// 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.
#pragma once
#include <wpi/SymbolExports.h>
#include <wpi/protobuf/Protobuf.h>
#include "frc/kinematics/DifferentialDriveWheelPositions.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::DifferentialDriveWheelPositions> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::DifferentialDriveWheelPositions Unpack(
const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
const frc::DifferentialDriveWheelPositions& value);
};

View File

@@ -0,0 +1,28 @@
// 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.
#pragma once
#include <wpi/SymbolExports.h>
#include <wpi/struct/Struct.h>
#include "frc/kinematics/DifferentialDriveWheelPositions.h"
template <>
struct WPILIB_DLLEXPORT wpi::Struct<frc::DifferentialDriveWheelPositions> {
static constexpr std::string_view GetTypeString() {
return "struct:DifferentialDriveWheelPositions";
}
static constexpr size_t GetSize() { return 16; }
static constexpr std::string_view GetSchema() {
return "double left;double right";
}
static frc::DifferentialDriveWheelPositions Unpack(
std::span<const uint8_t> data);
static void Pack(std::span<uint8_t> data,
const frc::DifferentialDriveWheelPositions& value);
};
static_assert(wpi::StructSerializable<frc::DifferentialDriveWheelPositions>);