Commits

German Larrain committed 6b83d3d

VehicleWithArm links' parameters are defined as class attributes

Comments (0)

Files changed (1)

bin/VehicleWithArm.py

 	STEPS_PER_FRAME = 100
 	BACKGROUND_COLOR = (0.8,0.8,0.8)
 	
+	LINK1_PARAMS = (1,0.8, 0.1,(0,0,0)) # (density, length, radius, center)
+	LINK2_PARAMS = (1,0.8,0.1,(0,0.5,0.5))
+	LINK3_PARAMS = (1,0.5,0.1,(0,0.8,1))
+	
 	def __init__(self, use_capsule_wheels=False):
 		""" Constructor, which calls the superclass constructor. """
 		self._use_capsule_wheels = use_capsule_wheels 
 		#=======================================================================
 		# ROBOTIC ARM
 		#=======================================================================
-		link1 = self.sim.add_capsule(density=1, length=0.8, radius=0.1, center=(0,0,0))
-		link2 = self.sim.add_capsule(density=1, length=0.8, radius=0.1, center=(0,0.5,0.5))
-		link3 = self.sim.add_capsule(density=1, length=0.5, radius=0.1, center=(0,0.8,1))
+		link1 = self.sim.add_capsule(*self.LINK1_PARAMS)
+		link2 = self.sim.add_capsule(*self.LINK2_PARAMS)
+		link3 = self.sim.add_capsule(*self.LINK3_PARAMS)
 		
 		# bodies are rotated before attaching themselves through joints
 		self.sim.get_object(link1).rotate(x_axis, mut.pi/2)