Commits

German Larrain  committed 70a2d04

events model: defined two new signals to simulator.Simulation (SIM_POST_STEP_SIGNAL, SIM_POST_FRAME_SIGNAL) and sent them where appropriate

  • Participants
  • Parent commits 310a00c

Comments (0)

Files changed (1)

File ars/model/simulator/__init__.py

 
 
 SIM_PRE_STEP_SIGNAL = 'simulation pre step'
+SIM_POST_STEP_SIGNAL = 'simulation post step'
 SIM_PRE_FRAME_SIGNAL = 'simulation pre frame'
+SIM_POST_FRAME_SIGNAL = 'simulation post frame'
 
 
 class Simulation:
 
 	def on_idle(self):
 		self.num_frame += 1
+
 		try:
 			dispatcher.send(SIM_PRE_FRAME_SIGNAL) # before each visualization frame
 		except Exception as e:
 			print(e)
 
 		self.perform_sim_steps_per_frame()
+
+		try:
+			dispatcher.send(SIM_POST_FRAME_SIGNAL) # after each visualization frame
+		except Exception as e:
+			print(e)
+
 		# clear functions registered to be called in the steps of this past frame
 		self.all_frame_steps_callbacks = []
 
 			# Remove all contact joints
 			self._contact_group.empty()
 
+			# after each integration step of the physics engine
+			try:
+				dispatcher.send(SIM_POST_STEP_SIGNAL)
+			except Exception as e:
+				print(e)
+
 
 	def update_actors(self):
 		"""Update the position and rotation of each simulated object's