@@ -2095,7 +2095,7 @@ def _apply_vectorized_enviornment_force(self):
20952095 frozenset ({entity_a .name , entity_b .name }), None
20962096 )
20972097 if joint is not None :
2098- joints .append (( entity_a , entity_b , joint ) )
2098+ joints .append (joint )
20992099 if joint .dist == 0 :
21002100 continue
21012101 if not self .collides (entity_a , entity_b ):
@@ -2187,7 +2187,9 @@ def _vectorized_joint_constraints(self, joints):
21872187 rot_a = []
21882188 rot_b = []
21892189 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
21912193 pos_joint_a .append (joint .pos_point (entity_a ))
21922194 pos_joint_b .append (joint .pos_point (entity_b ))
21932195 pos_a .append (entity_a .state .pos )
@@ -2257,12 +2259,12 @@ def _vectorized_joint_constraints(self, joints):
22572259 rotate , torque_b_rotate , torque_b_rotate + torque_b_fixed
22582260 )
22592261
2260- for i , ( entity_a , entity_b , _ ) in enumerate (joints ):
2262+ for i , joint in enumerate (joints ):
22612263 self .update_env_forces (
2262- entity_a ,
2264+ joint . entity_a ,
22632265 force_a [:, i ],
22642266 torque_a [:, i ],
2265- entity_b ,
2267+ joint . entity_b ,
22662268 force_b [:, i ],
22672269 torque_b [:, i ],
22682270 )
@@ -2828,12 +2830,7 @@ def _get_constraint_torques(
28282830 k = 1
28292831 penetration = k * (torch .exp (abs_delta_rot / k ) - 1 )
28302832
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
28372834 torque = torch .where ((abs_delta_rot < min_delta_rot ), 0.0 , torque )
28382835
28392836 return - torque , torque
0 commit comments