Example #1
0
	def see(self, stats = False, *args, **kargs):
		"""
		Call the native see method, but return a VisionResult (a list with some
		extra members tacked on)
		"""

		res = KillableRobot.see(self, stats=stats, *args, **kargs)
		if stats:
			return VisionResult(res[0], worldTransform = self.worldTransform), res[1]
		else:
			return VisionResult(res, worldTransform = self.worldTransform)
Example #2
0
	def __init__(self):
		#Get the motors set up
		GyroAndCompassRobot.__init__(self)

		with open('config.json') as configFile:
			KillableRobot.__init__(self, killCode = json.load(configFile).get('killCode') or 228)
		

		# Camera orientation - numbers need checking
		self.cameraMatrix = (
			Matrix4.new_translate(0, 0.48, 0) *     #0.5m up from the center of the robot
			Matrix4.new_rotatex(math.radians(18))   #Tilted forward by 18 degrees
		)

		# Cache, since .inverse is expensive
		self.worldTransform = self.cameraMatrix.inverse()

		#Set compass zero offset
		self.compass.heading = 0

		#get hardware
		self.arm    = Arm()
		self.lifter = Lifter()
		self.us     = Ultrasonic()