@@ -170,24 +170,19 @@ def test_jacobian_follower(robot="kuka_iiwa"):
170
170
p .stepSimulation ()
171
171
172
172
173
- def test_ik_in_place_no_err ():
173
+ def test_ik_in_place_no_err (robot = "kuka_iiwa" ):
174
174
pytorch_seed .seed (2 )
175
175
device = "cuda" if torch .cuda .is_available () else "cpu"
176
176
# 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 )
183
178
# robot frame
184
179
pos = torch .tensor ([0.0 , 0.0 , 0.0 ], device = device )
185
180
rot = torch .tensor ([0.0 , 0.0 , 0.0 ], device = device )
186
181
rob_tf = pk .Transform3d (pos = pos , rot = rot , device = device )
187
182
188
183
# goal equal to current configuration
189
184
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 ]
191
186
M = 1
192
187
goal_q = cur_q .unsqueeze (0 ).repeat (M , 1 )
193
188
@@ -220,6 +215,9 @@ def test_ik_in_place_no_err():
220
215
221
216
222
217
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" )
224
222
test_jacobian_follower (robot = "widowx" )
225
- test_ik_in_place_no_err ()
223
+ test_ik_in_place_no_err (robot = "widowx" )
0 commit comments