RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
Rotation3dStruct.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.struct;
6
7import java.nio.ByteBuffer;
8import org.wpilib.math.geometry.Quaternion;
9import org.wpilib.math.geometry.Rotation3d;
10import org.wpilib.util.struct.Struct;
11
12public final class Rotation3dStruct implements Struct<Rotation3d> {
13 @Override
14 public Class<Rotation3d> getTypeClass() {
15 return Rotation3d.class;
16 }
17
18 @Override
19 public String getTypeName() {
20 return "Rotation3d";
21 }
22
23 @Override
24 public int getSize() {
25 return Quaternion.struct.getSize();
26 }
27
28 @Override
29 public String getSchema() {
30 return "Quaternion q";
31 }
32
33 @Override
34 public Struct<?>[] getNested() {
35 return new Struct<?>[] {Quaternion.struct};
36 }
37
38 @Override
39 public Rotation3d unpack(ByteBuffer bb) {
41 return new Rotation3d(q);
42 }
43
44 @Override
45 public void pack(ByteBuffer bb, Rotation3d value) {
46 Quaternion.struct.pack(bb, value.getQuaternion());
47 }
48
49 @Override
50 public boolean isImmutable() {
51 return true;
52 }
53}
static final QuaternionStruct struct