Skip to content

Commit cf7406e

Browse files
committed
typing and formatting for unit test
1 parent 7cf94ef commit cf7406e

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

tests/test_rigid_physics.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2177,20 +2177,32 @@ def test_terrain_size(show_viewer, tol):
21772177
def test_jacobian(gs_sim, tol):
21782178
pendulum = gs_sim.entities[0]
21792179
angle = 0.7
2180-
pendulum.set_qpos(np.array([angle], dtype=np.float64))
2180+
pendulum.set_qpos(np.array([angle], dtype=gs.np_float))
21812181
gs_sim.scene.step()
21822182

21832183
link = pendulum.get_link("PendulumArm_0")
21842184

2185-
p_local = np.array([0.05, -0.02, 0.12], dtype=np.float64)
2186-
J_o = pendulum.get_jacobian(link).cpu().numpy()
2187-
J_p = pendulum.get_jacobian(link, p_local).cpu().numpy()
2185+
p_local = np.array([0.05, -0.02, 0.12], dtype=gs.np_float)
2186+
J_o = tensor_to_array(pendulum.get_jacobian(link))
2187+
J_p = tensor_to_array(pendulum.get_jacobian(link, p_local))
21882188

21892189
c, s = np.cos(angle), np.sin(angle)
2190-
Rx = np.array([[1, 0, 0], [0, c, -s], [0, s, c]], dtype=np.float64)
2190+
Rx = np.array(
2191+
[
2192+
[1, 0, 0],
2193+
[0, c, -s],
2194+
[0, s, c],
2195+
],
2196+
dtype=gs.np_float,
2197+
)
21912198
r_world = Rx @ p_local
21922199
r_cross = np.array(
2193-
[[0, -r_world[2], r_world[1]], [r_world[2], 0, -r_world[0]], [-r_world[1], r_world[0], 0]], dtype=np.float64
2200+
[
2201+
[0, -r_world[2], r_world[1]],
2202+
[r_world[2], 0, -r_world[0]],
2203+
[-r_world[1], r_world[0], 0],
2204+
],
2205+
dtype=gs.np_float,
21942206
)
21952207

21962208
lin_o, ang_o = J_o[:3, 0], J_o[3:, 0]

0 commit comments

Comments
 (0)