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 #322

Closed
engali94 opened this issue Oct 29, 2024 · 1 comment · Fixed by #323
Closed

More realistic GPS simulation with consistent lateral offset #322

engali94 opened this issue Oct 29, 2024 · 1 comment · Fixed by #323

Comments

@engali94
Copy link
Contributor

More realistic GPS simulation with consistent lateral offset

Current Behavior

The current simulated location provider follows route coordinates exactly, which doesn't reflect real-world GPS behavior. This makes it difficult to properly test route-snapping and other location-based features under realistic conditions.

Proposed Changes

Add support for simulated GPS inaccuracy by implementing consistent lateral offset from the route line.

@engali94
Copy link
Contributor Author

engali94 commented Oct 29, 2024

Hello @ianthetechie @Archdoog

the idea of this is to add lateral jitter to the simulated location and give the user full control over it by
adding support for configurable GPS bias simulation through a type-safe enum:

pub enum LocationBias {
    Left(f64),  // meters offset to the left of route
    Right(f64), // meters offset to the right of route
    Random(f64), // randomly alternate between left/right with given radius
    None,       // exact route following (current behavior)
}

the end user would use it in this way:

let provider = SimulatedLocationProvider()
// Test left-biased GPS behavior (4 meters to the left)
try provider.setSimulatedRoute(route, resampleDistance: 10, bias: .left(4.0))

// Or test right-biased behavior
try provider.setSimulatedRoute(route, resampleDistance: 10, bias: .right(4.0))

// Or exact route following
try provider.setSimulatedRoute(route, resampleDistance: 10) // Default behavior bias: .none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant