Skip to content

Commit 6a4e8e9

Browse files
committed
more tests
1 parent 666fd06 commit 6a4e8e9

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

tests/test_inverse_kinematics.py

+8-10
Original file line numberDiff line numberDiff line change
@@ -170,24 +170,19 @@ def test_jacobian_follower(robot="kuka_iiwa"):
170170
p.stepSimulation()
171171

172172

173-
def test_ik_in_place_no_err():
173+
def test_ik_in_place_no_err(robot="kuka_iiwa"):
174174
pytorch_seed.seed(2)
175175
device = "cuda" if torch.cuda.is_available() else "cpu"
176176
# device = "cpu"
177-
urdf = "kuka_iiwa/model.urdf"
178-
search_path = pybullet_data.getDataPath()
179-
full_urdf = os.path.join(search_path, urdf)
180-
chain = pk.build_serial_chain_from_urdf(open(full_urdf).read(), "lbr_iiwa_link_7")
181-
chain = chain.to(device=device)
182-
177+
chain, urdf = create_test_chain(robot=robot, device=device)
183178
# robot frame
184179
pos = torch.tensor([0.0, 0.0, 0.0], device=device)
185180
rot = torch.tensor([0.0, 0.0, 0.0], device=device)
186181
rob_tf = pk.Transform3d(pos=pos, rot=rot, device=device)
187182

188183
# goal equal to current configuration
189184
lim = torch.tensor(chain.get_joint_limits(), device=device)
190-
cur_q = torch.rand(7, device=device) * (lim[1] - lim[0]) + lim[0]
185+
cur_q = torch.rand(lim.shape[1], device=device) * (lim[1] - lim[0]) + lim[0]
191186
M = 1
192187
goal_q = cur_q.unsqueeze(0).repeat(M, 1)
193188

@@ -220,6 +215,9 @@ def test_ik_in_place_no_err():
220215

221216

222217
if __name__ == "__main__":
223-
# test_jacobian_follower(robot="kuka_iiwa")
218+
print("Testing kuka_iiwa IK")
219+
test_jacobian_follower(robot="kuka_iiwa")
220+
test_ik_in_place_no_err(robot="kuka_iiwa")
221+
print("Testing widowx IK")
224222
test_jacobian_follower(robot="widowx")
225-
test_ik_in_place_no_err()
223+
test_ik_in_place_no_err(robot="widowx")

0 commit comments

Comments
 (0)