forked from wpilibsuite/allwpilib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d86a2ec
commit cd277f2
Showing
4 changed files
with
90 additions
and
1 deletion.
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
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
39 changes: 39 additions & 0 deletions
39
...ath/src/main/java/edu/wpi/first/math/trajectory/struct/ExponentialProfileStateStruct.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,39 @@ | ||
package edu.wpi.first.math.trajectory.struct; | ||
|
||
import edu.wpi.first.math.trajectory.ExponentialProfile; | ||
import edu.wpi.first.util.struct.Struct; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
public class ExponentialProfileStateStruct implements Struct<ExponentialProfile.State> { | ||
@Override | ||
public Class<ExponentialProfile.State> getTypeClass() { | ||
return ExponentialProfile.State.class; | ||
} | ||
|
||
@Override | ||
public String getTypeName() { | ||
return "TrapezoidProfile.State"; | ||
} | ||
|
||
@Override | ||
public int getSize() { | ||
return kSizeDouble * 2; | ||
} | ||
|
||
@Override | ||
public String getSchema() { | ||
return "double position;double velocity"; | ||
} | ||
|
||
@Override | ||
public ExponentialProfile.State unpack(ByteBuffer bb) { | ||
return new ExponentialProfile.State(bb.getDouble(), bb.getDouble()); | ||
} | ||
|
||
@Override | ||
public void pack(ByteBuffer bb, ExponentialProfile.State value) { | ||
bb.putDouble(value.position); | ||
bb.putDouble(value.velocity); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
wpimath/src/main/java/edu/wpi/first/math/trajectory/struct/TrapezoidProfileStateStruct.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,39 @@ | ||
package edu.wpi.first.math.trajectory.struct; | ||
|
||
import edu.wpi.first.math.trajectory.TrapezoidProfile; | ||
import edu.wpi.first.util.struct.Struct; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
public class TrapezoidProfileStateStruct implements Struct<TrapezoidProfile.State> { | ||
@Override | ||
public Class<TrapezoidProfile.State> getTypeClass() { | ||
return TrapezoidProfile.State.class; | ||
} | ||
|
||
@Override | ||
public String getTypeName() { | ||
return "TrapezoidProfile.State"; | ||
} | ||
|
||
@Override | ||
public int getSize() { | ||
return kSizeDouble * 2; | ||
} | ||
|
||
@Override | ||
public String getSchema() { | ||
return "double position;double velocity"; | ||
} | ||
|
||
@Override | ||
public TrapezoidProfile.State unpack(ByteBuffer bb) { | ||
return new TrapezoidProfile.State(bb.getDouble(), bb.getDouble()); | ||
} | ||
|
||
@Override | ||
public void pack(ByteBuffer bb, TrapezoidProfile.State value) { | ||
bb.putDouble(value.position); | ||
bb.putDouble(value.velocity); | ||
} | ||
} |