Commits

German Larrain committed 5fe33d6

fourth example: new variation with a screenshot recorder by subclassing the original, which will no longer have that functionality.

  • Participants
  • Parent commits 634d5e0

Comments (0)

Files changed (2)

File bin/IROS/example4_sinusoidal_terrain.py

 	R2_KP = 20.0
 	R2_KD = 15.0
 	
-	# screenshot recorder
-	RECORDER_BASE_FILENAME = 'sin'
-	RECORD_PERIODICALLY = True
-	
 	def __init__(self):
 		""" Constructor, calls first the superclass constructor. """
 		VehicleWithArm.__init__(self)
 		self.set_pre_step_callback(self.on_pre_step)
-		self.create_screenshot_recorder(
-			self.RECORDER_BASE_FILENAME, self.RECORD_PERIODICALLY)
 		
 		self.q1_previous_error = 0.0
 		self.q2_previous_error = 0.0

File bin/IROS/example4b_sinusoidal_terrain_with_screenshot_recorder.py

+#!/usr/bin/env python
+
+# Created on 2012.01.16
+#
+# @author: german
+
+"""
+Example #4 with a screenshot recorder
+"""
+
+from example4_sinusoidal_terrain import Example4
+
+class Example4SR(Example4):
+	
+	# screenshot recorder
+	RECORDER_BASE_FILENAME = 'sin'
+	RECORD_PERIODICALLY = True
+	
+	def __init__(self):
+		""" Constructor, calls first the superclass constructor. """
+		Example4.__init__(self)
+		self.create_screenshot_recorder(
+			self.RECORDER_BASE_FILENAME, self.RECORD_PERIODICALLY)
+
+if __name__ == '__main__':
+	sim_program = Example4SR()
+	sim_program.start()