mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[wpimath] Move SlewRateLimiter from wpilib to wpimath (#3399)
Timer was replaced with wpi::Now() to avoid a dependency on other wpilib classes.
This commit is contained in:
@@ -1,26 +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.wpilibj;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class SlewRateLimiterTest {
|
||||
@Test
|
||||
void slewRateLimitTest() {
|
||||
SlewRateLimiter limiter = new SlewRateLimiter(1);
|
||||
Timer.delay(1);
|
||||
assertTrue(limiter.calculate(2) < 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
void slewRateNoLimitTest() {
|
||||
SlewRateLimiter limiter = new SlewRateLimiter(1);
|
||||
Timer.delay(1);
|
||||
assertEquals(limiter.calculate(0.5), 0.5);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user