1
- from wpimath .trajectory import TrajectoryGenerator , TrajectoryParameterizer
2
- from wpimath .geometry import Pose2d , Transform2d
3
- import wpimath .trajectory
4
- import wpimath .trajectory .constraint
5
- from wpimath .spline import CubicHermiteSpline , SplineHelper
6
-
7
- from wpimath .geometry import Ellipse2d , Pose2d , Rectangle2d , Rotation2d , Translation2d
8
-
9
- from wpimath .trajectory import Trajectory , TrajectoryConfig
1
+ import math
10
2
3
+ from wpimath .geometry import (
4
+ Ellipse2d ,
5
+ Pose2d ,
6
+ Rectangle2d ,
7
+ Rotation2d ,
8
+ Transform2d ,
9
+ Translation2d ,
10
+ )
11
+ from wpimath .spline import CubicHermiteSpline , SplineHelper
12
+ from wpimath .trajectory import (
13
+ Trajectory ,
14
+ TrajectoryConfig ,
15
+ TrajectoryGenerator ,
16
+ TrajectoryParameterizer ,
17
+ )
11
18
from wpimath .trajectory .constraint import (
12
- MaxVelocityConstraint ,
13
19
EllipticalRegionConstraint ,
20
+ MaxVelocityConstraint ,
14
21
RectangularRegionConstraint ,
22
+ TrajectoryConstraint ,
15
23
)
16
24
17
- import math
18
- import typing
19
-
20
25
21
26
def getTestTrajectory (config : TrajectoryConfig ) -> Trajectory :
22
27
# 2018 cross scale auto waypoints
@@ -100,6 +105,22 @@ def test_rectangular_region_constraint():
100
105
assert exceededConstraintOutsideRegion
101
106
102
107
108
+ #
109
+ # TrajectoryConstraint
110
+ #
111
+
112
+
113
+ def test_trajectory_constraint_min_max ():
114
+ min_max = TrajectoryConstraint .MinMax ()
115
+ _ , _ = min_max
116
+
117
+ min_max = TrajectoryConstraint .MinMax (minAcceleration = 0 , maxAcceleration = 1 )
118
+ assert (
119
+ repr (min_max )
120
+ == "TrajectoryConstraint.MinMax(minAcceleration=0.0, maxAcceleration=1.0)"
121
+ )
122
+
123
+
103
124
#
104
125
# TrajectoryParameterizer
105
126
#
@@ -114,7 +135,7 @@ def test_trajectory_parameterizer():
114
135
spline = CubicHermiteSpline (vec1 .x , vec2 .x , vec1 .y , vec2 .y )
115
136
116
137
# sample the pose and curvature along the spline
117
- points : typing . Tuple [ Pose2d , float ] = []
138
+ points : list [ tuple [ Pose2d , float ] ] = []
118
139
for i in range (100 ):
119
140
points .append (spline .getPoint (i / 100 ))
120
141
0 commit comments