# The maths within... robots

There is lots of maths in robots! Think of almost any of the clever things robots can do, its maths that makes it happen.

### Turn left?

A robot works its way round a room, it's using sensors, and whether they are ultrasonic, or detecting light or even smells, the sensors turn their measurement of the outside world into numbers, and numbers means maths. For example to avoid hitting something in its path a robot monitors the numbers coming from the ultrasonic detector, like a bat sending out a chirp, the signal bounced off the obstruction comes back, and the robot calculates the distance to the obstruction. Speed equals distance divided by time, so if the robot knows how fast its ultrasonic ‘ping’ is moving it can calculate the distance the ping has travelled over if it knows the time delay, and from this it knows how far the object is away. If the object is too close, the robot can just turn its wheels and move away, collision avoided.

### Grab that cuppa

A robot hand reaches out to pick up a cup of tea. Maths again, if the arm has a joint, like a human arm with an elbow, the position of the robots hand, or grasper, is determined by the angles at the joints of the arm, and the length of the sections of the arm. Using good old trigonometry you can work out for a given robot arm length and given angles at the joint, where the gripper will be. That’s useful, but what the robot needs to calculate is the inverse problem, it wants to put its gripper at a particular point in space, for example where the cuppa is, so how should it angle the joints to allow this? This is the maths of inverse kinematics. If you think about it (try it with your arm) there are a number of ways the arm could be flexed and still have the gripper (hand) at the same position. The more joints you have, elbow, shoulder and wrist (these are called degrees of freedom) the more difficult the maths becomes but the more flexible the robots abilities become. There are a whole range of clever maths tricks that have been used to solve this inverse problem, and today’s robots can reach out and grab thanks to mathematicians.

### Getting smarter

One of the most interesting areas of robotics is the ability to learn. If a robot can learn how to do a task then it doesn’t need to be told every time exactly what to do. Humans learn all the time, our brains are biological learning machines, each time we try something new connections in our brain change and, over time, we get better at the task. Think about reading, you couldn’t read when you were a baby, but your learned. How? Well you first learned what letters look like. Robots can do this, presented with lots of different letter a’s for example, each written in a different handwriting, a robot can use statistics to work out what the average shape of a letter a is. Ok so it needs a teachers to say this is an a, or this is a b, but you needed a teacher too. After the robot has learned what the average shape if letters are, if it then sees, with its camera, a new letter it can try and match the new letter to one of the learned letters. And so can start to read. The same trick works with other objects, recognising faces for example, or the expressions on peoples faces. Having been showed lots of examples the mathematics is able to pull out the patterns that mean, for example it’s a face rather than furniture. This is the basis of car number plate recognition for congestion charging, the computers has learned the shapes of the letters and numbers.

### Seeing and doing

Robots take in sensory information, from their cameras, ultrasonic and so on, and then do something with that information. They behave sensibly, they avoid a wall or recognise a smiling face and move towards it. Doing something means moving a part of the robot in the right way, the technical term for this is a motor response (motor here doesn’t refer to an electric motor, but to an actual movement of a part of the robot). Robots can therefore be seen as sensory-motor machines, they detect something (sensory) and react to it (motor). In fact humans are just very complicated sensory-motor machines; we can decide how we respond to particular sensory signals from the world around us. Our brain contains whole areas given over to processing information from our eyes or ears or the touch sensors on our skin. These areas then link with so called motor cortex, this is the part of our brain that causes our muscles to move, and our muscles moving are our motors responses. Maths is helping us understand the way our brains work, computational neuroscientists work on developing mathematical descriptions of how those parts of our brains work and interact, it’s a fascinating fusion of maths, biology and psychology.

### Punk robots

A good example of this sensory- motor machine idea, combined with robot learning, are the punk robots that were built to be part of the audience at punk rock gigs. Punk rockers love to dance, and their dance of choice is the pogo, jumping up and down in time to the music. So our punk robots pogo on computer controlled pistons, their motor response is to pogo, either small jumps or great big jumps. What makes them pogo, well it’s the music. The robots learned how to recognise good punk music. To do this Fiddian, who was the lead singer in the punk band Neurotic, used his record collection. As a kid he was really into punk, so the computer listened to all his old punk records and then using some clever maths and statistics based on ideas from the human brain, it was able to discover the sorts of musical patterns that were in punk music. The computer also listened to classical music, disco, pop, RnB, house, trance and so on, in fact a whole load of musical types. It was then taught that punk was best, so when it hears a new piece of music it listens to see how punky it is, how do the patterns in the music match up to the patterns in the punk its listened to before. The closer the match to the music it loves, the bigger the punkiness signal it creates. That punkiness signal then controls the pogoing, a better match gives a bigger pogo.

### All together now

The robots are listening to a live band, and live bands can change the way they play. When Fiddian was playing it was like entertaining simple robot copies of himself as a punk loving kid. He then tried to perform better to make the robots pogo more, so he and the robots were joined together, the robots behaviour influence the way that Fiddian performs, and they way he performs changes the way that the robots pogos. The pogoing robots also influence other people in the audience, and often humans would start to pogo when the robots did. This is something called social feedback, what we do influences they ways others act which in turn influences the way we act. There are even mathematical models for this sort of group behaviours, and they can be used to help robots become better in social situations, after all if they are going to be our friends in the future they need to know how to behave properly. But perhaps the punk robots are the rebellious adolescents of robotics, just interested in music, moshing and maths.

Article by Professor Peter McOwan, Professor of Computer Science, Queen Mary, University of London