Thursday, November 30, 2017

An Accurate GPS for $20?

This is a somewhat geeky post. However, if you've thought about using a GPS when windsurfing in the past, you might find it of interest.

Currently, the only "officially approved" GPS that the Locosys GW-60 watch. But the GW-60 has some issues, one of them being the price of about $250.

So - what if we could use something simple and cheap like this:
Here's what you see in the picture:

  1. A Samsung Galaxy J3 Luna Pro phone running Android. I bought it for $30 at Best Buy. 
  2. A USB GPS dongle with a U-blox 7 chip that I bought for $15 from Amazon (like this one).
  3. A USB "On-The-Go" cable for about $5 (like this one) to connect the dongle to the phone (note that the phone must support USB OTG - not all phones do!).
I'm also running the GPSLogit app, which costs about $17. But I had that already, and in the future, there probably will be other free apps that can be used. Similarly, if you already have an Android phone that supports USB OTG (also call "USB Host mode"), you could use that - hence the $20.

For the picture above, I used the free app GNSS Commander to read the data from the USB dongle, and provide them as "mock locations" to GPSLogit. After a successful initial test walk and drive,  I put the entire setup in a ziplock bag and then into a water proof armband, and then went windsurfing. For comparison, I also used a GW-60 watch. Here are the tracks:
The data from the dongle are in red, from the GW-60 in blue. Not a lot of difference! That's a promising start.

The setup above has a few issues, though - the biggest one being that we loose the accuracy data from the GPS chip in the dongle somewhere along the way. The U-blox GPS chips are exceptional in that they provide error estimates for doppler speeds; such error estimates (often call "SDoP") are essential to automatically identify artifacts in the GPS data (like Nina's recent 2 second top speed of 55 knots).

Since the GPS chip in the USB dongle can provide speed error estimates, a bit of hacking was required. I started with some public domain software for USB communication on Android, and quickly got it to read the dongle data. I used the u-center software on Windows to tell the dongle that is should send out data in the format that includes the speed accuracy data (using "ubx" instead of "NMEA" messages); while there, I also told it to send data at a higher rate (5 Hz like the GW-60, instead of the default 1 Hz). The hacked app simply reads the data, shows them on the screen to show it's busy, and write them to a "ubx" file.

Now, a test drive was in order. On the phone, I recorded the GPS data from the dongle with my hacked app, and also had GPSLogit record data from the phone's GPS chip. The speech function in GPSLogit also was on, and told me how fast I was going every 2 seconds. For comparison, I used a GW-60 watch.

Looking at the results back home turned out to be a bit more difficult. My favorite program, GPS Action Replay, is a bit buggy when it comes to reading ubx files, and got the date wrong by about a week. It also did not read the accuracy data correctly. In the alternative program, GPSResults, the accuracy data were displayed correctly, but the speed analysis did not work well, since the dongle data had a lot of missing data points (the distance between 2 points sometimes was 0.4 seconds instead of 0.2 seconds). Since GPSResults is super-strict, it refuses to use any section with missing points for top speeds. However, we a visual comparison of the data shows some interesting trends:
The picture above shows that the speeds from the GW-60 and the USB dongle were very close to each other most of the time. The data from the phone's GPS are often similar, but show a pronounce lag of about 2 seconds every time the speed goes up. I actually noticed that when driving - the speed announcements from the phone alway seemed to lag behind, even after taking some unavoidable lag between the speed measurement and the announcement into account. The cause of the lag is most likely a filter in the phone's GPS firmware. In the example above, the effect is that the phone GPS often understated the peak speed at the end of an acceleration by 1 - 2 km/h. For use outside of competitions, the phone GPS was sufficiently adequate; however, the delay in reporting acceleration might be somewhat detrimental when you want to fine-tune your stance in speed runs.

These first results are encouraging. Obviously, a lot more tests in "real-world" windsurfing conditions are necessary. Even before that, I'll need to look into the cause of the missing data points - it could be something as simple as the phone being to busy dumping data onto the screen, or announcing speeds. Worst case scenario would be to use the dongle at 1 Hz, where missing data points are much less likely.

One of the cool things about using phones for GPS speedsurfing is that they have large displays, sound output, and plenty of memory and processing power. That means you can see and hear your speed while your sailing, and get numbers in categories like alpha 500, nautical mile, and one hour where the GW-60 simply does not have enough "brains" to calculate the results on the fly. Even if you have to buy a phone at a non-sales price (closer to $70 or so), you'll end up with a cheaper and more powerful, albeit perhaps less convenient, solution.  That may require that apps like GPSLogit or Windsport Tracker will support the GPS dongles directly - but if not, app development on Android is pretty easy. With the accuracy data from the u-blox GPS chips, the results should even be useful for competitions like the GPS Team Challenge.

Monday, November 27, 2017

Harness Lines for Catapults

I was lucky today - my harness lines broke:
Usually, I hate it when harness lines break, but I'll make an exception today - they broke in a catapult. I sailed the same spot as yesterday (Barnstable Harbor), and foolishly believed that the water depth would be similar. I started sailing half an hour later than yesterday, that should account for low tide being a bit later, right? Wrong! Half a foot less water is the difference between not even touching the ground and stopping quickly when the fin hits the sand.
I was not sailing very fast, but the dive over the handle bar was abrupt enough for something to break. If the boom breaks, it gets expensive - about $700 for a new carbon boom. If the sail breaks, Nina will not be happy - and she already has to fix my 4.7. If the harness lines break, it's simple and cheap. We Germans have a word for that: Sollbruchstelle.

I had actually switched to adjustable harness lines several years ago when I read that adjustable lines break in catapults. Over time, I have broken a few booms and sails in catapults when hitting shallow spots - when the board stops but you keep going, something has to break! But the lines I used back then never worked well for me. Last year, though, when Nina and I started sharing booms again for some of our larger race sails, we started using Chinook Race Harness Lines. They cost about twice as much as fixed harness lines, but can easily be adjusted while sailing; are easy to hook into; and have replaceable parts, so that the cost over time can actually be lower than for other harness lines. These were the kind of lines I used today, and they broke when they were supposed to break. I must say, I am very happy about that.

The rest of today's session was interesting, too. Yesterday's session had been nice, and today's setup looked almost identical - just a couple of degrees colder, and a maybe a couple of miles more wind - but the closest wind meter at Chapin never reads accurately. I used the same gear as yesterday, only switching to a different pair of open-palm mittens. Well, these left my fingers a bit cold, and the spots that had been nice and flat yesterday either we're as flat today, or just a bit too shallow. But I was very nicely powered the entire time on my 7.0 ... at times, a bit too nicely. And then, the wind picked up. I found myself sailing at 24 knots when I really wanted to go slow, and decided to call it a day. That required a couple of downwind runs through the choppier parts. Too choppy, it turned out, when I hit a 2 or 3 foot steep ramp at 26 knots, and ended up in the water again. I thought the crash was somewhat controlled and that I hit the water, but either the water was harder than I thought it would be, or I hit the mast after all - my ribs are still hurting a bit.

After that, it was time for a little swim to get back to my gear. The waves were having fun playing with my board and pulling it out of my reach, but I eventually caught up with it. The GPS says it was just a 3-minute swim, but it felt a longer... or perhaps I'm still confused and am thinking about how long it took me to get the 7 m race sail out of the water again. There had been plenty of time for the mast sleeve to fill up, and pushing the tip up high enough so that it would stay about the waves was a tad of a challenge. But eventually, I made it back to shore, where a guy who had watched me commented that I had looked in control - how funny!

Monday, November 20, 2017

Cold and Windy

It's been windy a lot. And cold. Here's a picture from last Friday:
I sailed from Indian Neck Beach in Wellfleet Harbor. Nina had come along, but since it was cold, windier than predicted (33 mph gusting to low 40s), and bumpy, she stayed on shore. I can't blame her - temperatures were a little above 40ºF, but it felt rather cold. Maybe we have gotten spoiled by too many warm days up to now.

I used my Ianovated suit with an extra neoprene layer below, so I stayed nice and warm. This was the first session where I really needed mittens. I had brought a three different pairs of open-palm mittens, but the first pair I tried had only thin fabric on the inside of the fingertips. Not yet being used to cold-weather surfing again, my fingertips complained bitterly. No problem, I thought, and grabbed another pair that had neoprene covering the fingertips. That was much warmer ... but unfortunately, the mittens were too big, so my fingers slipped out a lot. Not a bit deal when taking short runs near shore, but the fin in Wellfleet Harbor is that you can take 3 mile long runs to the peninsula on the other side. I only went halfway before my inner chicken pointed out that going too far while all alone on the water might not be so smart, forcing me to turn around. Of course, my fingers slipped out of the mitten right away, and in 40+ mph gusts and a bit of chop, getting them back in proved to be really hard. Cooling the fingertips down to the point where the pain level became rather uncomfortable was a lot faster! Well, that ended up being a really short session. I was quite surprised when my fingers started to hurt again a couple of hours later in the hot tub - they had not really warmed up again the entire time. Fortunately, we had stopped at Inlandsea and gotten a new pair of palmless mittens, so the next cold session should involve less pain.

Yesterday, we had similar wind, but from a southerly direction - it was warm! I was able to sail in my 4.5 mm suit without a hat or mittens. The wind was similar in strength when we started, but instead of a 4.7 m freestyle sail, I used a 6.3 m race sail. After all, we were at the Kennedy Slicks, were it was supposed to be super-flat! And flat it was ... if you made it through the first 300 meters, where a lot of waves made it through and over the holes in the pier. Nina, who had not been on slalom gear for quite a while, had a bit of a hard time making it to the flat water at first. Just as she finally got halfway comfortable (after switching to a week fin because there was lots of junk in the water), the wind picked up, "gusting" to over 40 knots. I put the "gusting" in quotes because some of these gusts seemed to go on for several minutes, and were separated from the next gusts but just a short lull. More than 40 knots of wind is record territory, and Nina did indeed set a record, if you believe her GPS watch: it showed a 2 second top-speed of 55 knots! Analysis of the track at home showed that she reached this speed while swimming - just breaking the windsurf speed record apparently was not good enough for her. Or so her watch thought, and produced a big fat artifact. The maximum speed according to the GW-60 was 135 knots for 0.2 seconds! At this point, I was glad that it was an artifact, because otherwise, the acceleration would have reached rather unhealthy levels.

I had spend some time watching Nina swim and try to waterstart (which she managed .. a total of 3 times on her final run in, usually followed by gusts ripping the sail out of her hands a few seconds later). Then, I did my best to try and break her swimming record. I first tried to use her 5.0 m sail, but while the wind had dropped by about 10 mph, it was still windy enough to let me sail out and back a couple of times. So I went back out on my 6.3, and completely ignored the fact that the wind had switched to side-off. When my deep downwind trajectory would have let me crash into the wall rather than reach the flat water, I turned around, and practiced u-boat sailing my 90 l board in the now extremely gusty, but mostly very light, wind. For the amusement of beach goers, who were curious enough to enquire about the water temperature, I also added a few short stretches of swimming. Well, all forms of exercise are good, right?

Today was another sunny and windy day, but with temperatures below 40ºF, I decided to take a break. It's supposed to be warm and windy again tomorrow - see you on the water!

Sunday, November 12, 2017

Not Stupid - Scary

This is not a windsurfing post. Contrary to what some of you may have thought after reading the title, it's not a political post, either. This post is about something that scares me - and scares me quite a bit, more than the front loop in windsurfing.

I develop software for a living, and a lot of my work deals with complex algorithms. At times, that includes machine learning and artificial intelligence methods like neural networks. A few years ago, it seemed that computers were stupid and would remain stupid.

That has changed. Now:
  • Computers can act with more intelligence than any human
  • Computers can learn such intelligence-related skills hundred of times faster than humans, without any supervision - computers can learn skills that take humans decades to master in weeks.
These statements are based on recent developments in computers playing games - specifically, the game of Go. Go is a board game that is very popular in East Asia, where it is played by more than 40 million people. This includes more than one thousand professional Go players in Japan, China, North Korea, and Taiwan. They compete in a number of tournaments where the winner's purse can be as high as $500,000 (compared to the total prize money of $140,000 at the largest windsurfing event, the PWA World Cup in Sylt).

Compare to chess, Go has much simpler rules. But while computers have been able to beat chess champions since the 1990s, Go has been a much harder problem, partly do to the large number of possible moves that make a "brute force" approach to finding the best move impossible. It took until October 2015 until a computer beat a professional go player in an even match.  A few month later, the next version of the computer program beat an 18-times Go world champion.

This was an impressive feat, but the story does not end here - it gets better. The version of the software was able to run on a single computer rather than a network of computers that previous versions required; it beat professional go players 60:0.

Then came the really crazy improvement: AlphaGo Zero. Whereas pevious versions had been trained with thousands of Go-games played by amateur and professional players, AlphaGo Zero only knew the rules. Over a few days, it played a few million games against itself, and used the outcome of the games for "unsupervised learning". After 40 days, AlphaGo Zero played against the older version that had beaten the world champion.  AlphaGo Zero won 100 out of 100 games!

So - a computer program taught itself in 40 days to reach a level that takes the best human players decades to achieve! That's absolutely amazing.

It's also very scary. If a computer can teach itself to surpass any human at a very difficult mental task within weeks, then "artificial intelligences" that are generally more intelligent than humans suddenly don't look like science fiction anymore. Some of the most intelligent people on this planet, including Steven Hawking and Elon Musk, have warned about the potential dangers - perhaps it would make sense trying to understand what they are concerned about?

I won't delve into that now, but let me give you a few things to think about. The AlphaGo software was developed by Google, and is running on hardware designed by Google. One computer with 4 "TPUs" can beat the best human Go player; in total, Google uses about 2.5 million servers at it's gigantic data centers. Plenty of computing power to learn other things. How about learning about the ethics of one species exterminating tens of thousands of species?

Of course, we don't really have to worry about computers - they can't harm us because we can just turn them off, right? Only if the computers were somehow connected to weapons would be have to worry about those science-fiction scenarios. There may be some military drones around, but they are usually flown by human operators; even if capable of autonomous flight, any firing decisions usually require a human. According to Wikipedia, the "U.S. Military is investing heavily in research and development towards testing and deploying increasingly automated systems". But thankfully, these are still to be controlled by human beings, thoughtfully supervised by the Commander in Chief. Nothing to worry about!
--
If you're interested in learning more about the underlying AI or want to watch the Go games between AlphaGo and Go professionals, check out the DeepMind channel on YouTube.