Category Archives: Exercise

Garmin Forerunner 935

My trusty Garmin Forerunner 910xt has finally been put out to pasture, 2 years ago the barometric altimeter failed and I got it replaced with a refurbed version and over the last 3 months the power button has been getting harder and harder to push. My best guess is that the micro switch has lifted off of the board so it needs to be push at just the right angle to get it to line up with the contacts and actually activate.

My Fitbit HR had also given up the ghost as well in the last few months so I went looking for a replacement that would cover for both. I looked at both the Garmin 735 and the 935. Both do step counting and have a optical HR sensor in the back. Reviews of the HR sensor on the 735 were not so great and it was missing a barometric altimeter so that didn’t help it’s case. Wiggle were also doing a week of extra discount (17%) at the time as well which helped to bring the price of the 935 down to something slightly more sensible than list price.

So as you can guess by the title of this post I opted for the 935. It arrived this morning so I don’t have a lot to say about it just yet, but the first impressions are:

Garmin forerunner 935
Garmin forerunner 935
  • It’s a lot smaller than the 910xt and even a bit smaller than the Suunto Vector that I have been wearing as a day to day watch
  • It’s also lighter than I expected, I’m used to wearing something with a bit of heft (My first serious sailing watch was a Citizen Yatchmaster which was stainless steel, when I took it off my arm used to float) to it so this it will take a day or two to get used to how light it is.

A lot of the features need a bit of time to learn my training pattern and my day to day activity profile so I’ll give it a week to bed in and write some more about it, I’m also doing the London Tri next weekend so that will be a good chance to give it a proper workout.

Both the 735 and the 935 both support the 2 new HRM belts from Garmin that support recording HR data while swimming (the HRM-Tri and HRM-Swim), while I already have a ant+ HRM belt I’m seriously tempted by both of these (mainly for the geekiness) so I may have to grab one or both soon.

Contributing to OpenStreetMap

I had a day off on Monday, there were a couple of things I needed to get done and I just needed another day out of the office.

On the Sunday evening while working out what to do with the rest of the day I happened to be looking at the OpenStreetMap site for the area round my flat. I noticed that the latest set of roads for the second phase of the development hadn’t been included yet.

As it was
As it was

I use data from the OpenStreetMap project on my Garmin Edge 810 cycle computer to provide both maps and routing information (it’s free vs paying Garmin for map packages) so I really appreciate all the work that has gone into this project so I decided to have a look at how to contribute these new roads.

I knew that people tended to upload GPS data in the form of GPX files that then got used to build the maps. The best tool I had to record the GPS data was my Garmin Edge 810 so I decided to have a quick ride round the new roads.

Strava’s preview has dropped a lot of points, but the actual track looked more like this.

gpx trace

As well as using the 810 I put my Garmin Virb Camera on to record a video of the ride. I mainly did this to catch the street name signs so I could name things properly.

YouTube Preview Image

Signing up on the OpenStreetMap site was trivial, just fill in a username and email address, then click on the link in the email that was sent to verify the address. Now I had the option to upload the GPX file. From there I followed the instructions here and use the Potlatch 2 editor to overlay my GPX trace on the existing map. I then traced on the extension of Tinning Way and George Raymond Road and added Annealing Way. I need to go back over the video to double check the names of the other new roads so I can add them as well.

OpenStreetMap tiles get regenerated from time to time so after an hour or two my updates became visible to everybody else.

After adding new roads
After adding new roads

I’ll have to regenerate the maps for my Garmin Edge 810 sometime to see if it now directs me via these new roads when I set off on my next ride.

Openstreetmap Video overlays

So as I mentioned in my last post I’ve been playing with generating map overlays for the cycling videos I’ve been making while out training. I’d run into a rate limiting problem when using Google Maps static map API.

To work round this I thought I’d see what I could do using Openstreetmap. Openstreetmap doesn’t have a static image API so I’m going to try and build something similar using LeafletJS and a way to grab images of the pages generated.

<html>
<head>
	<title>Maps</title>
	<link type="text/css" href="leaflet.css" rel="stylesheet"/>
	<script type="application/javascript" src="leaflet.js"></script>
	<style >
	#map { 
		height: 250px; 
		width: 250px;
	}
	</style>
</head>
<body>
	<div id="map"/>
	<script type="application/javascript">
function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}

var args = getUrlVars();

var line = args["line"].split("|");

var last = line[(line.length - 1)];

var centre = [last.split(',')[0], last.split(',')[1]];

var map = L.map('map',{
	zoomControl: false,
	zoom: 15
});
map.setView(centre, 15);

L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', 
	{
		maxZoom: 20,
	}).addTo(map);

var latlngs = [];

for (var i=0; i<line.length; i++) {
	latlngs.push(L.latLng(line[i].split(',')[0],line[i].split(',')[1]));
}

var polyline = L.polyline(latlngs, {color: 'red'}).addTo(map);
	</script
</body>
</html>

This generates the map tiles and overlays the route, but it’s as a web page, now I needed a way to convert this into a PNG image. There are two options, html2canvas or PhantomJS. I decided to go with PhantomJS first. The following loads and renders the page and then generates a PNG image.

var page = require('webpage').create();
var system = require('system');


page.onConsoleMessage = function(msg, lineNum, sourceId) {
  //console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")');
};

page.viewportSize = {
  width: 265,
  height: 250
};

var url = "file:///opt/share/playing/map-overlay/index.html?" + system.args[1];

console.log(url);

page.open(url, function(){
  setTimeout(function() {	
    page.render(system.args[2]);
    phantom.exit();
  },500);
});

The coordinates for the line are passed in on the command line along with the file name to write the file to.

test

phantomjs --local-to-remote-url-access=true --max-disk-cache-size=1024 --disk-cache=true map.js [Path] [file name]

Running PhantomJS with the disk cache enabled should keep the load on the Openstreetmap servers to a minimum but I’m also looking at how easy it is to set up my own tile server.

I can now feed this in to the scripts I spun up last time.

YouTube Preview Image

DIY Video overlay

I got myself a Garmin Virb Elite in the post Christmas sales, the plan was to use it while riding my bike and when snowboarding.

The camera will shoot in full 1080p HD and has a super wide angle lens to grab loads of what’s going on.

I finally managed to get out on my bike at the weekend and remembered to hook the camera up so it was hung under the handle bars. The raw video looks pretty good.

Having got some video I wanted to overlay some of the stats from my Garmin 810 cycling computer like location, speed, elevation, gradient and heart rate. Garmin provide some software called Virb Edit which will do all this, unfortunately it only runs on Windows or OSx. No problem I thought, I’ll just throw it in the same Windows 7 VM I use for Garmin Express, the app I use to upload my workouts. This was going well until I tried to view one of the videos I’d just imported and it complained about not having DirectX 10 support. This is the bit of Windows that handles all the multimedia stuff and for video tends to need access to a GPU to accelerate things. While it is possible to get things like this to work with a VM it is a lot of work and requires the machine your using to have 2 graphics cards1.

Since the standard software wasn’t going to work I thought I’d have a go at trying to build some scripts to do this with Linux. I decided to start with a simple map overlay. I’ve played with Google Map’s static maps API before so I ran up some simple NodeJS code to read a TCX file I generated from the FIT file created by the camera.

var tcx = require('tcx-js');
var http = require('https');
var fs = require('fs');

var parser = new tcx.Parser();
parser.parse_file("test.tcx");

var tail = [];


parser.activity.trackpoints.every(function(element, index, array){
	
	var filename = index + '.png';
	var url = "https://maps.googleapis.com/maps/api/staticmap?center=" + element.lat + "," + element.lng + "&zoom=16&size=300x300";
	if (index != 0) {
		url = url + '&path=color:0x0000ff80|weight:2|' + tail.join('|');
	}
	console.log(url);


	 (function(uri,fn){
	 	http.get(uri, function(res){
	 		//console.log("statusCode: ", res.statusCode);
 //  			//console.log("headers: ", res.headers);
	 		var data = '';
	 		res.setEncoding('binary');
	 		res.on('data', function (chunk){
	 			data += chunk;
	 		});

	 		res.on('end', function(){
	 			fs.writeFile(fn, data, 'binary', function(err) {
	 				if (err) {
	 					console.log(err);
	 				}
	 			});
	 		});
	 	});	
	 })(url, filename);


	tail.push(element.lat + "," + element.lng);
	if (tail.length >= 25) {
		tail.shift();
	}

	if (index != (array.length-1)) {
		var now = new Date(element.time);
		var then = new Date(array[index +1].time);

		var diff = Math.abs((then.getTime() - now.getTime() ) / 1000);
		//console.log('%d', diff);
		for (var i=0; i<diff; i++) {
			fs.appendFile('list.txt',filename + '\n',function(err){});
		}
	}

	return true;
	
});

This worked pretty well until I hit Google’s rate limit so only got the first 100 map titles.

I used the ImageMagick scripts to build a composite image of the map tile on transparent background.

Create an empty 1920×1800 image with a transparent background

$ convert -size 1920x1080 xc:transparent background.png

Overlay the map title in the bottom right hand corner

$ composite -geometry 300x300+1520+700 1.png background.png scaled/1.png

The script also generates a file called list.txt which contains a list of the filenames and how many times to repeat them at 1 frame per second to match up with the orginal video. Using this list with mencoder to generate the video like this.

$ mencoder mf://@list.txt -mf w=1920:h=1080:fps=1:type=png -ovc copy -oac copy -o output.avi

Finally I used OpenShot to generate the composite video.

I’m going to have a look at using OpenStreetmap instead of Google Maps to avoid the rate limiting and also trying to generate some gauges for speed, cadence, altitude and heading.

1 The laptop I’m doing this on does actually have 2 graphics cards, but I’m using the better one to actually run the OS and it’s a royal pain to switch them round.

Wiggle Portsmouth Olympic Triathlon 2013

After doing the Blenheim Triathlon earlier in the year I’ve been looking have a go at something a bit further, so last weekend I did the Wiggle Portsmouth Olympic Distance Triathlon.

Olympic Triathlons are basically double all the distances of the Sprint version, so 1500m swim, 40km cycle and a 10k run.

I got round Blenheim in 1:30:02 (if I’d known I was that close, I’d have managed to sprint a little harder) so I was aiming to get round this course in sub 3 hours.

Swim 1500m

The swim was in the sea from down by Southsea Castle to the Pier. It was first sea swim and I was a bit concerned about waves and basically having my face stuck in salt water for about 30mins. The weather was pretty good and with no wind the water was totally flat. What I hadn’t really thought too much about was the tide, it was great on the 3 sides of the rectangle, just having to adjust a little as I crossed the short ends, but on the way back it was a hard slog. I stormed the first 1k in about 15mins, but the last 500m took 25mins.

Again Strava seams to be showing a strange time for the swim.

Time: 0:41:56

T1

I clocked this at 4:39 which includes the run up from the beach and I also didn’t hit the button until I’d been on the bike for about 200m so this was probably actually a bit quicker than Blenheim (4:25).

Cycle 40km

This was a really nice flat course with a long first lap up round the naval base followed by 4 laps round the sea front at Southsea. I pushed pretty hard on this leg and was pleased to average more than 30kph but was still getting passed by guys going a lot quicker on serious all carbon tri bikes.

Time: 1:16:12

T2

2:08 this time, which is about the same as Blenhiem(2:05)

Run 10km

The run was 2 laps of a loop the other way up the sea front from the cycle leg, again nice and flat apart from a really short climb up over the old defensive wall. I probably set off a little bit too quick as I had aimed for a 50min 10k and was doing 4:30 to 4:40 k’s early on, but I ended up with a total average of 4:55.

Time: 0:46:47

Total time 2:51:47

I came 176th out of 313 (including relay teams) and 46th in my age group. I was well under my 3 hour goal and I think if there had been no tide I could have taken nearly 10 more mins out of that as I can cover a 1500m in the pool in under 30mins.

One of the new challenges for this distance was working out how to take on food while on the move, as the research shows you can go for about 90mins on the reserves and carb loading before an event. I had tried a couple of flavours of gels the week before (I should have sorted this out a lot earlier) and not been too impressed with the black cherry or the chocolate orange. In the end I plumped for a lemon & lime flavoured one, I took the first one as I was starting the second lap on the bike along with a hand full of jelly babies. I saved the second one for while I was running the first lap.

I think I’m up for doing some more Sprint and Olympic distances, but I’m not mad enough to try a 70.3 or a Iron Man yet. Targets for the next Sprint is 1:15:00 and Olympic has to be 2:40:00 with a stretch of closer to 2:30:00

Blenheim Triathlon 2013

Last weekend I took part in the 2013 Blenheim Sprint Triathlon, it was my first full distance sprint with an open water swim. I had done 2 previous sprints but they had both had 400m pool based swims with no wet suites.

The first thing I’ll say is that the setting was amazing, from racking for transition in the court yard,

Racking in the court yard

To the view of the lake

Dragging the wetsuit on

To the riding and running round the grounds.

Swim 705m

I knew going in that the ride and the run wouldn’t be a problem and I knew I could cover the distance for the swim in a pool, but the mass deep water start did concern me a little and also trying to swim in a straight line with no rows of titles to follow. I was lead to expect the start would be a total washing machine of arms and legs everywhere, but actually wasn’t that bad. There was the odd finding a foot when reaching out and when rolling my head out to breath finding somebody right there that I couldn’t see though the murky water.

Time for the Swim: 14mins 15seconds.
I’m happy with that but think I’ll be able to improve on it for next time.

(Strava seams to have messed up the swim time for some reason)

T1

After the swim the 400m meter run up from the lake to transition was hard work while barefoot and trying to fight my way half out of the wetsuit. I wasted some time trying to get some socks on, but I needed them because my bike shoes are a just a bit too big to wear without them.

Time for T1: 4min 25seconds
They say transition is the 4th discipline and mine needs work.

Ride 20k

The cycle course was pretty good, it was made up of 3 laps with 2 decent climbs and lots of downhill. The only downside was because the foot bridge over the course had been hit by a bus on Friday night a compulsory dismount was added to each lap just before you got back to the palace. This messed with everybodies rhythm a bit and must have stuck a couple of mins on the time.

Time for Ride: 43mins 07seconds
I would have liked to have pushed this under 40mins

T2

A lot less to do this time, just needed to re-rack the bike, dump the helmet and swap the shoes

Time for T2: 2mins 17seconds
Again this needs to be a bit quicker, maybe some elastic laces will help.

Run 5.5k

The run starts with a evil climb over a foot bridge over the bike route. With the post ride jelly legs this is no fun at all as it’s pretty steep. Once that’s over it’s about 1k of flat before a steep down hill to round the other end of the lake

Time for Run: 25mins 59seconds
I know I can run this distance a lot quicker than this without the other 2 parts so I would like to get this down by a couple of mins as well.

Total Time: 1:30:02

I had a lot of fun doing it and I think with a little bit more work I can take a few minutes off all the legs and get it down to closer to 1:20 next year, but I’ve already starting thinking about the Olympic distance tri at Dorney Lake in September.

Man vs Horse

Today I did something a little different, instead of going to the local park to run 5km at Parkrun I set off to the New Forest to take part in a little event that Helen Bowyer had put together. The plan was to run 15km across the New Forest broken up in to 3 5km between pubs in a race against Helen on her horse Muttley. There where 7 runners from the ETS team, Me, James, Luke, Graham, Joe, Dominic and Peter also Rob on his road bike.

The runners and the Helen would be taking the same route with the runners getting a 10min head start on each leg. Rob had a route that was about twice as long and set off at the same time as Helen.

Leg 1

From The Rock at Canada Common to The Lamb at Nomansland. We set off across Canada Common from the back gate of The Rock, reasonably early on myself, James and Luke hit the front. Luckily Luke had run the route for this leg before so we didn’t have to do any looking at the map and managed to make our way to the Dealze Wood easily enough. We could probably have cut the corner a bit at the end and shaved some more time off. We had about a 5 min lead on Rob and another 3 over Helen (though she did have to detour a little to point Peter in the right direction).


View Leg 1 in a larger map

Leg 2

From The Lamb to The Royal Oak at Fritham. This was the shortest leg, but after a short climb through Bramshaw Wood it was across the open plain. The good view meant that Helen could see us and helped by the soft ground meant Muttley could go faster and caught us up with about 800m to go. Rob arrived pretty much at the same time as well.


View Leg 2 in a larger map

Leg 3

From The Royal Oak to The High Corner Inn. Jame, Luke and me hit the front again setting off, but the fact I’ve not been doing much more than 5ks recently really started to bite. I managed to stick with them both for the first half until we crossed the stream then we started to spread out. The spread ended up big enough that I lost site of Luke and James was long gone. I had a small nav failure at the bottom of the last climb up to the High Corner Inn, I think it was just my subconscious not wanting to climb, as I went past by about 400m and had to turn round and come back. Rob was first back this time.


View Leg 3 in a larger map

After we’ve finished we all went back to The Royal Oak for some lunch. It was a really good day out and I’m really up for having another go next year and maybe even have a look at the full marathon version at some point.

Triathlon time

I’ve gone and signed up for the Blenheim Palace triathlon in June 2013. There are a couple of guys from work who’ve signed up as well so there should be room for some healthy competition.

The training has already started, with cycling into work as many days as I can in the week. I’ve started to see an improvement in fitness already taking a massive 45 seconds off my 5k running PB on Saturday at the Southampton Parkrun getting under 21 mins(20:48).

I’m trying to work up a list of events for next year to see how I’m progressing, this years times are in the brackets:

  1. Eastleigh 10k – (44:32)
  2. Needles XC Half Marathon – (1:57:21)
  3. Isle of White Randonnee

I’m going to try and find some more to add as the year goes on as well.

I need to work on my swimming as my crawl still isn’t really anywhere near where it will need to be if I’m to make it anywhere near my target of somewhere around 1 hour 15 mins for the whole thing.

Tracks2Miles 1.1.14

Finally got round to spending some more time on Tracks2Miles.

This release is an attempt to make use of a lot of what is left of the API.

New features:

  1. New Workout types:
    • – Commute
    • – Spinning
    • – Rowing
    • – Cross Training
  2. Support for multi-media posts, Uploaded Images and links to Youtube and Vimeo are now shown in your timeline
  3. Like your friends workouts
  4. See when you get Motivational comments
  5. Added pull to refresh support to the timeline
  6. Slightly improved look and feel, the white background looks better

All that plus a couple of bugs I spotted along the way.

There is a new introduction video with a walk through of all the features

YouTube Preview Image

As always you can get the very latest version from the Android Market here: https://market.android.com/details?id=uk.me.hardill.dailymile

The next version should have better support for tablets and ICS devices that support Activity Fragments to make better use of large screens. I’ve also managed to arrange to borrow a Sony Ericsson X10 mini to see about trying to improve the UI for those of you with really small screen devices.

New My Tracks Patch

After my last My Tracks patch had to be pulled (to be honest it did break sharing routes by anything other than Tracks2Miles) a new (safe) patch was accepted a few days ago.

This patch passes just the My Tracks track id along with the URL for the exported file in the SHARE intent. The key for the extra reuses the same key that is used by the My Tracks library when sending Broadcasts on starting and stopping recording a new track. The track id can be recovered from the intent with the following code:

long track_id = 
    intent.getLongExtra(getString(R.string.track_id_broadcast_extra), -1);

Once you have the track id then looking up all the details of that track using the My Tracks Library project is trivial (Once you got the user to allow 3rd party apps access).

MyTracksProviderUtils utils = 
    new MyTracksProviderUtilsImpl(this.getContentResolver());
Track track = utils.getTrack(track_id);
TripStatistics stats = track.getStatistics();
double totalDistance = stats.getTotalDistance();
long movingTime = stats.getMovingTime();
String cat = track.getCategory();
String desc = track.getDescription();
long lastLocId = utils.getLastLocationId(track_id);
Location loc = utils.getLocation(lastLocId);

The latest version of Tracks2TitanXT has already been updated to use this method and Tracks2Miles will get an update for this as well as some better tablet support before the next version of My Tracks ships.