Skip to content

Commit 3d1e842

Browse files
committed
Merge pull request #227 from personalrobotics/bugfix/trajopt_tests
Fixed Trajopt tests
2 parents 3b8b2b7 + dd39438 commit 3d1e842

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

tests/planning/methods/PlanToConfiguration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_PlanToConfiguration_StraightLineIsFeasible_FindsSolution(self):
8686
class PlanToConfigurationCompleteTest(object):
8787
def test_PlanToConfiguration_GoalIsFeasible_FindsSolution(self):
8888
self.PlanFromStartToGoalConfiguration(
89-
self.config_feasible_start, self.config_feasible_goal)
89+
self.config_feasible_start2, self.config_feasible_goal)
9090

9191

9292
class PlanToConfigurationTestCollisionTest(object):

tests/planning/methods/PlanToEndEffectorPose.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def test_PlanToEndEffectorPose_GoalIsFeasible_FindsSolution(self):
1010
self.robot.SetActiveDOFValues(self.config_feasible_goal)
1111
goal_ik = self.manipulator.GetEndEffectorTransform()
1212

13-
self.robot.SetActiveDOFValues(self.config_feasible_start)
13+
self.robot.SetActiveDOFValues(self.config_feasible_start2)
1414

1515
# Test
1616
path = self.planner.PlanToEndEffectorPose(self.robot, goal_ik)
@@ -19,7 +19,7 @@ def test_PlanToEndEffectorPose_GoalIsFeasible_FindsSolution(self):
1919
self.ValidatePath(path)
2020

2121
first_waypoint = path.GetWaypoint(0)
22-
assert_allclose(first_waypoint, self.config_feasible_start)
22+
assert_allclose(first_waypoint, self.config_feasible_start2)
2323

2424
with self.env:
2525
last_waypoint = path.GetWaypoint(path.GetNumWaypoints() - 1)

tests/planning/planning_helpers.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ class BasePlannerTest(object):
1010
+2.35061574, 0.61043555, 0.85000000, 1.80684444, -0.08639935,
1111
-0.69750474, 1.31656172
1212
])
13+
14+
# This configuration is easier for Trajopt (and harder for most other
15+
# planners) because teh pole introduces a local minimum (maybe?).
16+
config_feasible_start2 = numpy.array([
17+
-2.61799387, 0.66440338, 0.19853743, 2.00944286, -0.08639925,
18+
-0.69750467, 1.31656153
19+
])
20+
21+
1322
config_feasible_goal = numpy.array([
1423
-0.84085883, 1.44573701, 0.20000000, 1.72620231, -0.81124757,
1524
-1.39363597, 1.29233111

tests/planning/test_TrajoptPlanner.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
PlanToConfigurationStraightLineTest,
44
PlanToEndEffectorPoseTest,
55
)
6-
from methods.PlanToConfiguration import PlanToConfigurationTestCollisionTest
6+
from methods.PlanToConfiguration import (
7+
PlanToConfigurationTestCollisionTest,
8+
PlanToConfigurationCompleteTest,
9+
)
710
from planning_helpers import BasePlannerTest
811
from unittest import TestCase
912
from or_trajopt import TrajoptPlanner
@@ -12,7 +15,9 @@
1215
class TrajoptPlannerTest(BasePlannerTest,
1316
PlanToConfigurationTest,
1417
PlanToEndEffectorPoseTest,
18+
PlanToConfigurationCompleteTest,
1519
PlanToConfigurationTestCollisionTest,
20+
PlanToConfigurationStraightLineTest,
1621
TestCase):
1722
planner_factory = TrajoptPlanner
1823

0 commit comments

Comments
 (0)