@@ -100,52 +100,29 @@ def __eq__(self, other: JointDescription) -> bool:
100
100
if not isinstance (other , JointDescription ):
101
101
return False
102
102
103
- if self .name != other .name :
104
- return False
105
-
106
- if not np .allclose (self .axis , other .axis ):
107
- return False
108
-
109
- if not np .allclose (self .pose , other .pose ):
110
- return False
111
-
112
- if self .jtype != other .jtype :
113
- return False
114
-
115
- if self .child != other .child :
116
- return False
117
-
118
- if self .parent != other .parent :
119
- return False
120
-
121
- if self .index != other .index :
122
- return False
123
-
124
- if not np .allclose (self .friction_static , other .friction_static ):
125
- return False
126
-
127
- if not np .allclose (self .friction_viscous , other .friction_viscous ):
128
- return False
129
-
130
- if not np .allclose (self .position_limit_damper , other .position_limit_damper ):
131
- return False
132
-
133
- if not np .allclose (self .position_limit_spring , other .position_limit_spring ):
134
- return False
135
-
136
- if not np .allclose (self .position_limit , other .position_limit ):
137
- return False
138
-
139
- if not np .allclose (self .initial_position , other .initial_position ):
140
- return False
141
-
142
- if not np .allclose (self .motor_inertia , other .motor_inertia ):
143
- return False
144
-
145
- if not np .allclose (self .motor_viscous_friction , other .motor_viscous_friction ):
146
- return False
147
-
148
- if not np .allclose (self .motor_gear_ratio , other .motor_gear_ratio ):
103
+ if not all (
104
+ self .name == other .name
105
+ and self .jtype == other .jtype
106
+ and self .child == other .child
107
+ and self .parent == other .parent
108
+ and self .index == other .index
109
+ and all (
110
+ np .allclose (getattr (self , attr ), getattr (other , attr ))
111
+ for attr in [
112
+ "axis" ,
113
+ "pose" ,
114
+ "friction_static" ,
115
+ "friction_viscous" ,
116
+ "position_limit_damper" ,
117
+ "position_limit_spring" ,
118
+ "position_limit" ,
119
+ "initial_position" ,
120
+ "motor_inertia" ,
121
+ "motor_viscous_friction" ,
122
+ "motor_gear_ratio" ,
123
+ ]
124
+ )
125
+ ):
149
126
return False
150
127
151
128
return True
@@ -163,14 +140,14 @@ def __hash__(self) -> int:
163
140
hash (self .child ),
164
141
hash (self .parent ),
165
142
hash (int (self .index )) if self .index is not None else 0 ,
166
- HashedNumpyArray .hash_of_array (np . array ( self .friction_static ) ),
167
- HashedNumpyArray .hash_of_array (np . array ( self .friction_viscous ) ),
168
- HashedNumpyArray .hash_of_array (np . array ( self .position_limit_damper ) ),
169
- HashedNumpyArray .hash_of_array (np . array ( self .position_limit_spring ) ),
170
- HashedNumpyArray .hash_of_array (np . array ( self .position_limit ) ),
143
+ HashedNumpyArray .hash_of_array (self .friction_static ),
144
+ HashedNumpyArray .hash_of_array (self .friction_viscous ),
145
+ HashedNumpyArray .hash_of_array (self .position_limit_damper ),
146
+ HashedNumpyArray .hash_of_array (self .position_limit_spring ),
147
+ HashedNumpyArray .hash_of_array (self .position_limit ),
171
148
HashedNumpyArray .hash_of_array (self .initial_position ),
172
- HashedNumpyArray .hash_of_array (np . array ( self .motor_inertia ) ),
173
- HashedNumpyArray .hash_of_array (np . array ( self .motor_viscous_friction ) ),
174
- HashedNumpyArray .hash_of_array (np . array ( self .motor_gear_ratio ) ),
149
+ HashedNumpyArray .hash_of_array (self .motor_inertia ),
150
+ HashedNumpyArray .hash_of_array (self .motor_viscous_friction ),
151
+ HashedNumpyArray .hash_of_array (self .motor_gear_ratio ),
175
152
),
176
153
)
0 commit comments