Skip to content

Commit

Permalink
add proto files
Browse files Browse the repository at this point in the history
  • Loading branch information
DeltaDizzy committed Mar 7, 2024
1 parent 6e9029f commit fad87d3
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// 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/proto/DifferentialDriveWheelPositionsProto.h"

#include "kinematics.pb.h"

google::protobuf::Message* wpi::Protobuf<
frc::DifferentialDriveWheelPositions>::New(google::protobuf::Arena* arena) {
return google::protobuf::Arena::CreateMessage<
wpi::proto::ProtobufDifferentialDriveWheelPositions>(arena);
}

frc::DifferentialDriveWheelPositions
wpi::Protobuf<frc::DifferentialDriveWheelPositions>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufDifferentialDriveWheelPositions*>(
&msg);
return frc::DifferentialDriveWheelPositions{
units::meters_per_second_t{m->left()},
units::meters_per_second_t{m->right()},
};
}

void wpi::Protobuf<frc::DifferentialDriveWheelPositions>::Pack(
google::protobuf::Message* msg,
const frc::DifferentialDriveWheelPositions& value) {
auto m = static_cast<wpi::proto::ProtobufDifferentialDriveWheelPositions*>(msg);
m->set_left(value.left.value());
m->set_right(value.right.value());
}
Original file line number Diff line number Diff line change
@@ -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> {

Check failure on line 13 in wpimath/src/main/native/include/frc/kinematics/proto/DifferentialDriveWheelPositionsProto.h

View workflow job for this annotation

GitHub Actions / Build - Windows

'DifferentialDriveWheelPositions': is not a member of 'frc'

Check failure on line 13 in wpimath/src/main/native/include/frc/kinematics/proto/DifferentialDriveWheelPositionsProto.h

View workflow job for this annotation

GitHub Actions / Build - Windows

'DifferentialDriveWheelPositions': undeclared identifier

Check failure on line 13 in wpimath/src/main/native/include/frc/kinematics/proto/DifferentialDriveWheelPositionsProto.h

View workflow job for this annotation

GitHub Actions / Build - Windows

'wpi::Protobuf': 'DifferentialDriveWheelPositions' is not a valid template type argument for parameter 'T'
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);
};

Check failure on line 19 in wpimath/src/main/native/include/frc/kinematics/proto/DifferentialDriveWheelPositionsProto.h

View workflow job for this annotation

GitHub Actions / Build - Windows

explicit specialization; 'wpi::Protobuf' is not a specialization of a class template

0 comments on commit fad87d3

Please sign in to comment.