Created
December 3, 2024 15:13
-
-
Save joaofig/26f24209c34f8aae209ea7d4d708cf47 to your computer and use it in GitHub Desktop.
Inserts the interpolated signals and derivatives in the database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def insert_dead_reckon(locations: List[DeadReckon]) -> None: | |
db = get_eved_db() | |
lat = np.array([p.latitude for p in locations]) | |
lon = np.array([p.longitude for p in locations]) | |
t = [p.t for p in locations] | |
signal_ids = [p.signal_id for p in locations] | |
x = np.append([0.0], | |
vec_haversine(lat[:-1], lon[:-1], | |
lat[1:], lon[1:])).cumsum() | |
speed = np.gradient(x, t) | |
accel = np.gradient(speed, t) | |
jerk = np.gradient(accel, t) | |
db.save_dead_reckoning(signal_ids, t, lat, lon, x, speed, accel, jerk) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment