forked from wpilibsuite/allwpilib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e9029f
commit fad87d3
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
wpimath/src/main/native/cpp/kinematics/proto/DifferentialDriveWheelPositionsProto.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} |
19 changes: 19 additions & 0 deletions
19
wpimath/src/main/native/include/frc/kinematics/proto/DifferentialDriveWheelPositionsProto.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 GitHub Actions / Build - Windows
Check failure on line 13 in wpimath/src/main/native/include/frc/kinematics/proto/DifferentialDriveWheelPositionsProto.h GitHub Actions / Build - Windows
|
||
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); | ||
}; | ||