Commits

German Larrain committed 9950707

ugly customization to generate simulation data of the falling ball example

  • Participants
  • Parent commits f4aeed9
  • Branches informe-semestre1

Comments (0)

Files changed (4)

ars/app/__init__.py

 WINDOW_ZOOM = 1.0
 
 FPS = 50
-STEPS_PER_FRAME = 50
+STEPS_PER_FRAME = 20
 
 class Program():
 	

ars/model/simulator/__init__.py

 			# Simulation step
 			time_step = self._DT / self._STEPS_PF
 			
-			'''
-			if WRITE_DATA_FILES:
-				self.writeDataFiles(self.dataFiles)
-			'''
+			
+			if True:
+				#self.writeDataFiles(self.dataFiles)
+				data_file = open('data.txt', 'a')
+				pos = self._objects.get('sphere').get_position()[1]
+				#gu.write_tuple_to_file(data_file, gu.insert_in_tuple(pos, 0, self.sim_time))
+				gu.write_tuple_to_file(data_file, (self.sim_time, pos))
+				data_file.close()
+			
 			
 			self._world.step(time_step)
 			self.sim_time += time_step

ars/model/simulator/collision.py

 	Callback function for the collide() method (in ODE). This function checks if the given geoms
 	do collide and creates contact joints (c_joint) if they do, except if they are connected.
 	"""
-	c_joint_bounce = 0.2
+	c_joint_bounce = 0.8
 	c_joint_mu = 500 # 0-5 = very slippery, 50-500 = normal, 5000 = very sticky
 
 	if (ode.areConnected(geom1.getBody(), geom2.getBody())):

bin/FallingBall.py

 class FallingBall(Program):
 	
 	def create_sim_objects(self):
-		self.sim.add_sphere(1, 0.5, (1,10,1))
+		self.sim.add_sphere(1, 0.5, (1,5,1))
 
 if __name__ == '__main__':
 	a = FallingBall()