Why we programmed a robot to act like a sheepdog

Why we programmed a robot to act like a sheepdog

Have you watched a sheepdog gather sheep on a hillside? The sheep move in waves and pulse back and forth, the dog weaving behind and around them. Squint a bit and it’s like watching iron filings on a piece of paper being drawn around by a magnet underneath, or a flock of starlings darting from an approaching falcon, or a school of fish evading an oncoming penguin.

The patterns look similar between each event because the coordinated behaviour we see in sheep flocks or fish schools – where individuals are all closely packed and aligned in a certain direction – can reduce their chances of being identified or eaten by predators.

Fascinated by these patterns, we set out to investigate how these anti-predator effects work, by using GPS to track flocks of sheep and a sheepdog:

What we found supported the long-standing assertion that individual animals respond to potential danger by moving towards the centre of a fleeing group – a theory called the “selfish herd” that was first proposed by the great evolutionary biologist Bill Hamilton in the 1970s.

Dog rules

However, there was something even more interesting than the way the sheep were flocking – the behaviour of the sheepdog. How was the dog managing to manoeuvre and manipulate so many sheep with such apparent ease? What rules was the dog using? To investigate this we built a model of the sheep and sheepdog behaviours, and compared computer simulations to the real data we had collected:

We found that the dog appeared to be using two very simple rules. It would drive the sheep from behind, towards the target, but if the sheep become too dispersed, the dog would move towards the edge of the leaking flock. Because the sheep move away from the dog and towards each other when the dog gets too close (remember the iron filings and magnet) the result is a cohesive sheep flock and a shepherding dog that weaves behind the flock.

But we did not code weaving into our model – just the two simple rules – and yet our model shepherd still presented the same weaving behaviour as the dog. This phenomenon, where a model has properties we did not “code in” is what is known as an emergent behaviour.


Read more: We need robots that can improvise, but it's not easy to teach them right from wrong


Robot shepherds

When we initially described this “shepherding model” based on the two rules, we said that our work “suggests new ways in which robots can be designed to influence movements of living and artificial agents”. This led to much media attention, and outrage that we wanted to replace sheepdogs with robots. We didn’t, but we do think it is possible to build robots for collection and herding tasks, inspired by the sheepdog behaviour.

To test our claims, we recently programmed a simple robot to follow our “dog rules”, and had it collect little plastic (inanimate) objects. We found that the robot did an excellent job. With no help from us, the robot quickly identified and collected the objects, adapting its behaviour if we threw more objects in for it to collect. The robot was successful in all our trials:

The next step is to do all of this in the real world. Although we used a simple robot in a simple laboratory setting, our findings indicate that our approach could be used to complete a variety of collection and herding tasks.

A suitable robot programmed with our algorithms could be used to clean up oil spills, plastic or other objects from the environment. It could also keep animals away from, or herd them to, a specific location without any human assistance. To accomplish this we hope to collaborate with engineers and robotics scientists who can help take our work forward.


Read more: Future robots won't resemble humans – we're too inefficient


Support evidence-based journalism with a tax-deductible donation today.