Working with car telemetry data including speed, throttle, braking, and position
Telemetry data provides detailed information about car performance throughout a session. FastF1 gives you access to channels like speed, RPM, throttle position, gear selection, and car position on track.
Telemetry data is stored in the Telemetry class, which extends pandas DataFrame with specialized methods for working with time-series racing data.
import fastf1session = fastf1.get_session(2023, 'Monaco', 'Q')session.load()# Get telemetry for a specific driverver_laps = session.laps.pick_drivers('VER')fastest_lap = ver_laps.pick_fastest()telemetry = fastest_lap.get_telemetry()print(telemetry.head())
# Get telemetry for one laplap = session.laps.pick_drivers('VER').pick_fastest()telemetry = lap.get_telemetry()print(f"Samples: {len(telemetry)}")print(f"Max speed: {telemetry['Speed'].max():.1f} km/h")
# Access raw car data by driver number (as string)ver_car_data = session.car_data['1'] # Verstappenham_car_data = session.car_data['44'] # Hamilton# Access raw position dataver_pos_data = session.pos_data['1']
import pandas as pd# Get telemetry from minute 10 to minute 15start = pd.Timedelta(minutes=10)end = pd.Timedelta(minutes=15)sliced = telemetry.slice_by_time(start, end)
telemetry = lap.get_telemetry()telemetry = telemetry.add_distance()# Now 'Distance' column is availableprint(f"Lap distance: {telemetry['Distance'].max():.0f} meters")
Distance is calculated by integrating speed over time. Integration error accumulates over long periods, so use this only for single laps or a few laps at a time.
Merges two telemetry objects with different time bases:
# Merge car data and position datacar_data = lap.get_car_data()pos_data = lap.get_pos_data()merged = car_data.merge_channels(pos_data)# Now has both car and position channelsprint(merged[['Speed', 'X', 'Y', 'Z']].head())
'original': Keep all timestamps from both sources (recommended)
int: Resample to specified frequency in Hz
None: Use Telemetry.TELEMETRY_FREQUENCY setting
Merging with frequency='original' is recommended. It preserves all original data points and only interpolates where necessary. Resampling to a fixed frequency interpolates most values, reducing accuracy.
Register custom channels for automatic interpolation:
from fastf1.core import Telemetry# Register a new continuous channelTelemetry.register_new_channel( name='MyCustomSpeed', signal_type='continuous', interpolation_method='linear')# Register a discrete channelTelemetry.register_new_channel( name='MyFlag', signal_type='discrete', interpolation_method=None)
Signal types:
'continuous': Speed, distance, etc. (requires interpolation method)
'discrete': Gear, DRS, flags, etc. (uses forward-fill)