001// Copyright (c) FIRST and other WPILib contributors. 002// Open Source Software; you can modify and/or share it under the terms of 003// the WPILib BSD license file in the root directory of this project. 004 005package edu.wpi.first.math.kinematics.proto; 006 007import edu.wpi.first.math.kinematics.DifferentialDriveWheelSpeeds; 008import edu.wpi.first.math.proto.Kinematics.ProtobufDifferentialDriveWheelSpeeds; 009import edu.wpi.first.util.protobuf.Protobuf; 010import us.hebi.quickbuf.Descriptors.Descriptor; 011 012public class DifferentialDriveWheelSpeedsProto 013 implements Protobuf<DifferentialDriveWheelSpeeds, ProtobufDifferentialDriveWheelSpeeds> { 014 @Override 015 public Class<DifferentialDriveWheelSpeeds> getTypeClass() { 016 return DifferentialDriveWheelSpeeds.class; 017 } 018 019 @Override 020 public Descriptor getDescriptor() { 021 return ProtobufDifferentialDriveWheelSpeeds.getDescriptor(); 022 } 023 024 @Override 025 public ProtobufDifferentialDriveWheelSpeeds createMessage() { 026 return ProtobufDifferentialDriveWheelSpeeds.newInstance(); 027 } 028 029 @Override 030 public DifferentialDriveWheelSpeeds unpack(ProtobufDifferentialDriveWheelSpeeds msg) { 031 return new DifferentialDriveWheelSpeeds(msg.getLeft(), msg.getRight()); 032 } 033 034 @Override 035 public void pack(ProtobufDifferentialDriveWheelSpeeds msg, DifferentialDriveWheelSpeeds value) { 036 msg.setLeft(value.leftMetersPerSecond); 037 msg.setRight(value.rightMetersPerSecond); 038 } 039}