mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-04 03:11:43 +00:00
Merge branch 'main' into 2027
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -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<MecanumDriveMotorVoltages, ProtobufMecanumDriveMotorVoltages> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -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<MecanumDriveMotorVoltages> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user