コード例 #1
0
 def testGetCurrentData(self):
     self.resetGlobVar()
     self.currdata = datatypes.ArduinoData(0, 1, 2, 3,
                                           datatypes.GPSCoordinate(4, 4), 5,
                                           6, 7, 0, 20)
     gVars.currentData = self.currdata
     self.gui_handler.getData()
     if (not gVars.taskStartTime):
         seconds = None
     else:
         seconds = (datetime.now() - gVars.taskStartTime).total_seconds()
         seconds = round(seconds)
     self.assertEqual(
         self.gui_handler.getData(), {
             "telemetry": {
                 "Heading": self.currdata.hog,
                 "COG": self.currdata.cog,
                 "SOG": self.currdata.sog,
                 "AWA": self.currdata.awa,
                 "latitude": self.currdata.gps_coord.lat,
                 "longitude": self.currdata.gps_coord.long,
                 "SheetPercent": self.currdata.sheet_percent,
                 "Rudder": self.currdata.rudder
             },
             "connectionStatus": {
                 "gpsSat": self.currdata.num_sat,
                 "HDOP": self.currdata.gps_accuracy,
                 "automode": self.currdata.auto
             },
             "currentProcess": {
                 "name": gVars.currentProcess,
                 "Starttime": seconds
             }
         })
コード例 #2
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)
コード例 #3
0
 def setUp(self):
     self.coords=[]
     self.coords.append(datatypes.GPSCoordinate(1.0,1.0))
     self.coords.append(datatypes.GPSCoordinate(1.0,2.0))
     self.coords.append(datatypes.GPSCoordinate(2.0,2.0))
     self.coords.append(datatypes.GPSCoordinate(2.0,1.0))
     self.chaseRace = chaserace.ChaseRace()
     gVars.instructions = datatypes.Instructions("none",[],[],"port",0)
     gVars.currentData = datatypes.ArduinoData(0, 1, 2, 3, datatypes.GPSCoordinate(4, 4) , 5, 6, 7, 0, 20)
コード例 #4
0
 def setUp(self):
     self.returnstr = "\n1, 22222222, 33333333, 4, 5, 6, 7, 8, 9, 10, 11, 12 \n1, 22222222, 33333333, 4, 5, 6, 7, 8, 9, 10, 11, 12 \n1, 22222222, 33333333, 4, 5, 6, 7, 8, 9, 10, 11, 12"
     self.returnarr = [1, 22222222, 33333333, 4, 5, 6, 7, 8, 9, 10, 11, 12]
     self.returnstrnospace = "\n1,22222222,33333333,4,5,6,7,8,9,10,11,12\n1,22222222,33333333,4,5,6,7,8,9,10,11,12\n1,22222222,33333333,4,5,6,7,8,9,10,11,12"
     self.arduinoData = datatypes.ArduinoData(
         5.0, 4.0, 11.0, 7.0, datatypes.GPSCoordinate(3.3333333, 2.2222222),
         8.0, 9.0, 10.0, 1.0, 12.0)
     self.ser = serial.Serial()
     serial.Serial = MagicMock(return_value=self.ser)
     self.ser.Serial = MagicMock(return_value=None)
     self.ser.flushInput = MagicMock(return_value=None)
     self.ard = arduino.arduino()
コード例 #5
0
ファイル: arduino.py プロジェクト: ArekSredzki/ubcsailbots
 def interpretArr(self, ardArr):
     arduinoData = datatypes.ArduinoData()
     arduinoData.hog = standardcalc.boundTo180(ardArr[ARD_HOG])
     arduinoData.cog = standardcalc.boundTo180(ardArr[ARD_COG])
     arduinoData.sog = ardArr[ARD_SOG]
     arduinoData.awa = ardArr[ARD_AWAV]
     arduinoData.gps_coord = datatypes.GPSCoordinate(
         ardArr[ARD_LAT] / 10000000, ardArr[ARD_LONG] / 10000000)
     arduinoData.sheet_percent = ardArr[ARD_SHT]
     arduinoData.num_sat = ardArr[ARD_SAT]
     arduinoData.gps_accuracy = ardArr[ARD_ACC]
     arduinoData.auto = ardArr[ARD_AUT]
     arduinoData.rudder = ardArr[ARD_RUD]
     return arduinoData
コード例 #6
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)
コード例 #7
0
 def resetGlobVar(self):
     gVars.boundaries = []
     gVars.currentData = datatypes.ArduinoData()
     gVars.functionQueue = []
     gVars.instructions = None
     gVars.queueParameters = []
コード例 #8
0
 def setUp(self):
     self.list1 = []
     gVars.currentData = datatypes.ArduinoData(0, 1, 2, 3, datatypes.GPSCoordinate(4, 4) , 5, 6, 7, 0, 20)
     self.list2 = [1,2,3]
     self.list3 = standardcalc.changeSpdList(self.list2)
コード例 #9
0
 def setUp(self):
     self.x = datatype.ArduinoData()
     self.y = datatype.ArduinoData(10, 10, 10, 10,
                                   datatype.GPSCoordinate(10, 10), 10, 10,
                                   10, 10, 10)