Compare commits
No commits in common. "dc95c2252ee3b5107cebf5eeee44afedac10a67e" and "21471654cbe9e91089e2fd214ad66bf08ecff373" have entirely different histories.
dc95c2252e
...
21471654cb
91
README
91
README
@ -44,93 +44,18 @@ of the screen
|
|||||||
|
|
||||||
random notes follow ...
|
random notes follow ...
|
||||||
|
|
||||||
|
1) Satellite requires these commands to be run before
|
||||||
|
it will work.
|
||||||
|
|
||||||
|
mmcli -m 0 --enable
|
||||||
|
mmcli -m 0 --location-enable-gps-raw
|
||||||
|
mmcli -m 0 --location-enable-gps-nmea
|
||||||
|
mmcli -m 0 --location-status
|
||||||
|
|
||||||
|
|
||||||
https://git.syndicate-lang.org/tonyg/squeak-phone/raw/commit/474960ddc665ed445a1f5afb0164fe39057720f9/devices/pine64-pinephone/modem-docs/80545ST10798A_LM940_QMI_Command_Reference_Guide_r3.pdf
|
2) we should make saturn give visual feedback while it's loading an
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
1) [done] connect Satellite to qmi-nmea
|
|
||||||
|
|
||||||
https://codeberg.org/tpikonen/satellite/src/branch/main/satellite/nmeasource.py#L106
|
|
||||||
|
|
||||||
2) [nope] do we need modemmanager? might be required if we want lte data,
|
|
||||||
but that's up to the "site admin" - we don't need it for biscuit itself
|
|
||||||
|
|
||||||
3) we should make saturn give visual feedback while it's loading an
|
|
||||||
app. How does it know when the app has finished loading? Maybe it
|
app. How does it know when the app has finished loading? Maybe it
|
||||||
could get told when its window is obscured
|
could get told when its window is obscured
|
||||||
|
|
||||||
4) rename Maps to soemthing that describes its role better. Cockpit?
|
|
||||||
HUD? (but it's actually H Down D) Head Unit? Navigate? Dashboard? Cluster?
|
|
||||||
Codriver? Satnav? Binnacle? Launch? Ride? Embark?
|
|
||||||
|
|
||||||
5) [all done]
|
|
||||||
Maps also needs to open the nmea port and parse data from it.
|
|
||||||
5a) Maps needs to open a fake nmea source for testing
|
|
||||||
5b) we need a generator of fake nmea data
|
|
||||||
|
|
||||||
6) Cockpit
|
|
||||||
- show [done] speed and [done] direction
|
|
||||||
- show speed limit
|
|
||||||
- [done] scroll and [not done] rotate map
|
|
||||||
- overlay planned route on map
|
|
||||||
- show next turn
|
|
||||||
- voice prompts
|
|
||||||
- when off-course, calculate route to nearest point on course
|
|
||||||
- fetch planned route from nominated url
|
|
||||||
(don't want to type the url in, is there a better way to have it check in
|
|
||||||
with a mothership?)
|
|
||||||
- save trail (maybe this could be a separate task entirely)
|
|
||||||
|
|
||||||
elapsed time: what should it actually show? moving time, I guess
|
|
||||||
- moving time since when?
|
|
||||||
|
|
||||||
should we rename bearing as course in nmea?
|
|
||||||
|
|
||||||
rotating the map is going to be complicated because the widget we're
|
|
||||||
using doesn't support it (bitmapped map tiles)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
perhaps we need a server-side component for route planning
|
|
||||||
|
|
||||||
|
|
||||||
7) think about how to use nfc tags or something for profiles so that
|
|
||||||
it can recognise when it's attached to bicycle or motorbike
|
|
||||||
|
|
||||||
|
|
||||||
8) use OSM directly?
|
|
||||||
|
|
||||||
we can't rotate the map using OsmGpsMap widget because the labels will
|
|
||||||
be sideways or upside down, so we need something with vectors that we
|
|
||||||
can rotate
|
|
||||||
|
|
||||||
a) we can get data from overpass api as json
|
|
||||||
|
|
||||||
b) we would like to cache the results, which means some kind of
|
|
||||||
chunking or tiling so that the json for position a is the same as the
|
|
||||||
json for position b.
|
|
||||||
|
|
||||||
c) at coarser zoom levels, we need to query for fewer objects: either
|
|
||||||
do it by hand -
|
|
||||||
|
|
||||||
- houses
|
|
||||||
- minor roads
|
|
||||||
- major roads
|
|
||||||
|
|
||||||
or so something smart but complicated like "only return ways that
|
|
||||||
cover more than 1/16th the length of the tile"
|
|
||||||
|
|
||||||
d) I think we will need some kind of server so that multiple users get
|
|
||||||
the benefit of the caching. If we're going to do that, should it also
|
|
||||||
do transformation e.g. from lat/long to x/y co-ordinates? We don't
|
|
||||||
need this bit yet though
|
|
||||||
|
|
||||||
3) alternatively we could use mapbox vector tiles, but tbh I'm
|
|
||||||
struggling to see now that helps. we don't have to transform from
|
|
||||||
lat/long but instead we have to parse a protobuf, how is that simpler?
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,16 +17,8 @@
|
|||||||
(.. "\nexpected " ve# "\ngot " va#)
|
(.. "\nexpected " ve# "\ngot " va#)
|
||||||
))))
|
))))
|
||||||
|
|
||||||
(fn expect-near [actual expected]
|
|
||||||
`(let [delta# (math.abs (- ,actual ,expected))
|
|
||||||
e# ,expected
|
|
||||||
a# ,actual]
|
|
||||||
(assert (< delta# 0.00000001)
|
|
||||||
(.. "expected " e# " to be approximately " a#))))
|
|
||||||
|
|
||||||
|
|
||||||
(fn define-tests [& body]
|
(fn define-tests [& body]
|
||||||
(when _G.RUNNING_TESTS
|
(when _G.RUNNING_TESTS
|
||||||
`(do ,(unpack body))))
|
`(do ,(unpack body))))
|
||||||
|
|
||||||
{ : define-tests : expect : expect= : expect-near }
|
{ : define-tests : expect : expect= }
|
||||||
|
@ -34,14 +34,11 @@ let
|
|||||||
hash = "sha256-VYr/DV1FAyzPe6p6Quc1nmsHup23IAMfz532rL167Q4=";
|
hash = "sha256-VYr/DV1FAyzPe6p6Quc1nmsHup23IAMfz532rL167Q4=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
rxi-json = callPackage ../rxi-json { lua = lua5_3; };
|
|
||||||
lua = lua5_3.withPackages (ps: with ps; [
|
lua = lua5_3.withPackages (ps: with ps; [
|
||||||
lgi
|
lgi
|
||||||
luafilesystem
|
luafilesystem
|
||||||
luaposix
|
luaposix
|
||||||
readline
|
readline
|
||||||
http
|
|
||||||
rxi-json
|
|
||||||
]);
|
]);
|
||||||
pname = "maps";
|
pname = "maps";
|
||||||
in stdenv.mkDerivation {
|
in stdenv.mkDerivation {
|
||||||
@ -52,12 +49,15 @@ in stdenv.mkDerivation {
|
|||||||
buildInputs = [
|
buildInputs = [
|
||||||
lua
|
lua
|
||||||
gtk3.dev
|
gtk3.dev
|
||||||
gobject-introspection
|
gobject-introspection # .dev
|
||||||
osm-gps-map
|
osm-gps-map
|
||||||
glib-networking
|
glib-networking
|
||||||
|
# gdk-pixbuf
|
||||||
|
# glib
|
||||||
|
# libchamplain
|
||||||
];
|
];
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
# lua
|
buildPackages.lua
|
||||||
gobject-introspection
|
gobject-introspection
|
||||||
makeWrapper
|
makeWrapper
|
||||||
fennel
|
fennel
|
||||||
@ -65,7 +65,6 @@ in stdenv.mkDerivation {
|
|||||||
copyDesktopItems
|
copyDesktopItems
|
||||||
];
|
];
|
||||||
GIO_EXTRA_MODULES = [ "${glib-networking.out}/lib/gio/modules" ];
|
GIO_EXTRA_MODULES = [ "${glib-networking.out}/lib/gio/modules" ];
|
||||||
RXI_JSON="${rxi-json}/";
|
|
||||||
|
|
||||||
makeFlags = [ "PREFIX=${placeholder "out"}" "NAME=${pname}" ];
|
makeFlags = [ "PREFIX=${placeholder "out"}" "NAME=${pname}" ];
|
||||||
|
|
||||||
|
@ -4,6 +4,6 @@ in
|
|||||||
package.overrideAttrs(o: {
|
package.overrideAttrs(o: {
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export LUA_CPATH=$(lua -e "print(package.cpath)")
|
export LUA_CPATH=$(lua -e "print(package.cpath)")
|
||||||
export LUA_PATH=$(lua -e "print(package.path)")\;$RXI_JSON/share/lua/5.3/?.lua
|
export LUA_PATH=$(lua -e "print(package.path)")
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
(local req (require :http.request))
|
|
||||||
(local { : dict_to_query } (require :http.util))
|
|
||||||
(local json (require :json))
|
|
||||||
|
|
||||||
(import-macros { : define-tests : expect : expect= : expect-near } :assert)
|
|
||||||
(local { : view } (require :fennel))
|
|
||||||
|
|
||||||
|
|
||||||
(local
|
|
||||||
query
|
|
||||||
(->
|
|
||||||
[
|
|
||||||
"[bbox:30.618338,-96.323712,30.591028,-96.330826]"
|
|
||||||
"[out:json]"
|
|
||||||
"[timeout:90];"
|
|
||||||
"("
|
|
||||||
"way ("
|
|
||||||
"30.626917110746,"
|
|
||||||
"-96.348809105664,"
|
|
||||||
"30.634468750236,"
|
|
||||||
"-96.339893442898"
|
|
||||||
");"
|
|
||||||
");"
|
|
||||||
"out ;"
|
|
||||||
]
|
|
||||||
(table.concat "\n")))
|
|
||||||
|
|
||||||
(let [r
|
|
||||||
(req.new_from_uri
|
|
||||||
"https://overpass-api.de/api/interpreter")]
|
|
||||||
(tset r.headers ":method" "POST")
|
|
||||||
(r:set_body (dict_to_query { :data query }))
|
|
||||||
(let [(headers stream) (r:go)]
|
|
||||||
(print (view headers))
|
|
||||||
(print (view (json.decode (stream:get_body_as_string))))))
|
|
||||||
|
|
||||||
(fn sinh [x] (/ (- 1 (math.exp (* -2 x))) (* 2 (math.exp (- x)))))
|
|
||||||
|
|
||||||
(expect (< (math.abs (- (sinh 2) 3.626860407847)) 0.001))
|
|
||||||
|
|
||||||
(fn tile->latlon [xtile ytile zoom]
|
|
||||||
(let [n (^ 2 zoom)
|
|
||||||
lon-deg (- (/ (* xtile 360) n) 180.0)
|
|
||||||
lat-rad (math.atan
|
|
||||||
(sinh (* math.pi (- 1 (/ (* 2 ytile) n))))
|
|
||||||
)]
|
|
||||||
|
|
||||||
(values (/ (* lat-rad 180) math.pi) lon-deg)))
|
|
||||||
|
|
||||||
(let [(lat lon) (tile->latlon 0 0 0)]
|
|
||||||
(expect= lon -180)
|
|
||||||
(expect-near lat 85.05112877)
|
|
||||||
)
|
|
||||||
|
|
||||||
(let [(lat lon) (tile->latlon 232798 103246 18)]
|
|
||||||
(expect-near lon 139.699401855)
|
|
||||||
(expect-near lat 35.6595278648)
|
|
||||||
)
|
|
||||||
|
|
||||||
(fn latlon->tile [lat lon zoom]
|
|
||||||
(let [n (^ 2 zoom)
|
|
||||||
x (* n (/ (+ lon 180) 360))
|
|
||||||
t1 (/ (* lat math.pi) 180)
|
|
||||||
t (math.log (+ (math.tan t1) (/ 1 (math.cos t1))))
|
|
||||||
y (* (- 1 (/ t math.pi)) (/ n 2))]
|
|
||||||
(values x y)))
|
|
||||||
|
|
||||||
(let [(x y) (latlon->tile 52.1234 -0.53 17)]
|
|
||||||
(expect= (math.floor x) 65343)
|
|
||||||
(expect= (math.floor y) 43221))
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
fetchurl,
|
|
||||||
runCommand,
|
|
||||||
lua,
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
src = fetchurl {
|
|
||||||
url = "https://raw.githubusercontent.com/rxi/json.lua/11077824d7cfcd28a4b2f152518036b295e7e4ce/json.lua";
|
|
||||||
hash = "sha256-DqzNpX+rwDMHNt4l9Fz1iYIaQrXg/gLk4xJffcC/K34=";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
runCommand "json" { } ''
|
|
||||||
mkdir -p $out/share/lua/${lua.luaversion}/
|
|
||||||
cp ${src} $out/share/lua/${lua.luaversion}/json.lua
|
|
||||||
''
|
|
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
fetchurl,
|
|
||||||
runCommand,
|
|
||||||
lua,
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
src = fetchurl {
|
|
||||||
url = "https://raw.githubusercontent.com/rxi/json.lua/11077824d7cfcd28a4b2f152518036b295e7e4ce/json.lua";
|
|
||||||
hash = "sha256-DqzNpX+rwDMHNt4l9Fz1iYIaQrXg/gLk4xJffcC/K34=";
|
|
||||||
};
|
|
||||||
in runCommand "json" {} ''
|
|
||||||
mkdir -p $out/share/lua/${lua.luaversion}/
|
|
||||||
cp ${src} $out/share/lua/${lua.luaversion}/json.lua
|
|
||||||
'';
|
|
Loading…
Reference in New Issue
Block a user