test_ompl_solver_bounds.py
Go to the documentation of this file.
1 import unittest
2 
3 import pyexotica as exo
4 
5 class OMPLLockedBoundsCase(unittest.TestCase):
6 
7  def test_lock_bounds(self):
8  # self.assertTrue(True)
9  ompl = exo.Setup.load_solver('{exotica_examples}/resources/configs/example_manipulate_ompl.xml')
10 
11  # set start and goal state
12  ompl.get_problem().start_state = [1.5035205538438838, 0.8730168650583787, -1.6298590879018438, 1.7106630821349438, -0.8789956712153559, 0.1278222471656531, 0.0]
13  ompl.get_problem().goal_state = [-1.5035205538442702, 0.8730168650583671, 1.6298590879018415, 1.7106630821349786, 0.8789956712153525, 0.12782224716566898, 0.0]
14 
15  # 1st solve call
16  solution = None
17  try:
18  solution = ompl.solve()
19  except Exception:
20  pass
21  self.assertTrue(solution is not None)
22 
23  # 2nd solve call
24  solution = None
25  try:
26  solution = ompl.solve()
27  except Exception:
28  pass
29  self.assertTrue(solution is not None)
30 
31  # get and change current bounds
32  jl = ompl.get_problem().get_scene().get_kinematic_tree().get_joint_limits()
33  jl[0] += 1
34  ompl.get_problem().get_scene().get_kinematic_tree().set_joint_limits_lower(jl[:,0])
35  ompl.get_problem().get_scene().get_kinematic_tree().set_joint_limits_upper(jl[:,1])
36 
37  # 3rd call with changed bounds
38  solution = None
39  failed = False
40  try:
41  solution = ompl.solve()
42  except Exception:
43  failed = True
44  pass
45  # the solve call with changed bounds should throw an exception
46  self.assertTrue(failed)
47  # ... and there should be no solution
48  self.assertTrue(solution is None)
49 


exotica_examples
Author(s):
autogenerated on Sat Apr 10 2021 02:37:17