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.geometry.proto; 006 007import edu.wpi.first.math.geometry.Twist3d; 008import edu.wpi.first.math.proto.Geometry3D.ProtobufTwist3d; 009import edu.wpi.first.util.protobuf.Protobuf; 010import us.hebi.quickbuf.Descriptors.Descriptor; 011 012public class Twist3dProto implements Protobuf<Twist3d, ProtobufTwist3d> { 013 @Override 014 public Class<Twist3d> getTypeClass() { 015 return Twist3d.class; 016 } 017 018 @Override 019 public Descriptor getDescriptor() { 020 return ProtobufTwist3d.getDescriptor(); 021 } 022 023 @Override 024 public ProtobufTwist3d createMessage() { 025 return ProtobufTwist3d.newInstance(); 026 } 027 028 @Override 029 public Twist3d unpack(ProtobufTwist3d msg) { 030 return new Twist3d( 031 msg.getDx(), msg.getDy(), msg.getDz(), msg.getRx(), msg.getRy(), msg.getRz()); 032 } 033 034 @Override 035 public void pack(ProtobufTwist3d msg, Twist3d value) { 036 msg.setDx(value.dx); 037 msg.setDy(value.dy); 038 msg.setDz(value.dz); 039 msg.setRx(value.rx); 040 msg.setRy(value.ry); 041 msg.setRz(value.rz); 042 } 043}