@@ -140,12 +140,12 @@ class URDFBasedRobot(XmlBasedRobot):
140
140
Base class for URDF .xml based robots.
141
141
"""
142
142
143
- def __init__ (self , model_urdf , robot_name , action_dim , obs_dim , basePosition = [ 0 , 0 , 0 ], baseOrientation = [ 0 , 0 , 0 , 1 ] , fixed_base = False , self_collision = False ):
143
+ def __init__ (self , model_urdf , robot_name , action_dim , obs_dim , basePosition = None , baseOrientation = None , fixed_base = False , self_collision = False ):
144
144
XmlBasedRobot .__init__ (self , robot_name , action_dim , obs_dim , self_collision )
145
145
146
146
self .model_urdf = model_urdf
147
- self .basePosition = basePosition
148
- self .baseOrientation = baseOrientation
147
+ self .basePosition = basePosition if basePosition is not None else [ 0 , 0 , 0 ]
148
+ self .baseOrientation = baseOrientation if baseOrientation is not None else [ 0 , 0 , 0 , 1 ]
149
149
self .fixed_base = fixed_base
150
150
151
151
def reset (self , bullet_client ):
@@ -185,9 +185,14 @@ class SDFBasedRobot(XmlBasedRobot):
185
185
Base class for SDF robots in a Scene.
186
186
"""
187
187
188
- def __init__ (self , model_sdf , robot_name , action_dim , obs_dim , basePosition = [ 0 , 0 , 0 ], baseOrientation = [ 0 , 0 , 0 , 1 ] , fixed_base = False , self_collision = False ):
188
+ def __init__ (self , model_sdf , robot_name , action_dim , obs_dim , basePosition = None , baseOrientation = None , fixed_base = False , self_collision = False ):
189
189
XmlBasedRobot .__init__ (self , robot_name , action_dim , obs_dim , self_collision )
190
190
191
+ if basePosition is None :
192
+ basePosition = [0 , 0 , 0 ]
193
+ if baseOrientation is None :
194
+ baseOrientation = [0 , 0 , 0 , 1 ]
195
+
191
196
self .model_sdf = model_sdf
192
197
self .fixed_base = fixed_base
193
198
@@ -275,7 +280,11 @@ def reset_position(self, position):
275
280
def reset_orientation (self , orientation ):
276
281
self ._p .resetBasePositionAndOrientation (self .bodies [self .bodyIndex ], self .get_position (), orientation )
277
282
278
- def reset_velocity (self , linearVelocity = [0 ,0 ,0 ], angularVelocity = [0 ,0 ,0 ]):
283
+ def reset_velocity (self , linearVelocity = None , angularVelocity = None ):
284
+ if linearVelocity is None :
285
+ linearVelocity = [0 , 0 , 0 ]
286
+ if angularVelocity is None :
287
+ angularVelocity = [0 , 0 , 0 ]
279
288
self ._p .resetBaseVelocity (self .bodies [self .bodyIndex ], linearVelocity , angularVelocity )
280
289
281
290
def reset_pose (self , position , orientation ):
0 commit comments