Commits

German Larrain committed 64d80c8

minor changes to demos

  • Participants
  • Parent commits 1f7a6a9

Comments (0)

Files changed (6)

bin/CentrifugalForceTest.py

 	JOINT1_ANCHOR = (0.0,0.0,0.0)
 	JOINT1_AXIS = (0.0,1.0,0.0) # (0.0,0.0,1.0) Z-axis in C++ example
 	JOINT1_FMAX = 100
-	JOINT2_ANCHOR = (0.0,2.0,0.0) # (0.0,2.0,1.0) # (0.0,1.0,2.0) in C++ example
+	JOINT2_ANCHOR = (0.0,2.0,1.0) # (0.0,2.0,1.0) # (0.0,1.0,2.0) in C++ example
 	JOINT2_AXIS = (1.0,0.0,0.0) # X-axis
 	
 	CABLE_LENGTH = mut.length3(mut.sub3(BALL_INITIAL_POS, JOINT2_ANCHOR))
 		box = self.sim.add_box(*self.BOX_PARAMS)
 		# FIXME: pole has no mass! => does not really matter, since speed is set
 		pole = self.sim.add_cylinder(1.0, self.POLE_HEIGHT, self.POLE_VISUAL_RADIUS, self.POLE_INITIAL_POS)
-		ball_density = self.BALL_MASS / get_sphere_volume(self.BALL_VISUAL_RADIUS)
+		ball_density = self.BALL_MASS / get_sphere_volume(self.BALL_RADIUS)
 		# FIXME: visual radius => did not affect the results noticeably
-		ball = self.sim.add_sphere(ball_density, self.BALL_VISUAL_RADIUS, self.BALL_INITIAL_POS)
+		ball = self.sim.add_sphere(ball_density, self.BALL_RADIUS, self.BALL_INITIAL_POS)
 		
 		# bodies are rotated before attaching themselves through joints
 		self.sim.get_object(pole).rotate(cts.X_AXIS, mut.pi/2)

bin/ControlledSimpleArm.py

 			self.apply_friction(q1p, q2p)
 			
 			output_data(time, self.sp, cv, self.sp - cv, mv)
-			print('q1p: %f, q2p: %f' % (q1p, q2p))
+			#print('q1p: %f, q2p: %f' % (q1p, q2p))
 			
 		except Exception as e:
 			print('Exception when executing on_pre_step: %s' % str(e))
 		(time, speed_i, sp, cv, error, torque))
 
 class RSS1(VehicleWithArm):
+	
+	WINDOW_SIZE = (1024,630)
+	CAMERA_POSITION = (0,8,15)
 
 	VEHICLE_OFFSET = (-4,0.5,2)
-	CAMERA_POSITION = (0,8,15)
 
 	LINK1_PARAMS = (1,0.8, 0.1,(0,0,0)) # (density, length, radius, center)
 	LINK2_PARAMS = (1,0.6,0.1,(0,0.7,0.2))
 			torque = self.compensate(sp, cv)
 			self.apply_torque_to_wheels(torque)
 			
-			#output_data(time, self.speed_i, sp, cv, sp - cv, torque)
-			print(self.get_kinematic_data())
+			output_data(time, self.speed_i, sp, cv, sp - cv, torque)
+			#print(self.get_kinematic_data())
 			
 		except:
 			print('Exception when executing on_pre_step')
 	
 	STEPS_PER_FRAME = 500
 	#OFFSET = (3,2,5)
-	VEHICLE_OFFSET = (3,2,5)
+	VEHICLE_OFFSET = (0,0,5)
 	TM_X, TM_Z = (40,20)
 	
 	def __init__(self):
 
 class Vehicle2(Program):
 	
-	TORQUE = 300
+	TORQUE = 200
 	
 	OFFSET = (3,1,3)
 	
+	FLOOR_BOX_SIZE = (20,0.01,20)
+	
 	def __init__(self):
 		""" Constructor, calls first the superclass constructor. """
 		Program.__init__(self)
 		
 		offset = self.OFFSET
 		
-		wheelR = self.sim.add_cylinder(1, 0.2, 0.3, (0,0,-0.5))
-		wheelL = self.sim.add_cylinder(1, 0.2, 0.3, (0,0,0.5))
+		wheelR = self.sim.add_cylinder(1, 0.4, 0.3, (0,0,-0.5))
+		wheelL = self.sim.add_cylinder(1, 0.4, 0.3, (0,0,0.5))
 		ball = self.sim.add_sphere(1, 0.3, (1,0,0))
 		chassis = self.sim.add_box(10, (2,0.2,1.5), (0.5,0.45,0))
 		

bin/VehicleWithArm.py

 
 class VehicleWithArm(Program):
 	
-	WHEEL_TORQUE = 300
-	VEHICLE_OFFSET = (2,0.5,2)
-	STEPS_PER_FRAME = 100
+	STEPS_PER_FRAME = 200
 	BACKGROUND_COLOR = (0.8,0.8,0.8)
+	FLOOR_BOX_SIZE = (20,0.01,20)
+	
+	WHEEL_TORQUE = 400
+	VEHICLE_OFFSET = (2,0.35,2)
 	
 	BALL_PARAMS = (1,0.3,(1,0,0)) # (density, radius, center)
 	CHASSIS_PARAMS = (10,(2,0.2,1.5),(0.5,0.45,0)) # (density, size, center)
 		
-	WHEEL_R_PARAMS = (1,0.2,0.3,(0,0,-0.5)) # (density, length, radius, center)
-	WHEEL_L_PARAMS = (1,0.2,0.3,(0,0,0.5))
+	WHEEL_R_PARAMS = (1,0.4,0.3,(0,0,-0.5)) # (density, length, radius, center)
+	WHEEL_L_PARAMS = (1,0.4,0.3,(0,0,0.5))
 	
 	LINK1_PARAMS = (1,0.8, 0.1,(0,0,0)) # (density, length, radius, center)
 	LINK2_PARAMS = (1,0.6,0.1,(0,0.7,0.2))
 		self.apply_torque_to_joints(-q1p * self.Q1_FRICTION_COEFF, -q2p * self.Q2_FRICTION_COEFF)
 
 if __name__ == '__main__':
-	a = VehicleWithArm(True, True)
+	a = VehicleWithArm()
 	a.start()
 	sys.exit(None)