[docs] Add missing JavaDocs (#6146)

This commit is contained in:
Tyler Veness
2024-01-04 08:38:06 -08:00
committed by GitHub
parent 6e58db398d
commit f29a7d2e50
145 changed files with 1106 additions and 94 deletions

View File

@@ -40,7 +40,10 @@ public class ChassisSpeeds implements ProtobufSerializable, StructSerializable {
/** Represents the angular velocity of the robot frame. (CCW is +) */
public double omegaRadiansPerSecond;
/** ChassisSpeeds protobuf for serialization. */
public static final ChassisSpeedsProto proto = new ChassisSpeedsProto();
/** ChassisSpeeds struct for serialization. */
public static final ChassisSpeedsStruct struct = new ChassisSpeedsStruct();
/** Constructs a ChassisSpeeds with zeros for dx, dy, and theta. */

View File

@@ -28,10 +28,14 @@ public class DifferentialDriveKinematics
implements Kinematics<DifferentialDriveWheelSpeeds, DifferentialDriveWheelPositions>,
ProtobufSerializable,
StructSerializable {
/** Differential drive trackwidth. */
public final double trackWidthMeters;
/** DifferentialDriveKinematics protobuf for serialization. */
public static final DifferentialDriveKinematicsProto proto =
new DifferentialDriveKinematicsProto();
/** DifferentialDriveKinematics struct for serialization. */
public static final DifferentialDriveKinematicsStruct struct =
new DifferentialDriveKinematicsStruct();

View File

@@ -11,6 +11,7 @@ import edu.wpi.first.units.Distance;
import edu.wpi.first.units.Measure;
import java.util.Objects;
/** Represents the wheel positions for a differential drive drivetrain. */
public class DifferentialDriveWheelPositions
implements WheelPositions<DifferentialDriveWheelPositions> {
/** Distance measured by the left side. */

View File

@@ -22,8 +22,11 @@ public class DifferentialDriveWheelSpeeds implements ProtobufSerializable, Struc
/** Speed of the right side of the robot. */
public double rightMetersPerSecond;
/** DifferentialDriveWheelSpeeds protobuf for serialization. */
public static final DifferentialDriveWheelSpeedsProto proto =
new DifferentialDriveWheelSpeedsProto();
/** DifferentialDriveWheelSpeeds struct for serialization. */
public static final DifferentialDriveWheelSpeedsStruct struct =
new DifferentialDriveWheelSpeedsStruct();

View File

@@ -48,7 +48,10 @@ public class MecanumDriveKinematics
private Translation2d m_prevCoR = new Translation2d();
/** MecanumDriveKinematics protobuf for serialization. */
public static final MecanumDriveKinematicsProto proto = new MecanumDriveKinematicsProto();
/** MecanumDriveKinematics struct for serialization. */
public static final MecanumDriveKinematicsStruct struct = new MecanumDriveKinematicsStruct();
/**
@@ -217,18 +220,38 @@ public class MecanumDriveKinematics
m_inverseKinematics.setRow(3, 0, 1, -1, -(rr.getX() + rr.getY()));
}
/**
* Returns the front-left wheel translation.
*
* @return The front-left wheel translation.
*/
public Translation2d getFrontLeft() {
return m_frontLeftWheelMeters;
}
/**
* Returns the front-right wheel translation.
*
* @return The front-right wheel translation.
*/
public Translation2d getFrontRight() {
return m_frontRightWheelMeters;
}
/**
* Returns the rear-left wheel translation.
*
* @return The rear-left wheel translation.
*/
public Translation2d getRearLeft() {
return m_rearLeftWheelMeters;
}
/**
* Returns the rear-right wheel translation.
*
* @return The rear-right wheel translation.
*/
public Translation2d getRearRight() {
return m_rearRightWheelMeters;
}

View File

@@ -15,6 +15,7 @@ import edu.wpi.first.util.protobuf.ProtobufSerializable;
import edu.wpi.first.util.struct.StructSerializable;
import java.util.Objects;
/** Represents the wheel positions for a mecanum drive drivetrain. */
public class MecanumDriveWheelPositions
implements WheelPositions<MecanumDriveWheelPositions>,
ProtobufSerializable,
@@ -31,9 +32,12 @@ public class MecanumDriveWheelPositions
/** Distance measured by the rear right wheel. */
public double rearRightMeters;
/** MecanumDriveWheelPositions protobuf for serialization. */
public static final MecanumDriveWheelPositionsProto proto = new MecanumDriveWheelPositionsProto();
/** MecanumDriveWheelPositions struct for serialization. */
public static final MecanumDriveWheelPositionsStruct struct =
new MecanumDriveWheelPositionsStruct();
public static final MecanumDriveWheelPositionsProto proto = new MecanumDriveWheelPositionsProto();
/** Constructs a MecanumDriveWheelPositions with zeros for all member fields. */
public MecanumDriveWheelPositions() {}

View File

@@ -14,6 +14,7 @@ import edu.wpi.first.units.Velocity;
import edu.wpi.first.util.protobuf.ProtobufSerializable;
import edu.wpi.first.util.struct.StructSerializable;
/** Represents the wheel speeds for a mecanum drive drivetrain. */
public class MecanumDriveWheelSpeeds implements ProtobufSerializable, StructSerializable {
/** Speed of the front left wheel. */
public double frontLeftMetersPerSecond;
@@ -27,9 +28,12 @@ public class MecanumDriveWheelSpeeds implements ProtobufSerializable, StructSeri
/** Speed of the rear right wheel. */
public double rearRightMetersPerSecond;
public static final MecanumDriveWheelSpeedsStruct struct = new MecanumDriveWheelSpeedsStruct();
/** MecanumDriveWheelSpeeds protobuf for serialization. */
public static final MecanumDriveWheelSpeedsProto proto = new MecanumDriveWheelSpeedsProto();
/** MecanumDriveWheelSpeeds struct for serialization. */
public static final MecanumDriveWheelSpeedsStruct struct = new MecanumDriveWheelSpeedsStruct();
/** Constructs a MecanumDriveWheelSpeeds with zeros for all member fields. */
public MecanumDriveWheelSpeeds() {}

View File

@@ -41,7 +41,9 @@ import org.ejml.simple.SimpleMatrix;
*/
public class SwerveDriveKinematics
implements Kinematics<SwerveDriveKinematics.SwerveDriveWheelStates, SwerveDriveWheelPositions> {
/** Wrapper class for swerve module states. */
public static class SwerveDriveWheelStates {
/** Swerve module states. */
public SwerveModuleState[] states;
/**

View File

@@ -7,7 +7,9 @@ package edu.wpi.first.math.kinematics;
import java.util.Arrays;
import java.util.Objects;
/** Represents the wheel positions for a swerve drive drivetrain. */
public class SwerveDriveWheelPositions implements WheelPositions<SwerveDriveWheelPositions> {
/** The distances driven by the wheels. */
public SwerveModulePosition[] positions;
/**

View File

@@ -29,9 +29,12 @@ public class SwerveModulePosition
/** Angle of the module. */
public Rotation2d angle = Rotation2d.fromDegrees(0);
public static final SwerveModulePositionStruct struct = new SwerveModulePositionStruct();
/** SwerveModulePosition protobuf for serialization. */
public static final SwerveModulePositionProto proto = new SwerveModulePositionProto();
/** SwerveModulePosition struct for serialization. */
public static final SwerveModulePositionStruct struct = new SwerveModulePositionStruct();
/** Constructs a SwerveModulePosition with zeros for distance and angle. */
public SwerveModulePosition() {}

View File

@@ -25,9 +25,12 @@ public class SwerveModuleState
/** Angle of the module. */
public Rotation2d angle = Rotation2d.fromDegrees(0);
public static final SwerveModuleStateStruct struct = new SwerveModuleStateStruct();
/** SwerveModuleState protobuf for serialization. */
public static final SwerveModuleStateProto proto = new SwerveModuleStateProto();
/** SwerveModuleState struct for serialization. */
public static final SwerveModuleStateStruct struct = new SwerveModuleStateStruct();
/** Constructs a SwerveModuleState with zeros for speed and angle. */
public SwerveModuleState() {}

View File

@@ -6,6 +6,11 @@ package edu.wpi.first.math.kinematics;
import edu.wpi.first.math.interpolation.Interpolatable;
/**
* Interface for wheel positions.
*
* @param <T> Wheel positions type.
*/
public interface WheelPositions<T extends WheelPositions<T>> extends Interpolatable<T> {
/**
* Returns a copy of this instance.