Skip to content

Commit

Permalink
Add StructSerializable tags to Matrix, Vector, and LinearSystem
Browse files Browse the repository at this point in the history
  • Loading branch information
KangarooKoala committed Jul 16, 2024
1 parent 2cc2818 commit 5fa7e8b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion wpimath/src/main/java/edu/wpi/first/math/Matrix.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import edu.wpi.first.util.protobuf.Protobuf;
import edu.wpi.first.util.protobuf.ProtobufSerializable;
import edu.wpi.first.util.struct.Struct;
import edu.wpi.first.util.struct.StructSerializable;
import java.util.Objects;
import org.ejml.MatrixDimensionException;
import org.ejml.data.DMatrixRMaj;
Expand All @@ -29,7 +30,8 @@
* @param <R> The number of rows in this matrix.
* @param <C> The number of columns in this matrix.
*/
public class Matrix<R extends Num, C extends Num> implements ProtobufSerializable {
public class Matrix<R extends Num, C extends Num>
implements ProtobufSerializable, StructSerializable {
/** Storage for underlying EJML matrix. */
protected final SimpleMatrix m_storage;

Expand Down
4 changes: 3 additions & 1 deletion wpimath/src/main/java/edu/wpi/first/math/Vector.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import edu.wpi.first.util.protobuf.Protobuf;
import edu.wpi.first.util.protobuf.ProtobufSerializable;
import edu.wpi.first.util.struct.Struct;
import edu.wpi.first.util.struct.StructSerializable;
import java.util.Objects;
import org.ejml.simple.SimpleMatrix;

Expand All @@ -21,7 +22,8 @@
*
* @param <R> The number of rows in this matrix.
*/
public class Vector<R extends Num> extends Matrix<R, N1> implements ProtobufSerializable {
public class Vector<R extends Num> extends Matrix<R, N1>
implements ProtobufSerializable, StructSerializable {
/**
* Constructs an empty zero vector of the given dimensions.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import edu.wpi.first.util.protobuf.Protobuf;
import edu.wpi.first.util.protobuf.ProtobufSerializable;
import edu.wpi.first.util.struct.Struct;
import edu.wpi.first.util.struct.StructSerializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
Expand All @@ -51,7 +52,7 @@
* @param <Outputs> Number of outputs.
*/
public class LinearSystem<States extends Num, Inputs extends Num, Outputs extends Num>
implements ProtobufSerializable {
implements ProtobufSerializable, StructSerializable {
/** Continuous system matrix. */
private final Matrix<States, States> m_A;

Expand Down

0 comments on commit 5fa7e8b

Please sign in to comment.