SlotForum banner

Live(ish) race data to any mobile device

9531 Views 104 Replies 11 Participants Last post by  Martyn_
Following on from a discussion on a HO thread (and talking with Dave who produces RC) about people having to crowd round a single screen, I thought it should be trivial to publish the data so that everyone can look at a web page on their iPad, iPhone etc. So it wasn't trivial (and there is someway to go to tidy up the screens) but it only took 3 or 4 hours to get the prototype working with Race Coordinator.

Here's a bad photo of it working, the photo shows a race in progress, while the iPod shows data for all run heats upto that point.
http://www.slingshotx.byethost17.com/zenph...bupdate.JPG.php

So here's what you need.
A network enabled PC running Race Coordinator http://racecoordinator.net/
A Lightweight Web Server that is able to run PHP scripts, there are plenty of free ones available I used something called Resin http://www.caucho.com/download/resin-4.0.30.zip
My prototype php script below.

Edit the couple of lines at the top of the script for the location of your RC files.
Copy the script below called results.php to webapps directory of resin i.e. C:\Program Files\resin-4.0.30\webapps\ROOT
Start a race and browse to http://129.168.?.?:8080/results.php and at the end of every hit if you hit refresh you'll see basic data for all racers.

Couple of things:-
if you can't browse to http://129.168.?.?:8080 then it may be you need to open 8080 on your firewall (especiall Windows 7 users).
Some of the data I've grabbed is wrong.
The data is only updated once a heat has been completed (I don't see this as a problem, you want to checkyour lap times & result after your heat)
It's pretty basic, I'm hoping someone will take on the task of building some nice screens.
If there is no ongoing race it defaults to viewing the most recent race completed.

If people want this functionality then we can tidy it up make it configurable, maybe RC can optionally pubish live data i.e. after every lap for real live race data to your own device (anyone for live callouts into your own headphones of laptime, gap etc?).

It's pretty easy to setup, whilst I'm a software engineer I've never installed a Web Server before or written php, so shouldn't take a genuis to get it working, I'll help where I can.

Let me know what you think.

CODE

Results

<?php

// Things that may need changing at the top
// This is the RC folder to search for json files, it will vary depending on Windows 7 / xp
// Windows 7 it will be something like C:\ProgramData\Race Coordinator\saves on xp it will be
// C:\Documents and Settings\All Users\Application Data\Race Coordinator
$RCDataDir = findLatestFile("C:/Documents and Settings/All Users/Application Data/Race Coordinator");

// Setup an array of lane colours so each driver can tell what lane they were in rather than a number
$lane = array (1=>"Red", 2=>"Blue", 3=>"Green", 4=>"Yellow");

// Searches for the latest file in a directory
function findLatestFile($dirName)
{
$lastTime = 0;
$latestFileName = "";
foreach (glob($dirName) as $f)
{
if (filemtime($f) > $lastTime)
{
$lastTime = filemtime($f);
$latestFileName = $f;
}
}
return $latestFileName;
}

$latestFile = findLatestFile($RCDataDir . "/saves/*/*.json");

// If we didn't find anything in saves then use the stats and look for the last race completed
if ($latestFile == null)
{
$latestFile = findLatestFile($RCDataDir . "/stats/*/*.json");
}

// Load the json file up, and decode it into a PHP object
$Vdata = file_get_contents($latestFile);
$JsonObject = json_decode($Vdata);

// Loop around each driver that has raced
foreach ($JsonObject->config_->driverList_ as &$driver)
{
print("Driver ".$driver->driver_->name_."

");
printf("Best Lap %.2f

", $driver->bestLapTime_);
printf("Worst Lap %.2f

", $driver->worstLapTime_);

// Now get each heat the driver has been entered in
$ctr = 0;
foreach ($driver->heats_ as &$heat)
{
$ctr = $ctr + 1;
$position = $heat->finalPosition_ + 1;
print("

$lane[$ctr] - ");
printf ("Position %s - Laps %d - Avg Lap %.2f - Lap Times ", $position, $heat->finalValue_, $heat->avgLapTime_);

// Now get the time for every lap in this heat
foreach ($heat->lapTimes_ as &$lap)
{
printf("%.2f, ", $lap);
}

}
print ("

-----------------

");
}
?>
See less See more
1 - 20 of 105 Posts
Guys, a lot of this goes over my head, but it does highlight something I have half-joked about before.

OK, locking all the HO guys good at this stuff in a room would be extreme, but it would be great if Al, Andrew and slotx could actively work together, perhaps with Dave from Race Coordinator - because the end result could be something truly amazing.

Each of you has a lot to offer, but perhaps not the time or comprehensive knowledge needed alone. But in a pool?......
2
Dave - that is just the response I was hoping for, the bits I can understand anyway


We finally have a copy of RC installed where it will remain set-up all the time, as part of the huge track down in Kent, so as soon as possible we will be using it. Right now we are looking at live starts, so I'm trying to remember how RC applies them. Does it support one relay per lane for example?

In terms of the HONK room:



What we would love to be able to have is a small screen directly in front of the drivers with just the start lights showing. If we do go to live starts then this could even be placed right by the start line, which is directly below the rostrum and a little to the right. Why small? So far we place traditional monitors where we need them, but their size means we can't always do that exactly where we would like and/or end up blocking the view of part of the track.

To continue the HONK bucket list we would want two large monitors on the back wall, where the union flag is in the picture, one showing the race in progress, one showing the overall leaderboard. Further screens would be cool, but we are already up against the practical limit of what we can do with cables and extended desktops, which is why marrying what Diesel does to Race Coordinator would be so awesome for us.

If the data could also be sent to people phones and laptops etc, that too would be fantastic. From a purely selfish point of view I would love not to have to upload results to, and update points tables on, the EAHORC website. To go home and see all that has been done would be very nice.

Whilst we are throwing everything out there, a speed trap and sector timing would be brilliant, if the data can be gathered and added to the other data for each driver. The end result of all this would be a fully immersive experience for those who want it to be, but non-invasive for those who are not fussed by such things.

Diesel - That is your picture above, I hope you don't mind me using it?
See less See more
QUOTE (-Sy- @ 4 Sep 2012, 07:42) <{POST_SNAPBACK}>Unfortunately I had several other projects on the go too and I'm not great at managing multiple projects so it got shelved.

This is something the prevalence of which I have only recently come to comprehend. It seems to be a DNA thing, people who have the talent for stuff the rest of us have no idea about and the imagination to envisage really cool ways to use said stuff also seem to be unable to think in a linear way and focus accordingly.

It is not universal, but it is common.

One sees this all the time with resin casters in HO. Really mad skills, passion for a body which fades, a messy work area covered in started projects, and so on. End result? Two finished masters per year. If you are lucky.
Andrew - I'm just looking at this from and end-user's point of view, so a lot of technical stuff goes over my head.

But I do know, from that point of view, that the current RC leaderboard is one of it's very best features. This updates every time a car crosses the line, and when you get down to the last few heats that is awesome to watch. On a big screen at HONK I think it will be something else.
2
The graphs would be of interest to me as well.

In the 80s I used to love the ones published in Grand Prix International (remember that?), with sparkplug graphics and whatnot.

I did once create this:



From the Trackmate laptime data, using a online graph maker and some photoshop touches. It took way too long to make a habit of it though
See less See more
QUOTE (diesel @ 3 Sep 2012, 13:08) <{POST_SNAPBACK}>.

The minute you think Al's software is race ready then I'll give him a list of my requirements.

We just used it at national level for the first time, instead of Trackmate.
QUOTE (injectorman @ 5 Sep 2012, 11:58) <{POST_SNAPBACK}>.....Every club is different. If we did need to run a final it would be lane rotation as per normal, you don't get a choice.

Sorry to go off on a tangent, I think we can all handle it, why would you only sometimes need a final, and why would the drivers not get a lane choice?
At lots of what is being discussed here goes over my head, but I do think it is better to be ambitious and do as much as possible, and generate as much data as possible - just as with penicillin and elementary particles the applicable uses can come later.

I can testify that data in the ear can be fantastic. I have been coached via radio several times at the 24hr HO race, by the team captain, and found it very helpful. At HONK, where sector timing would be viable, it would be as close to real-time telemetry as we could get. For those who don't want it, simple, don't plug in.

As for data to phones, one has to think about the future. My oldest cousin is comfortable with email but struggles with everything newer, his grandchild does not even have an email address and if it does not come at her via some kind of app on her Android phone it may as well not exist. I'm not saying that this is good or bad, just that we need to be savvy to what is ahead. Again, if there are people who don't see the point of data-to-phone then they don't have to use it.

We have only recently had access to a permanent HO track, so we are still working through the potential of that. 95% of HO tracks ever built here last a day and a half. I have no trouble believeing that some of the guys would love to access all kinds of data for that track. At the moment what data there is has come from the EAHORC spreadsheets, and me going through those sheets to create bespoke ones by driver or by chassis etc. I'm not sure I would want to keep all that up-to-date forever, as I'm self-taught with excel and it all takes an age.

If each driver could access their own profile, with reams of data therein, I'm pretty confident many would do so.
See less See more
It is fairly common to have finals where the person who did best in the heats gets first pick. Else why have qualifying? In our races, and again this is common, there are too many of us to do a round robin so in effect you are racing the lanes to start with. In our case your best three lane scores over three minutes is your qualifying score, and then come step-up finals.

With segmented races, another common format, the most common thing is to have qualifying to seed you only, and then all your lanes scores are added together - if you are seeded in group 2 but get more laps than all those in the top group, you beat them. If time is an issue, and some segmented meets have huge fields, there is no seeding, it is done some other way (past results for example), but there are no finals. Round robin you race everyone (right?), so again there is no need for finals.

Obviously your format makes sense to you, but I'd need more detail to comprehend why you follow a type of segmented racing with finals, and why only sometimes. Just as there is (nearly) always a best lane there is usually a turd, and your original description makes it sounds as if the top guy after all the RR stuff could end up in it.
See less See more
That sounds good to this non-technical person.

I assume these ''web pages'' can be generated on a network such as Diesel does now down at the Worthing Club? Even if there is no internet connection?

On another topic, but RC-related, does it support sector timing and speed traps, and one-relay per lane?
Without having any technical background I think it is important that Dave does it his way, and then we will see what others can make of it.

Andrew - if you are going to have a run at this, and it sounds as if you are, perhaps it could have a snappy project name, just as the live timing did?
Looks cracking.

How does one go about getting the data onto your phone or device?
I'm getting a new Android phone on Monday, so the, hem hem, timing is good


Are you limited by range in any way? Can you save the data?
See less See more
So, if one assumes that there is nothing special to be done to one's phone/device, what has to be done to the RC software and the TM hardware to make this work?
I have one that stopped working, but that is it.

I take one does not have to set an account etc, the router is just ''hardware'' ?
Now that we are finally cracking on with using RC at HONK I'm keen to be able to build up driver profiles down there.

By saving the different EAHORC classes as 'races', one would be able to keep data for, say, Open Wheel and Nascar, seperated.

Once that is done it would be very cool to be able to access the performance of every driver on each lane etc, over several meetings.

I know there is a stats tab, but that shows stuff in the current race, right?
Right, but that is only stats for one meeting per sheet.

I'm more talking about stats per driver, across multiple meetings. In your case Marc's (for example) file for rally would show his best lap times/reaction times/scores etc by date
Sounds awesome.

Can we take it as a given that when EAHORC comes to Marlborough next all this stuff will be in use
?
See less See more
1 - 20 of 105 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top