Skip to content

Commit 060b1d6

Browse files
committed
refactor: Update launch config, publish scripts, and telemetry analyzers
1 parent dcbf462 commit 060b1d6

File tree

5 files changed

+25
-20
lines changed

5 files changed

+25
-20
lines changed

.vscode/launch.json

+7-8
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@
2020
"justMyCode": false,
2121
"args": [
2222
"analyze",
23-
"--streaming",
24-
"--session-ids", "1718124083"
23+
// "--streaming",
24+
// "--session-ids", "1718124083"
2525
// "--game", "Assetto Corsa (64 bit)",
26-
// "--game",
27-
// "Richard Burns Rally",
28-
// "--game", "iRacing",
26+
// "--game", "Richard Burns Rally",
27+
"--game", "iRacing",
2928
// "--game", "rFactor 2 (64 bit)",
3029
// "--game", "rFactor",
31-
// "--track", "algarve:",
30+
"--track", "jerez moto",
3231
// "--track", "brandshatch grandprix",
3332
// "--track", "fiveflags",
3433
// "--track", "fuji nochicane",
@@ -42,8 +41,8 @@
4241
// "--track", "spa up",
4342
// "--track", "Daytona International Speedway",
4443
// "--track", "East-West",
45-
// "--track", "Outer",
46-
// "--car", "Mitsubishi Lancer Evo X R4"
44+
// "--track", "The Legend",
45+
"--car", "Super Formula SF23 - Honda"
4746
// "--car", "Chevrolet Monte Carlo SS"
4847
// "--car", "Chevrolet National Impala"
4948
// "--car", "Dallara F312 F3"

scripts/publish.sh

+5-8
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,16 @@ fi
1717
# create a random distance round track
1818
DISTANCE_ROUND_TRACK=$(shuf -i 0-10000 -n 1)
1919

20-
TOPIC="crewchief/durandom/1669233999/iRacing/sebring international/Ferrari 488 GT3 Evo 2021/Race"
21-
T='{"CarModel": "Ferrari 488 GT3 Evo 2020", "GameName": "iRacing", "SessionId": "1669233672", "SessionTypeName": "Race", "TrackCode": "sebring international", "Brake": 0.0, "Clutch": 1.0, "CurrentLap": 1.0, "CurrentLapTime": 0.0, "DistanceRoundTrack": 5564.84961, "Gear": 3.0, "Handbrake": 0.0, "Rpms": 0.0, "SpeedMs": 46.2075653, "SteeringAngle": -0.232568219, "Throttle": 0.995530248}'
22-
2320
# TOPIC="crewchief/goern/1689266594/Automobilista 2/Taruma:Taruma_Internacional/Formula Vee/Qualify"
2421
# T='{"time": '$TIMESTAMP', "telemetry": {"Clutch":0.0,"Brake":1.0,"Throttle":0.0,"Handbrake":0.0,"SteeringAngle":-0.0103,"Rpms":0.0,"Gear":0,"SpeedMs":0.0,"DistanceRoundTrack":'$DISTANCE_ROUND_TRACK',"WorldPosition_x":37.7886124,"WorldPosition_y":1.904185,"WorldPosition_z":-204.916718,"CurrentLap":1,"CurrentLapTime":-3.0,"LapTimePrevious":-1.0,"CurrentLapIsValid":false,"PreviousLapWasValid":true,"CarClass":"F_VEE"}}'
2522

26-
# TOPIC="replay/crewchief/durandom/1689266594/Richard Burns Rally/Sardian Night/Renault Clio 16S Williams GrpA/Race"
27-
# T='{"time": '$TIMESTAMP', "telemetry": {"Clutch":0.0,"Brake":1.0,"Throttle":0.0,"Handbrake":0.0,"SteeringAngle":-0.0103,"Rpms":0.0,"Gear":0,"SpeedMs":0.0,"DistanceRoundTrack":'$DISTANCE_ROUND_TRACK',"WorldPosition_x":37.7886124,"WorldPosition_y":1.904185,"WorldPosition_z":-204.916718,"CurrentLap":1,"CurrentLapTime":-3.0,"LapTimePrevious":-1.0,"CurrentLapIsValid":false,"PreviousLapWasValid":true,"CarClass":"F_VEE"}}'
23+
TOPIC="replay/crewchief/durandom/1689266594/Richard Burns Rally/Sardian Night/Renault Clio 16S Williams GrpA/Race"
24+
T='{"time": '$TIMESTAMP', "telemetry": {"Clutch":0.0,"Brake":1.0,"Throttle":0.0,"Handbrake":0.0,"SteeringAngle":-0.0103,"Rpms":0.0,"Gear":0,"SpeedMs":0.0,"DistanceRoundTrack":'$DISTANCE_ROUND_TRACK',"WorldPosition_x":37.7886124,"WorldPosition_y":1.904185,"WorldPosition_z":-204.916718,"CurrentLap":1,"CurrentLapTime":-3.0,"LapTimePrevious":-1.0,"CurrentLapIsValid":false,"PreviousLapWasValid":true,"CarClass":"F_VEE"}}'
2825

2926
# # New Session
30-
# TOPIC="replay/crewchief/durandom/1689266594/Richard Burns Rally/Sardian Night/Renault Clio 16S Williams GrpA/NewSession"
31-
# TOPIC="crewchief/durandom/1689266594/Richard Burns Rally/Sardian Night/Renault Clio 16S Williams GrpA/NewSession"
32-
# T='{"time": '$TIMESTAMP', "telemetry": {"Clutch":0.0,"Brake":1.0,"Throttle":0.0,"Handbrake":0.0,"SteeringAngle":-0.0103,"Rpms":0.0,"Gear":0,"SpeedMs":0.0,"DistanceRoundTrack":'$DISTANCE_ROUND_TRACK',"WorldPosition_x":37.7886124,"WorldPosition_y":1.904185,"WorldPosition_z":-204.916718,"CurrentLap":1,"CurrentLapTime":-3.0,"LapTimePrevious":-1.0,"CurrentLapIsValid":false,"PreviousLapWasValid":true,"CarClass":"F_VEE"}}'
27+
TOPIC="replay/crewchief/durandom/1689266594/Richard Burns Rally/Sardian Night/Renault Clio 16S Williams GrpA/NewSession"
28+
TOPIC="crewchief/durandom/1689266594/Richard Burns Rally/Sardian Night/Renault Clio 16S Williams GrpA/NewSession"
29+
T='{"time": '$TIMESTAMP', "telemetry": {"Clutch":0.0,"Brake":1.0,"Throttle":0.0,"Handbrake":0.0,"SteeringAngle":-0.0103,"Rpms":0.0,"Gear":0,"SpeedMs":0.0,"DistanceRoundTrack":'$DISTANCE_ROUND_TRACK',"WorldPosition_x":37.7886124,"WorldPosition_y":1.904185,"WorldPosition_z":-204.916718,"CurrentLap":1,"CurrentLapTime":-3.0,"LapTimePrevious":-1.0,"CurrentLapIsValid":false,"PreviousLapWasValid":true,"CarClass":"F_VEE"}}'
3330

3431
# TOPIC="crewchief/Jim/1689266594/Automobilista 2/Taruma:Taruma_Internacional/Formula Vee/Qualify"
3532
# T='{"time": '$TIMESTAMP', "telemetry": {"Clutch":0.0,"Brake":1.0,"Throttle":0.0,"Handbrake":0.0,"SteeringAngle":-0.0103,"Rpms":0.0,"Gear":0,"SpeedMs":0.0,"DistanceRoundTrack":0.0,"WorldPosition_x":37.7886124,"WorldPosition_y":1.904185,"WorldPosition_z":-204.916718,"CurrentLap":1,"CurrentLapTime":-3.0,"LapTimePrevious":-1.0,"CurrentLapIsValid":false,"PreviousLapWasValid":true,"CarClass":"F_VEE"}}'

scripts/publish_response.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ T='{"message": "https://www.mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Sampl
1414
T='{"message": "https://gitlab.com/mr_belowski/CrewChiefV4/-/raw/master/CrewChiefV4/sounds/driver_names/Ek.wav?inline=false", "priority": 9}'
1515
T='{"message": "https://github.com/durandom/racing-assets/raw/main/speech.mp3", "priority": 9}'
1616
T='{"message": "https://github.com/durandom/racing-assets/raw/main/speech.mp3", "priority": 9, "immediate": true}'
17-
# T='{"message": "brake normal gear 2", "priority": 9}'
17+
T='{"message": "brake normal gear 2", "priority": 9, "immediate": true}'
1818
# T='{"message": "brake normal gear 2", "priority": 9, "distance": 31}'
1919

2020
# Setup MQTT connection parameters

telemetry/analyzer.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ def split_sectors(
6363
one_sector = [
6464
{"start": 0, "end": max_distance, "length": max_distance},
6565
]
66-
if len(start) == 0:
67-
logging.error(f"No sectors found threshold: {threshold} min_length: {min_length_throttle_below_threshold}")
66+
67+
# Return one sector if we don't have valid start/end points
68+
if len(start) == 0 or len(end) == 0:
69+
logging.error(f"No valid sectors found - threshold: {threshold} min_length: {min_length_throttle_below_threshold}")
6870
return one_sector
6971

7072
# FIXME: not sure why this is needed

telemetry/fast_lap_analyzer.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,18 @@ def similar_sectors(self, sectors_a, sectors_b):
8686

8787
def extract_sectors(self, lap_data):
8888
df_max = self.analyzer.combine_max_throttle(lap_data)
89-
if df_max is None:
89+
if df_max is None or df_max.empty:
90+
logging.error("No valid data for sector extraction")
9091
return None, None
92+
9193
sector_start_end = self.analyzer.split_sectors(
9294
df_max, min_distance_between_sectors=35, min_length_throttle_below_threshold=20
9395
)
96+
97+
if not sector_start_end or len(sector_start_end) == 0:
98+
logging.error("No sectors found during extraction")
99+
return None, None
100+
94101
return sector_start_end, df_max
95102

96103
def fastest_sector(self, data_frames, start, end):

0 commit comments

Comments
 (0)