@@ -2095,7 +2095,7 @@ def _apply_vectorized_enviornment_force(self):
2095
2095
frozenset ({entity_a .name , entity_b .name }), None
2096
2096
)
2097
2097
if joint is not None :
2098
- joints .append (( entity_a , entity_b , joint ) )
2098
+ joints .append (joint )
2099
2099
if joint .dist == 0 :
2100
2100
continue
2101
2101
if not self .collides (entity_a , entity_b ):
@@ -2187,7 +2187,9 @@ def _vectorized_joint_constraints(self, joints):
2187
2187
rot_a = []
2188
2188
rot_b = []
2189
2189
joint_rot = []
2190
- for entity_a , entity_b , joint in joints :
2190
+ for joint in joints :
2191
+ entity_a = joint .entity_a
2192
+ entity_b = joint .entity_b
2191
2193
pos_joint_a .append (joint .pos_point (entity_a ))
2192
2194
pos_joint_b .append (joint .pos_point (entity_b ))
2193
2195
pos_a .append (entity_a .state .pos )
@@ -2257,12 +2259,12 @@ def _vectorized_joint_constraints(self, joints):
2257
2259
rotate , torque_b_rotate , torque_b_rotate + torque_b_fixed
2258
2260
)
2259
2261
2260
- for i , ( entity_a , entity_b , _ ) in enumerate (joints ):
2262
+ for i , joint in enumerate (joints ):
2261
2263
self .update_env_forces (
2262
- entity_a ,
2264
+ joint . entity_a ,
2263
2265
force_a [:, i ],
2264
2266
torque_a [:, i ],
2265
- entity_b ,
2267
+ joint . entity_b ,
2266
2268
force_b [:, i ],
2267
2269
torque_b [:, i ],
2268
2270
)
@@ -2828,12 +2830,7 @@ def _get_constraint_torques(
2828
2830
k = 1
2829
2831
penetration = k * (torch .exp (abs_delta_rot / k ) - 1 )
2830
2832
2831
- torque = (
2832
- force_multiplier
2833
- * delta_rot
2834
- / torch .where (abs_delta_rot > 0 , abs_delta_rot , 1e-8 )
2835
- * penetration
2836
- )
2833
+ torque = force_multiplier * delta_rot .sign () * penetration
2837
2834
torque = torch .where ((abs_delta_rot < min_delta_rot ), 0.0 , torque )
2838
2835
2839
2836
return - torque , torque
0 commit comments