File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -762,7 +762,8 @@ def IsTimedTrajectory(trajectory):
762
762
@returns: True if the trajectory is timed, False otherwise
763
763
"""
764
764
cspec = trajectory .GetConfigurationSpecification ()
765
- return cspec .ExtractDeltaTime (trajectory .GetWaypoint (0 )) is not None
765
+ empty_waypoint = numpy .zeros (cspec .GetDOF ())
766
+ return cspec .ExtractDeltaTime (empty_waypoint ) is not None
766
767
767
768
def ComputeEnabledAABB (kinbody ):
768
769
"""
Original file line number Diff line number Diff line change
1
+ import openravepy
2
+ import prpy .util
3
+ import unittest
4
+
5
+ class IsTimedTrajectoryTests (unittest .TestCase ):
6
+ def setUp (self ):
7
+ self .env = openravepy .Environment ()
8
+ self .traj = openravepy .RaveCreateTrajectory (self .env , '' )
9
+
10
+ def test_IsTimed_ReturnsTrue (self ):
11
+ cspec = openravepy .ConfigurationSpecification ()
12
+ cspec .AddDeltaTimeGroup ()
13
+
14
+ self .traj .Init (cspec )
15
+ self .assertTrue (prpy .util .IsTimedTrajectory (self .traj ))
16
+
17
+ self .traj .Insert (0 , [0. ])
18
+ self .assertTrue (prpy .util .IsTimedTrajectory (self .traj ))
19
+
20
+ def test_IsNotTimed_ReturnsFalse (self ):
21
+ cspec = openravepy .ConfigurationSpecification ()
22
+ cspec .AddGroup ('joint_values test_robot 0' , 1 , 'linear' )
23
+
24
+ self .traj .Init (cspec )
25
+ self .assertFalse (prpy .util .IsTimedTrajectory (self .traj ))
26
+
27
+ self .traj .Insert (0 , [0. ])
28
+ self .assertFalse (prpy .util .IsTimedTrajectory (self .traj ))
You can’t perform that action at this time.
0 commit comments