@@ -182,6 +182,15 @@ def test_fk_simple_arm():
182
182
assert list (tg .get_matrix ().shape ) == [N , 4 , 4 ]
183
183
184
184
185
+ def test_sdf_serial_chain ():
186
+ chain = pk .build_serial_chain_from_sdf (open (os .path .join (TEST_DIR , "simple_arm.sdf" )).read (), 'arm_wrist_roll' )
187
+ chain = chain .to (dtype = torch .float64 )
188
+ tg = chain .forward_kinematics ([0. , math .pi / 2.0 , - 0.5 , 0. ])
189
+ pos , rot = quat_pos_from_transform3d (tg )
190
+ assert quaternion_equality (rot , torch .tensor ([0.70710678 , 0. , 0. , 0.70710678 ], dtype = torch .float64 ))
191
+ assert torch .allclose (pos , torch .tensor ([1.05 , 0.55 , 0.5 ], dtype = torch .float64 ))
192
+
193
+
185
194
def test_cuda ():
186
195
if torch .cuda .is_available ():
187
196
d = "cuda"
@@ -197,9 +206,9 @@ def test_cuda():
197
206
198
207
ret = chain .forward_kinematics ({
199
208
'arm_shoulder_pan_joint' : 0 ,
200
- 'arm_elbow_pan_joint' : math .pi / 2.0 ,
201
- 'arm_wrist_lift_joint' : - 0.5 ,
202
- 'arm_wrist_roll_joint' : 0 ,
209
+ 'arm_elbow_pan_joint' : math .pi / 2.0 ,
210
+ 'arm_wrist_lift_joint' : - 0.5 ,
211
+ 'arm_wrist_roll_joint' : 0 ,
203
212
})
204
213
tg = ret ['arm_wrist_roll' ]
205
214
pos , rot = quat_pos_from_transform3d (tg )
0 commit comments