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