Follow zoom closer in town (z18 up to 20 km/h, 15.5 at 120+, the first step z17); TODO: driver's and co-driver's views by whether Android Auto is connected
This commit is contained in:
1 parent
f161243c61
commit
258d35a7a1
2 files changed
+8
-3
No files matched your search
@@ -334,6 +334,11 @@ already reaches the home MQTT broker (`mqtt_ext`) from ESPHome nodes in `~/espho
|
|||||||
the car server's trip and position (`/api/trip`, `/api/gnss/position`); only the map and
|
the car server's trip and position (`/api/trip`, `/api/gnss/position`); only the map and
|
||||||
the next maneuver, planning stays on the web. Testable without the car: the tablet runs the
|
the next maneuver, planning stays on the web. Testable without the car: the tablet runs the
|
||||||
Android Auto head unit emulation (DHU)
|
Android Auto head unit emulation (DHU)
|
||||||
|
*** [ ] Views by who's driving off which screen: no Android Auto connected → the 16" display
|
||||||
|
shows the 3D follow view (heading-up, pitched) for the driver; Android Auto connected → it
|
||||||
|
streams the 3D navigation to the driver, and the co-driver's display stays 2D (north-up
|
||||||
|
overview, planning). Needs the app to report connected/disconnected to the server (e.g.
|
||||||
|
next to `/api/gnss/position`) and the driving view to switch on it
|
||||||
** [ ] A native Android app on Ferrostar (rerouting, Valhalla speed limits, TTS built in) over
|
** [ ] A native Android app on Ferrostar (rerouting, Valhalla speed limits, TTS built in) over
|
||||||
our Valhalla (`format: osrm`) — only if navigation is wanted on a phone outside the car; the
|
our Valhalla (`format: osrm`) — only if navigation is wanted on a phone outside the car; the
|
||||||
car's 16" display is the Pi's browser either way. Ferrostar's web components are beta: no
|
car's 16" display is the Pi's browser either way. Ferrostar's web components are beta: no
|
||||||
|
|||||||
+3
-3
@@ -74,7 +74,7 @@ export function resumeFollow(map) {
|
|||||||
// The first step of a follow (or a jump after a gap): zoom in to see the
|
// The first step of a follow (or a jump after a gap): zoom in to see the
|
||||||
// road ahead. easeTo, not flyTo — flyTo's swoop zooms out over the distance
|
// road ahead. easeTo, not flyTo — flyTo's swoop zooms out over the distance
|
||||||
// first, the wrong way when starting to drive.
|
// first, the wrong way when starting to drive.
|
||||||
export const FOLLOW_ZOOM = 16;
|
export const FOLLOW_ZOOM = 17;
|
||||||
export function startFollow(map, lngLat) {
|
export function startFollow(map, lngLat) {
|
||||||
map.easeTo({ center: lngLat, zoom: Math.max(map.getZoom(), FOLLOW_ZOOM), duration: 1000 });
|
map.easeTo({ center: lngLat, zoom: Math.max(map.getZoom(), FOLLOW_ZOOM), duration: 1000 });
|
||||||
}
|
}
|
||||||
@@ -102,11 +102,11 @@ export function followPosition(map, lngLat, heading, speed, duration) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Auto-zoom like a car navigation: close in town, farther out the faster
|
// Auto-zoom like a car navigation: close in town, farther out the faster
|
||||||
// (0 km/h z17, 50 z16.2, 90 z15.6, 130+ z15). Eased toward that by at most
|
// (up to 20 km/h z18, 50 z17.3, 90 z16.3, 120+ z15.6). Eased toward that by at most
|
||||||
// 0.15 a fix and ignored within 0.25, so speed jitter doesn't pump the map.
|
// 0.15 a fix and ignored within 0.25, so speed jitter doesn't pump the map.
|
||||||
// A hand zoom pauses the follow; on resuming it eases back.
|
// A hand zoom pauses the follow; on resuming it eases back.
|
||||||
export function autoZoom(current, speed) {
|
export function autoZoom(current, speed) {
|
||||||
const target = Math.min(17, Math.max(15, 17 - speed * 3.6 * 0.0154));
|
const target = Math.max(15.5, 18 - Math.max(0, speed * 3.6 - 20) * 0.024);
|
||||||
const diff = target - current;
|
const diff = target - current;
|
||||||
if (Math.abs(diff) < 0.25) return null;
|
if (Math.abs(diff) < 0.25) return null;
|
||||||
return current + Math.sign(diff) * Math.min(Math.abs(diff), 0.15);
|
return current + Math.sign(diff) * Math.min(Math.abs(diff), 0.15);
|
||||||
|
|||||||
Reference in new issue
Block a user