Example #1
0
	def __init__(self):
		super(Nav, self).__init__()

		self.runLevel = Nav.RUNLVL_NORMAL
		## Sets the run interval, in terms of number of seconds
		self.RUN_INTERVAL = 2

		########## Private vars ##########
		self.__model = {
			'path': None,
			'currLoc': Point.fromParam()
		}

		## For multithreading
		self._threadListen = None
		self._active = True

		## For interprocess comms 
		self.DISPATCHER_PORT = 9001
		self._dispatcherClient = DispatcherClient(port=self.DISPATCHER_PORT)

		## Attach event listeners upon instantiation (to prevent duplicates)
		self.attachEvents()

		## For collision detection: lock navigation until ready
		self.collisionLocked = False
		self.obstacle = None

		## For pausing nav
		self.toPause = False

		logging.info('Nav Daemon running.')
Example #2
0
		def onPoint(args):
			"""Update location based on interprocess posting
			by cruncher
			"""
			locInfo = json.loads(args.get('payload'))
			x = locInfo.get('x')
			y = locInfo.get('y')
			z = locInfo.get('z')
			angle = locInfo.get('ang')
			self.__model['currLoc'] = Point.fromParam(
				x=x, 
				y=y,
				z=z, 
				orientation=angle)