Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/wasm-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ jobs:
- name: Build web library
run: just build-web

- name: Web unit tests
run: npm test -- --run
working-directory: web

- name: Build site
run: npm run build:site
working-directory: web
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if useLocalFramework {
path: "./common/target/ios/libferrostar-rs.xcframework"
)
} else {
let releaseTag = "0.53.0"
let releaseTag = "0.54.0"
let releaseChecksum = "b2f822b2599a625f0ba90a8256b36a1022b24525a642038d591be1be252a833c"
binaryTarget = .binaryTarget(
name: "ferrostarFFI",
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ext {

allprojects {
group = "com.stadiamaps.ferrostar"
version = "0.53.0"
version = "0.54.0"
}

// ktfmt-gradle 0.26 gates its Android source-set discovery on the `kotlin-android` plugin
Expand Down
13 changes: 13 additions & 0 deletions apple/Sources/UniFFI/ferrostar.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion common/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion common/ferrostar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ lints.workspace = true

[package]
name = "ferrostar"
version = "0.53.0"
version = "0.54.0"
readme = "README.md"
description = "The core of modern turn-by-turn navigation."
keywords = ["navigation", "routing", "valhalla", "osrm"]
Expand Down Expand Up @@ -63,6 +63,7 @@ wasm-bindgen-test = "0.3"
# Temp hack until proptest, tempfile, and uniffi upgrade to getrandom 0.4
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
getrandom = { version = "0.3", features = ["wasm_js"] }
js-sys = "0.3"

[lib]
crate-type = ["cdylib", "staticlib", "lib"]
10 changes: 7 additions & 3 deletions common/ferrostar/src/deviation_detection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,17 @@ pub enum RouteDeviationTracking {
/// No checks will be done, and we assume the user is always following the route.
None,
/// Detects deviation from the route using a configurable static distance threshold from the route line.
#[cfg_attr(feature = "wasm-bindgen", serde(rename_all = "camelCase"))]
#[serde(rename_all = "camelCase")]
StaticThreshold {
/// The minimum required horizontal accuracy of the user location, in meters.
/// Values larger than this will not trigger route deviation warnings.
#[serde(alias = "minimum_horizontal_accuracy")]
minimum_horizontal_accuracy: u16,
/// The maximum acceptable deviation from the route line, in meters.
///
/// If the distance between the reported location and the expected route line
/// is greater than this threshold, it will be flagged as an off route condition.
#[serde(alias = "max_acceptable_deviation")]
max_acceptable_deviation: f64,
},
// TODO: Standard variants that account for mode of travel. For example, `DefaultFor(modeOfTravel: ModeOfTravel)` with sensible defaults for walking, driving, cycling, etc.
Expand Down Expand Up @@ -146,17 +148,19 @@ pub enum DeviationKind {
///
/// This can happen when the user takes a shortcut, GPS noise places them on a future step,
/// or the route self-intersects. Step advance conditions can use this to limit advancement.
#[cfg_attr(feature = "wasm-bindgen", serde(rename_all = "camelCase"))]
#[serde(rename_all = "camelCase")]
OffStepOnRoute {
/// The deviation from the current step line, in meters.
#[serde(alias = "deviation_from_step_line")]
deviation_from_step_line: f64,
},
/// The user is off the expected route entirely
/// (not within threshold of any remaining step,
/// neither the current one nor any future one).
#[cfg_attr(feature = "wasm-bindgen", serde(rename_all = "camelCase"))]
#[serde(rename_all = "camelCase")]
CompletelyOffRoute {
/// The deviation from the route line, in meters.
#[serde(alias = "deviation_from_route_line")]
deviation_from_route_line: f64,
},
}
Expand Down
157 changes: 157 additions & 0 deletions common/ferrostar/src/fixtures/recording_canonical.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
{
"version": "0.53.0",
"initial_timestamp": 1000,
"config": {
"waypointAdvance": { "WaypointWithinRange": 10.0 },
"stepAdvanceCondition": {
"DistanceEntryExit": {
"distanceToEndOfStep": 20,
"distanceAfterEndStep": 5,
"minimumHorizontalAccuracy": 15,
"hasReachedEndOfCurrentStep": false
}
},
"arrivalStepAdvanceCondition": {
"DistanceToEndOfStep": {
"distance": 10,
"minimumHorizontalAccuracy": 15
}
},
"routeDeviationTracking": {
"StaticThreshold": {
"minimumHorizontalAccuracy": 15,
"maxAcceptableDeviation": 30.0
}
},
"snappedLocationCourseFiltering": "SnapToRoute"
},
"initial_route": {
"geometry": [{ "lat": 0.0, "lng": 0.0 }],
"bbox": {
"sw": { "lat": 0.0, "lng": 0.0 },
"ne": { "lat": 0.0, "lng": 0.0 }
},
"distance": 1.0,
"waypoints": [],
"steps": []
},
"events": [
{
"timestamp": 1003,
"event_data": {
"StateUpdate": {
"trip_state": {
"Navigating": {
"currentStepGeometryIndex": 0,
"userLocation": {
"coordinates": { "lat": 0.0, "lng": 0.0 },
"horizontalAccuracy": 3.0,
"courseOverGround": null,
"timestamp": 1234,
"speed": null
},
"snappedUserLocation": {
"coordinates": { "lat": 0.0, "lng": 0.0 },
"horizontalAccuracy": 3.0,
"courseOverGround": null,
"timestamp": 1234,
"speed": null
},
"remainingSteps": [
{
"geometry": [
{ "lat": 0.0, "lng": 0.0 },
{ "lat": 0.0, "lng": 0.001 }
],
"distance": 1.0,
"duration": 1.0,
"roadName": "Synthetic Street",
"exits": [],
"instruction": "Continue.",
"visualInstructions": [
{
"primaryContent": {
"text": "Synthetic Street",
"maneuverType": "continue",
"maneuverModifier": "straight",
"roundaboutExitDegrees": null,
"laneInfo": [
{
"active": true,
"directions": ["straight"],
"activeDirection": "straight"
}
],
"exitNumbers": []
},
"secondaryContent": null,
"subContent": null,
"triggerDistanceBeforeManeuver": 1.0
}
],
"spokenInstructions": [
{
"text": "Continue.",
"ssml": null,
"triggerDistanceBeforeManeuver": 1.0,
"utteranceId": "00000000-0000-0000-0000-000000000000"
}
],
"annotations": null,
"incidents": [
{
"id": "synthetic-incident",
"incidentType": "construction",
"description": "Synthetic incident",
"longDescription": null,
"creationTime": null,
"startTime": null,
"endTime": null,
"impact": "minor",
"lanesBlocked": ["left"],
"congestion": { "value": 5 },
"closed": false,
"geometryIndexStart": 0,
"geometryIndexEnd": 1,
"subType": null,
"subTypeDescription": null,
"iso31661Alpha2": null,
"iso31661Alpha3": null,
"affectedRoadNames": ["Synthetic Street"],
"bbox": null
}
],
"drivingSide": "right",
"roundaboutExitNumber": null
}
],
"remainingWaypoints": [],
"progress": {
"distanceToNextManeuver": 1.0,
"distanceRemaining": 1.0,
"durationRemaining": 1.0
},
"summary": {
"distanceTraveled": 0.0,
"snappedDistanceTraveled": 0.0,
"startedAt": "1970-01-01T00:00:01Z",
"endedAt": null
},
"deviation": {
"Deviation": {
"kind": {
"OffStepOnRoute": { "deviationFromStepLine": 1.5 }
}
}
},
"visualInstruction": null,
"spokenInstruction": null,
"annotationJson": "{}"
}
},
"step_advance_condition": "Manual"
}
}
}
]
}
Loading
Loading