@@ -33,9 +33,7 @@ def setUp(self):
3333 self .robot = pin .RobotWrapper .BuildFromURDF (
3434 urdf_path , package_dirs = [os .path .dirname (REPOSITORY_PATH )]
3535 )
36-
3736 self .non_colliding_objects_pair_id = 5
38- self .colliding_objects_pair_id = 24 # Between second and third bodies
3937 self .q0 = np .zeros (self .robot .model .nq )
4038 self .robot .collision_data = process_collision_pairs (
4139 self .robot .model , self .robot .collision_model
@@ -126,8 +124,20 @@ def test_negative_when_out_of_safety_zone(self):
126124 n_collision_pairs = len (self .robot .collision_model .collisionPairs ),
127125 d_min = 0.02 ,
128126 )
129- h = barrier .compute_barrier (self .configuration )
130- self .assertTrue (np .all (h [self .colliding_objects_pair_id ] < 0 ))
127+ # See https://github.com/stephane-caron/pink/pull/129 for an
128+ # illustration of this test configuration
129+ q_test = np .zeros (self .robot .model .nq )
130+ q_test [1 ] = 2.0
131+ q_test [3 ] = - 2.5
132+ configuration = Configuration (
133+ self .robot .model ,
134+ self .robot .data ,
135+ q_test ,
136+ collision_model = self .robot .collision_model ,
137+ collision_data = self .robot .collision_data ,
138+ )
139+ h = barrier .compute_barrier (configuration )
140+ self .assertTrue (np .min (h ) < 0 ) # we know there is a collision
131141
132142 def test_closest_collision_pairs (self ):
133143 """Test that the closest collision pairs are considered if number of
0 commit comments