Skip to content

Commit d5efb7c

Browse files
committed
[tests/python] change instances of "hppfcl" to "coal"
+ use pin.buildSampleGeometryModelHumanoid() + rename test_FrameCollisionResidual_no_collision_pairs() to test_frame_collision_no_collision_pairs() + remove unused local vars
1 parent 5ff68cd commit d5efb7c

File tree

1 file changed

+8
-37
lines changed

1 file changed

+8
-37
lines changed

tests/python/test_frames.py

+8-37
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212

1313
model = pin.buildSampleModelHumanoid()
14+
geometry = pin.buildSampleGeometryModelHumanoid(model)
1415
rdata: pin.Data = model.createData()
1516
SEED = 0
1617
np.random.seed(SEED)
@@ -193,7 +194,7 @@ def test_fly_high():
193194

194195

195196
def test_frame_collision():
196-
import hppfcl
197+
import coal
197198

198199
fr_name1 = "larm_shoulder2_body"
199200
fr_id1 = model.getFrameId(fr_name1)
@@ -210,16 +211,15 @@ def test_frame_collision():
210211
gamma = np.random.rand()
211212
delta = np.random.rand()
212213

213-
geometry = pin.GeometryModel()
214214
ig_frame = geometry.addGeometryObject(
215215
pin.GeometryObject(
216-
"frame", fr_id1, joint_id, hppfcl.Capsule(alpha, gamma), frame_SE3
216+
"frame", fr_id1, joint_id, coal.Capsule(alpha, gamma), frame_SE3
217217
)
218218
)
219219

220220
ig_frame2 = geometry.addGeometryObject(
221221
pin.GeometryObject(
222-
"frame2", fr_id2, joint_id2, hppfcl.Capsule(beta, delta), frame_SE3_bis
222+
"frame2", fr_id2, joint_id2, coal.Capsule(beta, delta), frame_SE3_bis
223223
)
224224
)
225225
geometry.addCollisionPair(pin.CollisionPair(ig_frame, ig_frame2))
@@ -265,47 +265,18 @@ def test_frame_collision():
265265
assert np.allclose(fdata.Jx, fdata2.Jx, atol=ATOL)
266266

267267

268-
def test_FrameCollisionResidual_no_collision_pairs():
269-
import hppfcl
270-
271-
fr_name1 = "larm_shoulder2_body"
272-
fr_id1 = model.getFrameId(fr_name1)
273-
joint_id = model.frames[fr_id1].parentJoint
274-
275-
fr_name2 = "rleg_elbow_body"
276-
fr_id2 = model.getFrameId(fr_name2)
277-
joint_id2 = model.frames[fr_id2].parentJoint
278-
279-
frame_SE3 = pin.SE3.Random()
280-
frame_SE3_bis = pin.SE3.Random()
281-
alpha = np.random.rand()
282-
beta = np.random.rand()
283-
gamma = np.random.rand()
284-
delta = np.random.rand()
285-
286-
geometry = pin.GeometryModel()
287-
ig_frame = geometry.addGeometryObject(
288-
pin.GeometryObject(
289-
"frame", fr_id1, joint_id, hppfcl.Capsule(alpha, gamma), frame_SE3
290-
)
291-
)
292-
293-
ig_frame2 = geometry.addGeometryObject(
294-
pin.GeometryObject(
295-
"frame2", fr_id2, joint_id2, hppfcl.Capsule(beta, delta), frame_SE3_bis
296-
)
297-
)
298-
268+
def test_frame_collision_no_collision_pairs():
299269
space = manifolds.MultibodyConfiguration(model)
300270
ndx = space.ndx
301271
x0 = space.neutral()
302272
d = np.random.randn(space.ndx) * 0.1
303273
d[6:] = 0.0
304274
x0 = space.integrate(x0, d)
305-
u0 = np.zeros(nu)
306-
q0 = x0[:nq]
307275

308276
fun = aligator.FrameCollisionResidual(ndx, nu, model, geometry, 0)
277+
data = fun.createData()
278+
fun.evaluate(x0, data)
279+
fun.computeJacobians(x0, data)
309280

310281

311282
if __name__ == "__main__":

0 commit comments

Comments
 (0)