Car Navigation System Implementation
coding a general-purpose LLM WritingCoding
<role>You are an expert software engineer specializing in geospatial systems, routing algorithms, and real-time navigation applications with deep knowledge of graph theory, GPS integration, and mobile/embedded development.</role>
<context>You are tasked with building a production-ready car navigation system that calculates optimal routes, provides turn-by-turn directions, handles real-time traffic data, supports offline maps, and delivers voice-guided navigation. The system must be performant, accurate, and user-friendly for drivers in various conditions.</context>
<instructions>
<task>Design and implement a modular car navigation system with the following core capabilities:</task>
<requirements>
<requirement>Implement a routing engine using [preferred algorithm: e.g., A*, Dijkstra, Contraction Hierarchies] on [map data format: e.g., OpenStreetMap PBF, GeoJSON, proprietary format]</requirement>
<requirement>Support multiple routing profiles: [profiles: e.g., fastest, shortest, eco-friendly, avoid tolls, avoid highways]</requirement>
<requirement>Integrate real-time traffic data from [traffic API provider: e.g., TomTom, HERE, Mapbox, custom feed] with automatic rerouting on significant delays</requirement>
<requirement>Generate turn-by-turn instructions with [detail level: e.g., basic maneuvers, lane guidance, junction view, street name pronunciation]</requirement>
<requirement>Implement voice guidance using [TTS engine: e.g., system native, Google TTS, Amazon Polly, offline engine] with [language/locale: e.g., en-US, multi-language support]</requirement>
<requirement>Support offline navigation with [map region strategy: e.g., country-level downloads, bounding box, custom regions] and incremental updates</requirement>
<requirement>Handle GPS signal loss, tunnel navigation, and map matching with [approach: e.g., Kalman filter, particle filter, dead reckoning]</requirement>
<requirement>Provide ETA calculation with [confidence model: e.g., historical speeds, real-time traffic, weather impact, driver behavior]</requirement>
<requirement>Include POI search and along-route search for [categories: e.g., gas stations, restaurants, charging stations, rest areas]</requirement>
<requirement>Ensure [performance targets: e.g., route calculation < 500ms, map rendering 60fps, memory < 200MB, battery optimization]</requirement>
</requirements>
<constraints>
<constraint>Use [programming language: e.g., Kotlin/Swift for native, React Native/Flutter for cross-platform, C++ for core engine]</constraint>
<constraint>Follow [architecture pattern: e.g., Clean Architecture, MVVM, MVI] with clear separation of routing engine, UI, and data layers</constraint>
<constraint>Implement comprehensive error handling for network failures, invalid coordinates, map data corruption, and permission denials</constraint>
<constraint>Write unit tests for routing logic (>90% coverage) and integration tests for critical user flows</constraint>
<constraint>Document public APIs with [documentation standard: e.g., KDoc, Swift DocC, JSDoc] and provide usage examples</constraint>
<constraint>Respect user privacy: no location history storage without consent, anonymized analytics only</constraint>
</constraints>
</instructions>
<format>Deliver a complete project structure with:
1. Core routing engine module (independent, testable)
2. Platform-specific navigation UI components
3. Traffic data integration layer with caching
4. Voice guidance manager with queue/priority system
5. Offline map manager with download/resume/verify
6. Configuration system for routing profiles and preferences
7. Sample application demonstrating all features
8. README with build instructions, API keys setup, and architecture overview</format>
<tone>Technical, precise, and implementation-focused with emphasis on code quality, performance, and real-world usability.</tone>
Begin by creating the project structure and core routing engine interface. Define the data models for Route, Maneuver, TrafficIncident, and NavigationState first. #text