Commits

German Larrain  committed 33cc9ce

-old demo files deleted: CentrifugalTest, Ragdoll
-development notes.txt add

  • Participants
  • Parent commits 8991972
  • Branches default

Comments (0)

Files changed (3)

File ars/CentrifugalTestPyOdeVtk.py

-'''
-Created on 2011.10.25 (copied from RagdollPyOdeVtk.py)
-Last modified on 2011.11.09
-
-@author: german
-TODO: attribute the code sections that were copied from somewhere else
-'''
-
-import sys
-
-import graphics.adapters as gp
-from model.simulator import Simulation
-
-WRITE_DATA_FILES = False
-DEBUG = False
-DO_TEST = True
-
-WINDOW_TITLE = "PyODE Centrifigal Test simulation"
-WINDOW_POSITION_X = 0
-WINDOW_POSITION_Y = 0
-WINDOW_SIZE_WIDTH = 1024 #640
-WINDOW_SIZE_HEIGHT = 768 #480
-WINDOW_ZOOM = 1.0
-
-FPS = 50
-STEPS_PER_FRAME = 100
-
-class Program():
-	
-	def __init__(self):
-		
-		self.dataFilesNames = None # TODO
-		self.dataFiles = None # TODO
-		
-		self.gAdapter = gp.VtkAdapter()
-		self.gAdapter.createWindow(WINDOW_TITLE,
-							 (WINDOW_POSITION_X, WINDOW_POSITION_Y),
-							 (WINDOW_SIZE_WIDTH, WINDOW_SIZE_HEIGHT), zoom = WINDOW_ZOOM)
-		
-		self.createSimulation()
-		
-		if WRITE_DATA_FILES: self.sim.dataFiles = self.openFiles() # TODO
-		'''
-			outputFiles = openFiles()
-			sim.dataFiles = outputFiles
-			# see Ragdoll2.ars.RagdollPyOdeVtk
-		'''
-		
-#		self.gAdapter.startWindow(self.sim.onIdle, self.createSimulation)
-		
-		# after the window is closed
-		if WRITE_DATA_FILES: self.closeFiles(self.sim.dataFiles) # TODO
-		
-	def createSimulation(self):
-		self.gAdapter.reset()
-		
-		# set up the simulation parameters
-		self.sim = Simulation(FPS, STEPS_PER_FRAME)
-		self.sim.addBasicSimulationObjects()
-		self.sim.addAxes()
-		self.sim.addFloor(normal=(0,1,0), boxSize=(20,0.01,20))
-
-		# create the objects specific to this program
-		'''
-		graphicRagdollObjects = self.sim.createRagdoll(density=500, offset=(0.0, 1.9, 0.0))
-		graphicsObstacle = self.sim.createObstacle(bodyLength=0.5, bodyradius=0.2)
-		'''
-		self.sim.addCylinder(1000, 2.0, 0.2, (0,1,0))
-		
-		#test
-		if DO_TEST:
-			graphicSphere = self.sim.addSphere(500, 0.5, (0,4,0))
-			graphicBox1 = self.sim.addBox(500, (1,1,1), (-1, 2, -1))
-			graphicBox2 = self.sim.addBox(500, (0.3,0.3,0.3), (-1, 1, -1))
-
-			self.gAdapter.addObject(graphicSphere)
-			self.gAdapter.addObject(graphicBox1)
-			self.gAdapter.addObject(graphicBox2)
-		
-		# add the graphic objects
-		self.gAdapter.addObjectsList(self.sim.getActors().values())
-		self.sim.updateActors()
-		#self.gAdapter.restartWindow()
-		self.gAdapter.startWindow(self.sim.onIdle, self.createSimulation)
-
-	def readFilenames(self):
-		# TODO
-		pass # see Ragdoll2.ars.RagdollPyOdeVtk
-	
-	def openFiles(self):
-		# TODO
-		pass # see Ragdoll2.ars.RagdollPyOdeVtk
-	
-	def closeFiles(self, files):
-		# TODO
-		for _key in files:
-			files[_key].close()
-
-class Experiment:
-
-	def __init__(self):
-		self.joint1vel_user = 0.0
-		self.poleBody = None
-
-
-
-if __name__ == '__main__':
-	print('this is CentrifugalTestPyOdeVtk.py')
-	Program()
-	sys.exit(None)

File ars/RagdollPyOdeVtk.py

-'''
-Created on 2011.10.14
-Last modified on 2011.11.11
-
-@author: german
-TODO: attribute the code sections that were copied from somewhere else
-'''
-
-import sys
-
-import graphics.adapters as gp
-from model.simulator import Simulation
-
-WRITE_DATA_FILES = False
-DEBUG = False
-DO_TEST = True
-
-WINDOW_TITLE = "PyODE ragdoll simulation"
-WINDOW_POSITION_X = 0
-WINDOW_POSITION_Y = 0
-WINDOW_SIZE_WIDTH = 1024 #640
-WINDOW_SIZE_HEIGHT = 768 #480
-WINDOW_ZOOM = 1.0
-
-FPS = 50
-STEPS_PER_FRAME = 50
-
-class Program():
-	
-	def __init__(self):
-		
-		self.doCreateWindow = True
-		self.dataFilesNames = None # TODO
-		self.dataFiles = None # TODO
-		
-		self.gAdapter = gp.VtkAdapter()
-		self.gAdapter.createWindow(WINDOW_TITLE,
-							 (WINDOW_POSITION_X, WINDOW_POSITION_Y),
-							 (WINDOW_SIZE_WIDTH, WINDOW_SIZE_HEIGHT), zoom = WINDOW_ZOOM)
-		
-		self.createSimulation()
-		
-		if WRITE_DATA_FILES: self.sim.dataFiles = self.openFiles() # TODO
-		'''
-			outputFiles = openFiles()
-			sim.dataFiles = outputFiles
-			# see Ragdoll2.ars.RagdollPyOdeVtk
-		'''
-		
-		while self.doCreateWindow:
-			self.doCreateWindow = False
-			self.gAdapter.startWindow(self.sim.onIdle, self.resetSimulation, self.onActionSelection)
-		
-		# after the window is closed
-		if WRITE_DATA_FILES: self.closeFiles(self.sim.dataFiles) # TODO
-	
-	def resetSimulation(self):
-		self.doCreateWindow = True
-		self.gAdapter.reset()
-		self.createSimulation()
-		
-	def createSimulation(self):
-		
-		# set up the simulation parameters
-		self.sim = Simulation(FPS, STEPS_PER_FRAME)
-		self.sim.addBasicSimulationObjects()
-		self.sim.addAxes()
-		self.sim.addFloor(normal=(0,1,0), boxSize=(20,0.01,20))
-		
-		# create the objects specific to this program: ragdoll and obstacle
-		self.sim.addRagdoll(density=500, offset=(0.0,1.9,0.0))
-		self.sim.addObstacle(bodyLength=0.5, bodyradius=0.2)
-		
-		#test
-		if DO_TEST:
-			self.sim.addSphere(50, 0.5, (0,5,0))
-			box1 = self.sim.addBox(50, (1,1,1), (-1,2,-1))
-			sphere1 = self.sim.addSphere(50, 0.5, (-1,3,-1))
-			box2 = self.sim.addBox(50, (1,1,1), (-1,4,-1))
-			box3 = self.sim.addBox(50, (1,1,1), (-1,5.2,-1))
-			
-			self.sim.addBox(50, (1,1,1), (-2,0.5,0))
-			self.sim.addBox(50, (1,1,1), (-2,1.5,0))
-			self.sim.addBox(50, (1,1,1), (-2,2.5,0))
-			
-			self.sim.addBox(50, (0.3,0.3,0.3), (-0.7,1,-0.7))
-			
-			self.sim.addCylinder(100, 2, 0.3, (3,1,3))
-			self.sim.addCylinder(100, 2, 0.3, (3,1,3))
-			
-			self.sim.addBallSocketJoint(self.sim.getObject(box1), self.sim.getObject(sphere1), (-1,3,-1))
-			self.sim.addFixedJoint(self.sim.getObject(sphere1), self.sim.getObject(box2))
-			#self.sim.addRotaryJoint(self.sim.getObject(box2), self.sim.getObject(box3), (-1.5,4.6,-1), (0,0,1))
-		
-		# add the graphic objects
-		self.gAdapter.addObjectsList(self.sim.getActors().values())
-		self.sim.updateActors()
-		#self.gAdapter.restartWindow()
-#		self.gAdapter.startWindow(self.sim.onIdle, self.createSimulation)
-
-	def onActionSelection(self, key):
-		print(key)
-		
-		if key == 'r':
-			print("reset simulation")
-			self.resetSimulation()
-		elif key == 'a':
-			print("joint1vel_user increment")
-		elif key == 'z':
-			print("joint1vel_user decrement")
-		elif key == 'd':
-			print("joint2vel_user increment")
-		elif key == 'c':
-			print("joint2vel_user decrement")
-		elif key == 'q':
-			print("toggle use of QuickStep function")
-		else:
-			print("no action defined for that key")
-
-	def readFilenames(self):
-		# TODO
-		pass # see Ragdoll2.ars.RagdollPyOdeVtk
-	
-	def openFiles(self):
-		# TODO
-		pass # see Ragdoll2.ars.RagdollPyOdeVtk
-	
-	def closeFiles(self, files):
-		# TODO
-		for _key in files:
-			files[_key].close()
-
-if __name__ == '__main__':
-	print('this is RagdollPyOdeVtk.py')
-	Program()
-	sys.exit(None)

File development notes.txt

+code style and conventions
+
+	PEP 8 - Style Guide for Python Code
+		http://www.python.org/dev/peps/pep-0008/
+	
+	Docstring Conventions
+		http://www.python.org/dev/peps/pep-0257/
+
+code analyzer and syntax checking
+	pylint -d W0312 MyScript.py
+		for now, we will not accept the recommendation of using 4-space indentation instead of tabs
+
+diagram generation
+	pyreverse CasterSim.py
+	dot -Tps classes_No_Name.dot -o graph1.ps