def __init__(self, waypointFile=None): """Constructor for the boat object""" self.arduino = Arduino() self.gps = Gps() self.xbee = Xbee() self._waypointN = 0 self._waypointE = 0 self._waypointNumber = 0 self._waypointDist = 0 self._waypointHeading = 0 self._targetHeading = 0 self._targetDistance = 0 self.s = 0 self.c = 0 self.r = 250
def __init__(self, args): self.__init_logging() self.__logger.info("Going to initialize Gps()") self.__gps = Gps() self.__logger.debug("Going to read position and direction") start, start_bear = self.__gps.fetch_get_pos_bearing() self.__logger.debug("start=" + str(start)) self.__logger.debug("start_bear=" + str(start_bear)) destination = Point(args.lon, args.lat) announcer_manager = AnnouncerManager() self.__logger.debug("Going to initialize router") router = OrsRouter(start, start_bear, destination, announcer_manager) while self.__update_pos_wrapped(self.__gps.fetch_get_pos_bearing(), router) == False: time.sleep(config.routing['main_poll_interval']) self.__logger.info("Arrival at destination")
def __init__(self): self.a=Gps() self.setupUi(MainWindow)
def main(): # Bootsplash anzeigen # und 1sek warten. Wichtig: in dieser Zeit hat man die Möglichkeit über serial ein neues Programm hochzuladen # Beim ESP32 ist das nicht mehr wichtig, da dieser zwei serial Schnittstellen hat. display = Display(scl=4, sda=0) display.println("RSSI") display.println("Location") display.println("Logger") display.println("") # display.print_dot() # Systeme konfigurieren try: # nur zum Testen # wlan = network.WLAN(network.STA_IF) # wlan.active(True) # wlan.connect('Freifunk') # while not wlan.isconnected(): # display.print_dot() # time.sleep(0.5) # display.println(str(wlan.status('rssi'))) # time.sleep(10) display.println("===CONF START==") display.println("scan wlan") # Wlan Objekt erstellen, dass selbständig einen scan macht und das stärkste Freifunk zurück gibt. # display.print_dot() wlan = Wlan("Freifunk") # display.println(wlan.ff_ap_bssid) wlan.connect() display.println("connect") #display.println(ubinascii.hexlify(wlan.ff_list[0][1])+str(wlan.ff_list[0][3])) while not wlan.isconnected(): display.print_dot() time.sleep(0.5) gps = Gps() s = 0.1 display.println("init uart 9600") display.print_dot() uart = Uart(0, 9600) time.sleep(s) display.println("set baud 115200") display.print_dot() uart.send_command(b'PMTK251,115200') time.sleep(s) display.println("init UART 115200") display.print_dot() uart = Uart(0, 115200) time.sleep(s) display.println("set 2Hz") display.print_dot() uart.send_command(b'PMTK220,500') time.sleep(s) display.println("set RMC, GGA") display.print_dot() uart.send_command(b'PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,00') time.sleep(s) display.println("===CONF END===") while True: line = uart.readline() # display.println(str(line)) gps.refresh(line) quality = False if wlan.isconnected() and int( gps.sats) > 7 and gps.is_fix and float(gps.hdop) < 2: quality = True if not (wlan.isconnected()): # display.println("") # display.println("lost wlan :(") # display.println("reconnect...") wlan.reconnect() # else: display.print_info(gps, quality, wlan) # display.println(str(wlan.wlan.status('rssi'))) time.sleep(0.1) except Exception as ex: display.println(repr(ex)) for e in ex.args: display.println(e[:16]) time.sleep(1) display.println(e[16:32]) time.sleep(1) display.println(e[32:48]) display.println("") time.sleep(10)
# furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. if __name__ == '__main__': parser = ArgumentParser(prog="gps.py") parser.add_argument("profile_name", dest="user", nargs="?", type=str, help="Your GitHub profile name") args = parser.parse_args() user = args.user if not user: user = input("Profile's name: ") if len(user) == 0: print("ERROR: No username was provided!") quit(1) g = Gps() g.gps_for(user) print(g.formatted_res())
iodef.init() if config.hw_rev >= 3: import ble import ble_gatt_dsc as ble_gatt ble.init_ble() crypto = Crypto() message = Message(crypto, config, heartbeat_message) message.start() radio = Radio("/dev/serial0", config, message, heartbeat_radio) radio.start() gps = Gps() gps.start() if config.hw_rev < 3: display = Display(message, version, config, revision, heartbeat_display) display.start() ui = UI(display, message, crypto, radio, config, heartbeat_ui) ui.start() ui.splash() if config.hw_rev >= 3: dscGatt = ble_gatt.DscGatt(quitdsc, message, config, radio) dscGatt.start() """