Monday, November 25th, 2019 at 3:44 pm - - Weekends

The Toxteth Day of the Dead just happened on November 23. Here’s a picture from the final scene down in St James Park below where I live, where eight people were being mumufied. [larger image]

This was the culmination of a mysterious procession around the streets of Toxteth with various events, like singing choirs and speeches about famous dead people from the area, such as Tony Bradshaw:

There are a lot of little things that can be weaved together, such as a poetic rendition of something from Arthurian legend at the junction of Merlin Street:

It is a truism that, if there is no god, then all sacred rituals must be made up by humans. We are human. Therefore we should make up sacred rituals that work for us. The purpose of these rituals is to raise our consciousness of reality, and of life and death. Otherwise we will be so completely distracted by petty things that we will waste the time that we are alive, which will make us oh so sad when we suddenly realize what we have done.

At one stage in the afternoon we were all given little strips of white cloth and a marker pen on which to write the name of our ghost for the day, someone who is dead whom we dearly miss. Everyone has one. Then we’d pin their name close to our heart and they would be present with us during the remains of the procession, sharing the company and the fun we are having. You can spot them in the two pictures above. Then the last few hundred metres of the procession as we went down Canning Street and into the boneyard below were taken in silence to be with our ghosts, before we had to say goodbye to them, take them off and leave them behind in a basket.

I only live here. I didn’t know any of this was going to happen. My sister spotted this and got us tickets for the Here-after Party, where there was some crazy music:

In return I took her out canvassing for the Labour Party in Crewe and Nantwich.

This is where politics gets real. Knocking on doors of random strangers up and down the streets you have been assigned to ask why is it so goddamned hard to vote against a lying cheating tool of the billionaire class and the most right-wing and immoral government of our time with no plan for the future, but is however fully aligned with foreign forces that intend to end life as we know it in this land, and in favour of a guy who is honest, gives a shit, knows real history, and can’t be bought to sell you out.

The second photo is a selfie from outside the Costa Coffee in Crewe market square where me and Aidan were market-testing my PublicWhip app for advising people how to vote based on parliamentary policies during the 2008 Crewe and Nantwich by-election. My contemporaneous blogposts are The Public Whip Crewe and the The Public Whip Crewe Two.

After lunch in a polish restaurant to recover our senses, we played on some musical see-saws in a square behind the covered market.

What a long mysterious unexpected scary adventure this is all turning out to be.

Everyone I meet seems to be good, so why are we ruled by such bad people?

Wednesday, October 30th, 2019 at 6:44 pm - - Whipping

The BBC completed its China: A New World Order series with an exercise in political propaganda so ham-fisted that it rivaled the Chinese State TV on a bad day.

Remarkably, it asked the audience to be sympathetic to the greed of multi-billion dollar gene patenting US agri-corporations, and against the availability of cheap and plentiful solar panels.


So, after ten minutes of Chinese dictator footage, we get served the appetizer.

(more…)

Tuesday, October 15th, 2019 at 5:12 pm - - Kayak Dive

Someone who had been reading my blog wanted me to take them kayak diving with their Hobie Tandem Island. It’s a ridiculous object. Why would they call a thing that’s supposed to go places on the water an island?

I nominated Llandudno Pier for the dive, as it was not so far away to drive, nobody else dives it (it’s missing from the otherwise flawless North Wales Dive Guide), and there was nearby slipway access. The thing is so heavy that it needs to get into the water off a set of trolley wheels… which is required in addition to the boat trailer used for transporting it behind a car.

After several cancelled weekends we went out last Sunday in the pouring rain because we were tired of putting it off. Becka was with Chris on the Island, his son came out a Hobie MiragePeddleboard, and I was on my sensible Ocean Kayak Scrambler XT Dive Kayak with has no moving parts whatsoever, which explains how it’s lasted us 17 years so far.

We got out, anchored on the far side of the pier after 3 attempts to get it to bite, and went straight into the water. There was a lot of difficulty getting Chris’s sidemount tanks attached and the lanyards they hung off the boat from released in the strong current. The procedure requires more thinking. Normal single-hull kayak diving is simple.

Aside from the lack of slack, the water was not half bad with visibility far better then the anticipated pea soup. Lots of leathery starfish, sponges and anemones on the ironwork. I lined off the anchor.

I kept the dive short and avoided proceeding too far into the metalwork mess under the pier, as turning around and going downcurrent is always trickier than you’d think because you’re out of control and embedded in the cloud of silt you’re kicking up.


Back on the surface the rain was hammering down. It was easier to climb back aboard now that the anchor was loose and we were drifting with the current.

I had a brief ride on the peddleboard, but then someone thought it looked more fun and came to steal it from me.

This left me peddling the Island with its twin fish fins drive.

Then we unfurled the sail and got underway.

Keep peddling.

I had to look underneath to see what was going on.

I’ve no idea how I’ve never seen this thing before. It’s fascinating. And it would for sure be broken in a few months in my careful hands.

Thursday, September 12th, 2019 at 1:52 pm - - Whipping

One of the primary advantages told to us of Brexit is that it permits the UK to instruct its own civil servants to negotiate new international trade deals, and not have the work done by the EU civil servants.

How’s that getting along?

Let’s go on the Gov.UK website to “Find out which new trade agreements will be in place if there’s a no-deal Brexit”.

We’ve got listed, in approximate order of importance, South Korea, Switzerland, Israel, Iceland and Norway, Chile, the Andean countries, Carribean, Central America (does not include Mexico), Eastern and Southern Africa, the Pacific states, the Palestinian Authority, the Faroe Islands, Liechtenstein.

There are 26 other countries or trading blocks listed as “engagement ongoing” where we’ve got nothing.

Let’s take a look at what’s actually been done in the last three years.

Here’s a bit from the UK/Chile Agreement of 6 February 2019:

Basically this says:

At moment of Brexit the provisions of the EU-Chile Agreement (including the instruments referred to in Article 206) are incorporated here, but modified so it is as if it had been signed between the UK and Chile in the first place, except for what’s written here.

One of these exceptions (Article 5) is that references to the Euro are not going to be changed to UK Pounds, even though an Agreement between the UK and Chile would have obviously used UK Pounds.

Here’s that aforementioned Article 206 of the EU-Chile Agreement:

Pretty boring. Most of these treaties are 95% Annexes listing every kind of product and material.

(more…)

Tuesday, September 10th, 2019 at 11:47 am - - Kayak Dive

The Jurassic coast has been the top of my list for a big kayak diving adventure for a while. Enough so that I invested in a copy of a 2015 guidebook called Dorset Dives (review article), which is more of a picture book with some dodgy dive site information, rather than a quality guide book with some crappy photos to break up the text.

It was not great weather at the start of September, but this is the time to take advantage of the gap between the start of the school term and the University term when the season is winding down. We’re trying to economize now that Becka is working half-time and has too many days not to “waste” being at home.

We drove down to Reading on Tuesday 3 September and then on to Durdle Door Holiday Park (via a grumpy dive cylinder filling station on Swanage Pier) with two dive kayaks on the roof, two full sets of dive gear including four tanks, three drysuits, two wetsuits, a cheap pop up tent, a trangia cooking stove and two bikes rammed into the car getting crushed by all the stuff slumping onto them. We had to return after we set off to pick up the sleeping bags I’d forgotten.

The tent pitching ground is in a crow-infested forest. Crows poop just as much as pidgeons, except it’s brown so you don’t see it on the ground. They also make a lot of noise. We walked down to Durdle Door and attempted to walk barefoot on the gravel beach to Bat’s Head. This hurt too much, so we put our sandles back on, which instantly filled with gravel and didn’t make much difference. We got changed and swam through the Bat’s Hole (natural arch) to the other beach and felt better for the cold water experience.

That evening we walked to Lulworth Cove where the chip shop was already closed, but the pub wasn’t.

Thursday 5 September was calm enough weather to kayak-dive out of Lulworth cove going west towards Durdle Door. Going in the other direction was not allowed as it’s a live firing range on weekdays.

First dive was on a promising looking reef out from Bat’s Head called The Cow. The other reefs in the same line with Durdle Door are: The Calf, The Blind Cow, and The Bull. There was nothing interesting on The Cow, so we gave The Bull a miss and went straight to the dive on Durdle Door, where the guidebook says this:

(more…)

Saturday, August 31st, 2019 at 3:13 pm - - Canyon, Hang-glide

The dates were set by Becka planning to spend one night in Interlaken on Friday 2 August between four weeks on the CUCC caving expedition in Austria and a one week caving expedition up a hill called the Sagistal to the east of the city, followed by a weekend at Sinterlaken the Swiss Caving Congress. This was then intended to lead into two separate week-long caving expeditions back in Austria (Plankamira and Datchstein), capped by a caving holiday down in the Ardeche in early September. However, I said: “Could we do something together that’s fun for me, because you ought to have got enough caving done by then?” and so, at great sacrifice, a canyoning holiday was scheduled.

I drove out to Interlaken on my own with my hang-glider on the 30 July, booked into Manor Farm 1 at £28/night for a narrow slot, and showed up the next morning at the Landplatz Lehn where I knew there was an english professional tandem pilot employed by hang-gliding interlaken to fly tourists off the hill at the rate of up to six flights a day, which is a heck of a lot of work.

Their van took me up to their favourite Amisbuhl takeoff between the trees (the taxi rate is 7Fr), helped me over the tedious 15 minute carry up a private road, and took three complete rounds of passengers airborn in the time it took me to set up and stand on the edge gibbering about doing a nil-wind takeoff. I have an experience of completely screwing these up with two crashes on take-off at Ager last year.

They say they have 300 flyable days at Interlaken, which is true because there’s enough shelter that they can fly in almost any condition, between bands of rain and cloud. They’re not all good flyable days.

(more…)

Monday, August 12th, 2019 at 3:58 pm - - Flightlogger, Hang-glide

I thought I had published this long form article in the blog until I looked for it. Turned out I’d accidentally left it on github here. Text is below the fold.

(more…)

Monday, August 12th, 2019 at 3:32 pm - - Hang-glide

After many days at Interlaken, generally flying down from various takeoffs and ramps, I got the opportunity and nerve to finally fly at Fiesch, where I got to see over the glaciers.

Flight 1 was easy; up and across the ridge into the Goms valley, thus saving me from the landing field at the bottom of takeoff. At the end of the flight I was caught in the convergence in the middle of the valley that took me back to 2800m. The only way down was to go to the edge of the valley and circle down.

Flight 2 was harder as I had to get really high first and then there was no lift for miles along the side of the valley until I was saved by a very slow climb on a particular ground collapse. There were some moments of zero-G on that flight. No matter how high I got, there were still always rocks above me.

Saturday, July 27th, 2019 at 8:20 pm - - Flightlogger

I’ve been trying to use the BNO055 for hang-glider experiments for a while. My current serial micropython interface is here or here. The sensor contains its own dedicated microcontroller that continually reads the gyros, accelerometers and magnetometers at a high frequency, fuses them, and provides orientation in the form of a quaternion, and acceleration separated into it’s kinetic and gravity components. (I’d prefer a version where you set the device working, and it streamed the measurements down on the wire instead of needing to be polled every 100ms.)

After years of not really having a clue, I’ve got far enough to be able to make a movie with these frames from an overhead unit attached to the keel of the glider with the intention of measuring the control inputs (ie the pilot’s hang position which determins his weight shift) in relation to the aerodynamic response.

There are two objectives of this work — other than the byproduct of learning a whole load about sensors that ought make me useful for something.

Firstly, we’d want to quantify the hidden variables of a glider (eg glide angle, control responsiveness, etc) in order to better compare between them.

Secondly, I want to quantify pilot behaviour and rig this up on a flight by a top pilot who always seems to do well, and find out what they’re doing that’s different from what I’m doing in order to enable some form of effective coaching that would save me a lot of time. (Generally the top pilots don’t know what they’re doing as they merely report doing it by feel, and that feel very luckily for them happens to coincide with doing it right.)

However, I don’t really trust these accelerometer readings when I watched this. It seemed like it was sticky. That is, its mathematical filters sometimes hold one value until it is no longer valid, and then swings wildly to another other value.

GPS readings sometimes do this and have nasty discontinuities. This is going to happen when there are bimodal probability distributions of the error where there are two likely interpretations of the position from the same measurments.

Meanwhile, I was looking at namespaces in OpenCV and the function findChessboardCorners() caught my eye. I wondered what that was for. Turns out it’s used for Camera calibration — finding lens distortion and focal length.

Then I found out about ArUco Markers and tried to use them for measuring the pilot’s position (see above).

That didn’t work on half the frames because the light catches it badly.

This lead onto the amazing all-in-one charuco board technology which has an aruco tag in each white square of a chess board so that nothing can possibly get confused.

This is great, because it gives an external means of verifying the absolute orientation sensor. If I could get the numbers to agree, then I’ll have proved I’ve understood all the orientation decoding and would know the error bounds.

My code is in this Jupyter notebook, though the bulk has been moved into the videos module of the hacktrack library for safekeeping.

Here’s the procedure, with the unit up top under my thumb containing the orientation sensor, the video camera embedded in the main unit (with the orange light visible to show that it’s working) looking down past the randomly flashing LED light.

And this is what it looks like from the camera’s point of view:

The phone is running a very crude android app I wrote called Hanglog3 for receiving the orientation sensor data via wifi over a socket from the ESP32 attached to the sensor and storing it in the phone’s copious memory, so I don’t need to use a mini-SD card writer wired to the microcontroller that causes it to stall for up to 80ms when the data is flushed to it.

What’s that LED light doing in the view?

That’s used to synchronize the logged orientation data with the frames from the video. I’ve made an interactive function called frameselectinteractive() that lets you slide a box around the LED in the image, like so:

Then the function extractledflashframes() measures the mean red green and blue values in the box for each frame so you can see that there is a clear enough signal.

In this case, the 200 value in the red channel shows a clear enough signal, which can be converted to a boolean on or off, and aligned with the timestamped LED on and off commands in the flight data file that also carries the orientation sensor data. I’ve used the Dust measurement records from this to save reprogramming anything, as the Dust sensor no longer exists (it was a ridiculous thing to carry around on a hang-glider anyway; what was I thinking?).

videoledonvalues = ledbrights.r>200
ledswitchtimes = (fd.pU.Dust==1)  # one timestamped record for every on and off of the LED
frametimes = videos.framestotime(videoledonvalues, ledswitchtimes)

Since the LED flashes at random intervals, there can be only one way to align them, which allows me to assign a timestamp to each video frame, and consequently to any information derived from that video frame, such as camera orientation.

The function which extracts camera orientation from the video frame is findtiltfromvideoframes().

The code which does this from an image frame works like this:

# extract the DICT_4X4_50 aruco markers from the image
markerCorners, markerIds, rejectedMarkers = 
  cv2.aruco.detectMarkers(frame, aruco_dict, parameters, cameraMatrix, distCoeff)

# try harder to match some of the failed markers with the knowledge of 
# where they lie in this particular charucoboard
cv2.aruco.refineDetectedMarkers(frame, charboard, markerCorners, markerIds, 
                                rejectedMarkers, cameraMatrix, distCoeffs)

# derive accurate 2D corners of the chessboard from the marker positions we have
retval, charucoCorners, charucoIds = cv2.aruco.interpolateCornersCharuco(markerCorners, 
     markerIds, frame, charboard, cameraMatrix, distCoeffs)

# Calculate relative camera to charuco board as a Rodrigues rotation vector (rvec) 
# and translation vector (tvec)
retval, rvec, tvec = cv2.aruco.estimatePoseCharucoBoard(charucoCorners, charucoIds, 
                                            charboard, cameraMatrix, distCoeffs)

# Convert rvec to single vector of the vertical Z-axis kingpost
r = cv2.Rodrigues(rvec)[0][2]
row = {"framenum":framenum, "tx":tvec[0][0], "ty":tvec[1][0], "tz":tvec[2][0], 
                            "rx":r[0], "ry":r[1], "rz":r[2]}

Notice that this cannot work without accurate values for the cameraMatrix and distCoeffs (distortion coefficients), which in the case of this camera has been calculated as:

cameraMatrix = numpy.array([[1.01048336e+03, 0.00000000e+00, 9.46630412e+02],
                            [0.00000000e+00, 1.01945395e+03, 5.71135893e+02],
                            [0.00000000e+00, 0.00000000e+00, 1.00000000e+00]])
distCoeffs = numpy.array([[-0.31967893,  0.13367133, -0.00175612,  0.00153122, -0.03052692]])

These numbers are not fully reproducible. However, they do make the picture look okay with the undistortion preview where straight lines look straight. Maybe there are too many degrees of freedom in the solution.

Now the hard part. The camera and the orientation sensor are not precisely aligned.

First the vertical axis of the orientation sensor, whose values are given in quaternions (pZ.q0, pZ.q1, pZ.q2, pZ.q3) needs to be extracted to provide a tilt-vector (of the Z-axis):

r00 = pZ.q0*pZ.q0*2 * pZ.iqsq
r33 = pZ.q3*pZ.q3*2 * pZ.iqsq
r01 = pZ.q0*pZ.q1*2 * pZ.iqsq
r02 = pZ.q0*pZ.q2*2 * pZ.iqsq
r13 = pZ.q1*pZ.q3*2 * pZ.iqsq
r23 = pZ.q2*pZ.q3*2 * pZ.iqsq
pZ["tiltx"] = r13 + r02
pZ["tilty"] = r23 - r01
pZ["tiltz"] = r00 - 1 + r33

Then the (rx, ry, rz) vectors from the video camera images needs aligning to the (tiltx, tilty, tiltz) vectors from this orientation sensor.

I have no idea how I cracked this one, but it went a bit like this:

# kingpost vertical vectors from camera
rx, ry, rz = tiltv.rx[t0:t1], tiltv.ry[t0:t1], tiltv.rz[t0:t1]

# Interpolated orientation tilt vector (so the timestamps are the same) 
ax = utils.InterpT(rx, lpZ.tiltx)
ay = utils.InterpT(ry, lpZ.tilty)
az = utils.InterpT(rz, lpZ.tiltz)

# Find the rotation between these two sets of points using SVD technology
# a[xyz] * r[xyz]^T
H = numpy.array([[sum(ax*rx), sum(ax*ry), sum(ax*rz)], 
                 [sum(ay*rx), sum(ay*ry), sum(ay*rz)], 
                 [sum(az*rx), sum(az*ry), sum(az*rz)]])
U, S, Vt = numpy.linalg.svd(H)
R = numpy.matmul(U, Vt)

print("Rotations in XYZ come to", numpy.degrees(cv2.Rodrigues(R)[0].reshape(3)), "degrees")


# Apply the rotations to the camera orientation
rrx, rry, rrz = \
(R[0][0]*rx + R[0][1]*ry + R[0][2]*rz, 
 R[1][0]*rx + R[1][1]*ry + R[1][2]*rz,
 R[2][0]*rx + R[2][1]*ry + R[2][2]*rz)

In this case, the rotations in XYZ came to [ 0.52880368 0.96020647 -80.29792978] degrees.

Thus, since I am now thoroughly running out of time, here is the comparison in XY of the unit vectors:

And this is how it looks to the individual components:

I am totally going to forget how any of this works when I get back. It is this hard to validate an orientation sensor against a video image, it seems.

Next is to make a charuco board with a flashing light in it with its own orientation sensor and pin it to the back of the pilot’s harness. Then maybe I’ll be measuring the glider relative to the pilot rather than the other way round.

All of this is so hard, and the main objectives haven’t even begun. Why is it so hard to get anywhere?

Thursday, July 25th, 2019 at 6:29 pm - - University 1 Comment »

On 15 July I nipped across to Manchester for the evening, having picked up a flier in the Unity Theatre a month before for the performance of Tao of Glass by Phelim McDermott (twitter handle).

I made up for the price of the ticket by some very cheap train fares bought in advance. As I walked across the city in the summer air past a very long queue for a homeless soup kitchen (which should not be a thing in this day and age) I saw a statue of Queen Victoria covered in pigeon poo. It could never have been otherwise from the day it was erected, unless there were no pigeons in Manchester back then.

The Royal Exchange Theatre looks like the Lunar Lander parked indoors. I had never seen it before, but apparently it’s been like this since 1976. Initially I thought it was something they built especially for the festival, which was a problem for me at the start of the show where Phelim was sitting in the audience and recounting about all the amazing performances he’d seen in that theatre when he was young.

Here’s what it looks like inside. The stage is a massive turntable, so it can spin round and show you the whole performance even when the actors are not moving. I don’t know what it dos to their sense of direction.

Halfway through the first act I recognized the performer from something I’d seen before. It was from a random show I rather liked called Panic, on for one night at the Unity Theatre (just 2 blocks walk from my house), where Phelem played the Great God Pan with his three nymphs. There was a lot of mythology woven in. The goat-like god Pan suspiciously disappeared at the same time that the goat-like depiction of Satan emerged around the birth of Christ.

My favourite part of the performance of Panic was when Phelem was having an emotional crisis and began going through his collection of self-help books, pulling each one out of the box and progressively shrieking their titles. He specifically singled out Tony Buzan who, “every year writes a new book, and it’s always exactly the same as his previous book!” The quantity was overwhelming. He ended up pouring box after box onto the table.

The Tao of Glass went on about Kintsugi, which doesn’t work for smashed glass. There were some other allegories I’ve been unable to remember to look up. One of the reviews tracked down A Mindell’s theory of three conical layers of Consensus Reality, Dreamland, and Essence. I wish I’d taken notes.

I got drawn into the misdirection about Philip Glass, who helped write the performance with Phelem over a week of work-shopping near his home in New York, and was to appear at the end on a Steinway player piano that would reproduce his composition exactly.

But there was a final scene where Phelem lay down next to an old record player to listen to the start of Glassworks, which was the album with which he first fell in love with the music and used to play it at home on repeat (joke!).

At this point Philip Glass himself walked across the stage, joined the musicians in the corner, 4 seats away from me, and played it himself.

I am so lucky to be here. I ought to go to more shows near me.

Apparently there have been some revivals of the older Glass work, like Einstein on the Beach. I just discovered that there’s films of it online from a recent show in Paris. I can watch hours of it, like so:

I’d go traveling to shows of Philip Glass pieces, if I had a way to find out about them in time, like some folks do for Wagner Operas. No one else I know understands it.

It’s a shame I don’t have a video of a Panic or this show I can go back over and get the names of things I want to look up again. We need footnotes, or show notes, or a recording that ticket-holders are allowed to access after the run. How else are we supposed to get a self-education round here?