Friday, May 27th, 2016 at 12:07 pm - - Flightlogger

The datalogger is fitted to the right hand upright of the control frame. According to my shoddy measurements the upright is 176cm long and the basbar is 138cm long. There are two wires from the corners of the control frame to a point on the keel 151cm forward, each of length 206cm. And there are another two wires to a point on the keel 80cm backward, each of length 205cm.

This seems to add up to a vector of (69.0, 42.06344442205491, -156.2492943010685) from the top of the control frame to one corner of the base bar, which is the alignment of the datalogger and its BNO055 orientation sensor strapped to the upright.

I definitely don’t have time for a complete blog record of this, and a lot of it isn’t working, even though I’ve spent no end of time hacking on things, but if I plot the logger vectors that go backwards and perpendicular to the upright on the gps track, I get this picture:

keelorientation

For scale, the red lines are 11m long and the plot rate is 3x on the 100Hz samples, so there are 33 of those lines per 1second of motion.

It’s reasonably smooth and consistent, unlike the accelerometer values, which I think represent a lot of vibrations in the system, if the creaking wicker chair-like noise on the gopro soundtrack is anything to go by. It’s about right, if you think of the airspeed being in line with the keel of the glider (which it is probably not, because of the yawing and side-slipping in turns).

I nearly bought a sonic anemometer second hand off ebay last week, but missed it. I’ve got an alert watch on a new one and have designs on fitting one to the top of the kingpost where it is out of the way and least likely to get damaged by flying into a hedge or the ground.

Regarding the kinematics of the system, every part of the flight is the same as everything else, so I can strip out the simpler bits to see if there is a relationship. In particular, this is a plot that claims to be 10 second long sections of the flight where the bank angle is less than 3degrees.

nobanksections

This doesn’t fit too well, and I can explain it that the calibration value on the device was at 1 out of 3 for most of the flight, in spite of starting off on the ground at 3/3, so it’s telling me it got it wrong.

Anyway, it’s straight enough to move on to this complex plot of some of those flight sections:

pitchsections

Time goes from left to right of about 10 to 20 seconds. The following traces have been displaced close to the zero horizontal white line so you can see their correlations, if any. Green is pitch angle, Yellow is smoothed acceleration in forward direction (approx because it’s not aligned with gravity yet), Red is airspeed, and White is differentiation of windspeed.

What I would hope for is a delayed correlation between pitch (green) and airspeed (red). If you push the nose up and hold it there, the glider will slow down, and then fly at a slower speed. If you pull the bar in and hold it there, the glider will speed up and then fly at a constant higher speed. But of course you’re moving the bar all the time. But you can almost convince yourself of the response; the green line goes down, and the windspeed then starts to rise, and vice versa.

This should be built this into a kinematic model of control and response. It would actually also align with the barometric reading, where the sink rate goes up with a higher speed, so it’s quite 2 dimensional in the vertical plane, with energy equations.

The other correlation should be between the forward acceleration and the derivative of the airspeed. Both the airspeed signals and the acceleration signals are quite full of noise, so they needed to be smoothed (I think I’ve done this incompetently here, but that’s for another fortnight of coding).

Here you would expect a direct correlation in still air, because if the accelerometer says I am accelerating at 1metre per second per second, then over the course of 2 seconds my absolute velocity will increase by 2 metres per second. And, if the air is still, then my measured air speed should also increase by 2 metres per second.

So these two ought to be scaled the same. Except the smoothing flattens out all the humps and troughs, so you really can’t tell what the absolute value of anything is from this anymore.

Some of the bumps seem to line up, but this is not adequate for a kinematic model.

The numbers get hairier and hairier as I try to approach something useful. And that useful thing would be to separate the absolute motion into that which is due to my control and the flight characteristics of the glider, and that which is due to the underlying wind speed and direction.

Accordingly, I should be doing lots of boring flights in completely still air at the start of the day with a working logger where everything is calibrated, rather than having lots of fun in thermic air. This is a job to do in Austria where the hills are high and I should have hours and hours in the campsite not coding on other things.

This work just takes so much time and has hit so many technical failures already that I doubt it could be done by someone who is answerable to a boss.

Wednesday, May 25th, 2016 at 1:05 pm - - Machining 1 Comment »

You know those clamps for the vice I was so pleased about fitting?

Well, they slipped out while milling metal due to all the vibrations during helixing.
loosevice

This just after I’d spent all afternoon compensating for the rotational position of the vice to withing 0.04mm across 50mm of its width by probing a piece of metal in the jaws wrapped in a piece of wax paper to electrically isolate it from the vice.

Bog! That’s ruined my day.

And the weekend is going to be rubbish, waiting in a tiny cold tent in Yorkshire for the fog to clear.

Wednesday, May 25th, 2016 at 12:58 pm - - Hang-glide

This was Sunday (yesterday) on Tailbridge Hill while Becka and friends were attempting some 80 mile massive cycle ride including a race up Great Dun Fell (844m), somewhere square in the middle of that dark grey wall of rain and hail to the north of me.

tailbridge

They didn’t make it. I suspected that something bad could happen in that area on an otherwise sunny day because of the RASP forecasts:
dunfellrasp
They were to the NE of Kirkby Stephen in the blue, and I was to the SW in the place with the nice thermal updrafts. I already knew no one was interested in my weather observations if it could lead to a change of plans, because they’d all been on a futile journey walking up a hill to a flood-prone cave on Saturday when I knew two strong cold fronts were predicted to pass overhead and make everything miserable.

I got into my own spot of hail up at the clouds at 1300m over Mallerstang Edge late in the day, and it was nice witnessing this three-dimensional field of white pixels streaming past.
mallerhail

I don’t have time to edit any video, so here is a video with a bit of hail in a flight last month from Builth Wells.

I had to do a better landing yesterday, because in Yorkshire the field boundaries are made of rocks.

Tuesday, May 17th, 2016 at 4:22 pm - - Whipping

I met my first Leave Europe supporter yesterday, but didn’t have enough time to quiz them. But they referred me to Boris Johnson’s speech in Manchester as an explanation.

I listened to it all.

Boris banged on about those nasty EU regulations infiltrating every part of the nation:

“They can’t tell us what sort of trains we can run, can they?

“Oh yes they can!

“Oh yes they can!

“The EU Commission told us that by 10 Nov 2018 we must create a rail freight corridor to Glasgow and Felixstowe, which means that Network Rail can be legally obliged to accept rail freight trains in place of passenger trains.

“Of course our excellent transport minister spotted this insanity, with the west coast main line full to capacity. If we had more freight trains, fewer passenger trains, there would me more overcrowding and higher fares. So he wrote a fierce letter to the Commission complaining that they were circumventing requirements, bending the rules, and of competence creep aka sticking their nose into something that wasn’t their business. But the Commission told him to ‘go and jump in a lake.’

“So we took them to the European Court of Justice, and what did the Court of Justice say? They told us ‘allez vous plonger dans un lac.’ They ruled on that occasion as they have done in 80 per cent of the cases in which Britain has been involved – they rules against us.”

Now these are the days when the world is interconnected, and we have a Channel Tunnel, and roads that are utterly chockablock with a hundred thousand fat diesel trucks that can freely drive onto the motorways in enormous numbers.

In the meantime it’s practically impossible to arrange for a zero-carbon electric train to haul heavy steel products direct from the steel mills on the Clyde to the construction sites in Barcelona because of the amazing national railway bureaucracies along the way.

It takes years of painstaking systematic work to identify and address these problems, like those articulated in a Select Committee report from 2005:

Many of our witnesses told us that getting rail freight through France was very difficult. The significance of this problem is greater because France’s geographical position means that international rail freight to and from Great Britain and the Iberian Peninsula travels through France. We were therefore encouraged by Mr Hilbrecht’s confirmation that Europorte 2, a subsidiary of Eurotunnel, had received a licence and a safety certificate to operate in France…

The French two-part tariff system was also said to be a particular barrier to open access and fair competition within France. Mr Hilbrecht was happy “to say that we have achieved agreement with France . . . . They agree that it (the two-part tariff system) should be changed”. Unfortunately the French government claim that because of the public service contracts with regions they cannot do so before 1 January 2006. This two-part tariff system needs to be abolished. We hope that the Commission will ensure that the French government abolish it as soon as possible.

The last problem that we identified is the least tangible, but is nevertheless an important challenge facing the rail freight industry. The evidence we received led us to believe that the rail industry in general, and in particular the rail infrastructure managers, have inadequate incentives to win new traffic. We recognise that, for political reasons, rail passengers are given priority over the movement of rail freight. This appears to have resulted in an institutional framework within the rail industry in which there is little incentive to increase and improve rail freight.

Whatever the cause of this lack of commercialism and competitive performance, it has to be overcome if the rail freight industry is to revive and achieve its potential.

But Boris doesn’t give a toss about this if he can make people laugh at his stupid jokes.

He’ll say all EU directives and ECJ rulings are about Brussels bureaucrats meddling in everything with their crappy regulations, when these ones are about unpicking the thicket of stultifying regulations and prohibitive monopoly rules that make it impossible run trains across national borders.

You have to pass laws to repeal laws, and fight hard to get rid of bureaucracy.

Anti-democratic? Never mind that each one of these directives is examined, amended and passed by a European Parliament that gets elected every five years where every vote counts equally, so that when the Green Party gets 6.7% of the votes, it gets 6.7% of the seats — unlike in the utterly screwed up system in the UK that gives disproportionate representative power to tosswits like Boris to tell us like it isn’t.

Yes, I mentioned that steel industry, the jewel in the crown of Britain’s awe-inspiring industrial revolution of the 19th century. You remember how a private corporation in one of our former British empire colonies bought it in its entirety for small change ten years ago and then shut the whole thing down last week? How humiliating is that?

So much for the Commonwealth Dream, eh? I don’t see Britain owning any comparable assets in foreign lands, other than a few seedy tax havens.

This should have been a seminal moment in our nation’s self-image.

But it isn’t because our political feelings have become pathologically detached from reality.

Apparently the EU tried to save the steel industry by putting tariffs on Chinese impots, but this effort was blocked by the UK government because our policy is to toady up to everything the Chinese want no matter what the cost.

That’s because the country that built the first commercial nuclear power station in the world in 1956 needs that Chinese finance to pay French engineers to consider building a new one — at a cost not quite as high as the International Space Station.

It’s not going to fly. And it doesn’t include the cost of taking it down, let alone in time for the sea levels to rise and wash the resulting radioactive sludge inland to Bristol and all along the North Devon coast with the tides.

Isn’t it curious the highest profile proponents of the Britain to Leave Europe are also climate change denialists? Once you have one delusion of supremacy, it’s easy to get more.

As Professor Danny Dorling pointed out:

The UK is not a typical country in Europe. If we were more typical I would have more patience with those who suggest that we could leave and our lives would improve. But in many ways we’re a poorly performing affluent country. This poor performance has little to do with the EU, and a lot to do with us, and our legacy of having had an Empire. From the Suez crisis right through to the Panama papers, there’s a series of embarrassments that have occurred and, in a way, this referendum is just another one of those embarrassments.

Some people have a fantasy (enjoyed by the majority of the Brexit group, particularly the Cabinet ministers) that if we were to leave we would become ‘Great’ again. We could become the richest country in the world again, and our EU membership is why we are not ‘Great’.

And, so, because a lot of sensible people are sick and tired of arguing with these total idiots, we feel like letting them have what they desire, and getting us out of Europe. And then the Europeans are not going to help us with driving our trains, cars, people, money, goods or anything else across our the borders and into their lands. Things will pretty quickly stop working and go south.

And these politicians who sold us this knackered bill of goods will absolutely own it. We’re going to have to finally learn the hard way how Not-Great we are. It’ll be good in the long run — if there was a long run — for us to have a more realistic perspective about who we are. After all, losing their big wars seems to have done a power of good to the standard of living of the people in Germany and Japan.

In the end none of this matters one little bit. We are arguing about these petty matters when we should be freaked out by the fact that the near-term human extinction has become inevitable.

At some point everyone will learn that we are nothing more than ten billion monkeys farting around on one lonely planet with made-up borders. We’ve used our big brains just enough to fuck things up royally, but we just cannot be arsed to turn it up another notch to avert disaster, can we?

Thursday, May 12th, 2016 at 5:04 pm - - Machining

I have actually been doing some machining at long last, having purchased a 130-040-01900 Precision Tool Vice Type 2 – 70mm wide vice, which feels reassuringly solid, square and metal for the entirely reasonable price of £56 — given that this is about what I’ll need to pay for a single tapered cutter when I get onto that project.

clampthinning
First problem was that the hold down clamps were a bit too wide to fit into the groove comfortably, so I milled them down by about 1.5mm. There had been a worry that these would be hardened steel, so I tested one by cutting a groove into it with a hacksaw. Of course the clamps are going to be soft steel. If it was hard metal it would be liable to make horrible marks in your work-piece.

looseclamp
Then I tried squaring off a bit of model board. This is what happens when you forget to tighten up the vice and the cutter lifts and ploughs through it before tossing it off the table.

A bit more practice, some work on toolpaths, more tools, the procurement of some pieces of metal, and I’ll be ready for business. Just in time for the holidays.

Monday, May 9th, 2016 at 4:49 pm - - Flightlogger

I made an interesting mistake during my flight over Merthyr which began in very rough air. My radio was charged and working, which meant I had an external source of misinformation to confuse me, that I did not have on my excellent flight from Builth Wells three days before.

One of the things I thought I overheard was that the thermals were tracking southeast in spite of the wind on the hill coming from due west. This suspect information lodged into my brain, so that when I finally got a good thermal I began tracking to the SE instead of due East with the wind, and fell out of it, and landed an embarrassing 5km away to the SE on a smooth bit of grassland feeling rather unhappy with myself.

Still, nothing important broken, except my ego. The data came out good, with the following temperature track vs altitude, where horizontal lines are degC from 0, vertical lines are 100m (topping at 1200m on the right), and green data points are during the climb, with red for the descent.

merthyralttmp

Potentially this means in such a strong thermal the temperature was one degC higher than the surrounding air, with brief drops in the readings in the moments where I fell out of the thermal. The climb rate up to 1000m was between 2 and 4m/s, but above that it became less than 1m/s — coinciding with period the temperature differential had decreased.

The thermal temperature is going to be all mixed up with rising air and surrounding air as I go in and out of the core, but it seems to have a pretty constant trend. The non-thermal air (encountered when I utterly lost the thermal) seems to be completely constant between 1000m and 1100m, which would account for the decline in thermal strength (according to theory) and at 1050m only differed by 0.3degrees.

Unfortunately, with only one thermal in the flight to derive the data from, the pattern is not definite. I think I should do something more serious with the temperature sensor, like fit a cowl over it to protect it from sunlight while directing the full flow of the wind across the device. It cannot take more than seconds to equalize. I ought to revisit my vacuum cleaner and hairdrier experiments.
(more…)

Thursday, May 5th, 2016 at 4:29 pm - - Flightlogger

I must have changed cards for one in an old camera or something, because the data files went bad on the hang glider logger.

What started out as an effort to plot a timeline of the holes in my data has turned into a simple SD card write benchmarking experiment which allows me to see the slippage.

The code sort of goes like this:

int multiple = 200; 
long biggaptime = multiple*2; 
long sumnormaltimes = 0; 
long nnormaltimes = 0; 
long flushmultiple = 1000; 
void loop()
{
    // wait for the next 200microsecond moment
    long mstamp; 
    long mstampnext = ((int)(mstampprev/multiple + 1))*multiple; 
    do {
        mstamp = micros(); 
    } while (mstamp <= mstampnext); 
    
    // output the microsecond value in 8 hex characters
    for (int i = 32-4; i >= 0; i -= 4)
        sdfile.write(hexchar((mstamp>>i)&0x0f)); 

    // if that write took longer than expected, record how long
    long mwritetime = micros() - mstamp; 
    if (mwritetime > biggaptime) {
        if (ngapsline < ngapslineP) {
            PRINT(" ", mwritetime, ".", nbytessincegap); 
        }
        nbytessincegap = 0; 
        ngapsline++; 

    // otherwise keep track of the average time
    } else {
        sumnormaltimes += mwritetime; 
        nnormaltimes++; 
    }
    nbytessincegap += 8; 
    
    // flush at a defined multiple of looks
    n++; 
    if ((n % flushmultiple) == 0) {
        sumnormaltimes = 0; 
        nnormaltimes = 0; 
        long mstamppreflush = micros(); 
        sdfile.flush(); 
        long mstampflushtime = micros() - mstamppreflush; 
        P(" F", mstampflushtime); 
    }
    mstampprev = mstamp; 
}

This produces output like this:

1085.0 17500.320 2926.512 2906.512 2912.512 3574.512 2925.512 2914.512 2912.512… (33.89)
10000 215737 F7575 994.320 407194.192 4632.512 2915.512 2943.512 2920.512… (33.89)
15000 407211 F7601 1104.384 3279.128 4400.512 205153.512 2916.512 2920.512… (33.82)
20000 207194 F7576 1018.448 3255.64 4535.512 2915.512 2916.512 204380.512… (33.80)

One can interpret it as taking on average 34microseconds per 8 byte write block, with a pause of 3milliseconds after every 512 bytes, and then an enormous 205millisecond pause after every 8*512=4096 bytes. The call to flush() takes 7.6milliseconds.

We can plot the timeline of writes with this function:

ftext = open(“SPEED.TXT”).read()
ts = [ int(ftext[i:i+8], 16) for i in range(0, len(ftext), 8) ]
t0 = ts[-20000]
sendactivity(points=[((t-t0)*1e-6, y) for t in ts[-20000:]])

to get the green series of points labelled 1 in the diagram below (where the yellow vertical lines represent one second increments):
badsdcards
(more…)

Thursday, April 28th, 2016 at 12:04 am - - Flightlogger, Hang-glide

Well, the hang-gliding has been quite lovely. But the logger appears shot to pieces.
cloud
I still don’t know what I am doing when I get to cloud-base, which is probably why I plummeted out of the sky shortly after this picture was taken.

As soon as I took off, the barometer stopped communicating most of its data.
badbaro
This is the device I lavished so much time on isolating it from the rest of the electrical circuit and arranging for it to bitbash the information back through an interrupt pin.

It could be some timing issue, or whatnot. No way to debug it. Luckily I got myself a Bluefly vario which does the same thing of reading a MS5611 barometer on a tight 50Hz loop and transmitting it back to the main board. In the Bluefly’s case it’s for the purpose of running a Kobo/XCsoar system. I’ve just given up on the one I built as it’s too inferior to simply running XCSoar on the phone where I’ve got colour and more or less know how to use it.

Luckily the Bluefly also sports a GPS and works through a serial port, so I’ve yanked off the Adafruit GPS breakout board and bodged the wires to insert the Bluefly in its place.
bfbodge
Then there was a small matter coding it up using a complex state machine to program the GPS module through the Bluefly pic processor to get it to read at 10 times a second.

But then the BNO055 orientation sensor played up and decides to shutdown at unexplained moments for unexplained periods of time.
badorient
The white vertical lines are 10 minute intervals, and there is a green dot for every successful orientation reading, with y-value proportional to the time since the previous reading, so I’m getting gaps in the data of half an hour in flight.

I’ve produced a reset timer to try and start it off again if no data comes through for 20 seconds.

Anyways, here is one of those nerve-wracking close encounters with the ground during the flight.
(more…)

Tuesday, April 19th, 2016 at 11:29 am - - Hang-glide

If you look closely you can see the grin behind the helmet.
DCIM100GOPROG0020178.
There was nothing especially epic about this XC flight from the Long Mynd to Clee Hill, except a masterful get-away from the slope in nil-wind with just one thermal during which I miraculously stayed on top of all the paragliders. Also there was a very low-save.

I took off at about 1:30 during the period when the wind was less than 5mph and sometimes coming from the SW. This trace is off the Long Mynd Gliding Club weather station:
myndwind

No one could explain why there was so little breeze to make reliable ridge soaring possible. Meanwhile, there were champion pilots flying 100s of miles on seven hour flights on that day, which one must try not to feel bad about, when I “only” managed to stay up for an hour and a half.

One thing I did learn for sure is that I utterly depend on the thermal assist of the XCSoar running on my android phone. (That Kobo kit you see in the video is going in the bin.) The magic went away when the phone ran out of batteries; my thermal tracking abilities went out the window from that moment on. So this flight (and hopefully many more, when I sort out an extra power supply brick for the phone) is dedicated to Lines 145 to 202 of XCSoar/src/Renderer/TrailRenderer.cpp which was able to direct my search for lift whenever I lost it. This is the section of the manual describing the critical feature:

xcsnailtrail

A couple more regrets. I didn’t make cloudbase by at least 300m, according to the dew point measurements. And the barometric reader, based on bit-bashing and interrupts, is completely shot to pieces by the overload on the microcontroller from acquiring so many other inputs of data. Only about 1% of the readings are getting through. I’ve got to come up with some other answer, and I don’t have a lot of time in a week when we’ve got some help doing something about the state of the kitchen floor.
kitchenhole

Monday, April 18th, 2016 at 4:43 pm - - Machining

This has taken a lot of effort fighting through the device trees on the Beaglebone to make it access the PWM and Quadrature encoder services at the same time, which is the minimum required to effect a stimulus response observation from a DC servo motor powered by an H-bridge.

What happens when you apply a fixed voltage to the DC motor for an eighth of a second, then reverse the voltage for another eighth of a second, and then set the voltage to zero (and try it for many different voltages and directions):

Here’s the graph of motor positions (in Y) over time (in X) for 20 different trials:

motortrialgraphs
(more…)