diff --git a/boxxy/src/server.js b/boxxy/src/server.js index 96cd86f..0bf0e26 100644 --- a/boxxy/src/server.js +++ b/boxxy/src/server.js @@ -80,11 +80,6 @@ app.put('/ping', basicAuth, function(req, res) { }); app.put('/state', basicAuth, function(req, res) { - try { - req.body.teams['16'].name = "VRG"; - req.body.teams['19'].name = "Urgent.fm & Schamper"; - } catch(err) { - } console.log('PUT /state'); boxxyState.putState(req.body); res.send('OK'); diff --git a/count-von-count/.gitignore b/count-von-count/.gitignore index b1ab326..aae3f49 100644 --- a/count-von-count/.gitignore +++ b/count-von-count/.gitignore @@ -1,3 +1,6 @@ dist log *.db +.cabal-sandbox +cabal.sandbox.config +external_sources diff --git a/count-von-count/count-von-count.yaml b/count-von-count/count-von-count.yaml index 3827eb4..4746575 100644 --- a/count-von-count/count-von-count.yaml +++ b/count-von-count/count-von-count.yaml @@ -1,5 +1,5 @@ -circuitLength: 380 -maxSpeed: 12 +circuitLength: 306 +maxSpeed: 15 batonWatchdogLifespan: 30 @@ -9,10 +9,10 @@ ekgPort: 8001 log: log/count-von-count.log replayLog: log/replay.log -protocol: csv +protocol: gyrid boxxies: - - host: "127.0.0.1" + - host: "live.12urenloop.be" port: 8080 path: "" user: "count-von-count" diff --git a/count-von-count/scripts/teams2015.hs b/count-von-count/scripts/teams2015.hs index f0d23f1..1af268f 100644 --- a/count-von-count/scripts/teams2015.hs +++ b/count-von-count/scripts/teams2015.hs @@ -9,32 +9,32 @@ main = do db <- newDatabase "count-von-count.db" deleteAll db - addStation db "gyrid4" "00:01:95:0b:ac:02" 300 -- Marked 113 + addStation db "gyrid101" "00:24:01:eb:c2:68" 20 + addStation db "gyrid102" "00:21:91:f1:f1:39" 70 + addStation db "gyrid103" "00:21:91:f1:f1:33" 100 + addStation db "gyrid104" "00:01:95:0b:ac:02" 150 + addStation db "gyrid105" "00:01:95:0a:56:32" 290 + addStation db "gyrid106" "00:21:91:f1:ea:11" 320 - --addStation db "gyrid1" "00:1c:f0:f1:f8:25" 45 - --addStation db "gyrid2" "00:24:01:eb:c2:68" 120 - --addStation db "gyrid3" "00:1c:f0:6c:39:32" 190 - --addStation db "gyrid4" "00:21:91:f1:f1:33" 300 - --addStation db "gyrid6" "00:1c:f0:6c:39:3e" 280 - --addStation db "gyrid5" "00:24:01:eb:c2:65" 370 - - t1 <- addTeam db "KVHV" - t2 <- addTeam db "Kofschipclubs" - t3 <- addTeam db "Wetenschappen & VLAK" - t4 <- addTeam db "Blandinia" + t1 <- addTeam db "HILOK" + t2 <- addTeam db "VGK" + t3 <- addTeam db "VDK" + t4 <- addTeam db "VBK" t5 <- addTeam db "VEK" - t6 <- addTeam db "VLK" - t7 <- addTeam db "VTK" - t8 <- addTeam db "HILOK" - t9 <- addTeam db "VBK" - t10 <- addTeam db "VGK" + t6 <- addTeam db "Wetenschappen & VLAK" + t7 <- addTeam db "Veto, LILA, Hermes" + t8 <- addTeam db "Blandinia" + t9 <- addTeam db "VPPK" + t10 <- addTeam db "Moeder Lies" t11 <- addTeam db "Politeia" - t12 <- addTeam db "VPPK" - t13 <- addTeam db "Veto, Moeder Lies, LILA & Hermes" - t14 <- addTeam db "VRG & Farma" - t15 <- addTeam db "SeniorenKonvent" - t16 <- addTeam db "Home Konvent" - t17 <- addTeam db "Urgent & Schamper" + t12 <- addTeam db "Kofschipclubs" + t13 <- addTeam db "SK" + t14 <- addTeam db "HK" + t15 <- addTeam db "KVHV" + t16 <- addTeam db "VRG & Farma" + t17 <- addTeam db "VTK" + t18 <- addTeam db "VLK" + t19 <- addTeam db "Schamper" b1 <- addBaton db "20:13:01:24:11:15" "Baton A" b2 <- addBaton db "20:13:01:30:03:69" "Baton B" @@ -80,5 +80,9 @@ main = do setTeamBaton db t15 $ Just b15 setTeamBaton db t16 $ Just b16 setTeamBaton db t17 $ Just b17 + setTeamBaton db t18 $ Just b18 + setTeamBaton db t19 $ Just b19 + closeDatabase db + diff --git a/tools/analyse_cvclog.py b/tools/analyse_cvclog.py new file mode 100644 index 0000000..3094bca --- /dev/null +++ b/tools/analyse_cvclog.py @@ -0,0 +1,72 @@ + +""" +Anylyse the CVC log to generate some plots. This should actually be +done with the database to be correct. + +Argument: count-von-count.log +""" + +import numpy as np +import matplotlib.pyplot as plt +import itertools +import sys +import collections + +length = 380 +start = 9 # o'clock +now = 60 * 60 * 12 # how many seconds after the start the given log was taken + +def time_to_relative_secs(timestring): + hours, minutes, seconds = timestring.split(':') + return 60 * 60 * (int(hours) - start) + 60 * int(minutes) + int(seconds) + +lapcounts = dict() + +with open(sys.argv[1], 'r') as f: + for line in f: + + line = line.strip() + team = line.split(':')[-2][1:] + if team not in lapcounts: + # New team, let's make a new array for their points + lapcounts[team] = [] + + if "Lap for" in line: + lapcounts[line.split('for ')[-1]].append( + time_to_relative_secs(line.split(']')[0][1:])) + +# filtering non-teams +filteredcounts = dict() +for team, times in lapcounts.items(): + if times: filteredcounts[team] = times + +# prediction +for team, times in filteredcounts.items(): + current = len(times) + y = list(abs(current - now / t * i)) + for i, t in enumerate(times)) + plt.plot(times, y, label=team) +plt.show() +plt.clf() + +# laps in function of time +for team, times in sorted(filteredcounts.items(), key=lambda tup: -len(tup[1])): + times = np.array(times) + plt.plot(times, range(len(times)), label="{} ({})".format(team, len(times)), linestyle='solid') +plt.legend(loc='upper left') +plt.xlabel('time in seconds') +plt.ylabel('number of laps') +plt.show() +plt.clf() + +# laptime in function of time +for team, times in sorted(filteredcounts.items(), key=lambda tup: -len(tup[1])): + if team != 'VBK': continue # too cluttered for all + times = np.array(times) + plt.scatter(times[1:], times[1:] - times[:-1], label=team) +plt.legend(loc='upper left') +plt.xlabel('time in seconds') +plt.ylabel('time per lap') +plt.show() +plt.clf() + diff --git a/tools/boxxy.sh b/tools/boxxy.sh index 8699196..1aaeab7 100644 --- a/tools/boxxy.sh +++ b/tools/boxxy.sh @@ -1,6 +1,6 @@ send() { - curl -XPUT localhost:8080/state \ + curl -XPUT live.12urenloop.be:8080/state \ -H 'Content-Type: application/json' \ -u 'count-von-count:tetten' \ -d "$1"