forked from Team254/FRC-2019-Public
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMotionProfileConstraints.java
37 lines (32 loc) · 1.02 KB
/
MotionProfileConstraints.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.team254.lib.motion;
/**
* Constraints for constructing a MotionProfile.
*/
public class MotionProfileConstraints {
protected double max_abs_vel = Double.POSITIVE_INFINITY;
protected double max_abs_acc = Double.POSITIVE_INFINITY;
public MotionProfileConstraints(double max_vel, double max_acc) {
this.max_abs_vel = Math.abs(max_vel);
this.max_abs_acc = Math.abs(max_acc);
}
/**
* @return The (positive) maximum allowed velocity.
*/
public double max_abs_vel() {
return max_abs_vel;
}
/**
* @return The (positive) maximum allowed acceleration.
*/
public double max_abs_acc() {
return max_abs_acc;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof MotionProfileConstraints)) {
return false;
}
final MotionProfileConstraints other = (MotionProfileConstraints) obj;
return (other.max_abs_acc() == max_abs_acc()) && (other.max_abs_vel() == max_abs_vel());
}
}