MCPcopy Create free account
hub / github.com/Simple-Robotics/Simple / test_simulator_handles

Function test_simulator_handles

tests/python/test_simulator_instance.py:90–125  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

88
89
90def test_simulator_handles():
91 model = pin.Model()
92 geom_model = pin.GeometryModel()
93 data = model.createData()
94 geom_data = geom_model.createData()
95
96 sim = simple.Simulator(model, data, geom_model, geom_data)
97
98 model2 = pin.buildSampleModelHumanoid()
99 model2.lowerPositionLimit = -np.ones((model2.nq, 1))
100 model2.upperPositionLimit = np.ones((model2.nq, 1))
101 geom_model2 = pin.buildSampleGeometryModelHumanoid(model2)
102 data2 = model2.createData()
103 geom_data2 = geom_model2.createData()
104 sim = simple.Simulator(model2, data2, geom_model2, geom_data2)
105 q = pin.randomConfiguration(model2)
106 pin.updateGeometryPlacements(sim.model, sim.data, sim.geom_model, sim.geom_data, q)
107
108 assert sim.model == model2
109 assert not (sim.model == model)
110 assert sim.geom_model == geom_model2
111 assert not (sim.geom_model == geom_model)
112 assert sim.geom_data == geom_data2
113 assert not (sim.geom_data == geom_data)
114
115 model3 = model2.copy()
116 freeflyer = pin.JointModelFreeFlyer()
117 joint = model2.addJoint(0, freeflyer, pin.SE3.Identity(), "ball_0")
118 assert sim.model.njoints == model3.njoints + 1
119 gemo_model3 = geom_model2.copy()
120 ball_shape = Sphere(0.1 / 2)
121 geom_ball = pin.GeometryObject(
122 "ball_0", joint, joint, pin.SE3.Identity(), ball_shape
123 )
124 ball_id = geom_model2.addGeometryObject(geom_ball)
125 assert sim.geom_model.ngeoms == gemo_model3.ngeoms + 1
126
127
128def test_init_empty():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected