@@ -218,7 +218,6 @@ def parse_urdf(morph, surface):
218218 j_info ["n_qs" ] = 1
219219 j_info ["n_dofs" ] = 1
220220 j_info ["init_qpos" ] = np .zeros (1 )
221-
222221 elif joint .joint_type == "continuous" :
223222 j_info ["dofs_motion_ang" ] = np .array ([joint .axis ])
224223 j_info ["dofs_motion_vel" ] = np .zeros ((1 , 3 ))
@@ -229,7 +228,6 @@ def parse_urdf(morph, surface):
229228 j_info ["n_qs" ] = 1
230229 j_info ["n_dofs" ] = 1
231230 j_info ["init_qpos" ] = np .zeros (1 )
232-
233231 elif joint .joint_type == "prismatic" :
234232 j_info ["dofs_motion_ang" ] = np .zeros ((1 , 3 ))
235233 j_info ["dofs_motion_vel" ] = np .array ([joint .axis ])
@@ -247,7 +245,6 @@ def parse_urdf(morph, surface):
247245 j_info ["n_qs" ] = 1
248246 j_info ["n_dofs" ] = 1
249247 j_info ["init_qpos" ] = np .zeros (1 )
250-
251248 elif joint .joint_type == "floating" :
252249 j_info ["dofs_motion_ang" ] = np .eye (6 , 3 , - 3 )
253250 j_info ["dofs_motion_vel" ] = np .eye (6 , 3 )
@@ -258,28 +255,30 @@ def parse_urdf(morph, surface):
258255 j_info ["n_qs" ] = 7
259256 j_info ["n_dofs" ] = 6
260257 j_info ["init_qpos" ] = np .concatenate ([gu .zero_pos (), gu .identity_quat ()])
261-
262258 else :
263259 gs .raise_exception (f"Unsupported URDF joint type: { joint .joint_type } " )
264260
265- j_info ["dofs_invweight" ] = np .full ((j_info ["n_dofs" ],), fill_value = - 1.0 )
266- j_info ["dofs_frictionloss" ] = np .zeros (j_info ["n_dofs" ])
267261 j_info ["sol_params" ] = gu .default_solver_params ()
268- j_info ["dofs_kp" ] = gu .default_dofs_kp (j_info ["n_dofs" ])
269- j_info ["dofs_kv" ] = gu .default_dofs_kv (j_info ["n_dofs" ])
270- j_info ["dofs_force_range" ] = np .tile ([- np .inf , np .inf ], (j_info ["n_dofs" ], 1 ))
262+ j_info ["dofs_invweight" ] = np .full ((j_info ["n_dofs" ],), fill_value = - 1.0 )
271263
272- j_info ["dofs_damping" ] = np .zeros (j_info ["n_dofs" ])
264+ joint_friction , joint_damping = 0.0 , 0.0
265+ if joint .dynamics is not None :
266+ joint_friction , joint_damping = joint .dynamics .friction , joint .dynamics .damping
267+ j_info ["dofs_frictionloss" ] = np .full (j_info ["n_dofs" ], joint_friction )
268+ j_info ["dofs_damping" ] = np .full (j_info ["n_dofs" ], joint_damping )
273269 j_info ["dofs_armature" ] = np .zeros (j_info ["n_dofs" ])
274270 if joint .joint_type not in ("floating" , "fixed" ) and morph .default_armature is not None :
275271 j_info ["dofs_armature" ] = np .full ((j_info ["n_dofs" ],), morph .default_armature )
276272
273+ j_info ["dofs_kp" ] = gu .default_dofs_kp (j_info ["n_dofs" ])
274+ j_info ["dofs_kv" ] = gu .default_dofs_kv (j_info ["n_dofs" ])
277275 if joint .safety_controller is not None :
278276 if joint .safety_controller .k_position is not None :
279277 j_info ["dofs_kp" ] = np .tile (joint .safety_controller .k_position , j_info ["n_dofs" ])
280278 if joint .safety_controller .k_velocity is not None :
281279 j_info ["dofs_kv" ] = np .tile (joint .safety_controller .k_velocity , j_info ["n_dofs" ])
282280
281+ j_info ["dofs_force_range" ] = np .tile ([- np .inf , np .inf ], (j_info ["n_dofs" ], 1 ))
283282 if joint .limit is not None and joint .limit .effort is not None :
284283 j_info ["dofs_force_range" ] = np .tile ([- joint .limit .effort , joint .limit .effort ], (j_info ["n_dofs" ], 1 ))
285284
0 commit comments