wtg / shuttletracker

🚐 Shuttle tracking for RPI.
https://shuttles.rpi.edu
GNU Affero General Public License v3.0
46 stars 53 forks source link

Update Spoofing #284

Closed MattCzyr closed 4 years ago

MattCzyr commented 4 years ago

The update spoofing feature creates fake (spoofed) updates at regular intervals, simulating controlled shuttle movement rather than getting live updates from the data feed. This functionality allows features to be tested in a predictable, controlled environment, even when there are no shuttles running. The feature can be enabled in the configuration (conf.json).

The updates are read from JSON files in the spoof_data folder when the Shuttle Tracker starts. At regular intervals, as defined in the configuration (default 10s), a new update will be created for each vehicle. The spoof_data folder contains starter data that simulates three vehicles running full, standard laps around each route (north, south, and west). Each JSON file contains all the updates for one vehicle in a similar syntax to how updates appear in the /updates and /history endpoints. However, because vehicle IDs, route IDs, and tracker IDs vary depending on how the Shuttle Tracker installation is configured, the starter data needs to be edited to include these attributes before it can be used. The folder includes a Python script to automate the addition of vehicle, route, and tracker IDs to JSON files, as well as documentation on usage of the update spoofing feature.