Ejemplo n.º 1
0
 def setUp(self):
     gVars.logger = sailbot_logger.Logger()
     self.round_buoy = roundbuoy.RoundBuoy()
     gVars.currentData = datatypes.ArduinoData(
         0, 0, 0, 0, datatypes.GPSCoordinate(0, 0), 0, 0, 0, 0, 0)
     self.buoyLoc = datatypes.GPSCoordinate(1, 1)
     self.angleBetweenBuoyAndGPSCoord = standardcalc.angleBetweenTwoCoords(
         gVars.currentData.gps_coord, self.buoyLoc)
Ejemplo n.º 2
0
def run(argv=None):
    #with open(path.join(path.dirname(__file__),'log/sailbot.log'), 'w'):
    #    pass
    gVars.logger = sailbot_logger.Logger()
    gVars.logger.info("Start")

    gVars.logger.info("Mock Enabled: " + str(mock))
    if (mock == False):
        arduino = piardio.arduino.arduino()
    else:
        arduino = piardio.mockarduino.arduino()
    gVars.logger.info("Created Arduino object")
    gVars.arduino = arduino
    s = sched.scheduler(time.time, time.sleep)
    s.enter(1, 1, setGlobVar, (s, ))
    thread.start_new_thread(s.run, ())

    while (gVars.run):
        # When the function queue has waiting calls, and there is no currently running process,
        # switch processes to the next function in the queue (FIFO)

        if (len(gVars.functionQueue) > 0 and gVars.currentProcess is None
                and gVars.currentData.auto == 1):
            killAllFunctions()
            time.sleep(.5)
            unkillAllFunctions()
            gVars.currentProcess = gVars.functionQueue.pop(0)
            gVars.currentParams = gVars.queueParameters.pop(0)
            task = getTaskObject(gVars.currentProcess)

            gVars.taskStartTime = datetime.now()

            try:
                if gVars.currentProcess == sVars.GO_AROUND or gVars.currentProcess == sVars.GO_TO:
                    task.run(*gVars.currentParams)
                else:
                    task.run(gVars.currentParams)
            except Exception, errtext:
                exc_type, exc_value, exc_traceback = sys.exc_info()
                gVars.logger.critical(
                    "Caught exception in " + str(gVars.currentProcess) +
                    ":<br>" + str(errtext) + "<br> Trace: " + "".join(
                        traceback.format_exception(
                            exc_type, exc_value, exc_traceback)).replace(
                                '\n', '<br>' + '&nbsp ' * 3))

            gVars.currentProcess = None
            gVars.currentParams = None

        time.sleep(.5)
Ejemplo n.º 3
0
	def setUp(self):
		gVars.logger = sailbot_logger.Logger()
		self.stationKeeping = stationkeeping.StationKeeping()
Ejemplo n.º 4
0
 def setUp(self):
     gVars.logger = sailbot_logger.Logger()
     self.boundaryHandler = circleboundaryhandler.CircleBoundaryHandler()
     gVars.currentData = datatypes.ArduinoData(
         0, 1, 2, 3, datatypes.GPSCoordinate(4, 4), 5, 6, 7, 0, 20)
Ejemplo n.º 5
0
 def setUp(self):
     self.logger = sailbot_logger.Logger()
Ejemplo n.º 6
0
 def setUp(self):
     gVars.logger = sailbot_logger.Logger()
     self.p2p = pointtopoint.PointToPoint()
     self.p2p.GPSCoord = datatypes.GPSCoordinate(49, -123)
     self.p2p.Dest = datatypes.GPSCoordinate(50, -122)  #north east
     self.p2p.sog = 100
Ejemplo n.º 7
0
 def setUp(self):
     gVars.logger = sailbot_logger.Logger()
     self.p2p = pointtopoint.PointToPoint()
Ejemplo n.º 8
0
 def setUp(self):
     self.tackengine = roundingtackengine.RoundingTackEngine("starboard")
     gVars.logger = sailbot_logger.Logger()
Ejemplo n.º 9
0
 def setUp(self):
     self.tackengine = tackengine.TackEngine()
     gVars.logger = sailbot_logger.Logger()