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.controller.proto;
006
007import edu.wpi.first.math.controller.ArmFeedforward;
008import edu.wpi.first.math.proto.Controller.ProtobufArmFeedforward;
009import edu.wpi.first.util.protobuf.Protobuf;
010import us.hebi.quickbuf.Descriptors.Descriptor;
011
012public class ArmFeedforwardProto implements Protobuf<ArmFeedforward, ProtobufArmFeedforward> {
013  @Override
014  public Class<ArmFeedforward> getTypeClass() {
015    return ArmFeedforward.class;
016  }
017
018  @Override
019  public Descriptor getDescriptor() {
020    return ProtobufArmFeedforward.getDescriptor();
021  }
022
023  @Override
024  public ProtobufArmFeedforward createMessage() {
025    return ProtobufArmFeedforward.newInstance();
026  }
027
028  @Override
029  public ArmFeedforward unpack(ProtobufArmFeedforward msg) {
030    return new ArmFeedforward(msg.getKs(), msg.getKg(), msg.getKv(), msg.getKa());
031  }
032
033  @Override
034  public void pack(ProtobufArmFeedforward msg, ArmFeedforward value) {
035    msg.setKs(value.ks);
036    msg.setKg(value.kg);
037    msg.setKv(value.kv);
038    msg.setKa(value.ka);
039  }
040}