@@ -135,12 +135,11 @@ def spherical(self, name: str) -> SphericalJoint:
135
135
"""
136
136
Retrieves the joint with next parameters:
137
137
* Joint type: Spherical
138
- * Joint mode: Force
138
+ * Joint mode: Passive
139
139
"""
140
140
joint = self ._get_joint_with_param (
141
141
name ,
142
- [vc .sim_joint_revolute_subtype , # bug in v-rep: return revolute, instead spherical
143
- vc .sim_joint_revolute_subtype ], # bug in v-rep: return revolute, instead spherical
142
+ [vc .sim_joint_spherical_subtype ],
144
143
vc .sim_jointmode_passive )
145
144
return SphericalJoint (joint )
146
145
@@ -192,16 +191,14 @@ def with_velocity_control(self, name: str) -> JointWithVelocityControl:
192
191
"""
193
192
joint = self ._get_joint_with_param (
194
193
name , [vc .sim_joint_revolute_subtype , vc .sim_joint_prismatic_subtype ],
195
- vc .sim_jointmode_motion ) # bug in v-rep: return motion, instead force
194
+ vc .sim_jointmode_force )
196
195
return JointWithVelocityControl (joint )
197
196
198
197
def _get_joint_with_param (self , name , types , mode ) -> AnyJoint :
199
198
handle = self ._get_object_handle (name )
200
199
if handle is not None :
201
200
type , curr_mode , limit , range = self ._get_info_about_joint (handle )
202
- if type == types [0 ] or \
203
- type == types [1 ] and \
204
- curr_mode == mode :
201
+ if type in types and curr_mode == mode :
205
202
return AnyJoint (self ._id , handle )
206
203
else :
207
204
raise MatchObjTypeError ("Joint with name: \" " + name +
@@ -214,8 +211,10 @@ def _get_info_about_joint(self, handle):
214
211
data_type_code = 16
215
212
code , handles , types_and_mode , limits_and_ranges , string_data = v .simxGetObjectGroupData (
216
213
self ._id , obj_type_code , data_type_code , self ._def_op_mode )
217
- if handles .__contains__ (handle ):
218
- return types_and_mode [0 ], types_and_mode [1 ], limits_and_ranges [0 ], limits_and_ranges [1 ]
214
+ if code == v .simx_return_ok :
215
+ index = handles .index (handle )
216
+ index = index * 2
217
+ return types_and_mode [index ], types_and_mode [index + 1 ], limits_and_ranges [index ], limits_and_ranges [index + 1 ]
219
218
else :
220
219
return None
221
220
0 commit comments