DrTomAllen.com
tom@jugglethis.net
  • About Me
  • Now
  • Robotics
    • Publications & Videos
  • Startups
    • Cubescape
    • Triple Point Robotics
  • Game Design
    • Underminers
    • Bounces
    • Dodgy Wiring
    • Half the Battle
    • Road to Nowhere
    • Summon the Swarm
    • Evil Robots
  • Projects
    • Web
    • GUI Design
  • Blog

Satisficing; a powerful tool for resource constrained decision making

25/10/2019

 
Satisficing is one of those funny looking words that a few academics use, but almost everyone else thinks must be a typo. It is however a subtle and wonderfully simple concept, and a valuable tool for anyone making decisions in a resource constrained world. Which is almost everyone...

Read More

Using Clubhouse's webhooks to announce ticket completion in Slack

17/10/2019

 
Clubhouse is a great tool for software teams to manage their work. It includes a Slack integration that can pick up ticket URLs in chats and expand them with details, and can also generate a message feed of activity on those tickets.

What it can't do however, is narrow down that firehose to just a few types of activity that are of interest. This post shows how to use Microsoft Flow (similar to IFTTT or Zapier) and Clubhouse's webhooks to build it yourself.

In the gallery below, you can see the gist of the flow:
1) The flow's trigger is receipt of a JSON payload into a webhook destination. This webhook URL is added to  Clubhouse's webhook integration in the Clubhouse settings.
2) The schema of that JSON is automatically created by posting in a sample payload from Clubhouse's webhooks API documentation (or just copy the code sample shown below)
3) A few conditions are checked - `actions` is present and set to `update`, `changes` exists under that and is set to `completed`, etc - and finally the inner block of JSON under `changes` is parsed to expose the fields of interest.
4) Finally, a message is posted to Slack that reports the activity type we're interested in.
Ultimately, the output ends up as a nicely formatted Slack message with a direct link back to the original ticket. The flow itself runs once per activity on any Clubhouse ticket, but only posts to Slack for those activities that we actually care about.
Picture
It would be great if Clubhouse would update their Slack integration to allow us to use multiple of them per workspace, and filter the output directly - but until that's possible, this hack has helped us raise the signal to noise ratio!

It's also possible to query the Clubhouse API directly from a flow (or an IFTTT, or a Zap). For example, I could have updated this to query the ticket details and pull out the owner's names, or the date it was started, etc. I'll leave that as an exercise for the reader...
JSON Schema for Base Webhook Payload

    
JSON Schema for `changes` payload

    

Project Planning with Directed Graphs

17/6/2019

 
I recently spent a week locked in a boardroom with my management team and chairman developing our company strategy for short, medium, and long-range horizons. At one point during that week I stumbled upon a new way of representing and evaluating choices between different projects, each with different resource requirements and benefiting different customers or segments. At its core, it's a directed graph.
Picture
In this simplest of examples, there's a project A which costs 2 units. Project B depends upon 100% of A and itself costs 5 units. What does B really cost? B + 1.0 * A = 5 + 2 = 7 units.

Simple enough, right? Nodes are projects, and have costs. Edges are dependencies between projects, and have weights. The full cost of any project is the weighted sum of all its dependencies and its own internal cost.

Read More

What are the least obvious ways that autonomous vehicles will change the world over the next two decades?

11/2/2016

 
Sales of board games will go gangbusters.

Wait, what? How is that related to autonomous vehicles? Ok, let me back up a bit...

This question specifically asks for the least obvious ways autonomous vehicles will change the world in the next two decades. Given that, let's establish what progress autonomous vehicles will have made in that timescale, and also start with a list of obvious things to get out of the way.

Current middle-ground estimates for when legally approved autonomous vehicles will be able to operate on public roads range from "next year" to 2025. From a technology standpoint I agree, but I'm not confident the bureaucracy will follow suit so quickly - perhaps in a few places, but certainly not everywhere. (Even as I write this, Google's self-driving car division is pushing the US government to make changes to federal laws that are expected to take decades to implement [1].) But within five to ten years of the first cities having the benefits that autonomous vehicles bring, there'll be sufficient public and industry pressure to force the laggards into line. When the benefits are so obvious, and the safety record puts humans to shame, you'd be a very short-lived politician if you tried to buck public opinion and insist on banning them.

We're already seeing every major vehicle manufacturer [2-5] putting massive resources into the technology, and even 3rd parties like NVIDIA building technologies [6] specifically to support this industry. It's a safe bet that within that same sort of timeline (5-15 years) the technology behind vehicular autonomy will have become commoditised enough that every brand will have at least a few autonomous models or options. Within the two decades allowed by this question, I'm confident not only that autonomous vehicles will be commonplace, but that most societies will also have changed their laws to allow unmanned vehicles (i.e. empty vehicles, or passengers only - no human driver/supervisor) to operate on public roads.

That covers my expectations of how far the technology and social acceptance will change, so given that, what are some obvious ways the world will change?
  1. People who currently cannot drive will have a new sense of freedom. This includes the blind, people with other disabilities, many elderly citizens, and children. This will massively alter the total addressable market for many businesses, and likewise the available worker pool for many others.
  2. Growth in domestic air travel will slow, as families take holidays where travel is done while sleeping in their vehicles. In an eight-hour sleep, you can quite easily travel 800km (500mi) - enough to get you between many cities in Europe and the US.
  3. Electric vehicles will dominate the new vehicle market, and autonomous vehicles will automatically dock with with their chargers too. It's certainly possible to build an autonomous vehicle around an internal combustion engine (ICE) vehicle (I've helped do it! [7]), but by the end of the two decade window there'll be so many good reasons to go electric that ICE vehicles will come to seem like an anachronism.
  4. The transport industry will be heavily disrupted. Taxis, ride-sharing, and potentially even many forms of mass transport will disappear, replaced by the ability to quickly call an auto-cab that you don't need to share with anyone else.
  5. Traffic accidents, vehicle related injuries, and even air pollution levels will all fall dramatically. The world will be a safer place to be a pedestrian, and with fewer humans accelerating and braking over and over again, it'll be a healthier place too. Fewer traffic jams too, since the majority are caused by human error, leading to far more consistency on commute times and thus a shorter duration of peak "hour". The other main cause of traffic jams is simply that everyone wants to get to work at the same time (hence, peak hour) but with inter-vehicle communication and better reflexes, autonomous vehicles can be more densely packed on existing roads; effectively increasing their capacity.
  6. There'll be fewer vehicles overall. As many people have noted, there's far less point to owning a vehicle that sits idle most of the time, when you can rent one just when and where you need it. For people who do keep a permanent private vehicle, leasing arrangements will be more popular, as the rapid improvements in capabilities will see society transition to the 2-3 year upgrade cycle seen in mobile phones today. This will necessitate changes to the taxation model that pays for roads, since in most countries it's currently part of vehicle registration costs.
  7. We probably won't need to build any more roads - ever. As I said above, better reflexes and communications mean autonomous vehicles can increase the capacity of existing roads. If people can sleep, get dressed, shower, or perform other time-consuming but necessary tasks in their vehicles, we could expect to see a shift in "core hours" for many workplaces. This would then shift or disrupt the concept of peak hour, meaning the capacities for which road networks are currently designed are excessive in an autonomous-vehicle powered world. Yes, population growth still exists (well, not so highly in developed countries any more) but I would be surprised if growth in demand wasn't outpaced by reductions in the peak usage required.
Given how many impacts and changes seem obvious, it shouldn't be surprising that there are lots of less obvious effects hidden below the surface. These need to be weighed up against the likelihood of their coming true however, because otherwise it's all too easy to follow a slippery-slope fallacy to a ridiculous conclusion!
​
Here are some not-so-obvious, but very likely ways that autonomous vehicles will change the world - and remember - within the next two decades.
  1. You'll start to see more motorbikes on the roads. If you've never tried it, start this train of thought by accepting my assertion that riding a motorbike through traffic is amongst the most fun - and yet still legal - things a person can do in this world. It's visceral, deceptively fast, and feels like you're playing cat-and-mouse with the rest of the vehicles on the roads. It's also dangerous. Humans are absolutely terrible drivers, such that the top three killers of motorcyclists are inexperience, alcohol, and other people's cars through no fault of the rider. As the proportion of homicidal maniacs in heavy metal killing machines decreases, replaced instead by rational rule-following computer systems, the pleasure of zipping along on a motorbike will only increase as the risk to life and limb of doing so falls. I have every expectation that a great many car enthusiasts will make the transition to bikes as their insurance costs for manually driving a high-powered vehicle rise through the roof. (On the same note, and for similar safety reasons, we should also see an increase in cyclists; fear of the dangers posed by vehicles is a commonly cited reason for why commuters don't cycle instead [8,9].)
  2. The cost of autonomous electric vehicles will be partially subsidised by electricity companies who will use them as a battery bank for demand-response infrastructure. A Tesla Model S carries 85kWh of energy when fully charged. By comparison, their home battery solution (the Powerwall) holds 7kWh. That means all those parked or idle cars provide a far greater source of on-demand energy than home batteries do, and the power companies are already excited enough about home batteries and connected device demand-response infrastructure [10]. (These provide the ability for the power company to buy-back people's stored power, or automatically turn down their air-conditioners to reduce load, far more cheaply than they can generate more power by spinning up additional power stations.)
  3. In the long-run, autonomous cars will be cheaper, not more expensive. Many of the expensive bits of current era vehicles are there to protect us from ourselves. If we stop driving them ourselves, much of that safety equipment becomes less relevant. In addition, although electric vehicles are expensive now, in general they're considerably simpler than ICE vehicles. As I've said above, for a variety of reasons autonomous vehicles are incredibly likely to jump onboard the electric bandwagon, and will thus benefit from the reduced costs due to mass production of batteries, electric motors, and the like. Yes, there are costs of sensors and computing power, but again mass production will drive these down significantly - LIDAR sensors have already seen a ten-fold reduction in the last five years, and I'm confident of another ten-fold in the next decade [11]. And finally, through a combination of subsidies by power companies, ad-supported vehicle rental, reduced need personal ownership, and more, the total proportion of household income spent on transport will fall significantly - and that is a huge change in and of itself.
  4. Sales of board games will go gangbusters. We're here at last! You've stuck with this answer as I've explored the numerous changes that autonomous vehicles will bring to society; lower pollution, faster and more reliable commutes, less vehicle-related injuries, increased personal freedom, lower household expenditure on transport, more usable personal time, less national budget spent on new roads, and more domestic travel done by car. One fairly non-obvious ramification of all this is that autonomous vehicles will lead to a renewed focus on family. Vehicles will be redesigned around the family circle - literally - by reversing the front seats and sticking a table in the middle. And if families are looking at each other, then road travel becomes an opportunity for togetherness, bonding, and play. Instead of the backseat evolving into a small cinema, families can actually do things together, instead of turning to isolated experiences because they can't communicate properly. Given that opportunity, what better to fill the table than one of the fastest growing gaming segments in the world [11] - board games! (All this said, I can just as easily imagine a slide-up double sided television emerging from the center of the table to perfectly isolate the adults from the kids. Such is human nature, I guess...)

The world will change significantly in the next two decades, and autonomous vehicles will most certainly be one of the most impactful forces. While much of their impact is obvious and inevitable, the cascade of changes they bring about lead to an exciting concert of possibilities. I've presented some of those I feel are both non-obvious, yet also likely. I can't wait to build the future and prove myself right!

References:
[1] Exclusive: In boost to self-driving cars, U.S. tells Google computers can qualify as drivers
[2] http://www.audi.com/content/com/brand/en/vorsprung_durch_technik/stream.html#topicFilters=vdtexp:Technologie/piloteddriving
[3] BMW autonomous car
[4] Volkswagen Group of America
[5] Ford Tripling Autonomous Vehicle Development Fleet, Accelerating On-Road Testing of Sensors and Software
[6] http://www.nvidia.com/object/advanced-driver-assistance-systems.html
[7] Robotics
[8] http://assets.dft.gov.uk/publications/climate-change-transport-choices/climate-change-transport-choices-full.pdf
[9] Barriers to cycling
[10] Demand Response | Department of Energy
[11] Quanergy Announces $250 Solid-State LIDAR for Cars, Robots, and More
[12] Hobby Games Market Climbs to $880 Million

(Originally answered on Quora at: http://qr.ae/ROxTTi)

What programming skills are required for a robotics engineer?

23/7/2015

 
Read Tom Allen's answer to What programming skills are required for a robotics engineer? on Quora

Solving problems that change while you're solving them.

7/7/2014

 
There's a great question on Quora that asks people to explain their theses in layman's terms. (Every Ph.D. should be expressible in a single sentence, and some of the answers here have this down to a fine art!) It certainly isn't simple to explain where I blew three and a half years of my life, but here's my attempt.

My research answered the question of how you solve problems when the problem itself is changing while you try to solve it. Imagine you're trying to work out the fastest route from one side of your city to the other, but while you're working it out people keep having car accidents that block roads, tow trucks keep clearing previously blocked roads, and the local council is constantly building new roads (really really quickly!) Adding to that, even when you've worked out what you think is a good route, while you're driving it the roads are still changing constantly.

My work showed that in most interesting applications of this problem (not just roads and driving, it applies in lots of other contexts as well), the time you spent working out a solution is quite large. If you want the 'perfect' solution, it could be so large that you would have been better off to drive a slower route but not spend so much time thinking about it in the first place.

I found a way to quantify all these factors, and a way to solve what you really want; not "find me the fastest route across the city", but rather "get me to the other side of my city as fast as possible". I was also able to prove that my method was guaranteed to be at least as fast as any other method, and most of the time was much faster.

Oh yeah, and I built a robot to do the driving... :-)
Picture
Picture
In a lot more detail, here's how the technique actually works. (And I'm not just being self-indulgent here - somebody actually asked for this...) Everything comes down to time. If we stick with the driving example that'll help. What you really want is to get to the other side of the city in the shortest amount of timing, starting RIGHT NOW!

Let's focus on just the one decision point right at the start - whether to set off instantly on a beeline for your destination, or to sit and plan a better path for a few minutes and then set off. Let's use some easy numbers and say it's 100 minutes drive across the city via the best route, and 200 minutes via the worst route (the one you can calculate instantly.) Let's also say it takes 20 minutes to calculate that best route.

Your two options are:
a) Planning time of zero, plus driving time of 200 minutes = 200 minutes.
b) Planning time of 20 minutes, plus driving time of 100 minutes = 120 minutes.

Obviously, b) is the better option. But actually, this isn't just a binary decision. There are many other options in the middle ground. (Straying away from common parlance, there's a class of algorithms called anytime planners that help find these middle points.) Often, problems turn out to have a solution that takes perhaps 1 minute of calculation time, but results in a driving time of 101 minutes. So, it's not the best route, but the total time is 102 minutes which is better than the total time for the best route. (In technical language, this is the Pareto optimal decision.)

The key point is that the "best" route is not the best route when you take the planning time into account. (Except when it is. But that doesn't happen much in practice!)

Ok, let's step it up a notch. There's actually a catch here too - assessing all the possible points on the spectrum between the worst and best routes also takes time. Let's call that the Decision Making time. Since that counts for the total time too, you'll need to minimise it as well, which might mean that it's better to only think about perhaps 5 options, rather than 50.

Perhaps...

Alternatively if the right option was one of the 45 you didn't consider, then maybe it would have been better to spend the Decision Making time to find that option, and then ... ARRRGGGHHH!!!

If you're thinking this is all getting a bit meta, you're exactly right. This class of problems is called Meta-computing.

Ok, let's step it up yet another notch! In the driving example I discussed in my answer, the roads keep changing while you're driving. Ignoring a few of the less interesting considerations, this effectively means that you have to go through the same decision making process all the bloody time!

So the best you can do is to start moving (as long as it's in roughly the right direction) and keep adjusting your route while you're driving. Whenever you settle upon a new choice of route, start driving it, and simultaneously start thinking about what you might want to do next. Do that until you reach your destination, at which point you can collapse in an exhausted heap, completely unable to think of anything else. Why did you need to drive there again?

In terms of what you actually need to do with all the choices you make, it comes down to the problem at hand. First you guess how much Decision Making time to spend, then you spend it evaluating the options - which involves guessing how much Planning and Driving time each option will require. Then, you pick the option you've guessed is the best, and you start planning it. Finally, you take the plan and start driving it. Then you repeat.

It's at this point that you re-read that last paragraph and ask "so what's with all the guessing?" Well, unfortunately, reasoning about time is reasoning about the future. You don't know how long something is going to take until you've actually done it, by which point it's too late to use that information because you've just done the thing you had to do to get the time it was going to take to do the thing you were just having about to had been done. I think... 

The only solution to this is to guess. Much of the contribution of my thesis was designing and testing a whole bunch of different ways of doing these guesses.

In the end, what you can say about this technique is that it is guaranteed to be no worse than any other technique that has access to the same information. I proved that. It probably doesn't sound like much, but it's actually very important because a lot of the time you're actually much better than other techniques if you use my technique. And since you're not going to be worse, you might as well use mine, just in case it's better!

So that's the common parlance explanation. In mathematical terms it's:




where y* is the optimal set of parameters to apply to the system out of the set Y of all possible sets of parameters, and the 't's are the Decision Making, Planning, and Driving times respectively, summed over all future time until the destination is reached.

Oh shit.

3/6/2014

 
Well this has been an eventful evening. My wife was going out with some friends, so she made me park on the road (since I'm only 80% of the way through digging a new driveway.) Nothing eventful here, but this is what writers call "foreshadowing"...

Once she's gone after dinner, and while my son is in the bath, the dog goes absolutely bananas barking. I pick up the wet and now angry son, rush downstairs, let the dog out the back door because I assume she wants to wee, and go back upstairs to the finish the bath. About 30 seconds later, I hear demented barking from outside the house. Oh shit. I could have sworn I saw my wife shut the gate. Oh shit. Oh shit. Oh shit.

I grab my son, plus towel, run downstairs towards the back door, only to almost trip over a frantic dog who is sprinting back inside. I slam the back door closed, turn off the light I'd left on out there, and start drying my son properly. Still a bit curious about what she was barking at, I'm preparing to take the child back upstairs to get into his pajamas when the barking starts again from inside the house! Oh - there's actually someone at the front door. Well that makes more sense.

It's a very grumpy neighbour I've not met before. He's just been knocking at the front door, then some crazy neighbour set the dog on him, then he went round to the back door only to have it slammed in his face and the lights turned off. Oops.

"No worries mate. I'm actually here about your car..."

"Uh, what about it?"

"Did you park on the road tonight?"

"Yes. Why?" (Oh shit. Oh shit. Oh shit.)

"Well you parked in a really stupid place mate, and I've gone and backed into it in the dark."

*sigh*

"Oh shit."

"Shit! Daddy said shit!"

"Hey! Don't say that word!"

"Sorry Daddy"

"I don't think it's too bad actually. Just some of the white paint is scratched and there's a bit of a dent in one panel."

"Hang on - my car is red."

"Oh. This one is white."

(Woohoo! Not mine!)

"Sorry mate, I don't know whose that is."

"Ok, sorry to bother you."

...

"Car went crash!"

"Yes buddy, car went crash."

Finally, I read my son a story and put him to bed exhausted. There's a tiny black spider on his radiator. I grab and squish it in my fingers as I leave the room, thinking I'll just rinse it off in the bathroom on my way back downstairs.

That's odd - why does it have a red blob on its back?

Oh shit.
Picture

MakeyMakey media keys

5/2/2014

 
Picture of a MakeyMakey circuit board
I've had a vague plan to augment my coffee table with some media centre controls for a while now, but when my brother's partner bought two MakeyMakeys for my son I uh... "borrowed" one for myself. Today I finally kicked off this project by re-mapping the inputs to keys I wanted it to trigger, but hit a difficulty with non-standard media keys for volume control.

Essentially, the MakeyMakey presents itself as a USB HID device - like a keyboard/mouse combo - and you then hook up anything conductive to an input, and use that to complete a circuit through to ground which then triggers a key or mouse movement. My plan is to have some coins or brass discs embossed into the surface of the table, and use these as attractive (and toddler-proof, since there will be no moving parts) keys.

Unfortunately, under the hood the MakeyMakey is essentially an Arduino board, and the HID implementation is designed to help Arduino's target market - not embedded software engineers. One irritating feature is that they want users to be able to easily say something like sendKey( 'a' ) rather than sendKey( 0x61 ), and in their infinite wisdom they've managed to implement this in such a way that you actually cannot send anything other than an ASCII character or modifier key. Great, we can signal to our typewriters to reset their carriage feed, but not send a volume up command because typewriters only have two volume settings anyway; 'loud' and 'obsolete'. I swear that joke was more funny before I wrote it down.

At any rate, for my first ever Arduino program, I've gone in and edited the core library to workaround this. This commit shows the necessary changes to the MakeyMakey code, but the additions may well be helpful for any other Arduino based projects that require HID device work.

Robotics: What is it like to program robots for a living?

22/10/2013

 
Read Quote of Tom Allen's answer to Robotics: What is it like to program robots for a living? on Quora

electric imp HttpIn using AJAX from a static HTML page without PHP, jQuery, or access to the electric imp Agents beta test. Phew!

17/9/2013

 
I spent a while refreshing my HTML front end skills while trying to get a basic electric imp prototype going. Since the EI forums have a paucity of information on this topic, here's a basic guide and some sample code. The point of this code compared to others you might find is that this one doesn't require access to the electric imp Agents beta test, doesn't require the use of jQuery, doesn't need you to have a PHP-capable webserver, and is really really simple.

This demo code is a basic webpage with five buttons corresponding to servo motor positions. You could use a slider instead, or toggles, or drive LEDs - whatever. The point is that clicking the buttons uses asynchronous javascript to POST to the EI API without loading the API response as a new webpage. So you don't see the "OK" and have to hit your back button. Simply dump the index.html file on your webserver with your HttpIn node's API endpoint, and your impee's UID in the obvious spots. Yes, this is a security risk, but for a basic prototype I and you probably don't care. Later on, when everyone is using Agents anyway, this won't be a problem. For now - enjoy!

Update 18/09/2013 - Added code for doing the same thing if you do have access to the Agents beta test. The HTML code stays the same - other than pointing the httpRequest to agent.electricimp.com/... instead of the older api.electricimp.com/v1/... - but you can remove your HttpIn node from the blueprint, and then use the attached Agent and Device scripts similarly to the original.
<<Previous
    This blog is very seldom updated. Having kids will do that.
    ​

    Archives

    October 2019
    June 2019
    February 2016
    July 2015
    July 2014
    June 2014
    February 2014
    October 2013
    September 2013
    May 2013
    April 2013
    March 2013
    November 2012
    September 2012
    August 2012
    June 2012
    May 2012

    Categories

    All
    Coffee
    Hacking
    Programming
    Projects
    Rants
    Robots
    Startups
    Thoughts

    RSS Feed