Drop gpsd support and the GNSS simulator service: the car's GNSS comes over CAN later; /api/gnss/position and the GNSS control stay, fed through GNSS_LATEST
This commit is contained in:
1 parent
09a9d8baba
commit
49900c1703
10 files changed
+22
-133
No files matched your search
@@ -325,73 +325,6 @@ through this app's own proxy rather than at kiwix-serve directly — it
|
||||
already has a full search UI of its own, this just makes it reachable
|
||||
through the same origin/reverse proxy as the rest of the app.
|
||||
|
||||
== GNSS position (gpsd)
|
||||
|
||||
The "GNSS" control needs https://gpsd.io[gpsd] running and pointed at
|
||||
a receiver (`gpsd /dev/ttyUSB0`, or whatever device the receiver shows
|
||||
up as). On openSUSE, `gpsd` is a package with systemd units
|
||||
(`gpsd.service` / `gpsd.socket`); on other distributions, check your
|
||||
package manager. No app-side configuration is needed — it just
|
||||
connects to `127.0.0.1:2947`, gpsd's default port.
|
||||
|
||||
To test without hardware or gpsd itself installed/running, run
|
||||
`bin/gnss_simulator.rb` — it speaks gpsd's own JSON wire protocol
|
||||
directly on gpsd's default port (`127.0.0.1:2947`), so
|
||||
`Maptool::GpsdClient` connects to it exactly as it would to real
|
||||
gpsd, no app-side changes needed. Drives a loop around a center point
|
||||
(Bratislava by default) at a driving-ish pace instead of sitting at a
|
||||
fixed position, since a stationary "GNSS position" isn't much to look
|
||||
at on the map:
|
||||
|
||||
[source,shell]
|
||||
----
|
||||
bin/gnss_simulator.rb # loop around Bratislava, 300m radius
|
||||
bin/gnss_simulator.rb 48.85 2.35 500 # custom center/radius (Paris, 500m)
|
||||
----
|
||||
|
||||
`GET /api/gnss/position` should report a fix within a couple of
|
||||
seconds, moving on every poll.
|
||||
|
||||
To test against gpsd itself instead (e.g. to exercise the actual
|
||||
NMEA-parsing path, not just gpsd's JSON output), feed it a fake NMEA
|
||||
stream over TCP instead of a real serial device — gpsd accepts a
|
||||
`tcp://host:port` source:
|
||||
|
||||
[source,shell]
|
||||
----
|
||||
# terminal 1: a TCP server repeating one NMEA GGA/RMC sentence pair
|
||||
python3 - <<'PY' 5001
|
||||
import socket, sys, time
|
||||
|
||||
def checksum(s):
|
||||
cs = 0
|
||||
for ch in s:
|
||||
cs ^= ord(ch)
|
||||
return f"{cs:02X}"
|
||||
|
||||
def sentence(body):
|
||||
return f"${body}*{checksum(body)}\r\n"
|
||||
|
||||
port = int(sys.argv[1])
|
||||
srv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
srv.bind(("127.0.0.1", port))
|
||||
srv.listen(1)
|
||||
conn, _ = srv.accept()
|
||||
gga = "GPGGA,123519,4808.916,N,01706.462,E,1,08,0.9,140.4,M,46.9,M,,"
|
||||
rmc = "GPRMC,123519,A,4808.916,N,01706.462,E,000.5,084.4,230824,003.1,W"
|
||||
while True:
|
||||
conn.sendall((sentence(gga) + sentence(rmc)).encode())
|
||||
time.sleep(1)
|
||||
PY
|
||||
|
||||
# terminal 2: point gpsd at it instead of a real device
|
||||
gpsd -N -n tcp://127.0.0.1:5001
|
||||
----
|
||||
|
||||
`GET /api/gnss/position` should then report the fake fix (Bratislava
|
||||
Castle, in the sentences above) within a couple of seconds.
|
||||
|
||||
== Tests
|
||||
|
||||
`bundle exec rake test` runs the whole suite (`test/test_*.rb`,
|
||||
|
||||
Reference in new issue
Block a user