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 org.wpilib.math.kinematics.proto; 006 007import org.wpilib.math.kinematics.MecanumDriveWheelAccelerations; 008import org.wpilib.math.proto.ProtobufMecanumDriveWheelAccelerations; 009import org.wpilib.util.protobuf.Protobuf; 010import us.hebi.quickbuf.Descriptors.Descriptor; 011 012public class MecanumDriveWheelAccelerationsProto 013 implements Protobuf<MecanumDriveWheelAccelerations, ProtobufMecanumDriveWheelAccelerations> { 014 @Override 015 public Class<MecanumDriveWheelAccelerations> getTypeClass() { 016 return MecanumDriveWheelAccelerations.class; 017 } 018 019 @Override 020 public Descriptor getDescriptor() { 021 return ProtobufMecanumDriveWheelAccelerations.getDescriptor(); 022 } 023 024 @Override 025 public ProtobufMecanumDriveWheelAccelerations createMessage() { 026 return ProtobufMecanumDriveWheelAccelerations.newInstance(); 027 } 028 029 @Override 030 public MecanumDriveWheelAccelerations unpack(ProtobufMecanumDriveWheelAccelerations msg) { 031 return new MecanumDriveWheelAccelerations( 032 msg.getFrontLeft(), msg.getFrontRight(), msg.getRearLeft(), msg.getRearRight()); 033 } 034 035 @Override 036 public void pack( 037 ProtobufMecanumDriveWheelAccelerations msg, MecanumDriveWheelAccelerations value) { 038 msg.setFrontLeft(value.frontLeft); 039 msg.setFrontRight(value.frontRight); 040 msg.setRearLeft(value.rearLeft); 041 msg.setRearRight(value.rearRight); 042 } 043}