Esempio n. 1
0
                     print("Current Progress:%.2f%%"%(nextPoint/len(Mapdata.keys())*100))
                     print("%d Degrees to next location"%Route.yaw)
                 if(distance > MaxDistance):
                     #如果超出范围
                     pass 
                     #----根据夹角调转机头----#
                 elif(nextPoint == len(Mapdata.keys())):
                     #未超出范围,则已达到目标点。
                     nextPoint = nextPoint
                     Route.EndOfNav = 1
                     time.sleep(1)
                     os.system('mplayer -really-quiet "/home/pi/RpiCentre/sound/ARRIVEDEST.mp3"')
                 else:
                     Route.EndOfNav = 0
                     nextPoint += 1
                 Comm.SendNavMessege(ser,Route,wirelessPort)
 elif ValidShip.manual_automatic == STATE_COLLECTING_POINTS:
     if(Comm.Ship_Attitude_On_Screen(ValidShip)):
         index = 1
         Coordinates_Saving_File = open("LatLong_Record.txt","w+")
         print("Coordinate Saving File Created.")
         print("Recording Coordinates")
         while (ValidShip.manual_automatic==STATE_COLLECTING_POINTS):
             time.sleep(0.7)#采点时间间隔设置
             print('%ds Coordinates saved')
             Record_Coordinates.start(Coordinates_Saving_File,index,ValidShip.longtitude,ValidShip.lattitude,0)
             index += 1
         Coordinates_Saving_File.close()
         os.rename('LatLong_Record.txt','LatLong.txt')
         print("New Coordinates Saved")
 elif ValidShip.manual_automatic == STATE_MANUAL_CTRL: