generated from Team488/FRCRobotTemplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit 97f2f42.
- Loading branch information
1 parent
97f2f42
commit de8d0f2
Showing
3 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/competition/subsystems/vision/SimpleNoteStruct.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package competition.subsystems.vision; | ||
|
||
import edu.wpi.first.util.struct.Struct; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
public class SimpleNoteStruct implements Struct<SimpleNote> { | ||
@Override | ||
public Class<SimpleNote> getTypeClass() { | ||
return SimpleNote.class; | ||
} | ||
|
||
@Override | ||
public String getTypeString() { | ||
return "struct:SimpleNote"; | ||
} | ||
|
||
@Override | ||
public int getSize() { | ||
return kSizeDouble * 3; | ||
} | ||
|
||
@Override | ||
public String getSchema() { | ||
return "double area; double yaw; double pitch"; | ||
} | ||
|
||
@Override | ||
public SimpleNote unpack(ByteBuffer byteBuffer) { | ||
var area = byteBuffer.getDouble(); | ||
var yaw = byteBuffer.getDouble(); | ||
var pitch = byteBuffer.getDouble(); | ||
return new SimpleNote(area, yaw, pitch); | ||
} | ||
|
||
@Override | ||
public void pack(ByteBuffer byteBuffer, SimpleNote simpleNote) { | ||
byteBuffer.putDouble(simpleNote.getArea()); | ||
byteBuffer.putDouble(simpleNote.getYaw()); | ||
byteBuffer.putDouble(simpleNote.getPitch()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters