RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
QuaternionProto.java
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5package org.wpilib.math.geometry.proto;
6
7import org.wpilib.math.geometry.Quaternion;
8import org.wpilib.math.geometry.proto.detail.ProtobufQuaternion;
9import org.wpilib.util.protobuf.Protobuf;
10import us.hebi.quickbuf.Descriptors.Descriptor;
11
12public final class QuaternionProto implements Protobuf<Quaternion, ProtobufQuaternion> {
13 @Override
14 public Class<Quaternion> getTypeClass() {
15 return Quaternion.class;
16 }
17
18 @Override
19 public Descriptor getDescriptor() {
21 }
22
23 @Override
27
28 @Override
29 public Quaternion unpack(ProtobufQuaternion msg) {
30 return new Quaternion(msg.getW(), msg.getX(), msg.getY(), msg.getZ());
31 }
32
33 @Override
34 public void pack(ProtobufQuaternion msg, Quaternion value) {
35 msg.setW(value.getW());
36 msg.setX(value.getX());
37 msg.setY(value.getY());
38 msg.setZ(value.getZ());
39 }
40
41 @Override
42 public boolean isImmutable() {
43 return true;
44 }
45}