mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[wpimath] Add structured data support for DifferentialDriveWheelPositions (#6412)
This commit is contained in:
@@ -49,3 +49,6 @@ struct WPILIB_DLLEXPORT DifferentialDriveWheelPositions {
|
||||
}
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
#include "frc/kinematics/proto/DifferentialDriveWheelPositionsProto.h"
|
||||
#include "frc/kinematics/struct/DifferentialDriveWheelPositionsStruct.h"
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
@@ -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>);
|
||||
Reference in New Issue
Block a user