MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / get_position

Method get_position

gps_manager.py:359–374  ·  view source on GitHub ↗

Return current position dict (or None if no fix).

(self)

Source from the content-addressed store, hash-verified

357 self._thread.start()
358 logger.info("GPS started via gpsd")
359 return True
360
361 def _start_serial(self):
362 try:
363 import serial as pyserial
364 self._serial = pyserial.Serial(self.port, self.baudrate, timeout=1)
365 self._running = True
366 self.connected = True
367 self.error = None
368 self._thread = threading.Thread(target=self._read_loop, daemon=True, name="gps-reader")
369 self._thread.start()
370 logger.info(f"GPS started on {self.port} @ {self.baudrate} baud")
371 return True
372 except ImportError:
373 self.error = "pyserial not installed (pip install pyserial)"
374 logger.error(self.error)
375 return False
376 except Exception as e:
377 self.error = f"GPS init failed: {e}"

Callers 5

_scan_loopMethod · 0.80
_bt_scan_loopMethod · 0.80
_cell_scan_loopMethod · 0.80
_parse_serial_lineMethod · 0.80

Calls 1

has_fixMethod · 0.95

Tested by

no test coverage detected