From cc41a0ed2458720555d8aff86fbfc52db3e17a22 Mon Sep 17 00:00:00 2001 From: Wispy <101812473+WispySparks@users.noreply.github.com> Date: Sun, 8 Dec 2024 19:05:06 -0600 Subject: [PATCH 1/7] [wpilib] Replace MecanumDriveMotorVoltages with a functional interface (#6760) --- .../command/MecanumControllerCommand.java | 169 ++++- .../subsystems/DriveSubsystem.java | 15 +- .../edu/wpi/first/math/proto/Kinematics.java | 601 ++---------------- .../cpp/wpimath/protobuf/kinematics.npb.cpp | 516 +++++++-------- .../cpp/wpimath/protobuf/kinematics.npb.h | 28 +- .../kinematics/MecanumDriveMotorVoltages.java | 15 +- .../proto/MecanumDriveMotorVoltagesProto.java | 42 -- .../MecanumDriveMotorVoltagesStruct.java | 48 -- wpimath/src/main/proto/kinematics.proto | 7 - .../MecanumDriveMotorVoltagesProtoTest.java | 27 - .../MecanumDriveMotorVoltagesStructTest.java | 25 - 11 files changed, 453 insertions(+), 1040 deletions(-) delete mode 100644 wpimath/src/main/java/edu/wpi/first/math/kinematics/proto/MecanumDriveMotorVoltagesProto.java delete mode 100644 wpimath/src/main/java/edu/wpi/first/math/kinematics/struct/MecanumDriveMotorVoltagesStruct.java delete mode 100644 wpimath/src/test/java/edu/wpi/first/math/kinematics/proto/MecanumDriveMotorVoltagesProtoTest.java delete mode 100644 wpimath/src/test/java/edu/wpi/first/math/kinematics/struct/MecanumDriveMotorVoltagesStructTest.java diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/MecanumControllerCommand.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/MecanumControllerCommand.java index 70978c63f1..ee52cfa9c3 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/MecanumControllerCommand.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/MecanumControllerCommand.java @@ -38,6 +38,7 @@ import java.util.function.Supplier; * *

This class is provided by the NewCommands VendorDep */ +@SuppressWarnings("removal") public class MecanumControllerCommand extends Command { private final Timer m_timer = new Timer(); private final boolean m_usePID; @@ -53,7 +54,7 @@ public class MecanumControllerCommand extends Command { private final PIDController m_frontRightController; private final PIDController m_rearRightController; private final Supplier m_currentWheelSpeeds; - private final Consumer m_outputDriveVoltages; + private final MecanumVoltagesConsumer m_outputDriveVoltages; private final Consumer m_outputWheelSpeeds; private double m_prevFrontLeftSpeedSetpoint; // m/s private double m_prevRearLeftSpeedSetpoint; // m/s @@ -84,8 +85,7 @@ public class MecanumControllerCommand extends Command { * @param frontRightController The front right wheel velocity PID. * @param rearRightController The rear right wheel velocity PID. * @param currentWheelSpeeds A MecanumDriveWheelSpeeds object containing the current wheel speeds. - * @param outputDriveVoltages A MecanumDriveMotorVoltages object containing the output motor - * voltages. + * @param outputDriveVoltages A MecanumVoltagesConsumer that consumes voltages of mecanum motors. * @param requirements The subsystems to require. */ @SuppressWarnings("this-escape") @@ -104,7 +104,7 @@ public class MecanumControllerCommand extends Command { PIDController frontRightController, PIDController rearRightController, Supplier currentWheelSpeeds, - Consumer outputDriveVoltages, + MecanumVoltagesConsumer outputDriveVoltages, Subsystem... requirements) { m_trajectory = requireNonNullParam(trajectory, "trajectory", "MecanumControllerCommand"); m_pose = requireNonNullParam(pose, "pose", "MecanumControllerCommand"); @@ -145,6 +145,139 @@ public class MecanumControllerCommand extends Command { addRequirements(requirements); } + /** + * Constructs a new MecanumControllerCommand that when executed will follow the provided + * trajectory. PID control and feedforward are handled internally. Outputs are scaled from -12 to + * 12 as a voltage output to the motor. + * + *

Note: The controllers will *not* set the outputVolts to zero upon completion of the path + * this is left to the user, since it is not appropriate for paths with nonstationary endstates. + * + * @param trajectory The trajectory to follow. + * @param pose A function that supplies the robot pose - use one of the odometry classes to + * provide this. + * @param feedforward The feedforward to use for the drivetrain. + * @param kinematics The kinematics for the robot drivetrain. + * @param xController The Trajectory Tracker PID controller for the robot's x position. + * @param yController The Trajectory Tracker PID controller for the robot's y position. + * @param thetaController The Trajectory Tracker PID controller for angle for the robot. + * @param desiredRotation The angle that the robot should be facing. This is sampled at each time + * step. + * @param maxWheelVelocityMetersPerSecond The maximum velocity of a drivetrain wheel. + * @param frontLeftController The front left wheel velocity PID. + * @param rearLeftController The rear left wheel velocity PID. + * @param frontRightController The front right wheel velocity PID. + * @param rearRightController The rear right wheel velocity PID. + * @param currentWheelSpeeds A MecanumDriveWheelSpeeds object containing the current wheel speeds. + * @param outputDriveVoltages A MecanumDriveMotorVoltages object containing the output motor + * voltages. + * @param requirements The subsystems to require. + */ + @Deprecated(since = "2025", forRemoval = true) + public MecanumControllerCommand( + Trajectory trajectory, + Supplier pose, + SimpleMotorFeedforward feedforward, + MecanumDriveKinematics kinematics, + PIDController xController, + PIDController yController, + ProfiledPIDController thetaController, + Supplier desiredRotation, + double maxWheelVelocityMetersPerSecond, + PIDController frontLeftController, + PIDController rearLeftController, + PIDController frontRightController, + PIDController rearRightController, + Supplier currentWheelSpeeds, + Consumer outputDriveVoltages, + Subsystem... requirements) { + this( + trajectory, + pose, + feedforward, + kinematics, + xController, + yController, + thetaController, + desiredRotation, + maxWheelVelocityMetersPerSecond, + frontLeftController, + rearLeftController, + frontRightController, + rearRightController, + currentWheelSpeeds, + (frontLeft, frontRight, rearLeft, rearRight) -> + outputDriveVoltages.accept( + new MecanumDriveMotorVoltages(frontLeft, frontRight, rearLeft, rearRight)), + requirements); + } + + /** + * Constructs a new MecanumControllerCommand that when executed will follow the provided + * trajectory. PID control and feedforward are handled internally. Outputs are scaled from -12 to + * 12 as a voltage output to the motor. + * + *

Note: The controllers will *not* set the outputVolts to zero upon completion of the path + * this is left to the user, since it is not appropriate for paths with nonstationary endstates. + * + *

Note 2: The final rotation of the robot will be set to the rotation of the final pose in the + * trajectory. The robot will not follow the rotations from the poses at each timestep. If + * alternate rotation behavior is desired, the other constructor with a supplier for rotation + * should be used. + * + * @param trajectory The trajectory to follow. + * @param pose A function that supplies the robot pose - use one of the odometry classes to + * provide this. + * @param feedforward The feedforward to use for the drivetrain. + * @param kinematics The kinematics for the robot drivetrain. + * @param xController The Trajectory Tracker PID controller for the robot's x position. + * @param yController The Trajectory Tracker PID controller for the robot's y position. + * @param thetaController The Trajectory Tracker PID controller for angle for the robot. + * @param maxWheelVelocityMetersPerSecond The maximum velocity of a drivetrain wheel. + * @param frontLeftController The front left wheel velocity PID. + * @param rearLeftController The rear left wheel velocity PID. + * @param frontRightController The front right wheel velocity PID. + * @param rearRightController The rear right wheel velocity PID. + * @param currentWheelSpeeds A MecanumDriveWheelSpeeds object containing the current wheel speeds. + * @param outputDriveVoltages A MecanumVoltagesConsumer that consumes voltages of mecanum motors. + * @param requirements The subsystems to require. + */ + public MecanumControllerCommand( + Trajectory trajectory, + Supplier pose, + SimpleMotorFeedforward feedforward, + MecanumDriveKinematics kinematics, + PIDController xController, + PIDController yController, + ProfiledPIDController thetaController, + double maxWheelVelocityMetersPerSecond, + PIDController frontLeftController, + PIDController rearLeftController, + PIDController frontRightController, + PIDController rearRightController, + Supplier currentWheelSpeeds, + MecanumVoltagesConsumer outputDriveVoltages, + Subsystem... requirements) { + this( + trajectory, + pose, + feedforward, + kinematics, + xController, + yController, + thetaController, + () -> + trajectory.getStates().get(trajectory.getStates().size() - 1).poseMeters.getRotation(), + maxWheelVelocityMetersPerSecond, + frontLeftController, + rearLeftController, + frontRightController, + rearRightController, + currentWheelSpeeds, + outputDriveVoltages, + requirements); + } + /** * Constructs a new MecanumControllerCommand that when executed will follow the provided * trajectory. PID control and feedforward are handled internally. Outputs are scaled from -12 to @@ -176,6 +309,7 @@ public class MecanumControllerCommand extends Command { * voltages. * @param requirements The subsystems to require. */ + @Deprecated(since = "2025", forRemoval = true) public MecanumControllerCommand( Trajectory trajectory, Supplier pose, @@ -200,15 +334,15 @@ public class MecanumControllerCommand extends Command { xController, yController, thetaController, - () -> - trajectory.getStates().get(trajectory.getStates().size() - 1).poseMeters.getRotation(), maxWheelVelocityMetersPerSecond, frontLeftController, rearLeftController, frontRightController, rearRightController, currentWheelSpeeds, - outputDriveVoltages, + (frontLeft, frontRight, rearLeft, rearRight) -> + outputDriveVoltages.accept( + new MecanumDriveMotorVoltages(frontLeft, frontRight, rearLeft, rearRight)), requirements); } @@ -403,8 +537,7 @@ public class MecanumControllerCommand extends Command { m_currentWheelSpeeds.get().rearRightMetersPerSecond, rearRightSpeedSetpoint); m_outputDriveVoltages.accept( - new MecanumDriveMotorVoltages( - frontLeftOutput, frontRightOutput, rearLeftOutput, rearRightOutput)); + frontLeftOutput, frontRightOutput, rearLeftOutput, rearRightOutput); } else { m_outputWheelSpeeds.accept( @@ -425,4 +558,22 @@ public class MecanumControllerCommand extends Command { public boolean isFinished() { return m_timer.hasElapsed(m_trajectory.getTotalTimeSeconds()); } + + /** A consumer to represent an operation on the voltages of a mecanum drive. */ + @FunctionalInterface + public interface MecanumVoltagesConsumer { + /** + * Accepts the voltages to perform some operation with them. + * + * @param frontLeftVoltage The voltage of the front left motor. + * @param frontRightVoltage The voltage of the front right motor. + * @param rearLeftVoltage The voltage of the rear left motor. + * @param rearRightVoltage The voltage of the rear left motor. + */ + void accept( + double frontLeftVoltage, + double frontRightVoltage, + double rearLeftVoltage, + double rearRightVoltage); + } } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumcontrollercommand/subsystems/DriveSubsystem.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumcontrollercommand/subsystems/DriveSubsystem.java index b3f9b3462a..d6ff1eb734 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumcontrollercommand/subsystems/DriveSubsystem.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumcontrollercommand/subsystems/DriveSubsystem.java @@ -5,7 +5,6 @@ package edu.wpi.first.wpilibj.examples.mecanumcontrollercommand.subsystems; import edu.wpi.first.math.geometry.Pose2d; -import edu.wpi.first.math.kinematics.MecanumDriveMotorVoltages; import edu.wpi.first.math.kinematics.MecanumDriveOdometry; import edu.wpi.first.math.kinematics.MecanumDriveWheelPositions; import edu.wpi.first.math.kinematics.MecanumDriveWheelSpeeds; @@ -125,11 +124,15 @@ public class DriveSubsystem extends SubsystemBase { } /** Sets the front left drive MotorController to a voltage. */ - public void setDriveMotorControllersVolts(MecanumDriveMotorVoltages volts) { - m_frontLeft.setVoltage(volts.frontLeftVoltage); - m_rearLeft.setVoltage(volts.rearLeftVoltage); - m_frontRight.setVoltage(volts.frontRightVoltage); - m_rearRight.setVoltage(volts.rearRightVoltage); + public void setDriveMotorControllersVolts( + double frontLeftVoltage, + double frontRightVoltage, + double rearLeftVoltage, + double rearRightVoltage) { + m_frontLeft.setVoltage(frontLeftVoltage); + m_rearLeft.setVoltage(rearLeftVoltage); + m_frontRight.setVoltage(frontRightVoltage); + m_rearRight.setVoltage(rearRightVoltage); } /** Resets the drive encoders to currently read a position of 0. */ diff --git a/wpimath/src/generated/main/java/edu/wpi/first/math/proto/Kinematics.java b/wpimath/src/generated/main/java/edu/wpi/first/math/proto/Kinematics.java index 5494f0b675..8db878799f 100644 --- a/wpimath/src/generated/main/java/edu/wpi/first/math/proto/Kinematics.java +++ b/wpimath/src/generated/main/java/edu/wpi/first/math/proto/Kinematics.java @@ -19,7 +19,7 @@ import us.hebi.quickbuf.RepeatedByte; import us.hebi.quickbuf.RepeatedMessage; public final class Kinematics { - private static final RepeatedByte descriptorData = ProtoUtil.decodeBase64(3427, + private static final RepeatedByte descriptorData = ProtoUtil.decodeBase64(3021, "ChBraW5lbWF0aWNzLnByb3RvEgl3cGkucHJvdG8aEGdlb21ldHJ5MmQucHJvdG8iTQoVUHJvdG9idWZD" + "aGFzc2lzU3BlZWRzEg4KAnZ4GAEgASgBUgJ2eBIOCgJ2eRgCIAEoAVICdnkSFAoFb21lZ2EYAyABKAFS" + "BW9tZWdhIkYKI1Byb3RvYnVmRGlmZmVyZW50aWFsRHJpdmVLaW5lbWF0aWNzEh8KC3RyYWNrX3dpZHRo" + @@ -31,53 +31,46 @@ public final class Kinematics { "GAIgASgLMiAud3BpLnByb3RvLlByb3RvYnVmVHJhbnNsYXRpb24yZFIKZnJvbnRSaWdodBI9CglyZWFy" + "X2xlZnQYAyABKAsyIC53cGkucHJvdG8uUHJvdG9idWZUcmFuc2xhdGlvbjJkUghyZWFyTGVmdBI/Cgpy" + "ZWFyX3JpZ2h0GAQgASgLMiAud3BpLnByb3RvLlByb3RvYnVmVHJhbnNsYXRpb24yZFIJcmVhclJpZ2h0" + - "Ip8BCiFQcm90b2J1Zk1lY2FudW1Ecml2ZU1vdG9yVm9sdGFnZXMSHQoKZnJvbnRfbGVmdBgBIAEoAVIJ" + - "ZnJvbnRMZWZ0Eh8KC2Zyb250X3JpZ2h0GAIgASgBUgpmcm9udFJpZ2h0EhsKCXJlYXJfbGVmdBgDIAEo" + - "AVIIcmVhckxlZnQSHQoKcmVhcl9yaWdodBgEIAEoAVIJcmVhclJpZ2h0IqABCiJQcm90b2J1Zk1lY2Fu" + - "dW1Ecml2ZVdoZWVsUG9zaXRpb25zEh0KCmZyb250X2xlZnQYASABKAFSCWZyb250TGVmdBIfCgtmcm9u" + - "dF9yaWdodBgCIAEoAVIKZnJvbnRSaWdodBIbCglyZWFyX2xlZnQYAyABKAFSCHJlYXJMZWZ0Eh0KCnJl" + - "YXJfcmlnaHQYBCABKAFSCXJlYXJSaWdodCKdAQofUHJvdG9idWZNZWNhbnVtRHJpdmVXaGVlbFNwZWVk" + - "cxIdCgpmcm9udF9sZWZ0GAEgASgBUglmcm9udExlZnQSHwoLZnJvbnRfcmlnaHQYAiABKAFSCmZyb250" + - "UmlnaHQSGwoJcmVhcl9sZWZ0GAMgASgBUghyZWFyTGVmdBIdCgpyZWFyX3JpZ2h0GAQgASgBUglyZWFy" + - "UmlnaHQiWwodUHJvdG9idWZTd2VydmVEcml2ZUtpbmVtYXRpY3MSOgoHbW9kdWxlcxgBIAMoCzIgLndw", - "aS5wcm90by5Qcm90b2J1ZlRyYW5zbGF0aW9uMmRSB21vZHVsZXMibwocUHJvdG9idWZTd2VydmVNb2R1" + - "bGVQb3NpdGlvbhIaCghkaXN0YW5jZRgBIAEoAVIIZGlzdGFuY2USMwoFYW5nbGUYAiABKAsyHS53cGku" + - "cHJvdG8uUHJvdG9idWZSb3RhdGlvbjJkUgVhbmdsZSJmChlQcm90b2J1ZlN3ZXJ2ZU1vZHVsZVN0YXRl" + - "EhQKBXNwZWVkGAEgASgBUgVzcGVlZBIzCgVhbmdsZRgCIAEoCzIdLndwaS5wcm90by5Qcm90b2J1ZlJv" + - "dGF0aW9uMmRSBWFuZ2xlQhoKGGVkdS53cGkuZmlyc3QubWF0aC5wcm90b0qNDwoGEgQAAEQBCggKAQwS" + - "AwAAEgoICgECEgMCABIKCQoCAwASAwQAGgoICgEIEgMGADEKCQoCCAESAwYAMQoKCgIEABIECAAMAQoK" + - "CgMEAAESAwgIHQoLCgQEAAIAEgMJAhAKDAoFBAACAAUSAwkCCAoMCgUEAAIAARIDCQkLCgwKBQQAAgAD" + - "EgMJDg8KCwoEBAACARIDCgIQCgwKBQQAAgEFEgMKAggKDAoFBAACAQESAwoJCwoMCgUEAAIBAxIDCg4P" + - "CgsKBAQAAgISAwsCEwoMCgUEAAICBRIDCwIICgwKBQQAAgIBEgMLCQ4KDAoFBAACAgMSAwsREgoKCgIE" + - "ARIEDgAQAQoKCgMEAQESAw4IKwoLCgQEAQIAEgMPAhkKDAoFBAECAAUSAw8CCAoMCgUEAQIAARIDDwkU" + - "CgwKBQQBAgADEgMPFxgKCgoCBAISBBIAFQEKCgoDBAIBEgMSCCwKCwoEBAICABIDEwISCgwKBQQCAgAF" + - "EgMTAggKDAoFBAICAAESAxMJDQoMCgUEAgIAAxIDExARCgsKBAQCAgESAxQCEwoMCgUEAgIBBRIDFAII" + - "CgwKBQQCAgEBEgMUCQ4KDAoFBAICAQMSAxQREgoKCgIEAxIEFwAaAQoKCgMEAwESAxcILwoLCgQEAwIA" + - "EgMYAhIKDAoFBAMCAAUSAxgCCAoMCgUEAwIAARIDGAkNCgwKBQQDAgADEgMYEBEKCwoEBAMCARIDGQIT" + - "CgwKBQQDAgEFEgMZAggKDAoFBAMCAQESAxkJDgoMCgUEAwIBAxIDGRESCgoKAgQEEgQcACEBCgoKAwQE" + - "ARIDHAgmCgsKBAQEAgASAx0CJwoMCgUEBAIABhIDHQIXCgwKBQQEAgABEgMdGCIKDAoFBAQCAAMSAx0l" + - "JgoLCgQEBAIBEgMeAigKDAoFBAQCAQYSAx4CFwoMCgUEBAIBARIDHhgjCgwKBQQEAgEDEgMeJicKCwoE" + - "BAQCAhIDHwImCgwKBQQEAgIGEgMfAhcKDAoFBAQCAgESAx8YIQoMCgUEBAICAxIDHyQlCgsKBAQEAgMS" + - "AyACJwoMCgUEBAIDBhIDIAIXCgwKBQQEAgMBEgMgGCIKDAoFBAQCAwMSAyAlJgoKCgIEBRIEIwAoAQoK" + - "CgMEBQESAyMIKQoLCgQEBQIAEgMkAhgKDAoFBAUCAAUSAyQCCAoMCgUEBQIAARIDJAkTCgwKBQQFAgAD", - "EgMkFhcKCwoEBAUCARIDJQIZCgwKBQQFAgEFEgMlAggKDAoFBAUCAQESAyUJFAoMCgUEBQIBAxIDJRcY" + - "CgsKBAQFAgISAyYCFwoMCgUEBQICBRIDJgIICgwKBQQFAgIBEgMmCRIKDAoFBAUCAgMSAyYVFgoLCgQE" + - "BQIDEgMnAhgKDAoFBAUCAwUSAycCCAoMCgUEBQIDARIDJwkTCgwKBQQFAgMDEgMnFhcKCgoCBAYSBCoA" + - "LwEKCgoDBAYBEgMqCCoKCwoEBAYCABIDKwIYCgwKBQQGAgAFEgMrAggKDAoFBAYCAAESAysJEwoMCgUE" + - "BgIAAxIDKxYXCgsKBAQGAgESAywCGQoMCgUEBgIBBRIDLAIICgwKBQQGAgEBEgMsCRQKDAoFBAYCAQMS" + - "AywXGAoLCgQEBgICEgMtAhcKDAoFBAYCAgUSAy0CCAoMCgUEBgICARIDLQkSCgwKBQQGAgIDEgMtFRYK" + - "CwoEBAYCAxIDLgIYCgwKBQQGAgMFEgMuAggKDAoFBAYCAwESAy4JEwoMCgUEBgIDAxIDLhYXCgoKAgQH" + - "EgQxADYBCgoKAwQHARIDMQgnCgsKBAQHAgASAzICGAoMCgUEBwIABRIDMgIICgwKBQQHAgABEgMyCRMK" + - "DAoFBAcCAAMSAzIWFwoLCgQEBwIBEgMzAhkKDAoFBAcCAQUSAzMCCAoMCgUEBwIBARIDMwkUCgwKBQQH" + - "AgEDEgMzFxgKCwoEBAcCAhIDNAIXCgwKBQQHAgIFEgM0AggKDAoFBAcCAgESAzQJEgoMCgUEBwICAxID" + - "NBUWCgsKBAQHAgMSAzUCGAoMCgUEBwIDBRIDNQIICgwKBQQHAgMBEgM1CRMKDAoFBAcCAwMSAzUWFwoK" + - "CgIECBIEOAA6AQoKCgMECAESAzgIJQoLCgQECAIAEgM5Ai0KDAoFBAgCAAQSAzkCCgoMCgUECAIABhID" + - "OQsgCgwKBQQIAgABEgM5ISgKDAoFBAgCAAMSAzkrLAoKCgIECRIEPAA/AQoKCgMECQESAzwIJAoLCgQE" + - "CQIAEgM9AhYKDAoFBAkCAAUSAz0CCAoMCgUECQIAARIDPQkRCgwKBQQJAgADEgM9FBUKCwoEBAkCARID" + - "PgIfCgwKBQQJAgEGEgM+AhQKDAoFBAkCAQESAz4VGgoMCgUECQIBAxIDPh0eCgoKAgQKEgRBAEQBCgoK" + - "AwQKARIDQQghCgsKBAQKAgASA0ICEwoMCgUECgIABRIDQgIICgwKBQQKAgABEgNCCQ4KDAoFBAoCAAMS" + - "A0IREgoLCgQECgIBEgNDAh8KDAoFBAoCAQYSA0MCFAoMCgUECgIBARIDQxUaCgwKBQQKAgEDEgNDHR5i" + - "BnByb3RvMw=="); + "IqABCiJQcm90b2J1Zk1lY2FudW1Ecml2ZVdoZWVsUG9zaXRpb25zEh0KCmZyb250X2xlZnQYASABKAFS" + + "CWZyb250TGVmdBIfCgtmcm9udF9yaWdodBgCIAEoAVIKZnJvbnRSaWdodBIbCglyZWFyX2xlZnQYAyAB" + + "KAFSCHJlYXJMZWZ0Eh0KCnJlYXJfcmlnaHQYBCABKAFSCXJlYXJSaWdodCKdAQofUHJvdG9idWZNZWNh" + + "bnVtRHJpdmVXaGVlbFNwZWVkcxIdCgpmcm9udF9sZWZ0GAEgASgBUglmcm9udExlZnQSHwoLZnJvbnRf" + + "cmlnaHQYAiABKAFSCmZyb250UmlnaHQSGwoJcmVhcl9sZWZ0GAMgASgBUghyZWFyTGVmdBIdCgpyZWFy" + + "X3JpZ2h0GAQgASgBUglyZWFyUmlnaHQiWwodUHJvdG9idWZTd2VydmVEcml2ZUtpbmVtYXRpY3MSOgoH" + + "bW9kdWxlcxgBIAMoCzIgLndwaS5wcm90by5Qcm90b2J1ZlRyYW5zbGF0aW9uMmRSB21vZHVsZXMibwoc" + + "UHJvdG9idWZTd2VydmVNb2R1bGVQb3NpdGlvbhIaCghkaXN0YW5jZRgBIAEoAVIIZGlzdGFuY2USMwoF" + + "YW5nbGUYAiABKAsyHS53cGkucHJvdG8uUHJvdG9idWZSb3RhdGlvbjJkUgVhbmdsZSJmChlQcm90b2J1", + "ZlN3ZXJ2ZU1vZHVsZVN0YXRlEhQKBXNwZWVkGAEgASgBUgVzcGVlZBIzCgVhbmdsZRgCIAEoCzIdLndw" + + "aS5wcm90by5Qcm90b2J1ZlJvdGF0aW9uMmRSBWFuZ2xlQhoKGGVkdS53cGkuZmlyc3QubWF0aC5wcm90" + + "b0qZDQoGEgQAAD0BCggKAQwSAwAAEgoICgECEgMCABIKCQoCAwASAwQAGgoICgEIEgMGADEKCQoCCAES" + + "AwYAMQoKCgIEABIECAAMAQoKCgMEAAESAwgIHQoLCgQEAAIAEgMJAhAKDAoFBAACAAUSAwkCCAoMCgUE" + + "AAIAARIDCQkLCgwKBQQAAgADEgMJDg8KCwoEBAACARIDCgIQCgwKBQQAAgEFEgMKAggKDAoFBAACAQES" + + "AwoJCwoMCgUEAAIBAxIDCg4PCgsKBAQAAgISAwsCEwoMCgUEAAICBRIDCwIICgwKBQQAAgIBEgMLCQ4K" + + "DAoFBAACAgMSAwsREgoKCgIEARIEDgAQAQoKCgMEAQESAw4IKwoLCgQEAQIAEgMPAhkKDAoFBAECAAUS" + + "Aw8CCAoMCgUEAQIAARIDDwkUCgwKBQQBAgADEgMPFxgKCgoCBAISBBIAFQEKCgoDBAIBEgMSCCwKCwoE" + + "BAICABIDEwISCgwKBQQCAgAFEgMTAggKDAoFBAICAAESAxMJDQoMCgUEAgIAAxIDExARCgsKBAQCAgES" + + "AxQCEwoMCgUEAgIBBRIDFAIICgwKBQQCAgEBEgMUCQ4KDAoFBAICAQMSAxQREgoKCgIEAxIEFwAaAQoK" + + "CgMEAwESAxcILwoLCgQEAwIAEgMYAhIKDAoFBAMCAAUSAxgCCAoMCgUEAwIAARIDGAkNCgwKBQQDAgAD" + + "EgMYEBEKCwoEBAMCARIDGQITCgwKBQQDAgEFEgMZAggKDAoFBAMCAQESAxkJDgoMCgUEAwIBAxIDGRES" + + "CgoKAgQEEgQcACEBCgoKAwQEARIDHAgmCgsKBAQEAgASAx0CJwoMCgUEBAIABhIDHQIXCgwKBQQEAgAB" + + "EgMdGCIKDAoFBAQCAAMSAx0lJgoLCgQEBAIBEgMeAigKDAoFBAQCAQYSAx4CFwoMCgUEBAIBARIDHhgj" + + "CgwKBQQEAgEDEgMeJicKCwoEBAQCAhIDHwImCgwKBQQEAgIGEgMfAhcKDAoFBAQCAgESAx8YIQoMCgUE" + + "BAICAxIDHyQlCgsKBAQEAgMSAyACJwoMCgUEBAIDBhIDIAIXCgwKBQQEAgMBEgMgGCIKDAoFBAQCAwMS" + + "AyAlJgoKCgIEBRIEIwAoAQoKCgMEBQESAyMIKgoLCgQEBQIAEgMkAhgKDAoFBAUCAAUSAyQCCAoMCgUE" + + "BQIAARIDJAkTCgwKBQQFAgADEgMkFhcKCwoEBAUCARIDJQIZCgwKBQQFAgEFEgMlAggKDAoFBAUCAQES" + + "AyUJFAoMCgUEBQIBAxIDJRcYCgsKBAQFAgISAyYCFwoMCgUEBQICBRIDJgIICgwKBQQFAgIBEgMmCRIK" + + "DAoFBAUCAgMSAyYVFgoLCgQEBQIDEgMnAhgKDAoFBAUCAwUSAycCCAoMCgUEBQIDARIDJwkTCgwKBQQF", + "AgMDEgMnFhcKCgoCBAYSBCoALwEKCgoDBAYBEgMqCCcKCwoEBAYCABIDKwIYCgwKBQQGAgAFEgMrAggK" + + "DAoFBAYCAAESAysJEwoMCgUEBgIAAxIDKxYXCgsKBAQGAgESAywCGQoMCgUEBgIBBRIDLAIICgwKBQQG" + + "AgEBEgMsCRQKDAoFBAYCAQMSAywXGAoLCgQEBgICEgMtAhcKDAoFBAYCAgUSAy0CCAoMCgUEBgICARID" + + "LQkSCgwKBQQGAgIDEgMtFRYKCwoEBAYCAxIDLgIYCgwKBQQGAgMFEgMuAggKDAoFBAYCAwESAy4JEwoM" + + "CgUEBgIDAxIDLhYXCgoKAgQHEgQxADMBCgoKAwQHARIDMQglCgsKBAQHAgASAzICLQoMCgUEBwIABBID" + + "MgIKCgwKBQQHAgAGEgMyCyAKDAoFBAcCAAESAzIhKAoMCgUEBwIAAxIDMissCgoKAgQIEgQ1ADgBCgoK" + + "AwQIARIDNQgkCgsKBAQIAgASAzYCFgoMCgUECAIABRIDNgIICgwKBQQIAgABEgM2CREKDAoFBAgCAAMS" + + "AzYUFQoLCgQECAIBEgM3Ah8KDAoFBAgCAQYSAzcCFAoMCgUECAIBARIDNxUaCgwKBQQIAgEDEgM3HR4K" + + "CgoCBAkSBDoAPQEKCgoDBAkBEgM6CCEKCwoEBAkCABIDOwITCgwKBQQJAgAFEgM7AggKDAoFBAkCAAES" + + "AzsJDgoMCgUECQIAAxIDOxESCgsKBAQJAgESAzwCHwoMCgUECQIBBhIDPAIUCgwKBQQJAgEBEgM8FRoK" + + "DAoFBAkCAQMSAzwdHmIGcHJvdG8z"); static final Descriptors.FileDescriptor descriptor = Descriptors.FileDescriptor.internalBuildGeneratedFileFrom("kinematics.proto", "wpi.proto", descriptorData, Geometry2D.getDescriptor()); @@ -91,17 +84,15 @@ public final class Kinematics { static final Descriptors.Descriptor wpi_proto_ProtobufMecanumDriveKinematics_descriptor = descriptor.internalContainedType(368, 292, "ProtobufMecanumDriveKinematics", "wpi.proto.ProtobufMecanumDriveKinematics"); - static final Descriptors.Descriptor wpi_proto_ProtobufMecanumDriveMotorVoltages_descriptor = descriptor.internalContainedType(663, 159, "ProtobufMecanumDriveMotorVoltages", "wpi.proto.ProtobufMecanumDriveMotorVoltages"); + static final Descriptors.Descriptor wpi_proto_ProtobufMecanumDriveWheelPositions_descriptor = descriptor.internalContainedType(663, 160, "ProtobufMecanumDriveWheelPositions", "wpi.proto.ProtobufMecanumDriveWheelPositions"); - static final Descriptors.Descriptor wpi_proto_ProtobufMecanumDriveWheelPositions_descriptor = descriptor.internalContainedType(825, 160, "ProtobufMecanumDriveWheelPositions", "wpi.proto.ProtobufMecanumDriveWheelPositions"); + static final Descriptors.Descriptor wpi_proto_ProtobufMecanumDriveWheelSpeeds_descriptor = descriptor.internalContainedType(826, 157, "ProtobufMecanumDriveWheelSpeeds", "wpi.proto.ProtobufMecanumDriveWheelSpeeds"); - static final Descriptors.Descriptor wpi_proto_ProtobufMecanumDriveWheelSpeeds_descriptor = descriptor.internalContainedType(988, 157, "ProtobufMecanumDriveWheelSpeeds", "wpi.proto.ProtobufMecanumDriveWheelSpeeds"); + static final Descriptors.Descriptor wpi_proto_ProtobufSwerveDriveKinematics_descriptor = descriptor.internalContainedType(985, 91, "ProtobufSwerveDriveKinematics", "wpi.proto.ProtobufSwerveDriveKinematics"); - static final Descriptors.Descriptor wpi_proto_ProtobufSwerveDriveKinematics_descriptor = descriptor.internalContainedType(1147, 91, "ProtobufSwerveDriveKinematics", "wpi.proto.ProtobufSwerveDriveKinematics"); + static final Descriptors.Descriptor wpi_proto_ProtobufSwerveModulePosition_descriptor = descriptor.internalContainedType(1078, 111, "ProtobufSwerveModulePosition", "wpi.proto.ProtobufSwerveModulePosition"); - static final Descriptors.Descriptor wpi_proto_ProtobufSwerveModulePosition_descriptor = descriptor.internalContainedType(1240, 111, "ProtobufSwerveModulePosition", "wpi.proto.ProtobufSwerveModulePosition"); - - static final Descriptors.Descriptor wpi_proto_ProtobufSwerveModuleState_descriptor = descriptor.internalContainedType(1353, 102, "ProtobufSwerveModuleState", "wpi.proto.ProtobufSwerveModuleState"); + static final Descriptors.Descriptor wpi_proto_ProtobufSwerveModuleState_descriptor = descriptor.internalContainedType(1191, 102, "ProtobufSwerveModuleState", "wpi.proto.ProtobufSwerveModuleState"); /** * @return this proto file's descriptor. @@ -2043,506 +2034,6 @@ public final class Kinematics { } } - /** - * Protobuf type {@code ProtobufMecanumDriveMotorVoltages} - */ - public static final class ProtobufMecanumDriveMotorVoltages extends ProtoMessage implements Cloneable { - private static final long serialVersionUID = 0L; - - /** - * optional double front_left = 1; - */ - private double frontLeft; - - /** - * optional double front_right = 2; - */ - private double frontRight; - - /** - * optional double rear_left = 3; - */ - private double rearLeft; - - /** - * optional double rear_right = 4; - */ - private double rearRight; - - private ProtobufMecanumDriveMotorVoltages() { - } - - /** - * @return a new empty instance of {@code ProtobufMecanumDriveMotorVoltages} - */ - public static ProtobufMecanumDriveMotorVoltages newInstance() { - return new ProtobufMecanumDriveMotorVoltages(); - } - - /** - * optional double front_left = 1; - * @return whether the frontLeft field is set - */ - public boolean hasFrontLeft() { - return (bitField0_ & 0x00000001) != 0; - } - - /** - * optional double front_left = 1; - * @return this - */ - public ProtobufMecanumDriveMotorVoltages clearFrontLeft() { - bitField0_ &= ~0x00000001; - frontLeft = 0D; - return this; - } - - /** - * optional double front_left = 1; - * @return the frontLeft - */ - public double getFrontLeft() { - return frontLeft; - } - - /** - * optional double front_left = 1; - * @param value the frontLeft to set - * @return this - */ - public ProtobufMecanumDriveMotorVoltages setFrontLeft(final double value) { - bitField0_ |= 0x00000001; - frontLeft = value; - return this; - } - - /** - * optional double front_right = 2; - * @return whether the frontRight field is set - */ - public boolean hasFrontRight() { - return (bitField0_ & 0x00000002) != 0; - } - - /** - * optional double front_right = 2; - * @return this - */ - public ProtobufMecanumDriveMotorVoltages clearFrontRight() { - bitField0_ &= ~0x00000002; - frontRight = 0D; - return this; - } - - /** - * optional double front_right = 2; - * @return the frontRight - */ - public double getFrontRight() { - return frontRight; - } - - /** - * optional double front_right = 2; - * @param value the frontRight to set - * @return this - */ - public ProtobufMecanumDriveMotorVoltages setFrontRight(final double value) { - bitField0_ |= 0x00000002; - frontRight = value; - return this; - } - - /** - * optional double rear_left = 3; - * @return whether the rearLeft field is set - */ - public boolean hasRearLeft() { - return (bitField0_ & 0x00000004) != 0; - } - - /** - * optional double rear_left = 3; - * @return this - */ - public ProtobufMecanumDriveMotorVoltages clearRearLeft() { - bitField0_ &= ~0x00000004; - rearLeft = 0D; - return this; - } - - /** - * optional double rear_left = 3; - * @return the rearLeft - */ - public double getRearLeft() { - return rearLeft; - } - - /** - * optional double rear_left = 3; - * @param value the rearLeft to set - * @return this - */ - public ProtobufMecanumDriveMotorVoltages setRearLeft(final double value) { - bitField0_ |= 0x00000004; - rearLeft = value; - return this; - } - - /** - * optional double rear_right = 4; - * @return whether the rearRight field is set - */ - public boolean hasRearRight() { - return (bitField0_ & 0x00000008) != 0; - } - - /** - * optional double rear_right = 4; - * @return this - */ - public ProtobufMecanumDriveMotorVoltages clearRearRight() { - bitField0_ &= ~0x00000008; - rearRight = 0D; - return this; - } - - /** - * optional double rear_right = 4; - * @return the rearRight - */ - public double getRearRight() { - return rearRight; - } - - /** - * optional double rear_right = 4; - * @param value the rearRight to set - * @return this - */ - public ProtobufMecanumDriveMotorVoltages setRearRight(final double value) { - bitField0_ |= 0x00000008; - rearRight = value; - return this; - } - - @Override - public ProtobufMecanumDriveMotorVoltages copyFrom( - final ProtobufMecanumDriveMotorVoltages other) { - cachedSize = other.cachedSize; - if ((bitField0_ | other.bitField0_) != 0) { - bitField0_ = other.bitField0_; - frontLeft = other.frontLeft; - frontRight = other.frontRight; - rearLeft = other.rearLeft; - rearRight = other.rearRight; - } - return this; - } - - @Override - public ProtobufMecanumDriveMotorVoltages mergeFrom( - final ProtobufMecanumDriveMotorVoltages other) { - if (other.isEmpty()) { - return this; - } - cachedSize = -1; - if (other.hasFrontLeft()) { - setFrontLeft(other.frontLeft); - } - if (other.hasFrontRight()) { - setFrontRight(other.frontRight); - } - if (other.hasRearLeft()) { - setRearLeft(other.rearLeft); - } - if (other.hasRearRight()) { - setRearRight(other.rearRight); - } - return this; - } - - @Override - public ProtobufMecanumDriveMotorVoltages clear() { - if (isEmpty()) { - return this; - } - cachedSize = -1; - bitField0_ = 0; - frontLeft = 0D; - frontRight = 0D; - rearLeft = 0D; - rearRight = 0D; - return this; - } - - @Override - public ProtobufMecanumDriveMotorVoltages clearQuick() { - if (isEmpty()) { - return this; - } - cachedSize = -1; - bitField0_ = 0; - return this; - } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ProtobufMecanumDriveMotorVoltages)) { - return false; - } - ProtobufMecanumDriveMotorVoltages other = (ProtobufMecanumDriveMotorVoltages) o; - return bitField0_ == other.bitField0_ - && (!hasFrontLeft() || ProtoUtil.isEqual(frontLeft, other.frontLeft)) - && (!hasFrontRight() || ProtoUtil.isEqual(frontRight, other.frontRight)) - && (!hasRearLeft() || ProtoUtil.isEqual(rearLeft, other.rearLeft)) - && (!hasRearRight() || ProtoUtil.isEqual(rearRight, other.rearRight)); - } - - @Override - public void writeTo(final ProtoSink output) throws IOException { - if ((bitField0_ & 0x00000001) != 0) { - output.writeRawByte((byte) 9); - output.writeDoubleNoTag(frontLeft); - } - if ((bitField0_ & 0x00000002) != 0) { - output.writeRawByte((byte) 17); - output.writeDoubleNoTag(frontRight); - } - if ((bitField0_ & 0x00000004) != 0) { - output.writeRawByte((byte) 25); - output.writeDoubleNoTag(rearLeft); - } - if ((bitField0_ & 0x00000008) != 0) { - output.writeRawByte((byte) 33); - output.writeDoubleNoTag(rearRight); - } - } - - @Override - protected int computeSerializedSize() { - int size = 0; - if ((bitField0_ & 0x00000001) != 0) { - size += 9; - } - if ((bitField0_ & 0x00000002) != 0) { - size += 9; - } - if ((bitField0_ & 0x00000004) != 0) { - size += 9; - } - if ((bitField0_ & 0x00000008) != 0) { - size += 9; - } - return size; - } - - @Override - @SuppressWarnings("fallthrough") - public ProtobufMecanumDriveMotorVoltages mergeFrom(final ProtoSource input) throws IOException { - // Enabled Fall-Through Optimization (QuickBuffers) - int tag = input.readTag(); - while (true) { - switch (tag) { - case 9: { - // frontLeft - frontLeft = input.readDouble(); - bitField0_ |= 0x00000001; - tag = input.readTag(); - if (tag != 17) { - break; - } - } - case 17: { - // frontRight - frontRight = input.readDouble(); - bitField0_ |= 0x00000002; - tag = input.readTag(); - if (tag != 25) { - break; - } - } - case 25: { - // rearLeft - rearLeft = input.readDouble(); - bitField0_ |= 0x00000004; - tag = input.readTag(); - if (tag != 33) { - break; - } - } - case 33: { - // rearRight - rearRight = input.readDouble(); - bitField0_ |= 0x00000008; - tag = input.readTag(); - if (tag != 0) { - break; - } - } - case 0: { - return this; - } - default: { - if (!input.skipField(tag)) { - return this; - } - tag = input.readTag(); - break; - } - } - } - } - - @Override - public void writeTo(final JsonSink output) throws IOException { - output.beginObject(); - if ((bitField0_ & 0x00000001) != 0) { - output.writeDouble(FieldNames.frontLeft, frontLeft); - } - if ((bitField0_ & 0x00000002) != 0) { - output.writeDouble(FieldNames.frontRight, frontRight); - } - if ((bitField0_ & 0x00000004) != 0) { - output.writeDouble(FieldNames.rearLeft, rearLeft); - } - if ((bitField0_ & 0x00000008) != 0) { - output.writeDouble(FieldNames.rearRight, rearRight); - } - output.endObject(); - } - - @Override - public ProtobufMecanumDriveMotorVoltages mergeFrom(final JsonSource input) throws IOException { - if (!input.beginObject()) { - return this; - } - while (!input.isAtEnd()) { - switch (input.readFieldHash()) { - case 127514064: - case -324277155: { - if (input.isAtField(FieldNames.frontLeft)) { - if (!input.trySkipNullValue()) { - frontLeft = input.readDouble(); - bitField0_ |= 0x00000001; - } - } else { - input.skipUnknownField(); - } - break; - } - case -336370317: - case -1456996218: { - if (input.isAtField(FieldNames.frontRight)) { - if (!input.trySkipNullValue()) { - frontRight = input.readDouble(); - bitField0_ |= 0x00000002; - } - } else { - input.skipUnknownField(); - } - break; - } - case -854852661: - case -712874558: { - if (input.isAtField(FieldNames.rearLeft)) { - if (!input.trySkipNullValue()) { - rearLeft = input.readDouble(); - bitField0_ |= 0x00000004; - } - } else { - input.skipUnknownField(); - } - break; - } - case -724967720: - case -618613823: { - if (input.isAtField(FieldNames.rearRight)) { - if (!input.trySkipNullValue()) { - rearRight = input.readDouble(); - bitField0_ |= 0x00000008; - } - } else { - input.skipUnknownField(); - } - break; - } - default: { - input.skipUnknownField(); - break; - } - } - } - input.endObject(); - return this; - } - - @Override - public ProtobufMecanumDriveMotorVoltages clone() { - return new ProtobufMecanumDriveMotorVoltages().copyFrom(this); - } - - @Override - public boolean isEmpty() { - return ((bitField0_) == 0); - } - - public static ProtobufMecanumDriveMotorVoltages parseFrom(final byte[] data) throws - InvalidProtocolBufferException { - return ProtoMessage.mergeFrom(new ProtobufMecanumDriveMotorVoltages(), data).checkInitialized(); - } - - public static ProtobufMecanumDriveMotorVoltages parseFrom(final ProtoSource input) throws - IOException { - return ProtoMessage.mergeFrom(new ProtobufMecanumDriveMotorVoltages(), input).checkInitialized(); - } - - public static ProtobufMecanumDriveMotorVoltages parseFrom(final JsonSource input) throws - IOException { - return ProtoMessage.mergeFrom(new ProtobufMecanumDriveMotorVoltages(), input).checkInitialized(); - } - - /** - * @return factory for creating ProtobufMecanumDriveMotorVoltages messages - */ - public static MessageFactory getFactory() { - return ProtobufMecanumDriveMotorVoltagesFactory.INSTANCE; - } - - /** - * @return this type's descriptor. - */ - public static Descriptors.Descriptor getDescriptor() { - return Kinematics.wpi_proto_ProtobufMecanumDriveMotorVoltages_descriptor; - } - - private enum ProtobufMecanumDriveMotorVoltagesFactory implements MessageFactory { - INSTANCE; - - @Override - public ProtobufMecanumDriveMotorVoltages create() { - return ProtobufMecanumDriveMotorVoltages.newInstance(); - } - } - - /** - * Contains name constants used for serializing JSON - */ - static class FieldNames { - static final FieldName frontLeft = FieldName.forField("frontLeft", "front_left"); - - static final FieldName frontRight = FieldName.forField("frontRight", "front_right"); - - static final FieldName rearLeft = FieldName.forField("rearLeft", "rear_left"); - - static final FieldName rearRight = FieldName.forField("rearRight", "rear_right"); - } - } - /** * Protobuf type {@code ProtobufMecanumDriveWheelPositions} */ diff --git a/wpimath/src/generated/main/native/cpp/wpimath/protobuf/kinematics.npb.cpp b/wpimath/src/generated/main/native/cpp/wpimath/protobuf/kinematics.npb.cpp index 6508741375..ad404212b9 100644 --- a/wpimath/src/generated/main/native/cpp/wpimath/protobuf/kinematics.npb.cpp +++ b/wpimath/src/generated/main/native/cpp/wpimath/protobuf/kinematics.npb.cpp @@ -78,283 +78,243 @@ static const uint8_t file_descriptor[] { 0x6f,0x74,0x6f,0x62,0x75,0x66,0x54,0x72,0x61,0x6e, 0x73,0x6c,0x61,0x74,0x69,0x6f,0x6e,0x32,0x64,0x52, 0x09,0x72,0x65,0x61,0x72,0x52,0x69,0x67,0x68,0x74, -0x22,0x9f,0x01,0x0a,0x21,0x50,0x72,0x6f,0x74,0x6f, +0x22,0xa0,0x01,0x0a,0x22,0x50,0x72,0x6f,0x74,0x6f, 0x62,0x75,0x66,0x4d,0x65,0x63,0x61,0x6e,0x75,0x6d, -0x44,0x72,0x69,0x76,0x65,0x4d,0x6f,0x74,0x6f,0x72, -0x56,0x6f,0x6c,0x74,0x61,0x67,0x65,0x73,0x12,0x1d, -0x0a,0x0a,0x66,0x72,0x6f,0x6e,0x74,0x5f,0x6c,0x65, -0x66,0x74,0x18,0x01,0x20,0x01,0x28,0x01,0x52,0x09, -0x66,0x72,0x6f,0x6e,0x74,0x4c,0x65,0x66,0x74,0x12, -0x1f,0x0a,0x0b,0x66,0x72,0x6f,0x6e,0x74,0x5f,0x72, -0x69,0x67,0x68,0x74,0x18,0x02,0x20,0x01,0x28,0x01, -0x52,0x0a,0x66,0x72,0x6f,0x6e,0x74,0x52,0x69,0x67, -0x68,0x74,0x12,0x1b,0x0a,0x09,0x72,0x65,0x61,0x72, -0x5f,0x6c,0x65,0x66,0x74,0x18,0x03,0x20,0x01,0x28, -0x01,0x52,0x08,0x72,0x65,0x61,0x72,0x4c,0x65,0x66, -0x74,0x12,0x1d,0x0a,0x0a,0x72,0x65,0x61,0x72,0x5f, -0x72,0x69,0x67,0x68,0x74,0x18,0x04,0x20,0x01,0x28, -0x01,0x52,0x09,0x72,0x65,0x61,0x72,0x52,0x69,0x67, -0x68,0x74,0x22,0xa0,0x01,0x0a,0x22,0x50,0x72,0x6f, -0x74,0x6f,0x62,0x75,0x66,0x4d,0x65,0x63,0x61,0x6e, -0x75,0x6d,0x44,0x72,0x69,0x76,0x65,0x57,0x68,0x65, -0x65,0x6c,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, -0x73,0x12,0x1d,0x0a,0x0a,0x66,0x72,0x6f,0x6e,0x74, -0x5f,0x6c,0x65,0x66,0x74,0x18,0x01,0x20,0x01,0x28, -0x01,0x52,0x09,0x66,0x72,0x6f,0x6e,0x74,0x4c,0x65, -0x66,0x74,0x12,0x1f,0x0a,0x0b,0x66,0x72,0x6f,0x6e, -0x74,0x5f,0x72,0x69,0x67,0x68,0x74,0x18,0x02,0x20, -0x01,0x28,0x01,0x52,0x0a,0x66,0x72,0x6f,0x6e,0x74, -0x52,0x69,0x67,0x68,0x74,0x12,0x1b,0x0a,0x09,0x72, -0x65,0x61,0x72,0x5f,0x6c,0x65,0x66,0x74,0x18,0x03, -0x20,0x01,0x28,0x01,0x52,0x08,0x72,0x65,0x61,0x72, -0x4c,0x65,0x66,0x74,0x12,0x1d,0x0a,0x0a,0x72,0x65, -0x61,0x72,0x5f,0x72,0x69,0x67,0x68,0x74,0x18,0x04, -0x20,0x01,0x28,0x01,0x52,0x09,0x72,0x65,0x61,0x72, -0x52,0x69,0x67,0x68,0x74,0x22,0x9d,0x01,0x0a,0x1f, -0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4d,0x65, -0x63,0x61,0x6e,0x75,0x6d,0x44,0x72,0x69,0x76,0x65, -0x57,0x68,0x65,0x65,0x6c,0x53,0x70,0x65,0x65,0x64, -0x73,0x12,0x1d,0x0a,0x0a,0x66,0x72,0x6f,0x6e,0x74, -0x5f,0x6c,0x65,0x66,0x74,0x18,0x01,0x20,0x01,0x28, -0x01,0x52,0x09,0x66,0x72,0x6f,0x6e,0x74,0x4c,0x65, -0x66,0x74,0x12,0x1f,0x0a,0x0b,0x66,0x72,0x6f,0x6e, -0x74,0x5f,0x72,0x69,0x67,0x68,0x74,0x18,0x02,0x20, -0x01,0x28,0x01,0x52,0x0a,0x66,0x72,0x6f,0x6e,0x74, -0x52,0x69,0x67,0x68,0x74,0x12,0x1b,0x0a,0x09,0x72, -0x65,0x61,0x72,0x5f,0x6c,0x65,0x66,0x74,0x18,0x03, -0x20,0x01,0x28,0x01,0x52,0x08,0x72,0x65,0x61,0x72, -0x4c,0x65,0x66,0x74,0x12,0x1d,0x0a,0x0a,0x72,0x65, -0x61,0x72,0x5f,0x72,0x69,0x67,0x68,0x74,0x18,0x04, -0x20,0x01,0x28,0x01,0x52,0x09,0x72,0x65,0x61,0x72, -0x52,0x69,0x67,0x68,0x74,0x22,0x5b,0x0a,0x1d,0x50, -0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x53,0x77,0x65, -0x72,0x76,0x65,0x44,0x72,0x69,0x76,0x65,0x4b,0x69, -0x6e,0x65,0x6d,0x61,0x74,0x69,0x63,0x73,0x12,0x3a, -0x0a,0x07,0x6d,0x6f,0x64,0x75,0x6c,0x65,0x73,0x18, -0x01,0x20,0x03,0x28,0x0b,0x32,0x20,0x2e,0x77,0x70, -0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e,0x50,0x72, -0x6f,0x74,0x6f,0x62,0x75,0x66,0x54,0x72,0x61,0x6e, -0x73,0x6c,0x61,0x74,0x69,0x6f,0x6e,0x32,0x64,0x52, -0x07,0x6d,0x6f,0x64,0x75,0x6c,0x65,0x73,0x22,0x6f, -0x0a,0x1c,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66, -0x53,0x77,0x65,0x72,0x76,0x65,0x4d,0x6f,0x64,0x75, -0x6c,0x65,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, -0x12,0x1a,0x0a,0x08,0x64,0x69,0x73,0x74,0x61,0x6e, -0x63,0x65,0x18,0x01,0x20,0x01,0x28,0x01,0x52,0x08, -0x64,0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x12,0x33, -0x0a,0x05,0x61,0x6e,0x67,0x6c,0x65,0x18,0x02,0x20, -0x01,0x28,0x0b,0x32,0x1d,0x2e,0x77,0x70,0x69,0x2e, +0x44,0x72,0x69,0x76,0x65,0x57,0x68,0x65,0x65,0x6c, +0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x73,0x12, +0x1d,0x0a,0x0a,0x66,0x72,0x6f,0x6e,0x74,0x5f,0x6c, +0x65,0x66,0x74,0x18,0x01,0x20,0x01,0x28,0x01,0x52, +0x09,0x66,0x72,0x6f,0x6e,0x74,0x4c,0x65,0x66,0x74, +0x12,0x1f,0x0a,0x0b,0x66,0x72,0x6f,0x6e,0x74,0x5f, +0x72,0x69,0x67,0x68,0x74,0x18,0x02,0x20,0x01,0x28, +0x01,0x52,0x0a,0x66,0x72,0x6f,0x6e,0x74,0x52,0x69, +0x67,0x68,0x74,0x12,0x1b,0x0a,0x09,0x72,0x65,0x61, +0x72,0x5f,0x6c,0x65,0x66,0x74,0x18,0x03,0x20,0x01, +0x28,0x01,0x52,0x08,0x72,0x65,0x61,0x72,0x4c,0x65, +0x66,0x74,0x12,0x1d,0x0a,0x0a,0x72,0x65,0x61,0x72, +0x5f,0x72,0x69,0x67,0x68,0x74,0x18,0x04,0x20,0x01, +0x28,0x01,0x52,0x09,0x72,0x65,0x61,0x72,0x52,0x69, +0x67,0x68,0x74,0x22,0x9d,0x01,0x0a,0x1f,0x50,0x72, +0x6f,0x74,0x6f,0x62,0x75,0x66,0x4d,0x65,0x63,0x61, +0x6e,0x75,0x6d,0x44,0x72,0x69,0x76,0x65,0x57,0x68, +0x65,0x65,0x6c,0x53,0x70,0x65,0x65,0x64,0x73,0x12, +0x1d,0x0a,0x0a,0x66,0x72,0x6f,0x6e,0x74,0x5f,0x6c, +0x65,0x66,0x74,0x18,0x01,0x20,0x01,0x28,0x01,0x52, +0x09,0x66,0x72,0x6f,0x6e,0x74,0x4c,0x65,0x66,0x74, +0x12,0x1f,0x0a,0x0b,0x66,0x72,0x6f,0x6e,0x74,0x5f, +0x72,0x69,0x67,0x68,0x74,0x18,0x02,0x20,0x01,0x28, +0x01,0x52,0x0a,0x66,0x72,0x6f,0x6e,0x74,0x52,0x69, +0x67,0x68,0x74,0x12,0x1b,0x0a,0x09,0x72,0x65,0x61, +0x72,0x5f,0x6c,0x65,0x66,0x74,0x18,0x03,0x20,0x01, +0x28,0x01,0x52,0x08,0x72,0x65,0x61,0x72,0x4c,0x65, +0x66,0x74,0x12,0x1d,0x0a,0x0a,0x72,0x65,0x61,0x72, +0x5f,0x72,0x69,0x67,0x68,0x74,0x18,0x04,0x20,0x01, +0x28,0x01,0x52,0x09,0x72,0x65,0x61,0x72,0x52,0x69, +0x67,0x68,0x74,0x22,0x5b,0x0a,0x1d,0x50,0x72,0x6f, +0x74,0x6f,0x62,0x75,0x66,0x53,0x77,0x65,0x72,0x76, +0x65,0x44,0x72,0x69,0x76,0x65,0x4b,0x69,0x6e,0x65, +0x6d,0x61,0x74,0x69,0x63,0x73,0x12,0x3a,0x0a,0x07, +0x6d,0x6f,0x64,0x75,0x6c,0x65,0x73,0x18,0x01,0x20, +0x03,0x28,0x0b,0x32,0x20,0x2e,0x77,0x70,0x69,0x2e, 0x70,0x72,0x6f,0x74,0x6f,0x2e,0x50,0x72,0x6f,0x74, -0x6f,0x62,0x75,0x66,0x52,0x6f,0x74,0x61,0x74,0x69, -0x6f,0x6e,0x32,0x64,0x52,0x05,0x61,0x6e,0x67,0x6c, -0x65,0x22,0x66,0x0a,0x19,0x50,0x72,0x6f,0x74,0x6f, -0x62,0x75,0x66,0x53,0x77,0x65,0x72,0x76,0x65,0x4d, -0x6f,0x64,0x75,0x6c,0x65,0x53,0x74,0x61,0x74,0x65, -0x12,0x14,0x0a,0x05,0x73,0x70,0x65,0x65,0x64,0x18, -0x01,0x20,0x01,0x28,0x01,0x52,0x05,0x73,0x70,0x65, -0x65,0x64,0x12,0x33,0x0a,0x05,0x61,0x6e,0x67,0x6c, -0x65,0x18,0x02,0x20,0x01,0x28,0x0b,0x32,0x1d,0x2e, -0x77,0x70,0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e, -0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x52,0x6f, -0x74,0x61,0x74,0x69,0x6f,0x6e,0x32,0x64,0x52,0x05, -0x61,0x6e,0x67,0x6c,0x65,0x42,0x1a,0x0a,0x18,0x65, -0x64,0x75,0x2e,0x77,0x70,0x69,0x2e,0x66,0x69,0x72, -0x73,0x74,0x2e,0x6d,0x61,0x74,0x68,0x2e,0x70,0x72, -0x6f,0x74,0x6f,0x4a,0x8d,0x0f,0x0a,0x06,0x12,0x04, -0x00,0x00,0x44,0x01,0x0a,0x08,0x0a,0x01,0x0c,0x12, -0x03,0x00,0x00,0x12,0x0a,0x08,0x0a,0x01,0x02,0x12, -0x03,0x02,0x00,0x12,0x0a,0x09,0x0a,0x02,0x03,0x00, -0x12,0x03,0x04,0x00,0x1a,0x0a,0x08,0x0a,0x01,0x08, -0x12,0x03,0x06,0x00,0x31,0x0a,0x09,0x0a,0x02,0x08, -0x01,0x12,0x03,0x06,0x00,0x31,0x0a,0x0a,0x0a,0x02, -0x04,0x00,0x12,0x04,0x08,0x00,0x0c,0x01,0x0a,0x0a, -0x0a,0x03,0x04,0x00,0x01,0x12,0x03,0x08,0x08,0x1d, -0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,0x00,0x12,0x03, -0x09,0x02,0x10,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02, -0x00,0x05,0x12,0x03,0x09,0x02,0x08,0x0a,0x0c,0x0a, -0x05,0x04,0x00,0x02,0x00,0x01,0x12,0x03,0x09,0x09, -0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,0x03, -0x12,0x03,0x09,0x0e,0x0f,0x0a,0x0b,0x0a,0x04,0x04, -0x00,0x02,0x01,0x12,0x03,0x0a,0x02,0x10,0x0a,0x0c, -0x0a,0x05,0x04,0x00,0x02,0x01,0x05,0x12,0x03,0x0a, -0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x01, -0x01,0x12,0x03,0x0a,0x09,0x0b,0x0a,0x0c,0x0a,0x05, -0x04,0x00,0x02,0x01,0x03,0x12,0x03,0x0a,0x0e,0x0f, -0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,0x02,0x12,0x03, -0x0b,0x02,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02, -0x02,0x05,0x12,0x03,0x0b,0x02,0x08,0x0a,0x0c,0x0a, -0x05,0x04,0x00,0x02,0x02,0x01,0x12,0x03,0x0b,0x09, -0x0e,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x03, -0x12,0x03,0x0b,0x11,0x12,0x0a,0x0a,0x0a,0x02,0x04, -0x01,0x12,0x04,0x0e,0x00,0x10,0x01,0x0a,0x0a,0x0a, -0x03,0x04,0x01,0x01,0x12,0x03,0x0e,0x08,0x2b,0x0a, -0x0b,0x0a,0x04,0x04,0x01,0x02,0x00,0x12,0x03,0x0f, -0x02,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x00, -0x05,0x12,0x03,0x0f,0x02,0x08,0x0a,0x0c,0x0a,0x05, -0x04,0x01,0x02,0x00,0x01,0x12,0x03,0x0f,0x09,0x14, -0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x00,0x03,0x12, -0x03,0x0f,0x17,0x18,0x0a,0x0a,0x0a,0x02,0x04,0x02, -0x12,0x04,0x12,0x00,0x15,0x01,0x0a,0x0a,0x0a,0x03, -0x04,0x02,0x01,0x12,0x03,0x12,0x08,0x2c,0x0a,0x0b, -0x0a,0x04,0x04,0x02,0x02,0x00,0x12,0x03,0x13,0x02, -0x12,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x00,0x05, -0x12,0x03,0x13,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04, -0x02,0x02,0x00,0x01,0x12,0x03,0x13,0x09,0x0d,0x0a, -0x0c,0x0a,0x05,0x04,0x02,0x02,0x00,0x03,0x12,0x03, -0x13,0x10,0x11,0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02, -0x01,0x12,0x03,0x14,0x02,0x13,0x0a,0x0c,0x0a,0x05, -0x04,0x02,0x02,0x01,0x05,0x12,0x03,0x14,0x02,0x08, -0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x01,0x01,0x12, -0x03,0x14,0x09,0x0e,0x0a,0x0c,0x0a,0x05,0x04,0x02, -0x02,0x01,0x03,0x12,0x03,0x14,0x11,0x12,0x0a,0x0a, -0x0a,0x02,0x04,0x03,0x12,0x04,0x17,0x00,0x1a,0x01, -0x0a,0x0a,0x0a,0x03,0x04,0x03,0x01,0x12,0x03,0x17, -0x08,0x2f,0x0a,0x0b,0x0a,0x04,0x04,0x03,0x02,0x00, -0x12,0x03,0x18,0x02,0x12,0x0a,0x0c,0x0a,0x05,0x04, -0x03,0x02,0x00,0x05,0x12,0x03,0x18,0x02,0x08,0x0a, -0x0c,0x0a,0x05,0x04,0x03,0x02,0x00,0x01,0x12,0x03, -0x18,0x09,0x0d,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02, -0x00,0x03,0x12,0x03,0x18,0x10,0x11,0x0a,0x0b,0x0a, -0x04,0x04,0x03,0x02,0x01,0x12,0x03,0x19,0x02,0x13, -0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x01,0x05,0x12, -0x03,0x19,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x03, -0x02,0x01,0x01,0x12,0x03,0x19,0x09,0x0e,0x0a,0x0c, -0x0a,0x05,0x04,0x03,0x02,0x01,0x03,0x12,0x03,0x19, -0x11,0x12,0x0a,0x0a,0x0a,0x02,0x04,0x04,0x12,0x04, -0x1c,0x00,0x21,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x04, -0x01,0x12,0x03,0x1c,0x08,0x26,0x0a,0x0b,0x0a,0x04, -0x04,0x04,0x02,0x00,0x12,0x03,0x1d,0x02,0x27,0x0a, -0x0c,0x0a,0x05,0x04,0x04,0x02,0x00,0x06,0x12,0x03, -0x1d,0x02,0x17,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02, -0x00,0x01,0x12,0x03,0x1d,0x18,0x22,0x0a,0x0c,0x0a, -0x05,0x04,0x04,0x02,0x00,0x03,0x12,0x03,0x1d,0x25, -0x26,0x0a,0x0b,0x0a,0x04,0x04,0x04,0x02,0x01,0x12, -0x03,0x1e,0x02,0x28,0x0a,0x0c,0x0a,0x05,0x04,0x04, -0x02,0x01,0x06,0x12,0x03,0x1e,0x02,0x17,0x0a,0x0c, -0x0a,0x05,0x04,0x04,0x02,0x01,0x01,0x12,0x03,0x1e, -0x18,0x23,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x01, -0x03,0x12,0x03,0x1e,0x26,0x27,0x0a,0x0b,0x0a,0x04, -0x04,0x04,0x02,0x02,0x12,0x03,0x1f,0x02,0x26,0x0a, -0x0c,0x0a,0x05,0x04,0x04,0x02,0x02,0x06,0x12,0x03, -0x1f,0x02,0x17,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02, -0x02,0x01,0x12,0x03,0x1f,0x18,0x21,0x0a,0x0c,0x0a, -0x05,0x04,0x04,0x02,0x02,0x03,0x12,0x03,0x1f,0x24, -0x25,0x0a,0x0b,0x0a,0x04,0x04,0x04,0x02,0x03,0x12, -0x03,0x20,0x02,0x27,0x0a,0x0c,0x0a,0x05,0x04,0x04, -0x02,0x03,0x06,0x12,0x03,0x20,0x02,0x17,0x0a,0x0c, -0x0a,0x05,0x04,0x04,0x02,0x03,0x01,0x12,0x03,0x20, -0x18,0x22,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x03, -0x03,0x12,0x03,0x20,0x25,0x26,0x0a,0x0a,0x0a,0x02, -0x04,0x05,0x12,0x04,0x23,0x00,0x28,0x01,0x0a,0x0a, -0x0a,0x03,0x04,0x05,0x01,0x12,0x03,0x23,0x08,0x29, -0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,0x00,0x12,0x03, -0x24,0x02,0x18,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02, -0x00,0x05,0x12,0x03,0x24,0x02,0x08,0x0a,0x0c,0x0a, -0x05,0x04,0x05,0x02,0x00,0x01,0x12,0x03,0x24,0x09, -0x13,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x00,0x03, -0x12,0x03,0x24,0x16,0x17,0x0a,0x0b,0x0a,0x04,0x04, -0x05,0x02,0x01,0x12,0x03,0x25,0x02,0x19,0x0a,0x0c, -0x0a,0x05,0x04,0x05,0x02,0x01,0x05,0x12,0x03,0x25, -0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x01, -0x01,0x12,0x03,0x25,0x09,0x14,0x0a,0x0c,0x0a,0x05, -0x04,0x05,0x02,0x01,0x03,0x12,0x03,0x25,0x17,0x18, -0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,0x02,0x12,0x03, -0x26,0x02,0x17,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02, -0x02,0x05,0x12,0x03,0x26,0x02,0x08,0x0a,0x0c,0x0a, -0x05,0x04,0x05,0x02,0x02,0x01,0x12,0x03,0x26,0x09, -0x12,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x02,0x03, -0x12,0x03,0x26,0x15,0x16,0x0a,0x0b,0x0a,0x04,0x04, -0x05,0x02,0x03,0x12,0x03,0x27,0x02,0x18,0x0a,0x0c, -0x0a,0x05,0x04,0x05,0x02,0x03,0x05,0x12,0x03,0x27, -0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x03, -0x01,0x12,0x03,0x27,0x09,0x13,0x0a,0x0c,0x0a,0x05, -0x04,0x05,0x02,0x03,0x03,0x12,0x03,0x27,0x16,0x17, -0x0a,0x0a,0x0a,0x02,0x04,0x06,0x12,0x04,0x2a,0x00, -0x2f,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x06,0x01,0x12, -0x03,0x2a,0x08,0x2a,0x0a,0x0b,0x0a,0x04,0x04,0x06, -0x02,0x00,0x12,0x03,0x2b,0x02,0x18,0x0a,0x0c,0x0a, -0x05,0x04,0x06,0x02,0x00,0x05,0x12,0x03,0x2b,0x02, -0x08,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x00,0x01, -0x12,0x03,0x2b,0x09,0x13,0x0a,0x0c,0x0a,0x05,0x04, -0x06,0x02,0x00,0x03,0x12,0x03,0x2b,0x16,0x17,0x0a, -0x0b,0x0a,0x04,0x04,0x06,0x02,0x01,0x12,0x03,0x2c, -0x02,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x01, -0x05,0x12,0x03,0x2c,0x02,0x08,0x0a,0x0c,0x0a,0x05, -0x04,0x06,0x02,0x01,0x01,0x12,0x03,0x2c,0x09,0x14, -0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x01,0x03,0x12, -0x03,0x2c,0x17,0x18,0x0a,0x0b,0x0a,0x04,0x04,0x06, -0x02,0x02,0x12,0x03,0x2d,0x02,0x17,0x0a,0x0c,0x0a, -0x05,0x04,0x06,0x02,0x02,0x05,0x12,0x03,0x2d,0x02, -0x08,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x02,0x01, -0x12,0x03,0x2d,0x09,0x12,0x0a,0x0c,0x0a,0x05,0x04, -0x06,0x02,0x02,0x03,0x12,0x03,0x2d,0x15,0x16,0x0a, -0x0b,0x0a,0x04,0x04,0x06,0x02,0x03,0x12,0x03,0x2e, -0x02,0x18,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x03, -0x05,0x12,0x03,0x2e,0x02,0x08,0x0a,0x0c,0x0a,0x05, -0x04,0x06,0x02,0x03,0x01,0x12,0x03,0x2e,0x09,0x13, -0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x03,0x03,0x12, -0x03,0x2e,0x16,0x17,0x0a,0x0a,0x0a,0x02,0x04,0x07, -0x12,0x04,0x31,0x00,0x36,0x01,0x0a,0x0a,0x0a,0x03, -0x04,0x07,0x01,0x12,0x03,0x31,0x08,0x27,0x0a,0x0b, -0x0a,0x04,0x04,0x07,0x02,0x00,0x12,0x03,0x32,0x02, -0x18,0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02,0x00,0x05, -0x12,0x03,0x32,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04, -0x07,0x02,0x00,0x01,0x12,0x03,0x32,0x09,0x13,0x0a, -0x0c,0x0a,0x05,0x04,0x07,0x02,0x00,0x03,0x12,0x03, -0x32,0x16,0x17,0x0a,0x0b,0x0a,0x04,0x04,0x07,0x02, -0x01,0x12,0x03,0x33,0x02,0x19,0x0a,0x0c,0x0a,0x05, -0x04,0x07,0x02,0x01,0x05,0x12,0x03,0x33,0x02,0x08, -0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02,0x01,0x01,0x12, -0x03,0x33,0x09,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x07, -0x02,0x01,0x03,0x12,0x03,0x33,0x17,0x18,0x0a,0x0b, -0x0a,0x04,0x04,0x07,0x02,0x02,0x12,0x03,0x34,0x02, -0x17,0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02,0x02,0x05, -0x12,0x03,0x34,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04, -0x07,0x02,0x02,0x01,0x12,0x03,0x34,0x09,0x12,0x0a, -0x0c,0x0a,0x05,0x04,0x07,0x02,0x02,0x03,0x12,0x03, -0x34,0x15,0x16,0x0a,0x0b,0x0a,0x04,0x04,0x07,0x02, -0x03,0x12,0x03,0x35,0x02,0x18,0x0a,0x0c,0x0a,0x05, -0x04,0x07,0x02,0x03,0x05,0x12,0x03,0x35,0x02,0x08, -0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02,0x03,0x01,0x12, -0x03,0x35,0x09,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x07, -0x02,0x03,0x03,0x12,0x03,0x35,0x16,0x17,0x0a,0x0a, -0x0a,0x02,0x04,0x08,0x12,0x04,0x38,0x00,0x3a,0x01, -0x0a,0x0a,0x0a,0x03,0x04,0x08,0x01,0x12,0x03,0x38, -0x08,0x25,0x0a,0x0b,0x0a,0x04,0x04,0x08,0x02,0x00, -0x12,0x03,0x39,0x02,0x2d,0x0a,0x0c,0x0a,0x05,0x04, -0x08,0x02,0x00,0x04,0x12,0x03,0x39,0x02,0x0a,0x0a, -0x0c,0x0a,0x05,0x04,0x08,0x02,0x00,0x06,0x12,0x03, -0x39,0x0b,0x20,0x0a,0x0c,0x0a,0x05,0x04,0x08,0x02, -0x00,0x01,0x12,0x03,0x39,0x21,0x28,0x0a,0x0c,0x0a, -0x05,0x04,0x08,0x02,0x00,0x03,0x12,0x03,0x39,0x2b, -0x2c,0x0a,0x0a,0x0a,0x02,0x04,0x09,0x12,0x04,0x3c, -0x00,0x3f,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x09,0x01, -0x12,0x03,0x3c,0x08,0x24,0x0a,0x0b,0x0a,0x04,0x04, -0x09,0x02,0x00,0x12,0x03,0x3d,0x02,0x16,0x0a,0x0c, -0x0a,0x05,0x04,0x09,0x02,0x00,0x05,0x12,0x03,0x3d, -0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x09,0x02,0x00, -0x01,0x12,0x03,0x3d,0x09,0x11,0x0a,0x0c,0x0a,0x05, -0x04,0x09,0x02,0x00,0x03,0x12,0x03,0x3d,0x14,0x15, -0x0a,0x0b,0x0a,0x04,0x04,0x09,0x02,0x01,0x12,0x03, -0x3e,0x02,0x1f,0x0a,0x0c,0x0a,0x05,0x04,0x09,0x02, -0x01,0x06,0x12,0x03,0x3e,0x02,0x14,0x0a,0x0c,0x0a, -0x05,0x04,0x09,0x02,0x01,0x01,0x12,0x03,0x3e,0x15, -0x1a,0x0a,0x0c,0x0a,0x05,0x04,0x09,0x02,0x01,0x03, -0x12,0x03,0x3e,0x1d,0x1e,0x0a,0x0a,0x0a,0x02,0x04, -0x0a,0x12,0x04,0x41,0x00,0x44,0x01,0x0a,0x0a,0x0a, -0x03,0x04,0x0a,0x01,0x12,0x03,0x41,0x08,0x21,0x0a, -0x0b,0x0a,0x04,0x04,0x0a,0x02,0x00,0x12,0x03,0x42, -0x02,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x0a,0x02,0x00, -0x05,0x12,0x03,0x42,0x02,0x08,0x0a,0x0c,0x0a,0x05, -0x04,0x0a,0x02,0x00,0x01,0x12,0x03,0x42,0x09,0x0e, -0x0a,0x0c,0x0a,0x05,0x04,0x0a,0x02,0x00,0x03,0x12, -0x03,0x42,0x11,0x12,0x0a,0x0b,0x0a,0x04,0x04,0x0a, -0x02,0x01,0x12,0x03,0x43,0x02,0x1f,0x0a,0x0c,0x0a, -0x05,0x04,0x0a,0x02,0x01,0x06,0x12,0x03,0x43,0x02, -0x14,0x0a,0x0c,0x0a,0x05,0x04,0x0a,0x02,0x01,0x01, -0x12,0x03,0x43,0x15,0x1a,0x0a,0x0c,0x0a,0x05,0x04, -0x0a,0x02,0x01,0x03,0x12,0x03,0x43,0x1d,0x1e,0x62, -0x06,0x70,0x72,0x6f,0x74,0x6f,0x33, +0x6f,0x62,0x75,0x66,0x54,0x72,0x61,0x6e,0x73,0x6c, +0x61,0x74,0x69,0x6f,0x6e,0x32,0x64,0x52,0x07,0x6d, +0x6f,0x64,0x75,0x6c,0x65,0x73,0x22,0x6f,0x0a,0x1c, +0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x53,0x77, +0x65,0x72,0x76,0x65,0x4d,0x6f,0x64,0x75,0x6c,0x65, +0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x12,0x1a, +0x0a,0x08,0x64,0x69,0x73,0x74,0x61,0x6e,0x63,0x65, +0x18,0x01,0x20,0x01,0x28,0x01,0x52,0x08,0x64,0x69, +0x73,0x74,0x61,0x6e,0x63,0x65,0x12,0x33,0x0a,0x05, +0x61,0x6e,0x67,0x6c,0x65,0x18,0x02,0x20,0x01,0x28, +0x0b,0x32,0x1d,0x2e,0x77,0x70,0x69,0x2e,0x70,0x72, +0x6f,0x74,0x6f,0x2e,0x50,0x72,0x6f,0x74,0x6f,0x62, +0x75,0x66,0x52,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e, +0x32,0x64,0x52,0x05,0x61,0x6e,0x67,0x6c,0x65,0x22, +0x66,0x0a,0x19,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75, +0x66,0x53,0x77,0x65,0x72,0x76,0x65,0x4d,0x6f,0x64, +0x75,0x6c,0x65,0x53,0x74,0x61,0x74,0x65,0x12,0x14, +0x0a,0x05,0x73,0x70,0x65,0x65,0x64,0x18,0x01,0x20, +0x01,0x28,0x01,0x52,0x05,0x73,0x70,0x65,0x65,0x64, +0x12,0x33,0x0a,0x05,0x61,0x6e,0x67,0x6c,0x65,0x18, +0x02,0x20,0x01,0x28,0x0b,0x32,0x1d,0x2e,0x77,0x70, +0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e,0x50,0x72, +0x6f,0x74,0x6f,0x62,0x75,0x66,0x52,0x6f,0x74,0x61, +0x74,0x69,0x6f,0x6e,0x32,0x64,0x52,0x05,0x61,0x6e, +0x67,0x6c,0x65,0x42,0x1a,0x0a,0x18,0x65,0x64,0x75, +0x2e,0x77,0x70,0x69,0x2e,0x66,0x69,0x72,0x73,0x74, +0x2e,0x6d,0x61,0x74,0x68,0x2e,0x70,0x72,0x6f,0x74, +0x6f,0x4a,0x99,0x0d,0x0a,0x06,0x12,0x04,0x00,0x00, +0x3d,0x01,0x0a,0x08,0x0a,0x01,0x0c,0x12,0x03,0x00, +0x00,0x12,0x0a,0x08,0x0a,0x01,0x02,0x12,0x03,0x02, +0x00,0x12,0x0a,0x09,0x0a,0x02,0x03,0x00,0x12,0x03, +0x04,0x00,0x1a,0x0a,0x08,0x0a,0x01,0x08,0x12,0x03, +0x06,0x00,0x31,0x0a,0x09,0x0a,0x02,0x08,0x01,0x12, +0x03,0x06,0x00,0x31,0x0a,0x0a,0x0a,0x02,0x04,0x00, +0x12,0x04,0x08,0x00,0x0c,0x01,0x0a,0x0a,0x0a,0x03, +0x04,0x00,0x01,0x12,0x03,0x08,0x08,0x1d,0x0a,0x0b, +0x0a,0x04,0x04,0x00,0x02,0x00,0x12,0x03,0x09,0x02, +0x10,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,0x05, +0x12,0x03,0x09,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04, +0x00,0x02,0x00,0x01,0x12,0x03,0x09,0x09,0x0b,0x0a, +0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,0x03,0x12,0x03, +0x09,0x0e,0x0f,0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02, +0x01,0x12,0x03,0x0a,0x02,0x10,0x0a,0x0c,0x0a,0x05, +0x04,0x00,0x02,0x01,0x05,0x12,0x03,0x0a,0x02,0x08, +0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x01,0x01,0x12, +0x03,0x0a,0x09,0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x00, +0x02,0x01,0x03,0x12,0x03,0x0a,0x0e,0x0f,0x0a,0x0b, +0x0a,0x04,0x04,0x00,0x02,0x02,0x12,0x03,0x0b,0x02, +0x13,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x05, +0x12,0x03,0x0b,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04, +0x00,0x02,0x02,0x01,0x12,0x03,0x0b,0x09,0x0e,0x0a, +0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x03,0x12,0x03, +0x0b,0x11,0x12,0x0a,0x0a,0x0a,0x02,0x04,0x01,0x12, +0x04,0x0e,0x00,0x10,0x01,0x0a,0x0a,0x0a,0x03,0x04, +0x01,0x01,0x12,0x03,0x0e,0x08,0x2b,0x0a,0x0b,0x0a, +0x04,0x04,0x01,0x02,0x00,0x12,0x03,0x0f,0x02,0x19, +0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x00,0x05,0x12, +0x03,0x0f,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x01, +0x02,0x00,0x01,0x12,0x03,0x0f,0x09,0x14,0x0a,0x0c, +0x0a,0x05,0x04,0x01,0x02,0x00,0x03,0x12,0x03,0x0f, +0x17,0x18,0x0a,0x0a,0x0a,0x02,0x04,0x02,0x12,0x04, +0x12,0x00,0x15,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x02, +0x01,0x12,0x03,0x12,0x08,0x2c,0x0a,0x0b,0x0a,0x04, +0x04,0x02,0x02,0x00,0x12,0x03,0x13,0x02,0x12,0x0a, +0x0c,0x0a,0x05,0x04,0x02,0x02,0x00,0x05,0x12,0x03, +0x13,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02, +0x00,0x01,0x12,0x03,0x13,0x09,0x0d,0x0a,0x0c,0x0a, +0x05,0x04,0x02,0x02,0x00,0x03,0x12,0x03,0x13,0x10, +0x11,0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x01,0x12, +0x03,0x14,0x02,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x02, +0x02,0x01,0x05,0x12,0x03,0x14,0x02,0x08,0x0a,0x0c, +0x0a,0x05,0x04,0x02,0x02,0x01,0x01,0x12,0x03,0x14, +0x09,0x0e,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x01, +0x03,0x12,0x03,0x14,0x11,0x12,0x0a,0x0a,0x0a,0x02, +0x04,0x03,0x12,0x04,0x17,0x00,0x1a,0x01,0x0a,0x0a, +0x0a,0x03,0x04,0x03,0x01,0x12,0x03,0x17,0x08,0x2f, +0x0a,0x0b,0x0a,0x04,0x04,0x03,0x02,0x00,0x12,0x03, +0x18,0x02,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02, +0x00,0x05,0x12,0x03,0x18,0x02,0x08,0x0a,0x0c,0x0a, +0x05,0x04,0x03,0x02,0x00,0x01,0x12,0x03,0x18,0x09, +0x0d,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x00,0x03, +0x12,0x03,0x18,0x10,0x11,0x0a,0x0b,0x0a,0x04,0x04, +0x03,0x02,0x01,0x12,0x03,0x19,0x02,0x13,0x0a,0x0c, +0x0a,0x05,0x04,0x03,0x02,0x01,0x05,0x12,0x03,0x19, +0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x01, +0x01,0x12,0x03,0x19,0x09,0x0e,0x0a,0x0c,0x0a,0x05, +0x04,0x03,0x02,0x01,0x03,0x12,0x03,0x19,0x11,0x12, +0x0a,0x0a,0x0a,0x02,0x04,0x04,0x12,0x04,0x1c,0x00, +0x21,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x04,0x01,0x12, +0x03,0x1c,0x08,0x26,0x0a,0x0b,0x0a,0x04,0x04,0x04, +0x02,0x00,0x12,0x03,0x1d,0x02,0x27,0x0a,0x0c,0x0a, +0x05,0x04,0x04,0x02,0x00,0x06,0x12,0x03,0x1d,0x02, +0x17,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x00,0x01, +0x12,0x03,0x1d,0x18,0x22,0x0a,0x0c,0x0a,0x05,0x04, +0x04,0x02,0x00,0x03,0x12,0x03,0x1d,0x25,0x26,0x0a, +0x0b,0x0a,0x04,0x04,0x04,0x02,0x01,0x12,0x03,0x1e, +0x02,0x28,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x01, +0x06,0x12,0x03,0x1e,0x02,0x17,0x0a,0x0c,0x0a,0x05, +0x04,0x04,0x02,0x01,0x01,0x12,0x03,0x1e,0x18,0x23, +0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x01,0x03,0x12, +0x03,0x1e,0x26,0x27,0x0a,0x0b,0x0a,0x04,0x04,0x04, +0x02,0x02,0x12,0x03,0x1f,0x02,0x26,0x0a,0x0c,0x0a, +0x05,0x04,0x04,0x02,0x02,0x06,0x12,0x03,0x1f,0x02, +0x17,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x02,0x01, +0x12,0x03,0x1f,0x18,0x21,0x0a,0x0c,0x0a,0x05,0x04, +0x04,0x02,0x02,0x03,0x12,0x03,0x1f,0x24,0x25,0x0a, +0x0b,0x0a,0x04,0x04,0x04,0x02,0x03,0x12,0x03,0x20, +0x02,0x27,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x03, +0x06,0x12,0x03,0x20,0x02,0x17,0x0a,0x0c,0x0a,0x05, +0x04,0x04,0x02,0x03,0x01,0x12,0x03,0x20,0x18,0x22, +0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x03,0x03,0x12, +0x03,0x20,0x25,0x26,0x0a,0x0a,0x0a,0x02,0x04,0x05, +0x12,0x04,0x23,0x00,0x28,0x01,0x0a,0x0a,0x0a,0x03, +0x04,0x05,0x01,0x12,0x03,0x23,0x08,0x2a,0x0a,0x0b, +0x0a,0x04,0x04,0x05,0x02,0x00,0x12,0x03,0x24,0x02, +0x18,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x00,0x05, +0x12,0x03,0x24,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04, +0x05,0x02,0x00,0x01,0x12,0x03,0x24,0x09,0x13,0x0a, +0x0c,0x0a,0x05,0x04,0x05,0x02,0x00,0x03,0x12,0x03, +0x24,0x16,0x17,0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02, +0x01,0x12,0x03,0x25,0x02,0x19,0x0a,0x0c,0x0a,0x05, +0x04,0x05,0x02,0x01,0x05,0x12,0x03,0x25,0x02,0x08, +0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x01,0x01,0x12, +0x03,0x25,0x09,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x05, +0x02,0x01,0x03,0x12,0x03,0x25,0x17,0x18,0x0a,0x0b, +0x0a,0x04,0x04,0x05,0x02,0x02,0x12,0x03,0x26,0x02, +0x17,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x02,0x05, +0x12,0x03,0x26,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04, +0x05,0x02,0x02,0x01,0x12,0x03,0x26,0x09,0x12,0x0a, +0x0c,0x0a,0x05,0x04,0x05,0x02,0x02,0x03,0x12,0x03, +0x26,0x15,0x16,0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02, +0x03,0x12,0x03,0x27,0x02,0x18,0x0a,0x0c,0x0a,0x05, +0x04,0x05,0x02,0x03,0x05,0x12,0x03,0x27,0x02,0x08, +0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x03,0x01,0x12, +0x03,0x27,0x09,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x05, +0x02,0x03,0x03,0x12,0x03,0x27,0x16,0x17,0x0a,0x0a, +0x0a,0x02,0x04,0x06,0x12,0x04,0x2a,0x00,0x2f,0x01, +0x0a,0x0a,0x0a,0x03,0x04,0x06,0x01,0x12,0x03,0x2a, +0x08,0x27,0x0a,0x0b,0x0a,0x04,0x04,0x06,0x02,0x00, +0x12,0x03,0x2b,0x02,0x18,0x0a,0x0c,0x0a,0x05,0x04, +0x06,0x02,0x00,0x05,0x12,0x03,0x2b,0x02,0x08,0x0a, +0x0c,0x0a,0x05,0x04,0x06,0x02,0x00,0x01,0x12,0x03, +0x2b,0x09,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02, +0x00,0x03,0x12,0x03,0x2b,0x16,0x17,0x0a,0x0b,0x0a, +0x04,0x04,0x06,0x02,0x01,0x12,0x03,0x2c,0x02,0x19, +0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x01,0x05,0x12, +0x03,0x2c,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x06, +0x02,0x01,0x01,0x12,0x03,0x2c,0x09,0x14,0x0a,0x0c, +0x0a,0x05,0x04,0x06,0x02,0x01,0x03,0x12,0x03,0x2c, +0x17,0x18,0x0a,0x0b,0x0a,0x04,0x04,0x06,0x02,0x02, +0x12,0x03,0x2d,0x02,0x17,0x0a,0x0c,0x0a,0x05,0x04, +0x06,0x02,0x02,0x05,0x12,0x03,0x2d,0x02,0x08,0x0a, +0x0c,0x0a,0x05,0x04,0x06,0x02,0x02,0x01,0x12,0x03, +0x2d,0x09,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02, +0x02,0x03,0x12,0x03,0x2d,0x15,0x16,0x0a,0x0b,0x0a, +0x04,0x04,0x06,0x02,0x03,0x12,0x03,0x2e,0x02,0x18, +0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x03,0x05,0x12, +0x03,0x2e,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x06, +0x02,0x03,0x01,0x12,0x03,0x2e,0x09,0x13,0x0a,0x0c, +0x0a,0x05,0x04,0x06,0x02,0x03,0x03,0x12,0x03,0x2e, +0x16,0x17,0x0a,0x0a,0x0a,0x02,0x04,0x07,0x12,0x04, +0x31,0x00,0x33,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x07, +0x01,0x12,0x03,0x31,0x08,0x25,0x0a,0x0b,0x0a,0x04, +0x04,0x07,0x02,0x00,0x12,0x03,0x32,0x02,0x2d,0x0a, +0x0c,0x0a,0x05,0x04,0x07,0x02,0x00,0x04,0x12,0x03, +0x32,0x02,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02, +0x00,0x06,0x12,0x03,0x32,0x0b,0x20,0x0a,0x0c,0x0a, +0x05,0x04,0x07,0x02,0x00,0x01,0x12,0x03,0x32,0x21, +0x28,0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02,0x00,0x03, +0x12,0x03,0x32,0x2b,0x2c,0x0a,0x0a,0x0a,0x02,0x04, +0x08,0x12,0x04,0x35,0x00,0x38,0x01,0x0a,0x0a,0x0a, +0x03,0x04,0x08,0x01,0x12,0x03,0x35,0x08,0x24,0x0a, +0x0b,0x0a,0x04,0x04,0x08,0x02,0x00,0x12,0x03,0x36, +0x02,0x16,0x0a,0x0c,0x0a,0x05,0x04,0x08,0x02,0x00, +0x05,0x12,0x03,0x36,0x02,0x08,0x0a,0x0c,0x0a,0x05, +0x04,0x08,0x02,0x00,0x01,0x12,0x03,0x36,0x09,0x11, +0x0a,0x0c,0x0a,0x05,0x04,0x08,0x02,0x00,0x03,0x12, +0x03,0x36,0x14,0x15,0x0a,0x0b,0x0a,0x04,0x04,0x08, +0x02,0x01,0x12,0x03,0x37,0x02,0x1f,0x0a,0x0c,0x0a, +0x05,0x04,0x08,0x02,0x01,0x06,0x12,0x03,0x37,0x02, +0x14,0x0a,0x0c,0x0a,0x05,0x04,0x08,0x02,0x01,0x01, +0x12,0x03,0x37,0x15,0x1a,0x0a,0x0c,0x0a,0x05,0x04, +0x08,0x02,0x01,0x03,0x12,0x03,0x37,0x1d,0x1e,0x0a, +0x0a,0x0a,0x02,0x04,0x09,0x12,0x04,0x3a,0x00,0x3d, +0x01,0x0a,0x0a,0x0a,0x03,0x04,0x09,0x01,0x12,0x03, +0x3a,0x08,0x21,0x0a,0x0b,0x0a,0x04,0x04,0x09,0x02, +0x00,0x12,0x03,0x3b,0x02,0x13,0x0a,0x0c,0x0a,0x05, +0x04,0x09,0x02,0x00,0x05,0x12,0x03,0x3b,0x02,0x08, +0x0a,0x0c,0x0a,0x05,0x04,0x09,0x02,0x00,0x01,0x12, +0x03,0x3b,0x09,0x0e,0x0a,0x0c,0x0a,0x05,0x04,0x09, +0x02,0x00,0x03,0x12,0x03,0x3b,0x11,0x12,0x0a,0x0b, +0x0a,0x04,0x04,0x09,0x02,0x01,0x12,0x03,0x3c,0x02, +0x1f,0x0a,0x0c,0x0a,0x05,0x04,0x09,0x02,0x01,0x06, +0x12,0x03,0x3c,0x02,0x14,0x0a,0x0c,0x0a,0x05,0x04, +0x09,0x02,0x01,0x01,0x12,0x03,0x3c,0x15,0x1a,0x0a, +0x0c,0x0a,0x05,0x04,0x09,0x02,0x01,0x03,0x12,0x03, +0x3c,0x1d,0x1e,0x62,0x06,0x70,0x72,0x6f,0x74,0x6f, +0x33, }; static const char file_name[] = "kinematics.proto"; static const char wpi_proto_ProtobufChassisSpeeds_name[] = "wpi.proto.ProtobufChassisSpeeds"; @@ -387,12 +347,6 @@ pb_filedesc_t wpi_proto_ProtobufMecanumDriveKinematics::file_descriptor(void) no PB_BIND(wpi_proto_ProtobufMecanumDriveKinematics, wpi_proto_ProtobufMecanumDriveKinematics, AUTO) -static const char wpi_proto_ProtobufMecanumDriveMotorVoltages_name[] = "wpi.proto.ProtobufMecanumDriveMotorVoltages"; -std::string_view wpi_proto_ProtobufMecanumDriveMotorVoltages::msg_name(void) noexcept { return wpi_proto_ProtobufMecanumDriveMotorVoltages_name; } -pb_filedesc_t wpi_proto_ProtobufMecanumDriveMotorVoltages::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; } -PB_BIND(wpi_proto_ProtobufMecanumDriveMotorVoltages, wpi_proto_ProtobufMecanumDriveMotorVoltages, AUTO) - - static const char wpi_proto_ProtobufMecanumDriveWheelPositions_name[] = "wpi.proto.ProtobufMecanumDriveWheelPositions"; std::string_view wpi_proto_ProtobufMecanumDriveWheelPositions::msg_name(void) noexcept { return wpi_proto_ProtobufMecanumDriveWheelPositions_name; } pb_filedesc_t wpi_proto_ProtobufMecanumDriveWheelPositions::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; } diff --git a/wpimath/src/generated/main/native/cpp/wpimath/protobuf/kinematics.npb.h b/wpimath/src/generated/main/native/cpp/wpimath/protobuf/kinematics.npb.h index e55103ffb8..cbb27afc08 100644 --- a/wpimath/src/generated/main/native/cpp/wpimath/protobuf/kinematics.npb.h +++ b/wpimath/src/generated/main/native/cpp/wpimath/protobuf/kinematics.npb.h @@ -63,17 +63,6 @@ typedef struct _wpi_proto_ProtobufMecanumDriveKinematics { pb_callback_t rear_right; } wpi_proto_ProtobufMecanumDriveKinematics; -typedef struct _wpi_proto_ProtobufMecanumDriveMotorVoltages { - static const pb_msgdesc_t* msg_descriptor(void) noexcept; - static std::string_view msg_name(void) noexcept; - static pb_filedesc_t file_descriptor(void) noexcept; - - double front_left; - double front_right; - double rear_left; - double rear_right; -} wpi_proto_ProtobufMecanumDriveMotorVoltages; - typedef struct _wpi_proto_ProtobufMecanumDriveWheelPositions { static const pb_msgdesc_t* msg_descriptor(void) noexcept; static std::string_view msg_name(void) noexcept; @@ -129,7 +118,6 @@ typedef struct _wpi_proto_ProtobufSwerveModuleState { #define wpi_proto_ProtobufDifferentialDriveWheelSpeeds_init_default {0, 0} #define wpi_proto_ProtobufDifferentialDriveWheelPositions_init_default {0, 0} #define wpi_proto_ProtobufMecanumDriveKinematics_init_default {{{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}} -#define wpi_proto_ProtobufMecanumDriveMotorVoltages_init_default {0, 0, 0, 0} #define wpi_proto_ProtobufMecanumDriveWheelPositions_init_default {0, 0, 0, 0} #define wpi_proto_ProtobufMecanumDriveWheelSpeeds_init_default {0, 0, 0, 0} #define wpi_proto_ProtobufSwerveDriveKinematics_init_default {{{NULL}, NULL}} @@ -140,7 +128,6 @@ typedef struct _wpi_proto_ProtobufSwerveModuleState { #define wpi_proto_ProtobufDifferentialDriveWheelSpeeds_init_zero {0, 0} #define wpi_proto_ProtobufDifferentialDriveWheelPositions_init_zero {0, 0} #define wpi_proto_ProtobufMecanumDriveKinematics_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}} -#define wpi_proto_ProtobufMecanumDriveMotorVoltages_init_zero {0, 0, 0, 0} #define wpi_proto_ProtobufMecanumDriveWheelPositions_init_zero {0, 0, 0, 0} #define wpi_proto_ProtobufMecanumDriveWheelSpeeds_init_zero {0, 0, 0, 0} #define wpi_proto_ProtobufSwerveDriveKinematics_init_zero {{{NULL}, NULL}} @@ -160,10 +147,6 @@ typedef struct _wpi_proto_ProtobufSwerveModuleState { #define wpi_proto_ProtobufMecanumDriveKinematics_front_right_tag 2 #define wpi_proto_ProtobufMecanumDriveKinematics_rear_left_tag 3 #define wpi_proto_ProtobufMecanumDriveKinematics_rear_right_tag 4 -#define wpi_proto_ProtobufMecanumDriveMotorVoltages_front_left_tag 1 -#define wpi_proto_ProtobufMecanumDriveMotorVoltages_front_right_tag 2 -#define wpi_proto_ProtobufMecanumDriveMotorVoltages_rear_left_tag 3 -#define wpi_proto_ProtobufMecanumDriveMotorVoltages_rear_right_tag 4 #define wpi_proto_ProtobufMecanumDriveWheelPositions_front_left_tag 1 #define wpi_proto_ProtobufMecanumDriveWheelPositions_front_right_tag 2 #define wpi_proto_ProtobufMecanumDriveWheelPositions_rear_left_tag 3 @@ -215,14 +198,6 @@ X(a, CALLBACK, OPTIONAL, MESSAGE, rear_right, 4) #define wpi_proto_ProtobufMecanumDriveKinematics_rear_left_MSGTYPE wpi_proto_ProtobufTranslation2d #define wpi_proto_ProtobufMecanumDriveKinematics_rear_right_MSGTYPE wpi_proto_ProtobufTranslation2d -#define wpi_proto_ProtobufMecanumDriveMotorVoltages_FIELDLIST(X, a) \ -X(a, STATIC, SINGULAR, DOUBLE, front_left, 1) \ -X(a, STATIC, SINGULAR, DOUBLE, front_right, 2) \ -X(a, STATIC, SINGULAR, DOUBLE, rear_left, 3) \ -X(a, STATIC, SINGULAR, DOUBLE, rear_right, 4) -#define wpi_proto_ProtobufMecanumDriveMotorVoltages_CALLBACK NULL -#define wpi_proto_ProtobufMecanumDriveMotorVoltages_DEFAULT NULL - #define wpi_proto_ProtobufMecanumDriveWheelPositions_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, DOUBLE, front_left, 1) \ X(a, STATIC, SINGULAR, DOUBLE, front_right, 2) \ @@ -264,12 +239,11 @@ X(a, CALLBACK, OPTIONAL, MESSAGE, angle, 2) /* wpi_proto_ProtobufSwerveDriveKinematics_size depends on runtime parameters */ /* wpi_proto_ProtobufSwerveModulePosition_size depends on runtime parameters */ /* wpi_proto_ProtobufSwerveModuleState_size depends on runtime parameters */ -#define WPI_PROTO_KINEMATICS_NPB_H_MAX_SIZE wpi_proto_ProtobufMecanumDriveMotorVoltages_size +#define WPI_PROTO_KINEMATICS_NPB_H_MAX_SIZE wpi_proto_ProtobufMecanumDriveWheelPositions_size #define wpi_proto_ProtobufChassisSpeeds_size 27 #define wpi_proto_ProtobufDifferentialDriveKinematics_size 9 #define wpi_proto_ProtobufDifferentialDriveWheelPositions_size 18 #define wpi_proto_ProtobufDifferentialDriveWheelSpeeds_size 18 -#define wpi_proto_ProtobufMecanumDriveMotorVoltages_size 36 #define wpi_proto_ProtobufMecanumDriveWheelPositions_size 36 #define wpi_proto_ProtobufMecanumDriveWheelSpeeds_size 36 diff --git a/wpimath/src/main/java/edu/wpi/first/math/kinematics/MecanumDriveMotorVoltages.java b/wpimath/src/main/java/edu/wpi/first/math/kinematics/MecanumDriveMotorVoltages.java index 8bc91b1d8e..51249d4fc3 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/kinematics/MecanumDriveMotorVoltages.java +++ b/wpimath/src/main/java/edu/wpi/first/math/kinematics/MecanumDriveMotorVoltages.java @@ -4,13 +4,9 @@ package edu.wpi.first.math.kinematics; -import edu.wpi.first.math.kinematics.proto.MecanumDriveMotorVoltagesProto; -import edu.wpi.first.math.kinematics.struct.MecanumDriveMotorVoltagesStruct; -import edu.wpi.first.util.protobuf.ProtobufSerializable; -import edu.wpi.first.util.struct.StructSerializable; - /** Represents the motor voltages for a mecanum drive drivetrain. */ -public class MecanumDriveMotorVoltages implements ProtobufSerializable, StructSerializable { +@Deprecated(since = "2025", forRemoval = true) +public class MecanumDriveMotorVoltages { /** Voltage of the front left motor. */ public double frontLeftVoltage; @@ -52,11 +48,4 @@ public class MecanumDriveMotorVoltages implements ProtobufSerializable, StructSe + "Rear Left: %.2f V, Rear Right: %.2f V)", frontLeftVoltage, frontRightVoltage, rearLeftVoltage, rearRightVoltage); } - - /** MecanumDriveMotorVoltages struct for serialization. */ - public static final MecanumDriveMotorVoltagesStruct struct = - new MecanumDriveMotorVoltagesStruct(); - - /** MecanumDriveMotorVoltages protobuf for serialization. */ - public static final MecanumDriveMotorVoltagesProto proto = new MecanumDriveMotorVoltagesProto(); } diff --git a/wpimath/src/main/java/edu/wpi/first/math/kinematics/proto/MecanumDriveMotorVoltagesProto.java b/wpimath/src/main/java/edu/wpi/first/math/kinematics/proto/MecanumDriveMotorVoltagesProto.java deleted file mode 100644 index 0b5f0c2583..0000000000 --- a/wpimath/src/main/java/edu/wpi/first/math/kinematics/proto/MecanumDriveMotorVoltagesProto.java +++ /dev/null @@ -1,42 +0,0 @@ -// 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.kinematics.proto; - -import edu.wpi.first.math.kinematics.MecanumDriveMotorVoltages; -import edu.wpi.first.math.proto.Kinematics.ProtobufMecanumDriveMotorVoltages; -import edu.wpi.first.util.protobuf.Protobuf; -import us.hebi.quickbuf.Descriptors.Descriptor; - -public final class MecanumDriveMotorVoltagesProto - implements Protobuf { - @Override - public Class getTypeClass() { - return MecanumDriveMotorVoltages.class; - } - - @Override - public Descriptor getDescriptor() { - return ProtobufMecanumDriveMotorVoltages.getDescriptor(); - } - - @Override - public ProtobufMecanumDriveMotorVoltages createMessage() { - return ProtobufMecanumDriveMotorVoltages.newInstance(); - } - - @Override - public MecanumDriveMotorVoltages unpack(ProtobufMecanumDriveMotorVoltages msg) { - return new MecanumDriveMotorVoltages( - msg.getFrontLeft(), msg.getFrontRight(), msg.getRearLeft(), msg.getRearRight()); - } - - @Override - public void pack(ProtobufMecanumDriveMotorVoltages msg, MecanumDriveMotorVoltages value) { - msg.setFrontLeft(value.frontLeftVoltage); - msg.setFrontRight(value.frontRightVoltage); - msg.setRearLeft(value.rearLeftVoltage); - msg.setRearRight(value.rearRightVoltage); - } -} diff --git a/wpimath/src/main/java/edu/wpi/first/math/kinematics/struct/MecanumDriveMotorVoltagesStruct.java b/wpimath/src/main/java/edu/wpi/first/math/kinematics/struct/MecanumDriveMotorVoltagesStruct.java deleted file mode 100644 index 8078e0a7b1..0000000000 --- a/wpimath/src/main/java/edu/wpi/first/math/kinematics/struct/MecanumDriveMotorVoltagesStruct.java +++ /dev/null @@ -1,48 +0,0 @@ -// 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.kinematics.struct; - -import edu.wpi.first.math.kinematics.MecanumDriveMotorVoltages; -import edu.wpi.first.util.struct.Struct; -import java.nio.ByteBuffer; - -public final class MecanumDriveMotorVoltagesStruct implements Struct { - @Override - public Class getTypeClass() { - return MecanumDriveMotorVoltages.class; - } - - @Override - public String getTypeName() { - return "MecanumDriveMotorVoltages"; - } - - @Override - public int getSize() { - return kSizeDouble * 4; - } - - @Override - public String getSchema() { - return "double front_left;double front_right;double rear_left;double rear_right"; - } - - @Override - public MecanumDriveMotorVoltages unpack(ByteBuffer bb) { - double front_left = bb.getDouble(); - double front_right = bb.getDouble(); - double rear_left = bb.getDouble(); - double rear_right = bb.getDouble(); - return new MecanumDriveMotorVoltages(front_left, front_right, rear_left, rear_right); - } - - @Override - public void pack(ByteBuffer bb, MecanumDriveMotorVoltages value) { - bb.putDouble(value.frontLeftVoltage); - bb.putDouble(value.frontRightVoltage); - bb.putDouble(value.rearLeftVoltage); - bb.putDouble(value.rearRightVoltage); - } -} diff --git a/wpimath/src/main/proto/kinematics.proto b/wpimath/src/main/proto/kinematics.proto index 4cb3b055a2..2a31b2d7c6 100644 --- a/wpimath/src/main/proto/kinematics.proto +++ b/wpimath/src/main/proto/kinematics.proto @@ -33,13 +33,6 @@ message ProtobufMecanumDriveKinematics { ProtobufTranslation2d rear_right = 4; } -message ProtobufMecanumDriveMotorVoltages { - double front_left = 1; - double front_right = 2; - double rear_left = 3; - double rear_right = 4; -} - message ProtobufMecanumDriveWheelPositions { double front_left = 1; double front_right = 2; diff --git a/wpimath/src/test/java/edu/wpi/first/math/kinematics/proto/MecanumDriveMotorVoltagesProtoTest.java b/wpimath/src/test/java/edu/wpi/first/math/kinematics/proto/MecanumDriveMotorVoltagesProtoTest.java deleted file mode 100644 index 0aaac653f4..0000000000 --- a/wpimath/src/test/java/edu/wpi/first/math/kinematics/proto/MecanumDriveMotorVoltagesProtoTest.java +++ /dev/null @@ -1,27 +0,0 @@ -// 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.kinematics.proto; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import edu.wpi.first.math.kinematics.MecanumDriveMotorVoltages; -import edu.wpi.first.math.proto.Kinematics.ProtobufMecanumDriveMotorVoltages; -import edu.wpi.first.wpilibj.ProtoTestBase; - -@SuppressWarnings("PMD.TestClassWithoutTestCases") -class MecanumDriveMotorVoltagesProtoTest - extends ProtoTestBase { - MecanumDriveMotorVoltagesProtoTest() { - super(new MecanumDriveMotorVoltages(1.2, 3.1, 2.5, -0.1), MecanumDriveMotorVoltages.proto); - } - - @Override - public void checkEquals(MecanumDriveMotorVoltages testData, MecanumDriveMotorVoltages data) { - assertEquals(testData.frontLeftVoltage, data.frontLeftVoltage); - assertEquals(testData.frontRightVoltage, data.frontRightVoltage); - assertEquals(testData.rearLeftVoltage, data.rearLeftVoltage); - assertEquals(testData.rearRightVoltage, data.rearRightVoltage); - } -} diff --git a/wpimath/src/test/java/edu/wpi/first/math/kinematics/struct/MecanumDriveMotorVoltagesStructTest.java b/wpimath/src/test/java/edu/wpi/first/math/kinematics/struct/MecanumDriveMotorVoltagesStructTest.java deleted file mode 100644 index a53fbbadd4..0000000000 --- a/wpimath/src/test/java/edu/wpi/first/math/kinematics/struct/MecanumDriveMotorVoltagesStructTest.java +++ /dev/null @@ -1,25 +0,0 @@ -// 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.kinematics.struct; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import edu.wpi.first.math.kinematics.MecanumDriveMotorVoltages; -import edu.wpi.first.wpilibj.StructTestBase; - -@SuppressWarnings("PMD.TestClassWithoutTestCases") -class MecanumDriveMotorVoltagesStructTest extends StructTestBase { - MecanumDriveMotorVoltagesStructTest() { - super(new MecanumDriveMotorVoltages(1.2, 3.1, 2.5, -0.1), MecanumDriveMotorVoltages.struct); - } - - @Override - public void checkEquals(MecanumDriveMotorVoltages testData, MecanumDriveMotorVoltages data) { - assertEquals(testData.frontLeftVoltage, data.frontLeftVoltage); - assertEquals(testData.frontRightVoltage, data.frontRightVoltage); - assertEquals(testData.rearLeftVoltage, data.rearLeftVoltage); - assertEquals(testData.rearRightVoltage, data.rearRightVoltage); - } -} From 39d05ebe7ca34d56853d7d46edfd97c579973378 Mon Sep 17 00:00:00 2001 From: Carl Hauser Date: Thu, 12 Dec 2024 19:18:02 -0800 Subject: [PATCH 2/7] [rtns] Capture exitCode from ssh_channel_get_exit_status (#7541) --- roborioteamnumbersetter/src/main/native/cpp/SshSession.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roborioteamnumbersetter/src/main/native/cpp/SshSession.cpp b/roborioteamnumbersetter/src/main/native/cpp/SshSession.cpp index 8da62444b6..187ad784b7 100644 --- a/roborioteamnumbersetter/src/main/native/cpp/SshSession.cpp +++ b/roborioteamnumbersetter/src/main/native/cpp/SshSession.cpp @@ -146,7 +146,7 @@ std::string SshSession::ExecuteResult(std::string_view cmd, int* exitStatus) { #if LIBSSH_VERSION_MAJOR == 0 && LIBSSH_VERSION_MINOR >= 11 ssh_channel_get_exit_state(channel, &exitCode, nullptr, nullptr); #else - ssh_channel_get_exit_status(channel); + exitCode = ssh_channel_get_exit_status(channel); #endif INFO("{} {}", exitCode, cmd); From 4225b732fd6ca8b4d1bb8686dd41c7098cbd12b7 Mon Sep 17 00:00:00 2001 From: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com> Date: Thu, 12 Dec 2024 19:18:40 -0800 Subject: [PATCH 3/7] Remove unnecessary boxing (#7539) * Remove unnecessary boxing Also remove unnecessary warning suppression * Use more idiomatic functional interfaces in NumericalIntegration --- .../edu/wpi/first/wpilibj/PneumaticHub.java | 3 +- .../wpilibj/PneumaticsControlModule.java | 3 +- .../edu/wpi/first/wpilibj/CounterTest.java | 9 ++--- .../first/wpilibj/DIOCrossConnectTest.java | 2 +- .../java/edu/wpi/first/wpilibj/PDPTest.java | 2 +- .../java/edu/wpi/first/wpilibj/PIDTest.java | 8 ++--- .../fixtures/DIOCrossConnectFixture.java | 6 ++-- .../math/system/NumericalIntegration.java | 35 ++++++++----------- .../java/edu/wpi/first/util/EventVector.java | 2 +- 9 files changed, 28 insertions(+), 42 deletions(-) diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PneumaticHub.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PneumaticHub.java index dedd790b45..127fb94f4f 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PneumaticHub.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PneumaticHub.java @@ -96,8 +96,7 @@ public class PneumaticHub implements PneumaticsBase { private static DataStore getForModule(int module) { synchronized (m_handleLock) { - Integer moduleBoxed = module; - DataStore pcm = m_handleMap.get(moduleBoxed); + DataStore pcm = m_handleMap.get(module); if (pcm == null) { pcm = new DataStore(module); } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PneumaticsControlModule.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PneumaticsControlModule.java index 4f1d70c516..c075c46a75 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PneumaticsControlModule.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PneumaticsControlModule.java @@ -47,8 +47,7 @@ public class PneumaticsControlModule implements PneumaticsBase { private static DataStore getForModule(int module) { synchronized (m_handleLock) { - Integer moduleBoxed = module; - DataStore pcm = m_handleMap.get(moduleBoxed); + DataStore pcm = m_handleMap.get(module); if (pcm == null) { pcm = new DataStore(module); } diff --git a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/CounterTest.java b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/CounterTest.java index 793c7e939e..9fa5e0aae7 100644 --- a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/CounterTest.java +++ b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/CounterTest.java @@ -26,8 +26,8 @@ public class CounterTest extends AbstractComsSetup { private static FakeCounterFixture counter = null; private static final Logger logger = Logger.getLogger(CounterTest.class.getName()); - Integer m_input; - Integer m_output; + int m_input; + int m_output; @Override protected Logger getClassLogger() { @@ -40,10 +40,7 @@ public class CounterTest extends AbstractComsSetup { * @param input The input Port * @param output The output Port */ - public CounterTest(Integer input, Integer output) { - assert input != null; - assert output != null; - + public CounterTest(int input, int output) { m_input = input; m_output = output; // System.out.println("Counter Test: Input: " + input + " Output: " + diff --git a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/DIOCrossConnectTest.java b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/DIOCrossConnectTest.java index 97405ce5ca..9a3ee5c801 100644 --- a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/DIOCrossConnectTest.java +++ b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/DIOCrossConnectTest.java @@ -39,7 +39,7 @@ public class DIOCrossConnectTest extends AbstractInterruptTest { * @param input The port for the input wire * @param output The port for the output wire */ - public DIOCrossConnectTest(Integer input, Integer output) { + public DIOCrossConnectTest(int input, int output) { if (dio != null) { dio.teardown(); } diff --git a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PDPTest.java b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PDPTest.java index d668d16d5a..eb7fda5179 100644 --- a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PDPTest.java +++ b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PDPTest.java @@ -51,7 +51,7 @@ public class PDPTest extends AbstractComsSetup { * @param mef Motor encoder fixture. * @param expectedCurrentDraw Expected current draw in Amps. */ - public PDPTest(MotorEncoderFixture mef, Double expectedCurrentDraw) { + public PDPTest(MotorEncoderFixture mef, double expectedCurrentDraw) { logger.fine("Constructor with: " + mef.getType()); if (me != null && !me.equals(mef)) { me.teardown(); diff --git a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PIDTest.java b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PIDTest.java index 909194556c..90c41eef97 100644 --- a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PIDTest.java +++ b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PIDTest.java @@ -41,9 +41,9 @@ public class PIDTest extends AbstractComsSetup { private PIDController m_controller = null; private static MotorEncoderFixture me = null; - private final Double m_p; - private final Double m_i; - private final Double m_d; + private final double m_p; + private final double m_i; + private final double m_d; @Override protected Logger getClassLogger() { @@ -58,7 +58,7 @@ public class PIDTest extends AbstractComsSetup { * @param d D gain. * @param mef Motor encoder fixture. */ - public PIDTest(Double p, Double i, Double d, MotorEncoderFixture mef) { + public PIDTest(double p, double i, double d, MotorEncoderFixture mef) { logger.fine("Constructor with: " + mef.getType()); if (PIDTest.me != null && !PIDTest.me.equals(mef)) { PIDTest.me.teardown(); diff --git a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/fixtures/DIOCrossConnectFixture.java b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/fixtures/DIOCrossConnectFixture.java index 78880d84a7..03aacb6a7d 100644 --- a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/fixtures/DIOCrossConnectFixture.java +++ b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/fixtures/DIOCrossConnectFixture.java @@ -37,10 +37,8 @@ public class DIOCrossConnectFixture implements ITestFixture { * @param input The port of the {@link DigitalInput} * @param output The port of the {@link DigitalOutput} */ - public DIOCrossConnectFixture(Integer input, Integer output) { - assert input != null; - assert output != null; - assert !input.equals(output); + public DIOCrossConnectFixture(int input, int output) { + assert input != output; m_input = new DigitalInput(input); m_output = new DigitalOutput(output); m_allocated = true; diff --git a/wpimath/src/main/java/edu/wpi/first/math/system/NumericalIntegration.java b/wpimath/src/main/java/edu/wpi/first/math/system/NumericalIntegration.java index 1dcddea840..a54e2eae44 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/system/NumericalIntegration.java +++ b/wpimath/src/main/java/edu/wpi/first/math/system/NumericalIntegration.java @@ -8,8 +8,9 @@ import edu.wpi.first.math.Matrix; import edu.wpi.first.math.Num; import edu.wpi.first.math.numbers.N1; import java.util.function.BiFunction; -import java.util.function.DoubleFunction; -import java.util.function.Function; +import java.util.function.DoubleBinaryOperator; +import java.util.function.DoubleUnaryOperator; +import java.util.function.UnaryOperator; /** Numerical integration utilities. */ public final class NumericalIntegration { @@ -25,13 +26,12 @@ public final class NumericalIntegration { * @param dtSeconds The time over which to integrate. * @return the integration of dx/dt = f(x) for dt. */ - @SuppressWarnings("overloads") - public static double rk4(DoubleFunction f, double x, double dtSeconds) { + public static double rk4(DoubleUnaryOperator f, double x, double dtSeconds) { final var h = dtSeconds; - final var k1 = f.apply(x); - final var k2 = f.apply(x + h * k1 * 0.5); - final var k3 = f.apply(x + h * k2 * 0.5); - final var k4 = f.apply(x + h * k3); + final var k1 = f.applyAsDouble(x); + final var k2 = f.applyAsDouble(x + h * k1 * 0.5); + final var k3 = f.applyAsDouble(x + h * k2 * 0.5); + final var k4 = f.applyAsDouble(x + h * k3); return x + h / 6.0 * (k1 + 2.0 * k2 + 2.0 * k3 + k4); } @@ -45,15 +45,13 @@ public final class NumericalIntegration { * @param dtSeconds The time over which to integrate. * @return The result of Runge Kutta integration (4th order). */ - @SuppressWarnings("overloads") - public static double rk4( - BiFunction f, double x, Double u, double dtSeconds) { + public static double rk4(DoubleBinaryOperator f, double x, double u, double dtSeconds) { final var h = dtSeconds; - final var k1 = f.apply(x, u); - final var k2 = f.apply(x + h * k1 * 0.5, u); - final var k3 = f.apply(x + h * k2 * 0.5, u); - final var k4 = f.apply(x + h * k3, u); + final var k1 = f.applyAsDouble(x, u); + final var k2 = f.applyAsDouble(x + h * k1 * 0.5, u); + final var k3 = f.applyAsDouble(x + h * k2 * 0.5, u); + final var k4 = f.applyAsDouble(x + h * k3, u); return x + h / 6.0 * (k1 + 2.0 * k2 + 2.0 * k3 + k4); } @@ -69,7 +67,6 @@ public final class NumericalIntegration { * @param dtSeconds The time over which to integrate. * @return the integration of dx/dt = f(x, u) for dt. */ - @SuppressWarnings("overloads") public static Matrix rk4( BiFunction, Matrix, Matrix> f, Matrix x, @@ -94,9 +91,8 @@ public final class NumericalIntegration { * @param dtSeconds The time over which to integrate. * @return 4th order Runge-Kutta integration of dx/dt = f(x) for dt. */ - @SuppressWarnings("overloads") public static Matrix rk4( - Function, Matrix> f, Matrix x, double dtSeconds) { + UnaryOperator> f, Matrix x, double dtSeconds) { final var h = dtSeconds; Matrix k1 = f.apply(x); @@ -145,7 +141,6 @@ public final class NumericalIntegration { * @param dtSeconds The time over which to integrate. * @return the integration of dx/dt = f(x, u) for dt. */ - @SuppressWarnings("overloads") public static Matrix rkdp( BiFunction, Matrix, Matrix> f, Matrix x, @@ -166,7 +161,6 @@ public final class NumericalIntegration { * @param maxError The maximum acceptable truncation error. Usually a small number like 1e-6. * @return the integration of dx/dt = f(x, u) for dt. */ - @SuppressWarnings("overloads") public static Matrix rkdp( BiFunction, Matrix, Matrix> f, Matrix x, @@ -291,7 +285,6 @@ public final class NumericalIntegration { * @param maxError The maximum acceptable truncation error. Usually a small number like 1e-6. * @return the integration of dx/dt = f(x, u) for dt. */ - @SuppressWarnings("overloads") public static Matrix rkdp( BiFunction, Matrix> f, double t, diff --git a/wpiutil/src/main/java/edu/wpi/first/util/EventVector.java b/wpiutil/src/main/java/edu/wpi/first/util/EventVector.java index 60fb5d13d0..9257d9706f 100644 --- a/wpiutil/src/main/java/edu/wpi/first/util/EventVector.java +++ b/wpiutil/src/main/java/edu/wpi/first/util/EventVector.java @@ -48,7 +48,7 @@ public class EventVector { public void wakeup() { m_lock.lock(); try { - for (Integer eventHandle : m_events) { + for (int eventHandle : m_events) { WPIUtilJNI.setEvent(eventHandle); } } finally { From e943424609abec8294d6d065fd4b3391a9088cbe Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Thu, 12 Dec 2024 22:19:14 -0500 Subject: [PATCH 4/7] [build] Update shadow plugin (#7540) --- build.gradle | 2 +- cameraserver/multiCameraServer/build.gradle | 2 +- developerRobot/build.gradle | 2 +- wpilibjIntegrationTests/build.gradle | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 8a51182b78..2db7083603 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ plugins { id 'idea' id 'visual-studio' id 'net.ltgt.errorprone' version '3.1.0' apply false - id 'com.github.johnrengelman.shadow' version '8.1.1' apply false + id 'com.gradleup.shadow' version '8.3.4' apply false id 'com.diffplug.spotless' version '6.20.0' apply false id 'com.github.spotbugs' version '6.0.2' apply false } diff --git a/cameraserver/multiCameraServer/build.gradle b/cameraserver/multiCameraServer/build.gradle index d13637c711..377bdbcf3c 100644 --- a/cameraserver/multiCameraServer/build.gradle +++ b/cameraserver/multiCameraServer/build.gradle @@ -22,7 +22,7 @@ application { mainClass = 'edu.wpi.Main' } -apply plugin: 'com.github.johnrengelman.shadow' +apply plugin: 'com.gradleup.shadow' repositories { maven { diff --git a/developerRobot/build.gradle b/developerRobot/build.gradle index 5a8b95c4b1..515388ee1a 100644 --- a/developerRobot/build.gradle +++ b/developerRobot/build.gradle @@ -35,7 +35,7 @@ application { mainClass = 'frc.robot.Main' } -apply plugin: 'com.github.johnrengelman.shadow' +apply plugin: 'com.gradleup.shadow' repositories { maven { diff --git a/wpilibjIntegrationTests/build.gradle b/wpilibjIntegrationTests/build.gradle index b79337aff8..b916736964 100644 --- a/wpilibjIntegrationTests/build.gradle +++ b/wpilibjIntegrationTests/build.gradle @@ -15,7 +15,7 @@ application { mainClass = 'edu.wpi.first.wpilibj.test.AntJunitLauncher' } -apply plugin: 'com.github.johnrengelman.shadow' +apply plugin: 'com.gradleup.shadow' repositories { maven { From 5e3dba672ad11f249c2bb733852b4358a2f5314f Mon Sep 17 00:00:00 2001 From: Daniel Chen <108989218+Daniel1464@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:25:38 -0500 Subject: [PATCH 5/7] [wpiutil] Record/Enum struct generation fix (#7538) ProceduralStructGenerator's genRecord and genEnum were package-private, and only extractClassStruct was made public. However, this package private visibility rendered them unable to be used by the rest of wpilib(and advanced users). Here, ProceduralStructGenerator is split into 2 classes: StructGenerator(which generates structs) and StructFetcher(the new namespace for extractClassStruct). In addition, genRecord and genEnum have been made public methods. --- .../wpi/first/util/struct/StructFetcher.java | 65 +++++++++++++++++++ ...uctGenerator.java => StructGenerator.java} | 61 ++--------------- ...atorTest.java => StructGeneratorTest.java} | 15 ++--- 3 files changed, 77 insertions(+), 64 deletions(-) create mode 100644 wpiutil/src/main/java/edu/wpi/first/util/struct/StructFetcher.java rename wpiutil/src/main/java/edu/wpi/first/util/struct/{ProceduralStructGenerator.java => StructGenerator.java} (88%) rename wpiutil/src/test/java/edu/wpi/first/util/struct/{ProceduralStructGeneratorTest.java => StructGeneratorTest.java} (90%) diff --git a/wpiutil/src/main/java/edu/wpi/first/util/struct/StructFetcher.java b/wpiutil/src/main/java/edu/wpi/first/util/struct/StructFetcher.java new file mode 100644 index 0000000000..dbfef7cc08 --- /dev/null +++ b/wpiutil/src/main/java/edu/wpi/first/util/struct/StructFetcher.java @@ -0,0 +1,65 @@ +// 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.util.struct; + +import java.util.Optional; + +/** + * A utility class for fetching the assigned struct of existing classes. These are usually public, + * static, and final properties with the Struct type. + */ +public final class StructFetcher { + private StructFetcher() { + throw new UnsupportedOperationException("This is a utility class!"); + } + + /** + * Returns a {@link Struct} for the given {@link StructSerializable} marked class. Due to the + * non-contractual nature of the marker this can fail. If the {@code struct} field could not be + * accessed for any reason, an empty {@link Optional} is returned. + * + * @param The type of the class. + * @param clazz The class object to extract the struct from. + * @return An optional containing the struct if it could be extracted. + */ + @SuppressWarnings("unchecked") + public static Optional> fetchStruct( + Class clazz) { + try { + var possibleField = Optional.ofNullable(clazz.getDeclaredField("struct")); + return possibleField.flatMap( + field -> { + if (Struct.class.isAssignableFrom(field.getType())) { + try { + return Optional.ofNullable((Struct) field.get(null)); + } catch (IllegalAccessException e) { + return Optional.empty(); + } + } else { + return Optional.empty(); + } + }); + } catch (NoSuchFieldException e) { + return Optional.empty(); + } + } + + /** + * Returns a {@link Struct} for the given class. This does not do compile time checking that the + * class is a {@link StructSerializable}. Whenever possible it is reccomended to use {@link + * #fetchStruct(Class)}. + * + * @param clazz The class object to extract the struct from. + * @return An optional containing the struct if it could be extracted. + */ + @SuppressWarnings("unchecked") + public static Optional> fetchStructDynamic(Class clazz) { + if (StructSerializable.class.isAssignableFrom(clazz)) { + return fetchStruct((Class) clazz).map(struct -> struct); + } else { + return Optional.empty(); + } + } +} diff --git a/wpiutil/src/main/java/edu/wpi/first/util/struct/ProceduralStructGenerator.java b/wpiutil/src/main/java/edu/wpi/first/util/struct/StructGenerator.java similarity index 88% rename from wpiutil/src/main/java/edu/wpi/first/util/struct/ProceduralStructGenerator.java rename to wpiutil/src/main/java/edu/wpi/first/util/struct/StructGenerator.java index 213a16289f..24b2541e1c 100644 --- a/wpiutil/src/main/java/edu/wpi/first/util/struct/ProceduralStructGenerator.java +++ b/wpiutil/src/main/java/edu/wpi/first/util/struct/StructGenerator.java @@ -12,11 +12,10 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Optional; /** A utility class for procedurally generating {@link Struct}s from records and enums. */ -public final class ProceduralStructGenerator { - private ProceduralStructGenerator() { +public final class StructGenerator { + private StructGenerator() { throw new UnsupportedOperationException("This is a utility class!"); } @@ -123,54 +122,6 @@ public final class ProceduralStructGenerator { } } - /** - * Returns a {@link Struct} for the given {@link StructSerializable} marked class. Due to the - * non-contractual nature of the marker this can fail. If the {@code struct} field could not be - * accessed for any reason, an empty {@link Optional} is returned. - * - * @param The type of the class. - * @param clazz The class object to extract the struct from. - * @return An optional containing the struct if it could be extracted. - */ - @SuppressWarnings("unchecked") - public static Optional> extractClassStruct( - Class clazz) { - try { - var possibleField = Optional.ofNullable(clazz.getDeclaredField("struct")); - return possibleField.flatMap( - field -> { - if (Struct.class.isAssignableFrom(field.getType())) { - try { - return Optional.ofNullable((Struct) field.get(null)); - } catch (IllegalAccessException e) { - return Optional.empty(); - } - } else { - return Optional.empty(); - } - }); - } catch (NoSuchFieldException e) { - return Optional.empty(); - } - } - - /** - * Returns a {@link Struct} for the given class. This does not do compile time checking that the - * class is a {@link StructSerializable}. Whenever possible it is reccomended to use {@link - * #extractClassStruct(Class)}. - * - * @param clazz The class object to extract the struct from. - * @return An optional containing the struct if it could be extracted. - */ - @SuppressWarnings("unchecked") - public static Optional> extractClassStructDynamic(Class clazz) { - if (StructSerializable.class.isAssignableFrom(clazz)) { - return extractClassStruct((Class) clazz).map(struct -> struct); - } else { - return Optional.empty(); - } - } - /** A utility for building schema syntax in a procedural manner. */ @SuppressWarnings("PMD.AvoidStringBufferField") public static class SchemaBuilder { @@ -303,7 +254,7 @@ public final class ProceduralStructGenerator { * @return The generated struct. */ @SuppressWarnings({"unchecked", "PMD.AvoidAccessibilityAlteration"}) - static Struct genRecord(final Class recordClass) { + public static Struct genRecord(final Class recordClass) { final RecordComponent[] components = recordClass.getRecordComponents(); final SchemaBuilder schemaBuilder = new SchemaBuilder(); final ArrayList> nestedStructs = new ArrayList<>(); @@ -329,7 +280,7 @@ public final class ProceduralStructGenerator { if (customStructTypeMap.containsKey(type)) { struct = customStructTypeMap.get(type); } else if (StructSerializable.class.isAssignableFrom(type)) { - var optStruct = extractClassStructDynamic(type); + var optStruct = StructFetcher.fetchStructDynamic(type); if (optStruct.isPresent()) { struct = optStruct.get(); } else { @@ -465,7 +416,7 @@ public final class ProceduralStructGenerator { * @return The generated struct. */ @SuppressWarnings({"unchecked", "PMD.AvoidAccessibilityAlteration"}) - static > Struct genEnum(Class enumClass) { + public static > Struct genEnum(Class enumClass) { final E[] enumVariants = enumClass.getEnumConstants(); final Field[] allEnumFields = enumClass.getDeclaredFields(); final SchemaBuilder schemaBuilder = new SchemaBuilder(); @@ -516,7 +467,7 @@ public final class ProceduralStructGenerator { if (customStructTypeMap.containsKey(type)) { struct = customStructTypeMap.get(type); } else if (StructSerializable.class.isAssignableFrom(type)) { - var optStruct = extractClassStructDynamic(type); + var optStruct = StructFetcher.fetchStructDynamic(type); if (optStruct.isPresent()) { struct = optStruct.get(); } else { diff --git a/wpiutil/src/test/java/edu/wpi/first/util/struct/ProceduralStructGeneratorTest.java b/wpiutil/src/test/java/edu/wpi/first/util/struct/StructGeneratorTest.java similarity index 90% rename from wpiutil/src/test/java/edu/wpi/first/util/struct/ProceduralStructGeneratorTest.java rename to wpiutil/src/test/java/edu/wpi/first/util/struct/StructGeneratorTest.java index ccdbca3056..c5a1eea25b 100644 --- a/wpiutil/src/test/java/edu/wpi/first/util/struct/ProceduralStructGeneratorTest.java +++ b/wpiutil/src/test/java/edu/wpi/first/util/struct/StructGeneratorTest.java @@ -4,15 +4,15 @@ package edu.wpi.first.util.struct; -import static edu.wpi.first.util.struct.ProceduralStructGenerator.genEnum; -import static edu.wpi.first.util.struct.ProceduralStructGenerator.genRecord; +import static edu.wpi.first.util.struct.StructGenerator.genEnum; +import static edu.wpi.first.util.struct.StructGenerator.genRecord; import static org.junit.jupiter.api.Assertions.assertEquals; import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.junit.jupiter.api.Test; -class ProceduralStructGeneratorTest { +class StructGeneratorTest { public record CustomRecord(int int32, boolean bool, double float64, char character, short int16) implements StructSerializable { public static CustomRecord create() { @@ -95,8 +95,7 @@ class ProceduralStructGeneratorTest { @SuppressWarnings("unchecked") private void testStructRoundTrip(S value) { - Struct struct = - ProceduralStructGenerator.extractClassStruct((Class) value.getClass()).get(); + Struct struct = StructFetcher.fetchStruct((Class) value.getClass()).get(); ByteBuffer buffer = ByteBuffer.allocate(struct.getSize()); buffer.order(ByteOrder.LITTLE_ENDIAN); struct.pack(buffer, value); @@ -108,8 +107,7 @@ class ProceduralStructGeneratorTest { @SuppressWarnings("unchecked") private void testStructDoublePack(S value) { - Struct struct = - ProceduralStructGenerator.extractClassStruct((Class) value.getClass()).get(); + Struct struct = StructFetcher.fetchStruct((Class) value.getClass()).get(); ByteBuffer buffer = ByteBuffer.allocate(struct.getSize()); buffer.order(ByteOrder.LITTLE_ENDIAN); struct.pack(buffer, value); @@ -123,8 +121,7 @@ class ProceduralStructGeneratorTest { @SuppressWarnings("unchecked") private void testStructDoubleUnpack(S value) { - Struct struct = - ProceduralStructGenerator.extractClassStruct((Class) value.getClass()).get(); + Struct struct = StructFetcher.fetchStruct((Class) value.getClass()).get(); ByteBuffer buffer = ByteBuffer.allocate(struct.getSize()); buffer.order(ByteOrder.LITTLE_ENDIAN); struct.pack(buffer, value); From 68285dae77c5756f0c052087d7ac083a7833a0c6 Mon Sep 17 00:00:00 2001 From: Daniel Chen <108989218+Daniel1464@users.noreply.github.com> Date: Fri, 13 Dec 2024 20:30:02 -0500 Subject: [PATCH 6/7] [commands] Add withDeadline modifier (#7299) Co-authored-by: Ryan Blue --- .../wpi/first/wpilibj2/command/Command.java | 19 +++++++ .../main/native/cpp/frc2/command/Command.cpp | 4 ++ .../native/cpp/frc2/command/CommandPtr.cpp | 9 ++++ .../native/include/frc2/command/Command.h | 12 +++++ .../native/include/frc2/command/CommandPtr.h | 10 ++++ .../command/CommandDecoratorTest.java | 51 +++++++++++++++++++ .../cpp/frc2/command/CommandDecoratorTest.cpp | 48 +++++++++++++++++ 7 files changed, 153 insertions(+) diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java index a53d792d0e..d6cd4c8860 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java @@ -287,6 +287,24 @@ public abstract class Command implements Sendable { return group; } + /** + * Creates a new command that runs this command and the deadline in parallel, finishing (and + * interrupting this command) when the deadline finishes. + * + *

Note: This decorator works by adding this command to a composition. The command the + * decorator was called on cannot be scheduled independently or be added to a different + * composition (namely, decorators), unless it is manually cleared from the list of composed + * commands with {@link CommandScheduler#removeComposedCommand(Command)}. The command composition + * returned from this method can be further decorated without issue. + * + * @param deadline the deadline of the command group + * @return the decorated command + * @see Command#deadlineFor + */ + public ParallelDeadlineGroup withDeadline(Command deadline) { + return new ParallelDeadlineGroup(deadline, this); + } + /** * Decorates this command with a set of commands to run parallel to it, ending when the calling * command ends and interrupting all the others. Often more convenient/less-verbose than @@ -321,6 +339,7 @@ public abstract class Command implements Sendable { * @param parallel the commands to run in parallel. Note the parallel commands will be interrupted * when the deadline command ends * @return the decorated command + * @see Command#withDeadline */ public ParallelDeadlineGroup deadlineFor(Command... parallel) { return new ParallelDeadlineGroup(this, parallel); diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/Command.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/Command.cpp index 365cf80a4e..af8e30a33a 100644 --- a/wpilibNewCommands/src/main/native/cpp/frc2/command/Command.cpp +++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/Command.cpp @@ -121,6 +121,10 @@ CommandPtr Command::OnlyIf(std::function condition) && { return std::move(*this).ToPtr().OnlyIf(std::move(condition)); } +CommandPtr Command::WithDeadline(CommandPtr&& deadline) && { + return std::move(*this).ToPtr().WithDeadline(std::move(deadline)); +} + CommandPtr Command::DeadlineFor(CommandPtr&& parallel) && { return std::move(*this).ToPtr().DeadlineFor(std::move(parallel)); } diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandPtr.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandPtr.cpp index 298cc2e50c..d4125fdceb 100644 --- a/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandPtr.cpp +++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandPtr.cpp @@ -168,6 +168,15 @@ CommandPtr CommandPtr::OnlyIf(std::function condition) && { return std::move(*this).Unless(std::not_fn(std::move(condition))); } +CommandPtr CommandPtr::WithDeadline(CommandPtr&& deadline) && { + AssertValid(); + std::vector> vec; + vec.emplace_back(std::move(m_ptr)); + m_ptr = std::make_unique(std::move(deadline).Unwrap(), + std::move(vec)); + return std::move(*this); +} + CommandPtr CommandPtr::DeadlineWith(CommandPtr&& parallel) && { AssertValid(); std::vector> vec; diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/Command.h b/wpilibNewCommands/src/main/native/include/frc2/command/Command.h index c4af1afe81..4dea3eb1a5 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/Command.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/Command.h @@ -309,6 +309,16 @@ class Command : public wpi::Sendable, public wpi::SendableHelper { [[nodiscard]] CommandPtr OnlyIf(std::function condition) &&; + /** + * Creates a new command that runs this command and the deadline in parallel, + * finishing (and interrupting this command) when the deadline finishes. + * + * @param deadline the deadline of the command group + * @return the decorated command + * @see DeadlineFor + */ + CommandPtr WithDeadline(CommandPtr&& deadline) &&; + /** * Decorates this command with a set of commands to run parallel to it, ending * when the calling command ends and interrupting all the others. Often more @@ -318,9 +328,11 @@ class Command : public wpi::Sendable, public wpi::SendableHelper { * @param parallel the commands to run in parallel. Note the parallel commands * will be interupted when the deadline command ends * @return the decorated command + * @see WithDeadline */ [[nodiscard]] CommandPtr DeadlineFor(CommandPtr&& parallel) &&; + /** * Decorates this command with a set of commands to run parallel to it, ending * when the last command ends. Often more convenient/less-verbose than diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/CommandPtr.h b/wpilibNewCommands/src/main/native/include/frc2/command/CommandPtr.h index e2f534f754..81a255a9a7 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/CommandPtr.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/CommandPtr.h @@ -182,6 +182,16 @@ class CommandPtr final { [[nodiscard]] CommandPtr OnlyIf(std::function condition) &&; + /** + * Creates a new command that runs this command and the deadline in parallel, + * finishing (and interrupting this command) when the deadline finishes. + * + * @param deadline the deadline of the command group + * @return the decorated command + * @see DeadlineFor + */ + CommandPtr WithDeadline(CommandPtr&& deadline) &&; + /** * Decorates this command with a set of commands to run parallel to it, ending * when the calling command ends and interrupting all the others. Often more diff --git a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/CommandDecoratorTest.java b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/CommandDecoratorTest.java index 1f9605d010..4d9ad2c06f 100644 --- a/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/CommandDecoratorTest.java +++ b/wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/CommandDecoratorTest.java @@ -271,6 +271,57 @@ class CommandDecoratorTest extends CommandTestBase { } } + @Test + void withDeadlineTest() { + try (CommandScheduler scheduler = new CommandScheduler()) { + AtomicBoolean finish = new AtomicBoolean(false); + + Command endsBeforeGroup = Commands.none().withDeadline(Commands.waitUntil(finish::get)); + scheduler.schedule(endsBeforeGroup); + scheduler.run(); + assertTrue(scheduler.isScheduled(endsBeforeGroup)); + finish.set(true); + scheduler.run(); + assertFalse(scheduler.isScheduled(endsBeforeGroup)); + finish.set(false); + + Command endsAfterGroup = Commands.idle().withDeadline(Commands.waitUntil(finish::get)); + scheduler.schedule(endsAfterGroup); + scheduler.run(); + assertTrue(scheduler.isScheduled(endsAfterGroup)); + finish.set(true); + scheduler.run(); + assertFalse(scheduler.isScheduled(endsAfterGroup)); + } + } + + @Test + void withDeadlineOrderTest() { + try (CommandScheduler scheduler = new CommandScheduler()) { + AtomicBoolean dictatorHasRun = new AtomicBoolean(false); + AtomicBoolean dictatorWasPolled = new AtomicBoolean(false); + Command dictator = + new FunctionalCommand( + () -> {}, + () -> dictatorHasRun.set(true), + interrupted -> {}, + () -> { + dictatorWasPolled.set(true); + return true; + }); + Command other = + Commands.run( + () -> + assertAll( + () -> assertTrue(dictatorHasRun.get()), + () -> assertTrue(dictatorWasPolled.get()))); + Command group = other.withDeadline(dictator); + scheduler.schedule(group); + scheduler.run(); + assertAll(() -> assertTrue(dictatorHasRun.get()), () -> assertTrue(dictatorWasPolled.get())); + } + } + @Test void alongWithTest() { try (CommandScheduler scheduler = new CommandScheduler()) { diff --git a/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandDecoratorTest.cpp b/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandDecoratorTest.cpp index 3a31308a3f..a0b7726f5d 100644 --- a/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandDecoratorTest.cpp +++ b/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandDecoratorTest.cpp @@ -221,6 +221,27 @@ TEST_F(CommandDecoratorTest, DeadlineFor) { EXPECT_FALSE(scheduler.IsScheduled(group)); } +TEST_F(CommandDecoratorTest, WithDeadline) { + CommandScheduler scheduler = GetScheduler(); + + bool finish = false; + + auto dictator = WaitUntilCommand([&finish] { return finish; }); + auto endsAfter = WaitUntilCommand([] { return false; }); + + auto group = std::move(endsAfter).WithDeadline(std::move(dictator).ToPtr()); + + scheduler.Schedule(group); + scheduler.Run(); + + EXPECT_TRUE(scheduler.IsScheduled(group)); + + finish = true; + scheduler.Run(); + + EXPECT_FALSE(scheduler.IsScheduled(group)); +} + TEST_F(CommandDecoratorTest, AlongWith) { CommandScheduler scheduler = GetScheduler(); @@ -283,6 +304,33 @@ TEST_F(CommandDecoratorTest, DeadlineForOrder) { EXPECT_TRUE(dictatorWasPolled); } +TEST_F(CommandDecoratorTest, WithDeadlineOrder) { + CommandScheduler scheduler = GetScheduler(); + + bool dictatorHasRun = false; + bool dictatorWasPolled = false; + + auto dictator = + FunctionalCommand([] {}, [&dictatorHasRun] { dictatorHasRun = true; }, + [](bool interrupted) {}, + [&dictatorWasPolled] { + dictatorWasPolled = true; + return true; + }); + auto other = RunCommand([&dictatorHasRun, &dictatorWasPolled] { + EXPECT_TRUE(dictatorHasRun); + EXPECT_TRUE(dictatorWasPolled); + }); + + auto group = std::move(other).WithDeadline(std::move(dictator).ToPtr()); + + scheduler.Schedule(group); + scheduler.Run(); + + EXPECT_TRUE(dictatorHasRun); + EXPECT_TRUE(dictatorWasPolled); +} + TEST_F(CommandDecoratorTest, AlongWithOrder) { CommandScheduler scheduler = GetScheduler(); From 4bca79b9afb4c20d722ec6b054421c6b549b30e5 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sat, 14 Dec 2024 11:42:49 -0700 Subject: [PATCH 7/7] [wpimath] Revert "ChassisSpeeds fromRelative and discretize methods made instance methods (#7115)" (#7549) This reverts commit a3b12b3bd96ddcd29912752dbbed4039d6731dc7. --- .../examples/mecanumbot/Drivetrain.java | 14 ++-- .../mecanumdriveposeestimator/Drivetrain.java | 14 ++-- .../examples/swervebot/Drivetrain.java | 14 ++-- .../subsystems/DriveSubsystem.java | 14 ++-- .../swervedriveposeestimator/Drivetrain.java | 24 +++--- .../controller/HolonomicDriveController.java | 11 +-- .../first/math/kinematics/ChassisSpeeds.java | 77 ------------------- .../math/kinematics/ChassisSpeedsTest.java | 11 ++- 8 files changed, 52 insertions(+), 127 deletions(-) diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumbot/Drivetrain.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumbot/Drivetrain.java index 61cfce638e..c64c9b3958 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumbot/Drivetrain.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumbot/Drivetrain.java @@ -129,12 +129,14 @@ public class Drivetrain { */ public void drive( double xSpeed, double ySpeed, double rot, boolean fieldRelative, double periodSeconds) { - var chassisSpeeds = new ChassisSpeeds(xSpeed, ySpeed, rot); - if (fieldRelative) { - chassisSpeeds.toRobotRelativeSpeeds(m_gyro.getRotation2d()); - } - chassisSpeeds.discretize(periodSeconds); - var mecanumDriveWheelSpeeds = m_kinematics.toWheelSpeeds(chassisSpeeds); + var mecanumDriveWheelSpeeds = + m_kinematics.toWheelSpeeds( + ChassisSpeeds.discretize( + fieldRelative + ? ChassisSpeeds.fromFieldRelativeSpeeds( + xSpeed, ySpeed, rot, m_gyro.getRotation2d()) + : new ChassisSpeeds(xSpeed, ySpeed, rot), + periodSeconds)); mecanumDriveWheelSpeeds.desaturate(kMaxSpeed); setSpeeds(mecanumDriveWheelSpeeds); } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumdriveposeestimator/Drivetrain.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumdriveposeestimator/Drivetrain.java index de48109448..256824c03b 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumdriveposeestimator/Drivetrain.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumdriveposeestimator/Drivetrain.java @@ -141,12 +141,14 @@ public class Drivetrain { */ public void drive( double xSpeed, double ySpeed, double rot, boolean fieldRelative, double periodSeconds) { - var chassisSpeeds = new ChassisSpeeds(xSpeed, ySpeed, rot); - if (fieldRelative) { - chassisSpeeds.toRobotRelativeSpeeds(m_poseEstimator.getEstimatedPosition().getRotation()); - } - chassisSpeeds.discretize(periodSeconds); - var mecanumDriveWheelSpeeds = m_kinematics.toWheelSpeeds(chassisSpeeds); + var mecanumDriveWheelSpeeds = + m_kinematics.toWheelSpeeds( + ChassisSpeeds.discretize( + fieldRelative + ? ChassisSpeeds.fromFieldRelativeSpeeds( + xSpeed, ySpeed, rot, m_poseEstimator.getEstimatedPosition().getRotation()) + : new ChassisSpeeds(xSpeed, ySpeed, rot), + periodSeconds)); mecanumDriveWheelSpeeds.desaturate(kMaxSpeed); setSpeeds(mecanumDriveWheelSpeeds); } diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervebot/Drivetrain.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervebot/Drivetrain.java index f622259b49..958e5a3e61 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervebot/Drivetrain.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervebot/Drivetrain.java @@ -57,12 +57,14 @@ public class Drivetrain { */ public void drive( double xSpeed, double ySpeed, double rot, boolean fieldRelative, double periodSeconds) { - var chassisSpeeds = new ChassisSpeeds(xSpeed, ySpeed, rot); - if (fieldRelative) { - chassisSpeeds.toRobotRelativeSpeeds(m_gyro.getRotation2d()); - } - chassisSpeeds.discretize(periodSeconds); - var swerveModuleStates = m_kinematics.toWheelSpeeds(chassisSpeeds); + var swerveModuleStates = + m_kinematics.toSwerveModuleStates( + ChassisSpeeds.discretize( + fieldRelative + ? ChassisSpeeds.fromFieldRelativeSpeeds( + xSpeed, ySpeed, rot, m_gyro.getRotation2d()) + : new ChassisSpeeds(xSpeed, ySpeed, rot), + periodSeconds)); SwerveDriveKinematics.desaturateWheelSpeeds(swerveModuleStates, kMaxSpeed); m_frontLeft.setDesiredState(swerveModuleStates[0]); m_frontRight.setDesiredState(swerveModuleStates[1]); diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervecontrollercommand/subsystems/DriveSubsystem.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervecontrollercommand/subsystems/DriveSubsystem.java index c950e4c7c5..04ee2998df 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervecontrollercommand/subsystems/DriveSubsystem.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervecontrollercommand/subsystems/DriveSubsystem.java @@ -118,12 +118,14 @@ public class DriveSubsystem extends SubsystemBase { * @param fieldRelative Whether the provided x and y speeds are relative to the field. */ public void drive(double xSpeed, double ySpeed, double rot, boolean fieldRelative) { - var chassisSpeeds = new ChassisSpeeds(xSpeed, ySpeed, rot); - if (fieldRelative) { - chassisSpeeds.toRobotRelativeSpeeds(m_gyro.getRotation2d()); - } - chassisSpeeds.discretize(DriveConstants.kDrivePeriod); - var swerveModuleStates = DriveConstants.kDriveKinematics.toWheelSpeeds(chassisSpeeds); + var swerveModuleStates = + DriveConstants.kDriveKinematics.toSwerveModuleStates( + ChassisSpeeds.discretize( + fieldRelative + ? ChassisSpeeds.fromFieldRelativeSpeeds( + xSpeed, ySpeed, rot, m_gyro.getRotation2d()) + : new ChassisSpeeds(xSpeed, ySpeed, rot), + DriveConstants.kDrivePeriod)); SwerveDriveKinematics.desaturateWheelSpeeds( swerveModuleStates, DriveConstants.kMaxSpeedMetersPerSecond); m_frontLeft.setDesiredState(swerveModuleStates[0]); diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervedriveposeestimator/Drivetrain.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervedriveposeestimator/Drivetrain.java index a28dfcacc2..c232bb19a7 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervedriveposeestimator/Drivetrain.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervedriveposeestimator/Drivetrain.java @@ -36,11 +36,8 @@ public class Drivetrain { new SwerveDriveKinematics( m_frontLeftLocation, m_frontRightLocation, m_backLeftLocation, m_backRightLocation); - /* - * Here we use SwerveDrivePoseEstimator so that we can fuse odometry readings. - * The numbers used - * below are robot specific, and should be tuned. - */ + /* Here we use SwerveDrivePoseEstimator so that we can fuse odometry readings. The numbers used + below are robot specific, and should be tuned. */ private final SwerveDrivePoseEstimator m_poseEstimator = new SwerveDrivePoseEstimator( m_kinematics, @@ -69,12 +66,14 @@ public class Drivetrain { */ public void drive( double xSpeed, double ySpeed, double rot, boolean fieldRelative, double periodSeconds) { - var chassisSpeeds = new ChassisSpeeds(xSpeed, ySpeed, rot); - if (fieldRelative) { - chassisSpeeds.toRobotRelativeSpeeds(m_poseEstimator.getEstimatedPosition().getRotation()); - } - chassisSpeeds.discretize(periodSeconds); - var swerveModuleStates = m_kinematics.toWheelSpeeds(chassisSpeeds); + var swerveModuleStates = + m_kinematics.toSwerveModuleStates( + ChassisSpeeds.discretize( + fieldRelative + ? ChassisSpeeds.fromFieldRelativeSpeeds( + xSpeed, ySpeed, rot, m_poseEstimator.getEstimatedPosition().getRotation()) + : new ChassisSpeeds(xSpeed, ySpeed, rot), + periodSeconds)); SwerveDriveKinematics.desaturateWheelSpeeds(swerveModuleStates, kMaxSpeed); m_frontLeft.setDesiredState(swerveModuleStates[0]); m_frontRight.setDesiredState(swerveModuleStates[1]); @@ -93,8 +92,7 @@ public class Drivetrain { m_backRight.getPosition() }); - // Also apply vision measurements. We use 0.3 seconds in the past as an example - // -- on + // Also apply vision measurements. We use 0.3 seconds in the past as an example -- on // a real robot, this must be calculated based either on latency or timestamps. m_poseEstimator.addVisionMeasurement( ExampleGlobalMeasurementSensor.getEstimatedGlobalPose( diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/HolonomicDriveController.java b/wpimath/src/main/java/edu/wpi/first/math/controller/HolonomicDriveController.java index c1c30d42d2..a243a52d85 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/HolonomicDriveController.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/HolonomicDriveController.java @@ -102,10 +102,9 @@ public class HolonomicDriveController { m_poseError = trajectoryPose.relativeTo(currentPose); m_rotationError = desiredHeading.minus(currentPose.getRotation()); - ChassisSpeeds speeds = new ChassisSpeeds(xFF, yFF, thetaFF); + if (!m_enabled) { - speeds.toRobotRelativeSpeeds(currentPose.getRotation()); - return speeds; + return ChassisSpeeds.fromFieldRelativeSpeeds(xFF, yFF, thetaFF, currentPose.getRotation()); } // Calculate feedback velocities (based on position error). @@ -113,10 +112,8 @@ public class HolonomicDriveController { double yFeedback = m_yController.calculate(currentPose.getY(), trajectoryPose.getY()); // Return next output. - speeds.vxMetersPerSecond += xFeedback; - speeds.vyMetersPerSecond += yFeedback; - speeds.toRobotRelativeSpeeds(currentPose.getRotation()); - return speeds; + return ChassisSpeeds.fromFieldRelativeSpeeds( + xFF + xFeedback, yFF + yFeedback, thetaFF, currentPose.getRotation()); } /** diff --git a/wpimath/src/main/java/edu/wpi/first/math/kinematics/ChassisSpeeds.java b/wpimath/src/main/java/edu/wpi/first/math/kinematics/ChassisSpeeds.java index e0eb407796..4c806a52cb 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/kinematics/ChassisSpeeds.java +++ b/wpimath/src/main/java/edu/wpi/first/math/kinematics/ChassisSpeeds.java @@ -103,9 +103,7 @@ public class ChassisSpeeds implements ProtobufSerializable, StructSerializable { * @param omegaRadiansPerSecond Angular velocity. * @param dtSeconds The duration of the timestep the speeds should be applied for. * @return Discretized ChassisSpeeds. - * @deprecated Use instance method instead. */ - @Deprecated(forRemoval = true, since = "2025") public static ChassisSpeeds discretize( double vxMetersPerSecond, double vyMetersPerSecond, @@ -143,9 +141,7 @@ public class ChassisSpeeds implements ProtobufSerializable, StructSerializable { * @param omega Angular velocity. * @param dt The duration of the timestep the speeds should be applied for. * @return Discretized ChassisSpeeds. - * @deprecated Use instance method instead. */ - @Deprecated(forRemoval = true, since = "2025") public static ChassisSpeeds discretize( LinearVelocity vx, LinearVelocity vy, AngularVelocity omega, Time dt) { return discretize( @@ -166,9 +162,7 @@ public class ChassisSpeeds implements ProtobufSerializable, StructSerializable { * @param continuousSpeeds The continuous speeds. * @param dtSeconds The duration of the timestep the speeds should be applied for. * @return Discretized ChassisSpeeds. - * @deprecated Use instance method instead. */ - @Deprecated(forRemoval = true, since = "2025") public static ChassisSpeeds discretize(ChassisSpeeds continuousSpeeds, double dtSeconds) { return discretize( continuousSpeeds.vxMetersPerSecond, @@ -177,36 +171,6 @@ public class ChassisSpeeds implements ProtobufSerializable, StructSerializable { dtSeconds); } - /** - * Discretizes a continuous-time chassis speed. - * - *

This function converts this continuous-time chassis speed into a discrete-time one such that - * when the discrete-time chassis speed is applied for one timestep, the robot moves as if the - * velocity components are independent (i.e., the robot moves v_x * dt along the x-axis, v_y * dt - * along the y-axis, and omega * dt around the z-axis). - * - *

This is useful for compensating for translational skew when translating and rotating a - * swerve drivetrain. - * - * @param dtSeconds The duration of the timestep the speeds should be applied for. - */ - public void discretize(double dtSeconds) { - var desiredDeltaPose = - new Pose2d( - vxMetersPerSecond * dtSeconds, - vyMetersPerSecond * dtSeconds, - new Rotation2d(omegaRadiansPerSecond * dtSeconds)); - - // Find the chassis translation/rotation deltas in the robot frame that move the robot from its - // current pose to the desired pose - var twist = Pose2d.kZero.log(desiredDeltaPose); - - // Turn the chassis translation/rotation deltas into average velocities - vxMetersPerSecond = twist.dx / dtSeconds; - vyMetersPerSecond = twist.dy / dtSeconds; - omegaRadiansPerSecond = twist.dtheta / dtSeconds; - } - /** * Converts a user provided field-relative set of speeds into a robot-relative ChassisSpeeds * object. @@ -220,9 +184,7 @@ public class ChassisSpeeds implements ProtobufSerializable, StructSerializable { * considered to be zero when it is facing directly away from your alliance station wall. * Remember that this should be CCW positive. * @return ChassisSpeeds object representing the speeds in the robot's frame of reference. - * @deprecated Use toRobotRelativeSpeeds instead. */ - @Deprecated(forRemoval = true, since = "2025") public static ChassisSpeeds fromFieldRelativeSpeeds( double vxMetersPerSecond, double vyMetersPerSecond, @@ -247,9 +209,7 @@ public class ChassisSpeeds implements ProtobufSerializable, StructSerializable { * considered to be zero when it is facing directly away from your alliance station wall. * Remember that this should be CCW positive. * @return ChassisSpeeds object representing the speeds in the robot's frame of reference. - * @deprecated Use toRobotRelativeSpeeds instead. */ - @Deprecated(forRemoval = true, since = "2025") public static ChassisSpeeds fromFieldRelativeSpeeds( LinearVelocity vx, LinearVelocity vy, AngularVelocity omega, Rotation2d robotAngle) { return fromFieldRelativeSpeeds( @@ -267,9 +227,7 @@ public class ChassisSpeeds implements ProtobufSerializable, StructSerializable { * considered to be zero when it is facing directly away from your alliance station wall. * Remember that this should be CCW positive. * @return ChassisSpeeds object representing the speeds in the robot's frame of reference. - * @deprecated Use toRobotRelativeSpeeds instead. */ - @Deprecated(forRemoval = true, since = "2025") public static ChassisSpeeds fromFieldRelativeSpeeds( ChassisSpeeds fieldRelativeSpeeds, Rotation2d robotAngle) { return fromFieldRelativeSpeeds( @@ -279,21 +237,6 @@ public class ChassisSpeeds implements ProtobufSerializable, StructSerializable { robotAngle); } - /** - * Converts this field-relative set of speeds into a robot-relative ChassisSpeeds object. - * - * @param robotAngle The angle of the robot as measured by a gyroscope. The robot's angle is - * considered to be zero when it is facing directly away from your alliance station wall. - * Remember that this should be CCW positive. - */ - public void toRobotRelativeSpeeds(Rotation2d robotAngle) { - // CW rotation into chassis frame - var rotated = - new Translation2d(vxMetersPerSecond, vyMetersPerSecond).rotateBy(robotAngle.unaryMinus()); - vxMetersPerSecond = rotated.getX(); - vyMetersPerSecond = rotated.getY(); - } - /** * Converts a user provided robot-relative set of speeds into a field-relative ChassisSpeeds * object. @@ -307,9 +250,7 @@ public class ChassisSpeeds implements ProtobufSerializable, StructSerializable { * considered to be zero when it is facing directly away from your alliance station wall. * Remember that this should be CCW positive. * @return ChassisSpeeds object representing the speeds in the field's frame of reference. - * @deprecated Use toFieldRelativeSpeeds instead. */ - @Deprecated(forRemoval = true, since = "2025") public static ChassisSpeeds fromRobotRelativeSpeeds( double vxMetersPerSecond, double vyMetersPerSecond, @@ -333,9 +274,7 @@ public class ChassisSpeeds implements ProtobufSerializable, StructSerializable { * considered to be zero when it is facing directly away from your alliance station wall. * Remember that this should be CCW positive. * @return ChassisSpeeds object representing the speeds in the field's frame of reference. - * @deprecated Use toFieldRelativeSpeeds instead. */ - @Deprecated(forRemoval = true, since = "2025") public static ChassisSpeeds fromRobotRelativeSpeeds( LinearVelocity vx, LinearVelocity vy, AngularVelocity omega, Rotation2d robotAngle) { return fromRobotRelativeSpeeds( @@ -353,9 +292,7 @@ public class ChassisSpeeds implements ProtobufSerializable, StructSerializable { * considered to be zero when it is facing directly away from your alliance station wall. * Remember that this should be CCW positive. * @return ChassisSpeeds object representing the speeds in the field's frame of reference. - * @deprecated Use toFieldRelativeSpeeds instead. */ - @Deprecated(forRemoval = true, since = "2025") public static ChassisSpeeds fromRobotRelativeSpeeds( ChassisSpeeds robotRelativeSpeeds, Rotation2d robotAngle) { return fromRobotRelativeSpeeds( @@ -365,20 +302,6 @@ public class ChassisSpeeds implements ProtobufSerializable, StructSerializable { robotAngle); } - /** - * Converts this robot-relative set of speeds into a field-relative ChassisSpeeds object. - * - * @param robotAngle The angle of the robot as measured by a gyroscope. The robot's angle is - * considered to be zero when it is facing directly away from your alliance station wall. - * Remember that this should be CCW positive. - */ - public void toFieldRelativeSpeeds(Rotation2d robotAngle) { - // CCW rotation out of chassis frame - var rotated = new Translation2d(vxMetersPerSecond, vyMetersPerSecond).rotateBy(robotAngle); - vxMetersPerSecond = rotated.getX(); - vyMetersPerSecond = rotated.getY(); - } - /** * Adds two ChassisSpeeds and returns the sum. * diff --git a/wpimath/src/test/java/edu/wpi/first/math/kinematics/ChassisSpeedsTest.java b/wpimath/src/test/java/edu/wpi/first/math/kinematics/ChassisSpeedsTest.java index 5ed2e7f22a..8f7bb6fd12 100644 --- a/wpimath/src/test/java/edu/wpi/first/math/kinematics/ChassisSpeedsTest.java +++ b/wpimath/src/test/java/edu/wpi/first/math/kinematics/ChassisSpeedsTest.java @@ -20,11 +20,10 @@ class ChassisSpeedsTest { @Test void testDiscretize() { final var target = new ChassisSpeeds(1.0, 0.0, 0.5); - final var speeds = new ChassisSpeeds(1.0, 0.0, 0.5); final var duration = 1.0; final var dt = 0.01; - speeds.discretize(duration); + final var speeds = ChassisSpeeds.discretize(target, duration); final var twist = new Twist2d( speeds.vxMetersPerSecond * dt, @@ -62,8 +61,8 @@ class ChassisSpeedsTest { @Test void testFromFieldRelativeSpeeds() { - final var chassisSpeeds = new ChassisSpeeds(1.0, 0.0, 0.5); - chassisSpeeds.toRobotRelativeSpeeds(Rotation2d.kCW_Pi_2); + final var chassisSpeeds = + ChassisSpeeds.fromFieldRelativeSpeeds(1.0, 0.0, 0.5, Rotation2d.kCW_Pi_2); assertAll( () -> assertEquals(0.0, chassisSpeeds.vxMetersPerSecond, kEpsilon), @@ -73,8 +72,8 @@ class ChassisSpeedsTest { @Test void testFromRobotRelativeSpeeds() { - final var chassisSpeeds = new ChassisSpeeds(1.0, 0.0, 0.5); - chassisSpeeds.toFieldRelativeSpeeds(Rotation2d.fromDegrees(45.0)); + final var chassisSpeeds = + ChassisSpeeds.fromRobotRelativeSpeeds(1.0, 0.0, 0.5, Rotation2d.fromDegrees(45.0)); assertAll( () -> assertEquals(1.0 / Math.sqrt(2.0), chassisSpeeds.vxMetersPerSecond, kEpsilon),