Commits

German Larrain committed 842f6e6

model.simulator: no code changes, just some formatting according to pep8.

  • Participants
  • Parent commits 640685d

Comments (0)

Files changed (1)

ars/model/simulator/__init__.py

-
-# Created on 2011.10.17
-#
-# @author: german
 from abc import ABCMeta, abstractmethod
 
 import random
 
 class Simulation:
 
-	def __init__(self, FPS, STEPS_PF, do_debug = False):
+	def __init__(self, FPS, STEPS_PF, do_debug=False):
 		self._FPS = FPS
 		self._DT = 1.0 / FPS
 		self._STEPS_PF = STEPS_PF  # steps per frame
 		self.coll_engine = coll.OdeEngine()
 		self.phs_engine = phs.OdeEngine()
 
-	def add_basic_simulation_objects(self, gravity=(0.0,-9.81,0.0)):
+	def add_basic_simulation_objects(self, gravity=(0.0, -9.81, 0.0)):
 		"""Create the basic simulation objects needed for physics and collision
 		such as a contact group (holds temporary contact joints generated during
 		collisions), a simulation 'world' (where physics objects are processed)
 		name = 'axes'
 		return self.add_object(SimulatedObject(name, actor=gAxes))
 
-	def add_floor(self, normal=(0,1,0), dist=0, box_size=(5,0.1,5), box_center=(0,0,0), color=(0.2,0.5,0.5)):
+	def add_floor(self, normal=(0, 1, 0), dist=0, box_size=(5, 0.1, 5),
+			box_center=(0, 0, 0), color=(0.2, 0.5, 0.5)):
 		"""Create a plane geom to simulate a floor. It won't be used explicitly
 		later (space object has a reference to it)"""
 		# FIXME: the relation between ODE's definition of plane and the center
 		# 	of the box
-		self._floor_geom = self.phs_engine.create_plane_geom(self._space, normal, dist)
+		self._floor_geom = self.phs_engine.create_plane_geom(self._space,
+			normal, dist)
 		# TODO: use normal parameter for orientation
 		gFloor = gp.Box(box_size, box_center)
 		gFloor.set_color(color)
 		name = "floor"
 		return self.add_object(SimulatedObject(name, actor=gFloor))
 
-	def add_trimesh_floor(self, vertices, faces, center=(0,0,0), color=(0.2,0.5,0.5)):
+	def add_trimesh_floor(self, vertices, faces, center=(0, 0, 0),
+			color=(0.2, 0.5, 0.5)):
 		self._floor_geom = coll.Trimesh(self._space, vertices, faces, center)
 		gFloor = gp.Trimesh(vertices, faces, center)
 		gFloor.set_color(color)
 		"""Rotate the object by applying a rotation matrix defined by the given
 		axis and angle"""
 		rot_now = mu.matrix_as_3x3_tuples(self.get_rotation())
-		rot_to_apply = mu.matrix_as_3x3_tuples(gemut.calc_rotation_matrix(axis, angle))
+		rot_to_apply = mu.matrix_as_3x3_tuples(gemut.calc_rotation_matrix(axis,
+			angle))
 		# Matrix (of the rotation to apply)
 		# multiplies from the LEFT the actual one
 		rot_final = mu.matrix_as_tuple(mu.matrix3_multiply(rot_to_apply, rot_now))