mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
Merge branch 'main' into 2027
This commit is contained in:
@@ -124,7 +124,8 @@ public final class LinearSystemId {
|
||||
* @param kA The acceleration gain, in volts/(unit/sec²)
|
||||
* @return A LinearSystem representing the given characterized constants.
|
||||
* @throws IllegalArgumentException if kV < 0 or kA <= 0.
|
||||
* @see <a href="https://github.com/wpilibsuite/sysid">https://github.com/wpilibsuite/sysid</a>
|
||||
* @see <a
|
||||
* href="https://github.com/wpilibsuite/allwpilib/tree/main/sysid">https://github.com/wpilibsuite/allwpilib/tree/main/sysid</a>
|
||||
*/
|
||||
public static LinearSystem<N2, N1, N2> createDCMotorSystem(double kV, double kA) {
|
||||
if (kV < 0.0) {
|
||||
@@ -235,7 +236,8 @@ public final class LinearSystemId {
|
||||
* @param kA The acceleration gain, in volts/(unit/sec²)
|
||||
* @return A LinearSystem representing the given characterized constants.
|
||||
* @throws IllegalArgumentException if kV < 0 or kA <= 0.
|
||||
* @see <a href="https://github.com/wpilibsuite/sysid">https://github.com/wpilibsuite/sysid</a>
|
||||
* @see <a
|
||||
* href="https://github.com/wpilibsuite/allwpilib/tree/main/sysid">https://github.com/wpilibsuite/allwpilib/tree/main/sysid</a>
|
||||
*/
|
||||
public static LinearSystem<N1, N1, N1> identifyVelocitySystem(double kV, double kA) {
|
||||
if (kV < 0.0) {
|
||||
@@ -268,7 +270,8 @@ public final class LinearSystemId {
|
||||
* @param kA The acceleration gain, in volts/(unit/sec²)
|
||||
* @return A LinearSystem representing the given characterized constants.
|
||||
* @throws IllegalArgumentException if kV < 0 or kA <= 0.
|
||||
* @see <a href="https://github.com/wpilibsuite/sysid">https://github.com/wpilibsuite/sysid</a>
|
||||
* @see <a
|
||||
* href="https://github.com/wpilibsuite/allwpilib/tree/main/sysid">https://github.com/wpilibsuite/allwpilib/tree/main/sysid</a>
|
||||
*/
|
||||
public static LinearSystem<N2, N1, N2> identifyPositionSystem(double kV, double kA) {
|
||||
if (kV < 0.0) {
|
||||
@@ -301,7 +304,8 @@ public final class LinearSystemId {
|
||||
* @return A LinearSystem representing the given characterized constants.
|
||||
* @throws IllegalArgumentException if kVLinear <= 0, kALinear <= 0, kVAngular <= 0, or
|
||||
* kAAngular <= 0.
|
||||
* @see <a href="https://github.com/wpilibsuite/sysid">https://github.com/wpilibsuite/sysid</a>
|
||||
* @see <a
|
||||
* href="https://github.com/wpilibsuite/allwpilib/tree/main/sysid">https://github.com/wpilibsuite/allwpilib/tree/main/sysid</a>
|
||||
*/
|
||||
public static LinearSystem<N2, N2, N2> identifyDrivetrainSystem(
|
||||
double kVLinear, double kALinear, double kVAngular, double kAAngular) {
|
||||
@@ -348,7 +352,8 @@ public final class LinearSystemId {
|
||||
* @return A LinearSystem representing the given characterized constants.
|
||||
* @throws IllegalArgumentException if kVLinear <= 0, kALinear <= 0, kVAngular <= 0,
|
||||
* kAAngular <= 0, or trackwidth <= 0.
|
||||
* @see <a href="https://github.com/wpilibsuite/sysid">https://github.com/wpilibsuite/sysid</a>
|
||||
* @see <a
|
||||
* href="https://github.com/wpilibsuite/allwpilib/tree/main/sysid">https://github.com/wpilibsuite/allwpilib/tree/main/sysid</a>
|
||||
*/
|
||||
public static LinearSystem<N2, N2, N2> identifyDrivetrainSystem(
|
||||
double kVLinear, double kALinear, double kVAngular, double kAAngular, double trackwidth) {
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
package edu.wpi.first.math.trajectory;
|
||||
|
||||
import edu.wpi.first.math.trajectory.struct.ExponentialProfileStateStruct;
|
||||
import edu.wpi.first.util.struct.StructSerializable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -128,7 +130,10 @@ public class ExponentialProfile {
|
||||
}
|
||||
|
||||
/** Profile state. */
|
||||
public static class State {
|
||||
public static class State implements StructSerializable {
|
||||
/** The struct that serializes this class. */
|
||||
public static final ExponentialProfileStateStruct struct = new ExponentialProfileStateStruct();
|
||||
|
||||
/** The position at this state. */
|
||||
public double position;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package edu.wpi.first.math.trajectory;
|
||||
|
||||
import edu.wpi.first.math.MathSharedStore;
|
||||
import edu.wpi.first.math.trajectory.struct.TrapezoidProfileStateStruct;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -75,6 +76,9 @@ public class TrapezoidProfile {
|
||||
|
||||
/** Profile state. */
|
||||
public static class State {
|
||||
/** The struct used to serialize this class. */
|
||||
public static final TrapezoidProfileStateStruct struct = new TrapezoidProfileStateStruct();
|
||||
|
||||
/** The position at this state. */
|
||||
public double position;
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
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 "ExponentialProfileState";
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
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 "TrapezoidProfileState";
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user