Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More realistic GPS simulation with consistent lateral offset #323

Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
build:
runs-on: macos-14
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-android-build
cancel-in-progress: true
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:

test:

runs-on: macos-14
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-android-test
cancel-in-progress: true
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:

verify-snapshots:

runs-on: macos-14
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-android-snapshots
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/typos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
uses: actions/checkout@v4

- name: Run typos
uses: crate-ci/typos@v1.26.0
uses: crate-ci/typos@master
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import kotlinx.coroutines.launch
import uniffi.ferrostar.CourseOverGround
import uniffi.ferrostar.GeographicCoordinate
import uniffi.ferrostar.Heading
import uniffi.ferrostar.LocationBias
import uniffi.ferrostar.LocationSimulationState
import uniffi.ferrostar.Route
import uniffi.ferrostar.Speed
Expand Down Expand Up @@ -168,8 +169,8 @@ class SimulatedLocationProvider : LocationProvider {
}
}

fun setSimulatedRoute(route: Route) {
simulationState = locationSimulationFromRoute(route, resampleDistance = 10.0)
fun setSimulatedRoute(route: Route, bias: LocationBias = LocationBias.None) {
simulationState = locationSimulationFromRoute(route, resampleDistance = 10.0, bias)
lastLocation = simulationState?.currentLocation

if (listeners.isNotEmpty() && simulationJob?.isActive != true) {
Expand Down
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
Expand Down
12 changes: 10 additions & 2 deletions apple/Sources/FerrostarCore/Location.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,16 @@ public class SimulatedLocationProvider: LocationProviding, ObservableObject {
lastLocation = location
}

public func setSimulatedRoute(_ route: Route, resampleDistance: Double = 10) throws {
simulationState = try locationSimulationFromRoute(route: route, resampleDistance: resampleDistance)
public func setSimulatedRoute(
_ route: Route,
resampleDistance: Double = 10,
bias: LocationBias = .none
) throws {
simulationState = try locationSimulationFromRoute(
route: route,
resampleDistance: resampleDistance,
bias: bias
)
lastLocation = simulationState?.currentLocation
}

Expand Down
132 changes: 117 additions & 15 deletions apple/Sources/UniFFI/ferrostar.swift

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

1 change: 1 addition & 0 deletions common/Cargo.lock

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

1 change: 1 addition & 0 deletions common/ferrostar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ wasm_js = [
[dependencies]
geo = "0.29.0"
polyline = "0.11.0"
rand = "0.8.5"
serde = { version = "1.0.210", features = ["derive"] }
serde_json = { version = "1.0.128", default-features = false }
serde-wasm-bindgen = { version = "0.6.5", optional = true }
Expand Down
Loading
Loading