Cracking the Code


Cracking the Code

Similar Content

Browse content similar to Cracking the Code. Check below for episodes and series from the same categories and more!

Transcript


LineFromTo

Being a racing driver is an exciting job

0:00:090:00:12

that needs split-second reactions and nerves of steel.

0:00:120:00:15

When driving round tracks at high speeds,

0:00:150:00:18

it's important that drivers know exactly what they're doing.

0:00:180:00:21

Nowadays, racing simulators are used by all the top racing teams

0:00:210:00:24

to train their drivers.

0:00:240:00:26

These simulators aim to recreate the racing experience

0:00:260:00:29

as closely as possible.

0:00:290:00:31

So, how do computers make the virtual world so realistic?

0:00:310:00:35

I'm here at Silverstone racing track

0:00:350:00:37

with my computer hackers to find out more.

0:00:370:00:40

I'm Bradley.

0:00:400:00:41

I'm Hannah.

0:00:410:00:43

Hi, I'm Stuart, I'm going to be your driver.

0:00:430:00:45

Before we can find out how realistic simulators are,

0:00:500:00:53

we first need to know what it's like in a real car.

0:00:530:00:56

So we're getting in the back

0:00:560:00:58

as racing driver Stuart takes the wheel.

0:00:580:01:00

Wow, that is so fast and really scary!

0:01:080:01:11

Luckily, Stuart's a professional who knows what he's doing.

0:01:130:01:16

To get that good, he's needed to do a lot of practice.

0:01:160:01:19

OK, how was it?

0:01:210:01:23

-Amazing.

-It was really cool.

0:01:230:01:25

How come you can go so fast on the track?

0:01:250:01:28

It's fair to say I've probably done quite a few laps around Silverstone,

0:01:280:01:32

I do know it very well.

0:01:320:01:33

And also I know the car very well,

0:01:330:01:35

so you put those two things together

0:01:350:01:37

and obviously that makes it easy for me.

0:01:370:01:39

But nowadays, drivers don't do all their practice on the real track.

0:01:410:01:45

Our next stop is the University of Hertfordshire

0:01:460:01:50

to see how their racing simulator helps drivers

0:01:500:01:52

to get the perfect lap time.

0:01:520:01:54

I'm here with Geoff, who runs the simulator,

0:01:540:01:57

and Claire, whose company makes the simulators.

0:01:570:02:00

So guys, what do you think?

0:02:000:02:02

Awesome.

0:02:020:02:03

Absolutely amazing.

0:02:030:02:05

What's it made up from?

0:02:060:02:08

The simulator is a complex mix of high-tech hardware and software.

0:02:080:02:13

On the hardware side, we've got the motion base,

0:02:130:02:16

we have the steering wheel, the pedals, the screens.

0:02:160:02:19

And on the software side,

0:02:190:02:21

we have lots of models working hard behind the scenes

0:02:210:02:23

to make sure the driver sees the right thing

0:02:230:02:25

and feels the right thing.

0:02:250:02:27

And to make sure the driver does feel and see the right thing,

0:02:280:02:31

programmers have to know about physics.

0:02:310:02:33

They need to understand how cars behave in real life,

0:02:330:02:36

so that they can programme the simulator to work in the same way.

0:02:360:02:40

-So if you practise on one of these...

-Yeah.

0:02:420:02:44

..would you be able to drive a real car?

0:02:440:02:46

You would, yeah.

0:02:460:02:48

I mean, drivers come in here, professional drivers,

0:02:480:02:50

they will drive the car, learn the circuit

0:02:500:02:53

and we've had drivers win the race straight after this,

0:02:530:02:57

they've never been to the circuit before.

0:02:570:02:59

Can we have a go?

0:02:590:03:00

Of course, let's go and do it.

0:03:000:03:02

In order to make the simulator as realistic as possible,

0:03:170:03:21

programmers have to make a very accurate virtual world

0:03:210:03:25

inside the computer.

0:03:250:03:26

We call this modelling.

0:03:260:03:28

So the simulator code must use the laws of physics,

0:03:310:03:34

it has to know how to work out the speed of the car

0:03:340:03:37

or the forces that the driver feels.

0:03:370:03:39

It also needs lots of information - lengths, heights, weights,

0:03:410:03:46

numbers that describe the car, the track, the bumps, everything.

0:03:460:03:51

So we create our model of the world using rules and information.

0:03:510:03:56

This file describes the car,

0:03:560:03:57

so if we have a look at it here,

0:03:570:03:59

there's various numbers,

0:03:590:04:01

you've got the mass of the car,

0:04:010:04:02

so that tells you how much the car weighs in kilograms.

0:04:020:04:05

We have power, we have braking,

0:04:050:04:08

we have the torque of the engine,

0:04:080:04:10

so how much power the engine's able to deliver to the track.

0:04:100:04:14

What happens if you change the numbers?

0:04:170:04:19

These numbers?

0:04:190:04:21

Well, you could make a new car.

0:04:210:04:22

If we took some of these numbers,

0:04:220:04:24

maybe we changed 20 of the numbers,

0:04:240:04:27

things like the engine performance, the engine speed,

0:04:270:04:31

the weight of the car...

0:04:310:04:32

we can make that Renault Megane drive like the F1 car

0:04:320:04:36

and be as fast as the F1 car.

0:04:360:04:38

That's pretty cool.

0:04:380:04:39

So can we have a go with the Formula 1?

0:04:390:04:41

We can, yeah, but that is tough,

0:04:410:04:43

you've got to be good to drive the F1 car.

0:04:430:04:46

So Hannah and Bradley had a few crashes in the Formula 1 car.

0:05:070:05:11

Good job it's just a simulator.

0:05:110:05:13

But now, it's time to find out how a professional does it.

0:05:130:05:17

We've seen how we can represent different cars using information

0:05:220:05:25

like the mass of the car or the power of the engine.

0:05:250:05:28

But how does a simulator use that information

0:05:280:05:31

to create a thrilling experience which responds to the driver?

0:05:310:05:34

That's done by writing the computer program.

0:05:340:05:38

How do you programme the simulator?

0:05:380:05:40

What we can see here is the core computer code of the simulator,

0:05:400:05:44

we can see it's a set of many, many commands -

0:05:440:05:48

if you turn left, the simulator will move in such a way

0:05:480:05:51

that you feel like you're really turning left.

0:05:510:05:54

If you put your foot down on the accelerator,

0:05:540:05:57

it's going to make you feel you're going really fast.

0:05:570:05:59

That's all written in this code.

0:05:590:06:02

On screen, we've got a load of words and symbols,

0:06:020:06:05

but when we run this code,

0:06:050:06:07

it creates the whole simulator experience

0:06:070:06:09

and brings the virtual world to life.

0:06:090:06:11

This code is where the programmers are applying the laws of physics.

0:06:110:06:14

What else does the simulator have to do?

0:06:140:06:17

The simulator is having to do so many different things at once.

0:06:170:06:21

If you're the driver and you're hurtling towards a corner,

0:06:210:06:24

the simulator needs to know -

0:06:240:06:25

are you going to make the corner in time?

0:06:250:06:28

If you don't, are you going to spin off and hit the wall?

0:06:280:06:30

Is it raining? Are you going to slip?

0:06:300:06:32

What noises does it need to make, what do the graphics need to show?

0:06:320:06:35

Every single element of the simulator is talking to each other

0:06:350:06:38

-about 1,000 times a second.

-Wow!

0:06:380:06:40

So, guys, what did you think of that?

0:06:400:06:42

-Awesome.

-Scary.

0:06:420:06:45

So, how did the two of you think it compared to Silverstone?

0:06:450:06:48

When you were racing round, it looked really real.

0:06:480:06:51

It was fun,

0:06:510:06:53

but it wasn't quite as real as being actually at Silverstone.

0:06:530:06:57

The simulator isn't perfect,

0:06:570:06:59

because there are limits to what computers can do.

0:06:590:07:02

So how much information they can read,

0:07:020:07:04

how fast they can work out calculations,

0:07:040:07:06

or how much detail the graphics card can draw on the screen.

0:07:060:07:10

So simulators may still have some way to go,

0:07:100:07:13

but computer programmers are improving on their programs,

0:07:130:07:15

and newer computers are making it easier and faster

0:07:150:07:19

to work with more information,

0:07:190:07:21

so simulators can become even more realistic,

0:07:210:07:23

to the point where maybe it will be difficult to tell the difference

0:07:230:07:27

between computer-generated environments and the real world.

0:07:270:07:31

Video games are popular all over the world

0:07:420:07:45

and I know I can be found playing on my games console for hours.

0:07:450:07:48

But creating the game can be just as fun and challenging

0:07:480:07:51

as playing the game itself.

0:07:510:07:52

So I've come to St Saviour's Primary School, in London,

0:07:520:07:55

to meet the year sixes who are using Scratch to create games.

0:07:550:07:59

So do you all like playing video games?

0:07:590:08:01

ALL: Yes.

0:08:010:08:03

All of you, that's great.

0:08:030:08:04

Well, today, you are going to get some cool stuff,

0:08:040:08:06

you're going to create your own video game.

0:08:060:08:09

It's a simple game of cat and mouse,

0:08:090:08:10

and you're controlling the mouse with your mouse.

0:08:100:08:13

'The children are using a free piece of coding software.

0:08:130:08:16

'All the commands you need are laid out on the left hand side,

0:08:160:08:20

'these are all the instructions which make up your code.

0:08:200:08:24

'You then drag all the commands into the middle to write your program.

0:08:240:08:28

'On the right, you have your characters, or sprites,

0:08:280:08:31

'and above this, your stage, where you can view everything.'

0:08:310:08:34

-The mouse is trying to run away from the cat.

-Oh, wow.

0:08:340:08:38

OK, so how are you doing that?

0:08:380:08:40

-You have to give it a script.

-OK.

0:08:400:08:42

So for the mouse mine is "move 20 steps"

0:08:420:08:47

and it would be quite boring

0:08:470:08:49

if you had to press it and press it over again,

0:08:490:08:51

so you would go to Control,

0:08:510:08:53

then you would put "for ever",

0:08:530:08:57

-or you can do "repeat", but I'm choosing "for ever".

-OK.

0:08:570:09:00

And so you could put sounds on it,

0:09:000:09:03

just jam it in through here

0:09:030:09:05

and it has to, you have to go to Controls again,

0:09:050:09:10

and there's an option saying "when green flag clicked",

0:09:100:09:15

so you put it at the very top.

0:09:150:09:17

And let's test it out and...

0:09:170:09:19

Oh yeah, that's cool.

0:09:190:09:21

'Although the children are designing the same basic game,

0:09:210:09:23

'the beauty of using coding software such as this

0:09:230:09:27

'is that it gives the freedom to develop your own version

0:09:270:09:30

'and be as creative as you like.'

0:09:300:09:32

This mouse, Herbert, follows me around and the cat, Felix,

0:09:320:09:37

follows Herbert around,

0:09:370:09:39

but when Herbert gets caught by Felix, he turns into a ghost.

0:09:390:09:44

Wow!

0:09:440:09:46

'Like all good games, we need a scoring system.

0:09:460:09:48

'A score is a variable, so you need to use the variable commands

0:09:480:09:52

'in the top left of the screen.'

0:09:520:09:54

Every time Herbert gets caught by Felix,

0:09:540:09:59

the score goes minus 100,

0:09:590:10:01

and it goes up every second

0:10:010:10:03

when you keep him away from Felix.

0:10:030:10:05

OK, so every time the mouse gets caught by Felix,

0:10:050:10:09

-you lose 100 points.

-Yeah.

0:10:090:10:10

But, as long as you keep the mouse away from Felix,

0:10:100:10:13

-you're gaining points all the time.

-Yeah.

0:10:130:10:15

-So you have four sprites in your game?

-Yeah.

0:10:190:10:22

That's a bit complicated.

0:10:220:10:24

-Yeah, it's a harder game to play than the one on here.

-Uh-huh.

0:10:240:10:27

I still need to work a bit on the programming of the two new ones,

0:10:270:10:31

cos it's not really working with the other two ones.

0:10:310:10:35

Yeah, at the moment, it looks like Herbert and that fish,

0:10:350:10:38

-one of your new sprites, is kind of glued together.

-Yeah.

0:10:380:10:41

All right, well, it seems awfully complicated,

0:10:410:10:44

so I'll let you get on with that.

0:10:440:10:45

'When you're programming, things often don't work out the first time,

0:10:450:10:49

'so you have to really make sure you've understood the problem

0:10:490:10:52

'and that you have all the right steps, and in the right order.

0:10:520:10:56

'All this coding has got them thinking

0:10:560:10:58

'about the kind of games they'd like to create,

0:10:580:11:00

'the rules of the games, and how they'd fit together.'

0:11:000:11:04

I would like to make a game based on pinball,

0:11:040:11:06

and when the ball touches some holes, it gets points.

0:11:060:11:13

I would like to make a maze

0:11:130:11:14

and you have to... The character will follow you with your mouse

0:11:140:11:18

and you have to collect like, food items along the way to power up.

0:11:180:11:21

I would like to make my own car game.

0:11:210:11:24

You have to avoid objects

0:11:240:11:26

and if you hit an object, you lose points.

0:11:260:11:29

Now you've heard their ideas,

0:11:290:11:31

what sorts of game would you make?

0:11:310:11:33

Where are we?

0:11:450:11:46

The Parliament of the Daleks.

0:11:460:11:48

I don't know about you,

0:11:510:11:52

but I'm a massive Doctor Who fan.

0:11:520:11:54

I grew up watching The Doctor,

0:11:540:11:56

transfixed as he travelled around the universe

0:11:560:11:59

escaping from all the weird and wonderful cultures.

0:11:590:12:01

A lot's changed since then,

0:12:030:12:04

different Doctors have come and gone,

0:12:040:12:06

but I think it's fair to say that the show gets better and better

0:12:060:12:09

and looks more and more stunning.

0:12:090:12:11

And a lot of that is due to computer programming.

0:12:110:12:14

Hi, I'm Joey.

0:12:160:12:18

Hi, I'm Effie.

0:12:180:12:19

So me and my two lucky hackers, Effie and Joey,

0:12:190:12:23

who are both Doctor Who crazy,

0:12:230:12:25

have both come to BBC Television Centre

0:12:250:12:27

to find out where it all began.

0:12:270:12:29

Back in the 1960s, when Doctor Who started,

0:12:350:12:38

they used to make all these props by hand,

0:12:380:12:40

I mean, they still make some of the props by hand now,

0:12:400:12:43

but it's all a bit time-consuming,

0:12:430:12:44

so how else do you think they make them?

0:12:440:12:47

-Using computers...

-Graphics and stuff.

0:12:470:12:49

Shall we go and find out?

0:12:490:12:50

-Yeah.

-Come on, let's go, then.

0:12:500:12:52

The next stop is the Visual Effects Studio.

0:12:560:12:58

There are many elements that go into making Doctor Who

0:12:580:13:01

such an amazing, magical show.

0:13:010:13:03

But some of it isn't possible with just actors and props.

0:13:030:13:06

So, guys, we're here with Cat and guess what?

0:13:060:13:09

She works on Doctor Who!

0:13:090:13:11

Really?

0:13:110:13:12

Do you actually do the episodes and stuff and like that?

0:13:120:13:15

Yeah, we work on a lot of the Doctor Who episodes.

0:13:150:13:18

Cat shows the children

0:13:180:13:20

how computers are used

0:13:200:13:22

to produce really exciting visual effects for the series.

0:13:220:13:25

So, let's have a look at this Dalek,

0:13:250:13:28

this is one Dalek by itself, but...

0:13:280:13:31

-Lonely.

-Yeah, he looks lonely.

0:13:310:13:34

So how do you think we could make a bunch more Daleks?

0:13:340:13:38

BOTH: Um... Copy and paste?

0:13:380:13:42

THEY CHUCKLE

0:13:420:13:43

Well, we could do that, but it would take a really, really long time,

0:13:430:13:46

so, instead, we're going to be lazy and use some programming.

0:13:460:13:51

And I've got this little bit of script here

0:13:510:13:54

and I can run that to make a set of Daleks,

0:13:540:13:58

six rows with six in each row.

0:13:580:14:02

'So with this piece of code,

0:14:030:14:05

'we can create six rows of six Daleks from the one original Dalek.

0:14:050:14:10

'The code tells us that for each row,

0:14:100:14:12

'and for every position within the row, make one Dalek.

0:14:120:14:15

'Then, move the Dalek into position.'

0:14:200:14:22

So, if I just run that.

0:14:280:14:30

Wow! That's a lot of Daleks.

0:14:320:14:34

We have a little army of Daleks.

0:14:340:14:37

When I watched Doctor Who as a kid,

0:14:370:14:39

often from behind the sofa,

0:14:390:14:41

you could only ever have a few Daleks on screen,

0:14:410:14:44

because they were actual props,

0:14:440:14:46

but here we're creating whole armies with a little computer code.

0:14:460:14:49

'It's terrifying.'

0:14:490:14:52

What's even more amazing

0:14:520:14:54

is that every single Dalek in that army can behave independently.

0:14:540:14:57

Using a piece of code, called the rand command,

0:14:570:15:01

we can instruct each Dalek to move its eyestalk,

0:15:010:15:04

head and body randomly.

0:15:040:15:06

So can we all have a go at changing the code?

0:15:070:15:09

Yeah, sure, we could make them look in the same direction,

0:15:090:15:12

if you'd like.

0:15:120:15:14

Yeah, that would look cool.

0:15:140:15:15

So let's change the head rotate,

0:15:150:15:17

cos that's which direction they're looking in,

0:15:170:15:20

so, instead of this, which picks a random number,

0:15:200:15:24

what we're going to do is we can put in just a number that you choose.

0:15:240:15:29

So let's give them a number.

0:15:290:15:31

Um... I don't know.

0:15:310:15:34

Pick a number.

0:15:340:15:35

By changing the code, we replace the rand command with a set number

0:15:370:15:42

and hey presto, you have an army of Daleks staring in one direction.

0:15:420:15:46

And they all look the same,

0:15:460:15:48

exactly the same way.

0:15:480:15:50

So you wouldn't want to be facing them.

0:15:500:15:53

'But that's exactly what we're going to do

0:15:560:15:59

'as visual effects artist, Rose,

0:15:590:16:00

'puts our acting skills to the test.

0:16:000:16:02

'Right, Rose, what's our motivation?'

0:16:020:16:05

In this scene, it's the Dalek Parliament,

0:16:050:16:07

so you're all surrounded by Daleks,

0:16:070:16:10

and I want you to look like, kind of scared.

0:16:100:16:12

Brilliant. Yeah, that works, like that.

0:16:120:16:15

Brilliant. And action.

0:16:150:16:17

When we want to mix actors with computer-generated effects,

0:16:240:16:27

you need to film them against a green screen,

0:16:270:16:29

so you can replace the background

0:16:290:16:31

with something you've designed yourself.

0:16:310:16:33

They're everywhere, what are you going to do?

0:16:330:16:36

Right, now, stand up, stand up.

0:16:360:16:38

Cool, now, look really brave.

0:16:380:16:42

Now, you're not going to be scared of these guys,

0:16:420:16:44

the Doctor's going to come along and save you in a bit.

0:16:440:16:47

'OK, that's a wrap.

0:16:470:16:49

'Now, it's back to the edit to upload and review the footage.'

0:16:490:16:52

You look great, don't you?

0:16:520:16:54

Your face is all covered up.

0:16:550:16:57

Wow, look at you, guys.

0:16:590:17:00

Oh, it's hilarious!

0:17:000:17:02

So shall we put you guys in this?

0:17:020:17:06

All right, so...

0:17:060:17:08

I'm going to use the computer here

0:17:090:17:11

to select all of the green and get rid of it.

0:17:110:17:13

-Are you ready?

-Yeah.

0:17:130:17:14

It's going to look really cool.

0:17:140:17:17

There it goes, see?

0:17:170:17:18

Is this how they film Doctor Who, then?

0:17:180:17:21

Yeah, this is how all of the green screen shots are done on Doctor Who,

0:17:210:17:24

using this kind of method.

0:17:240:17:27

That's so cool!

0:17:270:17:28

How long does it take to film an episode?

0:17:280:17:30

It depends on the episode,

0:17:300:17:32

it can be anywhere between a few weeks

0:17:320:17:35

or a couple of months, it depends on how many creatures are in it.

0:17:350:17:38

Now, I can put you on top of the footage I have here,

0:17:380:17:42

so that you'll be sitting in the Dalek Parliament.

0:17:420:17:45

So here we go.

0:17:450:17:48

That's you guys there.

0:17:480:17:50

Wow. That's so cool.

0:17:500:17:51

'Rose has used a graphics package to superimpose us into the shot.

0:17:510:17:55

'The computer runs a program

0:17:550:17:56

'which has removed all the green pixels from the footage

0:17:560:17:59

'and then merged the video with the computer-generated images.

0:17:590:18:03

'Hollywood, eat your heart out.

0:18:030:18:05

'Here comes the finished shot,

0:18:050:18:07

'the three of us transported into the Dalek Parliament.'

0:18:070:18:10

Here I am!

0:18:130:18:14

'And here's the Doctor on the same set.'

0:18:150:18:18

Remember, next time, when you watch all the monsters on Doctor Who,

0:18:180:18:21

that lots of them were generated by computers

0:18:210:18:24

and computer code was used to make them move around and look scary.

0:18:240:18:27

And it's all done by artists and coders

0:18:270:18:30

sitting around computers like these.

0:18:300:18:32

When writing your own computer program,

0:18:470:18:49

you'll sometimes want to include graphics.

0:18:490:18:53

I'm here with the pupils from the Ilsleys Primary School

0:18:530:18:55

so we can create our own computer graphics.

0:18:550:18:58

You can create something known as a bitmap

0:18:580:19:00

and that's when you break the picture down into a grid

0:19:000:19:03

of different coloured squares.

0:19:030:19:04

Hi, guys!

0:19:060:19:08

So we've given you a stack of cards and also a grid, known as a bitmap,

0:19:080:19:12

and that has a series of zeros and ones.

0:19:120:19:15

Every time you see a zero, that represents white.

0:19:150:19:17

When you see a one, that represents a black.

0:19:170:19:20

So just turn over the cards when you see a one

0:19:200:19:22

and see what picture you get.

0:19:220:19:24

'We've got two different teams,

0:19:270:19:29

'and each team is working through a different bitmap grid.'

0:19:290:19:32

Zero up there, white up there.

0:19:320:19:35

'When there's a zero in the grid, they place the card white face up,

0:19:350:19:38

'when there's a one, they place it black face up.

0:19:380:19:43

'We're using only zeros and ones to represent the information

0:19:430:19:46

'and we call this binary.

0:19:460:19:48

'So a computer can represent graphics and pictures

0:19:500:19:52

'as a grid of numbers.

0:19:520:19:54

'Each number tells us the colour of one small square called a pixel,

0:19:550:19:59

'and we build up the whole picture using a load of these pixels.'

0:19:590:20:03

All right, so, guys, how are you approaching this,

0:20:030:20:05

how are you working as a team?

0:20:050:20:06

We're doing the corners first and then seeing where they're going.

0:20:060:20:09

-So you're the director, telling everyone what to do.

-Yeah.

0:20:090:20:12

And they place them. Oh, that's cool.

0:20:120:20:14

Guys, wow, you seem to be doing really well. What's your strategy?

0:20:160:20:19

-Going row, row, row.

-Row, row, row.

0:20:190:20:21

Cool, so what do you think it could be?

0:20:210:20:23

I have no idea, it looks like antennae.

0:20:230:20:27

-We don't know...

-You've lost where you're at.

0:20:320:20:34

One, two, three, four, five, you're on the sixth level up.

0:20:340:20:37

Wow, you guys were super quick, that was awesome.

0:20:410:20:45

So what do you think it could be?

0:20:450:20:47

-Alien.

-An alien? Do you all think that?

0:20:470:20:50

-Like a robot.

-A robot?

0:20:500:20:52

What about computers?

0:20:520:20:54

Think about games.

0:20:540:20:55

-Space Invaders!

-Space Invaders, I think that's right.

0:20:550:20:58

Wow, you guys have done it as well.

0:21:000:21:02

So what do you reckon this is?

0:21:020:21:04

-A dog.

-A dog? What makes you say that?

0:21:040:21:06

Because it's got the legs and it's got the ears,

0:21:060:21:08

and it's kind of got the body shape.

0:21:080:21:10

-OK, oh, yeah, and that over there's a tail, I suppose.

-Yeah.

0:21:100:21:13

OK, no eyes, though.

0:21:130:21:15

But I've got to ask you, how come that leg down there,

0:21:150:21:19

it seems by itself?

0:21:190:21:21

Is there a black missing?

0:21:210:21:22

So I reckon this one actually should be a black,

0:21:220:21:25

I think it was a number one.

0:21:250:21:27

Yeah...

0:21:270:21:29

-Now, that looks a bit better, doesn't it?

-Yeah.

0:21:290:21:32

So, guys, these look totally awesome.

0:21:320:21:34

However, they do look rather blocky

0:21:340:21:36

and that's because the squares we're using are rather big.

0:21:360:21:38

So I have some smaller squares, which are a quarter of the size -

0:21:380:21:42

you can fit four of these

0:21:420:21:43

into one of the squares you've got at the moment

0:21:430:21:45

making it a bit smoother, and that's something we call higher resolution.

0:21:450:21:49

'A higher resolution picture contains more pixels,

0:21:550:21:58

'so there's more information and we can have more detail.

0:21:580:22:02

'And there are other ways to improve the picture too.

0:22:020:22:05

'Today, we're only using zero and one for white and black,

0:22:050:22:09

'but if we used more numbers, we could have different colours.

0:22:090:22:13

'When your computer stores a photo,

0:22:130:22:15

'each pixel could be any one of over 16,000,000 colours.'

0:22:150:22:20

That's better already, can you see? It's actually less harsh,

0:22:200:22:24

it curves a bit more, these edges are a lot smoother.

0:22:240:22:29

Yeah, that's working really well, cool.

0:22:290:22:31

This is pretty impressive.

0:22:310:22:33

Oh, you've even put the white bits in the ears.

0:22:330:22:35

Yeah, I thought if we could have even smaller squares,

0:22:350:22:39

coloured maybe pink inside,

0:22:390:22:42

it would look even more effective.

0:22:420:22:45

Yeah, you could have the pink inside the ears, that would be great.

0:22:450:22:48

So what do you think, do you like it, do you think it looks better?

0:22:480:22:51

A bit smoother?

0:22:510:22:52

It has a higher resolution.

0:22:520:22:54

So, guys, these look great.

0:22:560:22:58

The smaller squares have improved it already,

0:22:580:23:00

and if we were to go even smaller with the squares,

0:23:000:23:03

we could make it much better, and if we were to add more numbers,

0:23:030:23:06

not just the zeros and ones, we could actually add some colour too.

0:23:060:23:10

Nowadays, miniature computers are everywhere,

0:23:240:23:27

inside our tablets and mobile phones.

0:23:270:23:29

This is a new generation computer,

0:23:290:23:31

the size of a credit card.

0:23:310:23:34

These tiny computers are what my hackers and I

0:23:340:23:37

have come to see today.

0:23:370:23:38

I'm Lottie.

0:23:380:23:39

I'm Harry.

0:23:410:23:43

And this is Dave.

0:23:450:23:46

Today, he's showing us the exciting things

0:23:460:23:49

we can do with a tiny computer and a bit of programming.

0:23:490:23:52

What is a Raspberry Pi?

0:23:520:23:53

It's a small computer, it's very cheap and it's very lightweight.

0:23:530:23:57

I thought it would be about that big,

0:23:570:24:02

but it's a lot smaller and it can still fit everything you need.

0:24:020:24:06

Some things you recognise off a normal computer,

0:24:060:24:09

and there's other things you've never seen before

0:24:090:24:11

because it's like on the inside, it's inside a computer.

0:24:110:24:14

Because it's a fully functional computer,

0:24:170:24:19

you can programme it to do all sorts of amazing things,

0:24:190:24:22

like building your own electronics projects.

0:24:220:24:25

And because it's small,

0:24:250:24:27

Dave and his friends have done something really cool.

0:24:270:24:30

You might think these photos were taken by satellite,

0:24:320:24:35

but, actually, they were taken from this balloon.

0:24:350:24:39

Hanging from the balloon is a box which contains an ordinary webcam,

0:24:390:24:43

a sat nav tracker, a radio transmitter

0:24:430:24:46

and, of course, the miniature computer,

0:24:460:24:49

which Dave has programmed to snap the photos

0:24:490:24:51

and then beam them back down to Earth.

0:24:510:24:54

So this is what we have in the payload, as it's called,

0:24:540:24:58

there's the webcam that it takes photos with,

0:24:580:25:01

and that's the aerial, so that dangles out the bottom

0:25:010:25:05

of the box and that transmits signals maybe 300, 500 miles away.

0:25:050:25:11

And how do you get the signals?

0:25:110:25:12

I've got a ten-metre pole in the garden there

0:25:120:25:16

-with an aerial up the top.

-Oh, wow!

0:25:160:25:18

'So Dave's connected the webcam and sat nav tracker as inputs

0:25:180:25:22

'and the radio transmitter is the output.

0:25:220:25:25

'Now we know how it all works,

0:25:250:25:27

'let's get the kit ready for launch.'

0:25:270:25:29

Perfect, and then just slide in.

0:25:310:25:33

'The computer and webcam go into the protective box,

0:25:350:25:39

'and this will be hung underneath the balloon.'

0:25:390:25:42

That's probably the biggest balloon you've ever seen.

0:25:420:25:44

'Dave fills the balloon with helium, just like a massive party balloon.'

0:25:440:25:48

It's attacking me.

0:25:520:25:53

SHE LAUGHS

0:25:530:25:55

'With Dave and his friends, we ease it up into the sky.

0:26:040:26:07

'There's a balloon, a parachute,

0:26:070:26:09

'our computer and a backup transmitter

0:26:090:26:13

'so we can find it even if the computer goes wrong.'

0:26:130:26:16

Three, two, one!

0:26:160:26:18

THEY LAUGH

0:26:180:26:21

Bye-bye, balloon, see you later.

0:26:260:26:30

With the balloon launched,

0:26:310:26:33

the webcam is already taking pictures.

0:26:330:26:35

Each picture is split up into sections

0:26:350:26:38

which are transmitted piece by piece

0:26:380:26:40

over the radio transmitter back to Earth.

0:26:400:26:43

The photos look stunning,

0:26:430:26:45

but the quality of the image isn't very high.

0:26:450:26:47

The radio transmitter can send us the photos from a long way away,

0:26:470:26:51

but it's quite slow, so we can only send low-resolution pictures.

0:26:510:26:56

So, when I programme this, I have to choose what size image to take

0:26:560:27:01

and how much to compress it down to a file

0:27:010:27:03

that takes not too long to send.

0:27:030:27:06

So there's a compromise between a nice big image

0:27:060:27:09

that's got lots of detail but takes for ever to send

0:27:090:27:12

and then, a nice small image that we can send lots of.

0:27:120:27:15

All of this only works

0:27:150:27:17

because Dave's written some programs for the tiny computer

0:27:170:27:19

which make everything work together.

0:27:190:27:22

So what does the code look like?

0:27:220:27:24

It just looks like somebody's randomly done that.

0:27:240:27:27

Oh, yeah, that's how I build my programs.

0:27:270:27:29

It's not too bad actually.

0:27:290:27:31

One program tells the webcam to take the pictures

0:27:310:27:34

and what resolution to take them at.

0:27:340:27:36

This is written as a loop

0:27:360:27:38

so the webcam keeps taking pictures one after another, every 30 seconds.

0:27:380:27:43

Another program sends output to the radio transmitter,

0:27:430:27:47

transmitting the pictures to Earth.

0:27:470:27:50

It also sends the position from the sat nav tracker,

0:27:500:27:53

so that Dave and his friends can track the balloon.

0:27:530:27:56

With the balloon floating up above Earth,

0:28:030:28:06

Dave and his wife Julie set off to chase it.

0:28:060:28:08

The program on the minicomputer is constantly transmitting

0:28:080:28:11

its height and location,

0:28:110:28:13

so we know exactly where it is.

0:28:130:28:15

The balloon could land hundreds of kilometres away -

0:28:150:28:18

it's even landed in the sea before.

0:28:180:28:20

Let's hope that doesn't happen today.

0:28:200:28:22

Meanwhile, back at Mission Control,

0:28:300:28:33

with Dave's friend Anthony,

0:28:330:28:34

we view the pictures as well as tracking the balloon

0:28:340:28:37

and following Dave's progress.

0:28:370:28:39

OK, so those are just coming in now,

0:28:400:28:43

those are slightly higher than you would go in a plane.

0:28:430:28:46

If you just go up a little bit,

0:28:460:28:48

-you see the sky's beginning to get dark.

-Yeah.

-Yeah.

0:28:480:28:52

And you're getting more and more of the curvature of the Earth.

0:28:520:28:54

It's incredible, it's amazing.

0:28:540:28:57

I like that one because there's the sun,

0:28:570:28:59

the Earth and the black of space.

0:28:590:29:01

Yeah, it's beautiful, it's gorgeous.

0:29:010:29:03

That's one of my favourites because it's really bright.

0:29:030:29:06

Yeah. That's incredible.

0:29:060:29:08

It's amazing to think these photos were taken

0:29:110:29:13

by a computer the size of a credit card

0:29:130:29:15

floating above the clouds in a homemade box.

0:29:150:29:19

Dave even holds the record

0:29:190:29:21

for the highest photograph taken by amateur equipment,

0:29:210:29:24

nearly 40 kilometres above the Earth.

0:29:240:29:27

But today, our balloon is only travelling

0:29:270:29:30

up to about 30 kilometres.

0:29:300:29:32

That's still three times as high as a passenger plane flies.

0:29:320:29:36

Then, it bursts and starts its descent back to Earth by parachute.

0:29:360:29:41

-OK, there it goes, it's just burst.

-Oh, wow!

0:29:410:29:44

Looks like it's burst.

0:29:440:29:45

Oh, good, what altitude did it burst at?

0:29:450:29:48

30, 431.

0:29:480:29:49

30, 431. OK, that's good.

0:29:490:29:51

So Dave now knows, so he will go and track it down.

0:29:510:29:54

Yeah, he will have picked up in the car that it's burst

0:29:540:29:57

and he will now be going.

0:29:570:29:58

'After about 30 minutes, the balloon lands back on Earth.'

0:29:580:30:02

So that's the field it's landed in.

0:30:020:30:04

'Once the height we're receiving stops going down,

0:30:040:30:07

'we know the balloon's landed

0:30:070:30:09

'and, of course, we also get a picture of the ground.'

0:30:090:30:13

Can we talk to Dave?

0:30:130:30:15

Yeah, absolutely, yeah, if you type in that box there,

0:30:150:30:17

type in, "Dave, head up the M11."

0:30:170:30:19

We're heading left on the M11 in a few miles. Excellent!

0:30:220:30:26

There's a road on the left there,

0:30:370:30:39

so that's probably where we want Dave to get to.

0:30:390:30:41

As night falls, Dave pulls up in the field,

0:30:470:30:50

but will he be able to find the box in the dark?

0:30:500:30:53

There you go, so, how has it survived?

0:30:550:30:59

That looks pretty good, so almost completely intact,

0:30:590:31:03

and that's what's left of the balloon.

0:31:030:31:05

TELEPHONE RINGS

0:31:050:31:07

-Oh, there you go. Well, let's see where they're at.

-It's just moved.

0:31:070:31:10

Hiya, Dave.

0:31:100:31:12

Hey, Anthony, how are you doing?

0:31:120:31:13

-Hey, excellent.

-'I have some good news for you.'

0:31:130:31:15

I am holding in my hand

0:31:150:31:17

a parachute, the full piece of latex

0:31:170:31:19

and the Pi payload and buzz as well.

0:31:190:31:22

ALL: Yeah!

0:31:220:31:23

Superb!

0:31:230:31:24

'That's cool.'

0:31:240:31:26

They're quite pleased.

0:31:260:31:28

-Very pleased, yeah.

-Speak to you soon.

0:31:280:31:30

-'Thank you, bye-bye.'

-Bye, cheers, bye.

0:31:300:31:32

This has been a record-breaking piece of programming,

0:31:340:31:37

and we've been able to take some amazing pictures.

0:31:370:31:40

'By learning to program,

0:31:400:31:41

'there's all sorts of things we can make possible,

0:31:410:31:43

'whether it's creating a game for our mobile phone

0:31:430:31:46

'or doing something really cool with a tiny computer.'

0:31:460:31:50

The sky's the limit.

0:31:500:31:51

Today's computers are getting smaller and cheaper,

0:32:020:32:05

and this little thing is a Raspberry Pi.

0:32:050:32:07

It's a credit card-sized computer

0:32:070:32:09

and you can plug in your keyboard, mouse and monitor.

0:32:090:32:14

These have been designed to explore computer programming,

0:32:140:32:17

so I've come to St Saviour's Primary

0:32:170:32:19

to see how they're using their Pi

0:32:190:32:20

to generate code that has some real bite.

0:32:200:32:23

'Getting started is really straightforward.

0:32:240:32:26

'Just like any computer, plug in your inputs, such as your keyboard,

0:32:260:32:31

'and your outputs, in this case, your monitor.

0:32:310:32:35

'With the computers connected up,

0:32:350:32:36

'we're using open source coding software

0:32:360:32:40

'to programme a motion-sensing crocodile,

0:32:400:32:42

'so that when you place your finger in the croc's mouth,

0:32:420:32:44

'it'll bite you.'

0:32:440:32:46

It's now croc time, so you should see a box of Lego

0:32:480:32:50

along with some instructions - get going!

0:32:500:32:52

'So first off, following the instruction sheet,

0:33:010:33:03

'the group need to build their crocodile.'

0:33:030:33:06

Donna, where does this one go?

0:33:060:33:09

'The crocodile will then be brought to life by connecting it up

0:33:090:33:12

'to the miniature computer before we start the coding.'

0:33:120:33:16

-Is it those?

-Yeah!

0:33:160:33:17

OK, so what are all these bits?

0:33:170:33:19

So, this is the motor and this is the sensor,

0:33:190:33:23

so when the finger comes along,

0:33:230:33:26

-there will be a thing here and it will...

-Trap your finger.

0:33:260:33:31

Yeah, trap your finger.

0:33:310:33:32

So it will be the roof of the mouth.

0:33:320:33:34

And then, what does the motor do?

0:33:340:33:37

So the motor powers it to go up and down.

0:33:370:33:39

Up and down, oh, cool.

0:33:390:33:41

'So, in this system, the sensor is the input and the motor the output.'

0:33:410:33:47

So if you put your finger here, it will bite you?

0:33:470:33:50

Yeah.

0:33:500:33:51

So has everyone finished building their crocodiles?

0:34:000:34:02

ALL: Yes.

0:34:020:34:03

Awesome, now we're getting to the dangerous bit.

0:34:030:34:05

We want you to write a program, using Scratch,

0:34:050:34:08

so that when you put your finger in the crocodile's mouth,

0:34:080:34:10

it will bite you.

0:34:100:34:12

In the same way that the crocodile fits together piece by piece,

0:34:120:34:15

this computer code fits together like building blocks.

0:34:150:34:19

All the commands you need are on the left hand side of the screen,

0:34:190:34:22

which you drag into the middle to write your program.

0:34:220:34:25

For this program, we're going to need to use the sensing commands,

0:34:250:34:29

which tell the crocodile when to shut its mouth.

0:34:290:34:32

The sensor value tells you how far you are from the crocodile's mouth.

0:34:320:34:36

As your hand gets closer to the sensor, the number decreases,

0:34:360:34:40

so you need to check what number it goes down to

0:34:400:34:43

when your finger is in its mouth.

0:34:430:34:45

Now that the croc is programmed to know when to bite,

0:34:460:34:49

we need to programme it so it knows how to bite,

0:34:490:34:52

so we need to write some code for the croc's motor

0:34:520:34:55

so its mouth will open and shut.

0:34:550:34:57

Great, so you've programmed yours to start biting your finger, right?

0:34:570:35:01

-Yeah.

-OK, do you want to show me what you did?

0:35:010:35:03

So, as you can see, it's less than 20,

0:35:030:35:07

it won't bite unless it's under 20.

0:35:070:35:11

-So 20, that's the distance your finger is from the sensor.

-Yeah.

0:35:110:35:15

So when it closes, it stays on for one second,

0:35:150:35:20

and then, this way means it goes open,

0:35:200:35:24

so it goes that way for one second and then this way.

0:35:240:35:27

-So it bites your finger for one second and then lets go?

-Yeah.

-OK.

0:35:270:35:31

-And that's all down to your programming?

-Yeah.

0:35:310:35:33

Oh, that's so cool.

0:35:330:35:35

'And it really is that straightforward

0:35:350:35:37

'to write a simple computer program.'

0:35:370:35:39

Congratulations, you all built and coded a finger-biting crocodile.

0:35:390:35:44

Did anyone lose any fingers though?

0:35:440:35:46

ALL: No.

0:35:460:35:47

Good stuff.

0:35:470:35:49

'It's incredible to think you can do all this

0:35:490:35:52

'with such a tiny little computer.

0:35:520:35:54

'I wonder what else you can do with it?'

0:35:540:35:56

Robots aren't just in science-fiction stories,

0:36:090:36:12

they're already playing a role in our lives,

0:36:120:36:15

from making cars, toys and electronic gadgets -

0:36:150:36:17

we've even got them playing their own sport now.

0:36:170:36:20

WHISTLE

0:36:200:36:22

All robots are controlled by a computer,

0:36:220:36:24

but the question is, how does the computer tell them what to do?

0:36:240:36:28

My hackers and I are going to find out.

0:36:280:36:30

Hi, I'm Sam.

0:36:300:36:32

Hi, I'm Saffia.

0:36:320:36:34

We've come to Plymouth University to meet their robot football team.

0:36:340:36:37

Come on, guys!

0:36:370:36:38

One, two, three, go!

0:36:410:36:43

Today, it's people versus machines.

0:36:490:36:52

Sam and Saffia are using game controllers

0:36:520:36:54

to control these white robots,

0:36:540:36:56

but they're up against Plymouth's Black Ninja robots,

0:36:560:36:59

who play football in the International Robot World Cup.

0:36:590:37:03

The black robots have been programmed

0:37:030:37:05

so they can play by themselves,

0:37:050:37:07

they don't need anyone controlling them with joy pads.

0:37:070:37:09

It's pretty clever stuff.

0:37:090:37:11

These are our football robots.

0:37:120:37:14

The rules state, in the competition,

0:37:140:37:16

that all the robots have to be what's known as autonomous,

0:37:160:37:19

that means automatic.

0:37:190:37:21

So they have to do everything by themselves,

0:37:210:37:24

without humans controlling.

0:37:240:37:26

The main thing about these robots is that they use shapes

0:37:260:37:30

and colours to define things,

0:37:300:37:32

but they have to have little tricks,

0:37:320:37:35

like an orange thing on a green background.

0:37:350:37:39

If you took that orange ball

0:37:390:37:40

and you put it over in a different coloured background,

0:37:400:37:43

it won't think that's the ball.

0:37:430:37:44

You have to make very simple rules to make it understand what to do.

0:37:440:37:49

THEY CHEER

0:37:490:37:54

'To make robots play for themselves,

0:37:550:37:58

'we have to write computer code -

0:37:580:38:00

'it's this code that makes the robot do things,

0:38:000:38:02

'like walk or kick the ball.

0:38:020:38:04

'Programmers need to think hard

0:38:040:38:06

'about exactly what actions the robot needs to perform,

0:38:060:38:09

'what things does the program need to know

0:38:090:38:11

'and what things doesn't it need to worry about.

0:38:110:38:14

'For example, if we want to programme a robot goalkeeper

0:38:140:38:18

'we need to know where the ball is and when it's heading for the goal,

0:38:180:38:21

'so the position is the most important thing.

0:38:210:38:24

'We can think of a number line for our position,

0:38:240:38:28

'with zero in the middle where our goalkeeper starts.

0:38:280:38:31

'If the ball is heading for the negative numbers,

0:38:310:38:34

'then the goalkeeper dives to the right.

0:38:340:38:36

'If it's positive,

0:38:360:38:37

'then the goalkeeper dives to the left,

0:38:370:38:40

'and if it's near the middle, then he stays in the middle.

0:38:400:38:43

'But what does the code to control the goalkeeper actually look like?'

0:38:430:38:47

If the ball is between this far away and over to the left,

0:38:470:38:52

then we want you to dive left.

0:38:520:38:54

'If the position along the goal line

0:38:540:38:57

'is bigger than 100 but less than 2,000,

0:38:570:39:00

'then the code makes the goalkeeper dive to the left.

0:39:000:39:03

'But if the position is between minus 100 and minus 2,000,

0:39:060:39:11

'the goalkeeper dives right.'

0:39:110:39:13

And also, we have to have a robot that just stands in the middle,

0:39:130:39:17

because, otherwise, if he dived left

0:39:170:39:19

and the ball was going straight at us, it would be a goal.

0:39:190:39:21

'If the position is close to zero,

0:39:210:39:24

'in between minus 100 and positive 100,

0:39:240:39:26

'then the goalkeeper stays in the middle.

0:39:260:39:30

'So the goalkeeper decides what he's going to do

0:39:300:39:33

'using these "if" conditions.'

0:39:330:39:35

How do you write such a long and complicated code?

0:39:410:39:43

A long piece of code is made up of small functions,

0:39:430:39:49

and the functions do various little things that we want.

0:39:490:39:53

So "looking for ball" would be a function.

0:39:530:39:55

Then "walk to ball" would be another function.

0:40:000:40:03

So that makes it much more manageable.

0:40:080:40:10

So robots break down playing football

0:40:100:40:13

into a series of different functions, simple tasks.

0:40:130:40:16

I wonder how different that is from what Sam and Saffia are doing

0:40:160:40:19

when they're controlling their robots.

0:40:190:40:22

Oh, come on!

0:40:220:40:23

BOTH: Yeah!

0:40:230:40:25

Once a program has been written,

0:40:250:40:27

the code gets downloaded onto the robot.

0:40:270:40:30

Each robot has its own processor board,

0:40:300:40:33

a tiny computer that runs the code

0:40:330:40:34

so it can decide what the robot should do.

0:40:340:40:37

All right, guys, that's it, OK.

0:40:410:40:44

The scores are 2-0 to the white team.

0:40:440:40:46

THEY CHEER

0:40:460:40:48

'With so many things to do,

0:40:480:40:49

'playing football's actually a very complicated game

0:40:490:40:51

'for a robot to play.

0:40:510:40:53

'Even with all the long code,

0:40:530:40:55

'the autonomous robots couldn't always find the ball

0:40:550:40:58

'or kick it in the right direction,

0:40:580:40:59

'so they just couldn't win against Saffia and Sam.'

0:40:590:41:03

Press that button there and he'll do an impression of Usain Bolt.

0:41:030:41:07

HE CHUCKLES

0:41:070:41:08

It's a pretty good look, right?

0:41:080:41:10

So robots can be programmed to play football and other games

0:41:140:41:17

by breaking the tasks down into a series of simple instructions.

0:41:170:41:21

But this robot is called iCub,

0:41:210:41:24

and he doesn't need step by step instructions,

0:41:240:41:26

he can learn what to do for himself.

0:41:260:41:28

We looked at how children learn

0:41:280:41:31

and we tried to model that process

0:41:310:41:35

so that our robot is able to learn

0:41:350:41:38

in the same way that you or I can.

0:41:380:41:40

This is a box.

0:41:420:41:43

iCub: Box.

0:41:450:41:46

-Cool.

-What is this?

0:41:460:41:47

iCub: Box.

0:41:490:41:50

This is a stapler, what is this?

0:41:530:41:55

iCub: Stapler.

0:41:560:41:57

Where is the box?

0:41:590:42:01

'So iCub has been programmed in a different way.

0:42:070:42:10

'His computer program can learn new things,

0:42:100:42:12

'and that's a very complicated program to write.'

0:42:120:42:16

Does it only recognise one voice

0:42:160:42:18

or does it recognise other people's voices?

0:42:180:42:20

We use a commercial software for speech recognition,

0:42:200:42:24

and that's been trained on my voice.

0:42:240:42:26

Does it understand Northern, my accent?

0:42:260:42:29

-It would if we trained it on your voice, yes.

-OK.

0:42:290:42:31

Getting speech recognition to work with children is difficult

0:42:310:42:34

because the pitch is much higher.

0:42:340:42:36

'So the robot really only understands Tony's voice,

0:42:370:42:40

'but we're going to give it a go anyway.'

0:42:400:42:43

This is a box.

0:42:430:42:45

What is this?

0:42:450:42:47

'Try speaking deeper, try to sound more like Tony.'

0:42:480:42:51

This is a box.

0:42:510:42:53

What is this?

0:42:540:42:56

iCub: Box.

0:43:000:43:02

Yeah, that's cool!

0:43:020:43:05

This is a stapler, what is this?

0:43:090:43:12

iCub: Box.

0:43:150:43:17

Where is the box?

0:43:200:43:21

THEY CHEER

0:43:250:43:28

'Tony says that iCub's learning things like children do.

0:43:280:43:31

'I wonder how similar it is

0:43:310:43:33

'to the way people actually do learn things.'

0:43:330:43:36

Why did it get some things wrong?

0:43:360:43:39

If we'd written our program as a series of steps to execute,

0:43:390:43:44

then it would have gone through those steps

0:43:440:43:46

and it would have performed perfectly.

0:43:460:43:48

What's going on here with iCub,

0:43:480:43:50

because it's learning things in much the same way that children do,

0:43:500:43:55

it does make mistakes,

0:43:550:43:56

it makes quite a lot of mistakes

0:43:560:43:58

and that doesn't always make for the best demo.

0:43:580:44:01

What iCub's doing that's different is...

0:44:010:44:05

it's working in situations that the designer can't foresee -

0:44:050:44:09

you can't lay down a set of rules saying, you know,

0:44:090:44:12

"This is what a stapler is going to look like." All right?

0:44:120:44:15

Because then somebody will bring in some new stapler

0:44:150:44:18

that looks a bit different and iCub's lost.

0:44:180:44:21

'Learning a few objects might not seem like much,

0:44:210:44:24

'but this is early days.

0:44:240:44:25

'Programmers like Tony are constantly developing their programs

0:44:250:44:29

'and improving them so that one day in the future,

0:44:290:44:32

'robots will be able to learn to do all sorts of things.'

0:44:320:44:36

So there's still some way to go, but, like all technologies,

0:44:360:44:40

it only takes a matter of time.

0:44:400:44:42

Maybe in the future, you'll be working on the next generation

0:44:420:44:45

of robot football players.

0:44:450:44:47

Have you ever wanted to own your own robot?

0:44:590:45:01

Robots are really cool, but they're useless

0:45:010:45:03

if you can't tell them what you want them to do

0:45:030:45:06

in a way that they'll understand.

0:45:060:45:07

So I'm here at The Digital School House

0:45:070:45:10

with some pupils from Marish Primary School

0:45:100:45:12

and they're going to show me how they program their own robots.

0:45:120:45:15

We've got a map of a town,

0:45:160:45:18

full of buildings like hairdressers, florists and a gym.

0:45:180:45:22

Our car is going to start next to the sports shop at A

0:45:220:45:25

and then drive through the town to the baker's at B.

0:45:250:45:28

FD,

0:45:320:45:34

RT90,

0:45:340:45:37

FD.

0:45:370:45:39

First of all, we've got to plan our route,

0:45:390:45:41

breaking it down into a sequence of step-by-step instructions.

0:45:410:45:45

We can get around the whole town with just three instructions -

0:45:450:45:48

move forward, turn left 90 degrees and turn right 90 degrees, so that

0:45:480:45:53

our car follows the road through the town avoiding all buildings.

0:45:530:45:57

FD, FD, done.

0:45:580:46:02

Now, we're recreating the town on our computer,

0:46:030:46:06

using different pictures to represent the shops and buildings.

0:46:060:46:10

We're making this like a town so the car can move around.

0:46:100:46:14

We're trying to match these pictures with those pictures over there.

0:46:140:46:19

OK, so all these objects represent shops in the town, is that it?

0:46:190:46:23

Yeah.

0:46:230:46:25

So we go to gym, we press gym.

0:46:250:46:28

So you've just added gym to the objects of things

0:46:280:46:30

that now are on your map.

0:46:300:46:32

Yeah, so it will make it more interesting, cos then

0:46:320:46:34

the robotic car can go to lots of different places, like everyday life.

0:46:340:46:40

Oh, cool.

0:46:400:46:42

Now we create a procedure called "Drive".

0:46:420:46:45

A procedure is the list of instructions

0:46:450:46:47

that our car is going to follow. It will only do exactly what we tell it

0:46:470:46:52

so we've got to make sure we've got all the instructions right

0:46:520:46:55

otherwise the car will go the wrong way.

0:46:550:46:58

So can you tell me about the commands?

0:46:580:47:00

Well, I'm telling it to do forward, forward, right turn 90 degrees.

0:47:000:47:06

So the FD means forward and then the RT90 means right turn 90,

0:47:060:47:12

so that 90 is the degrees you want your car to turn.

0:47:120:47:15

These simple instructions are the building blocks of our code,

0:47:150:47:19

and with the right sequence of instructions

0:47:190:47:21

we can make the robot travel any route we like.

0:47:210:47:24

So, where will your car end up, then?

0:47:250:47:27

Next to the bakery.

0:47:270:47:29

-OK, fingers crossed, that's if everything works out.

-Yeah.

0:47:290:47:32

An important part of programming

0:47:320:47:34

is to test the code that we've written.

0:47:340:47:37

Some of the groups have decided to test their procedures

0:47:370:47:39

on the computer before they try it out with their actual robot.

0:47:390:47:44

That's a good idea, because it's going to be much quicker

0:47:440:47:46

to change it now rather than later.

0:47:460:47:49

Looks like the car's crashing into the gym.

0:47:490:47:51

You might need to check the code, guys!

0:47:510:47:53

Once we've tested it, we need to connect up our car

0:47:550:47:58

and download the procedure, so our code can tell the robot what to do.

0:47:580:48:02

And now, the moment of truth. Have we got it right?

0:48:030:48:07

We've made it past the first bend.

0:48:110:48:13

Hang on!

0:48:150:48:16

It's all gone wrong on this corner.

0:48:160:48:18

We should have turned right 90 degrees,

0:48:180:48:20

but we're going back the way we came. How did that happen?!

0:48:200:48:24

And now we've crashed into the cake shop.

0:48:240:48:26

That's what happens when you don't test your code properly!

0:48:260:48:29

Looking good so far.

0:48:390:48:40

So close!

0:48:430:48:45

But they've gone forward again.

0:48:450:48:47

They've missed the turn. Now they're not even on the map!

0:48:470:48:51

And, into the crash barrier.

0:48:510:48:52

When I was there, I was meant to do a RT90

0:48:520:48:55

then move forward twice and then do an LE90.

0:48:550:48:58

OK, so it was the right and left you got wrong, basically.

0:48:580:49:01

Oh, that's such a shame, guys!

0:49:010:49:03

-Do you think it's going to work?

-Yeah!

0:49:030:49:05

-Do you guys think it's going to work?

-Yes.

0:49:050:49:08

OK, let's go. Fingers crossed.

0:49:080:49:11

Tension's mounting!

0:49:230:49:25

Brilliant! We've made it!

0:49:330:49:35

That's great, guys! Next to the baker, just how we wanted to be.

0:49:350:49:39

Cool! It looks like it's going to be easy

0:49:390:49:41

just to write a set of instructions, doesn't it?

0:49:410:49:44

But actually, it's quite hard.

0:49:440:49:45

But you need those instructions to be precise, so that your robot

0:49:450:49:48

knows exactly where to go, that step-by-step process.

0:49:480:49:52

When you're programming, you often have to find and fix mistakes

0:49:520:49:56

until your code does exactly what you want.

0:49:560:49:59

We call mistakes "bugs",

0:49:590:50:00

and getting rid of the bugs is all part of the fun.

0:50:000:50:04

Everybody loves playing with toys,

0:50:150:50:17

whether it's train sets,

0:50:170:50:19

action figures or board games.

0:50:190:50:22

Many of today's toys already have computers in,

0:50:230:50:27

but there's a new generation of toys

0:50:270:50:28

which are way more sophisticated

0:50:280:50:30

making their way into toy stores near you.

0:50:300:50:33

To find out more about this,

0:50:330:50:35

my two intrepid hackers, Edward and Hannah, have come with me

0:50:350:50:39

to meet two guys who've created something quite extraordinary.

0:50:390:50:43

Hi, I'm Edward.

0:50:430:50:44

Hi, I'm Hannah.

0:50:460:50:48

They've produced something they call AppToys,

0:50:480:50:50

which use the newest technologies

0:50:500:50:52

and the most inventive computer programming.

0:50:520:50:55

So, guys, do you know what AppToys are?

0:50:550:50:57

-Well, I know what apps are.

-I know what toys are.

0:50:570:50:59

But we're not really sure what AppToys are.

0:50:590:51:01

OK, I think we're just about to find out.

0:51:010:51:03

Hi, guys. Come on down.

0:51:060:51:07

Thanks for coming. My name's Elliot, this is Martin.

0:51:110:51:15

Together, we're toy developers

0:51:150:51:17

and we'd like to show you our range of products.

0:51:170:51:20

AppToys use smart devices, such as phones or tablets, to control them.

0:51:200:51:25

First off, you download an app to your smart device,

0:51:250:51:28

which is then placed inside the toy,

0:51:280:51:30

such as a dog kennel or police car, which you buy from a toy shop.

0:51:300:51:34

When you put the phone inside the kennel

0:51:340:51:38

the phone recognises that it's inside the kennel.

0:51:380:51:42

Then it divides the screen up accordingly

0:51:420:51:45

so that it aligns with our mirrors, which gives it the 3D effect.

0:51:450:51:49

So, we have the phone that has the app we downloaded,

0:51:490:51:53

and then we've put it into this hardware, where there's mirrors,

0:51:530:51:56

but how does it all come together?

0:51:560:51:58

Are there sensors in the hardware, so the phone recognises it's there?

0:51:580:52:04

Yeah, there's accelerometers and the accelerometer recognises

0:52:040:52:07

what angle it's at, so if it's upside down,

0:52:070:52:10

which is what is required for the kennel, we can recognise that.

0:52:100:52:13

Smartphones are mini-computers

0:52:130:52:15

and have a number of different inputs, processors and outputs.

0:52:150:52:21

The accelerometer is one of these inputs

0:52:210:52:24

and tells the phone which way up it is.

0:52:240:52:26

The AppToy also uses the phone's other inputs, such as

0:52:260:52:30

the microphone, and processing software like speech recognition.

0:52:300:52:34

So, in this case, you give your virtual pets different commands.

0:52:340:52:38

Chase tail.

0:52:380:52:40

Wow!

0:52:400:52:41

-So it's using voice activation.

-That's good.

0:52:410:52:44

-Can it roll over?

-It can roll over. Roll over!

0:52:440:52:48

THEY LAUGH

0:52:480:52:49

-So how do you feed it?

-You say, "Feed",

0:52:490:52:51

then you put your finger through the front

0:52:510:52:53

and the camera is looking for your finger

0:52:530:52:55

so it knows that you've fed it.

0:52:550:52:57

Some of the toys make use of the smartphones' ability

0:52:570:53:00

to transfer information between them using Bluetooth technology.

0:53:000:53:04

This one's a bit scarier than a dog.

0:53:040:53:06

CREATURE ROARS

0:53:060:53:09

That's called Battle-Dino

0:53:090:53:10

because you train it to become a real fighting machine

0:53:100:53:13

and then you send it to your friend's crate

0:53:130:53:16

and they battle it out together, so the strongest dinosaur wins.

0:53:160:53:19

-Wow!

-That's really, really good.

0:53:190:53:22

That's cool?

0:53:220:53:23

-Good, we spent a long time working on it!

-HE LAUGHS

0:53:230:53:26

AppToys use the existing technologies of smartphones,

0:53:270:53:31

but they still need to program all this technology

0:53:310:53:33

to get it to do all the cool things they want it to.

0:53:330:53:37

Programming whizz Martin shows us how he used computer coding

0:53:370:53:41

to design the T-Rex game.

0:53:410:53:42

HIGH-PITCHED ROAR

0:53:420:53:44

In the game, the T-Rex will grow from a baby to an adult

0:53:440:53:48

and as he gets bigger, his roar will have to change.

0:53:480:53:51

Now, the really cool thing about coding and sound is that you can

0:53:510:53:55

use the code to change the sound, so you don't need to have lots of

0:53:550:53:59

different recordings of him roaring, you can just change it in code.

0:53:590:54:03

And what we did, if we go back and look at the T-Rex code, you can

0:54:030:54:07

see, when we go down here, we have this command, "audio.pitch", OK?

0:54:070:54:13

The pitch of the sound is the quality that makes it

0:54:130:54:16

either high or low, and what we're going to do is,

0:54:160:54:19

we just make that pitch equal to the speed that he's animating at.

0:54:190:54:24

The computer uses this number, the audio.pitch value,

0:54:240:54:28

to determine how long to play the sound for.

0:54:280:54:31

-So, can we have a go at that?

-Yeah, sure.

0:54:310:54:33

OK, so, instead of using the speed to do the pitch,

0:54:330:54:38

it could be anything, really, from 0 to 5, 6 or like 2.5, 3.5.

0:54:380:54:46

Shall we try 3.5?

0:54:460:54:48

-Yeah, go on.

-You type it.

0:54:480:54:51

3.5.

0:54:510:54:54

And then we put that to finish the line, then we'll save it.

0:54:540:54:58

So he's going to roar at 3.5 now.

0:54:580:55:02

SQUEAKY ROAR

0:55:020:55:04

THEY LAUGH

0:55:040:55:07

That, it wasn't scary, it sounded like he was in pain!

0:55:070:55:10

Like someone had stood on him!

0:55:100:55:12

SQUEAKY ROAR

0:55:120:55:14

Shall we make it a bit deeper?

0:55:140:55:15

Do you want to choose a number that will make it a bit deeper?

0:55:150:55:18

0.25.

0:55:180:55:23

Let's see what that sounds like.

0:55:260:55:28

BOOMING, ECHOING ROAR

0:55:290:55:33

If it gets too low, you won't even hear it, you'll just feel rumbling.

0:55:330:55:38

That was like a train going through a tunnel or something, wasn't it?

0:55:380:55:41

It was very deep.

0:55:410:55:43

BOOMING ROAR

0:55:440:55:45

And it's not just the pitch you need to code for.

0:55:450:55:49

The T-Rex needs a really precise set of instructions.

0:55:490:55:52

Commands to tell it when to grow, roar or when to walk.

0:55:520:55:56

And it's the same for all the games.

0:55:580:56:00

Computer code is written to control everything,

0:56:000:56:02

from the speed of the police car, to the bark of the dog.

0:56:020:56:06

DOG BARKS

0:56:060:56:07

It's been great to get a behind the scenes look at all these AppToys

0:56:070:56:10

and unlock some of the secrets of the coding.

0:56:100:56:13

But Elliot has got one last thing to show us - their amazing aquarium.

0:56:130:56:18

Oh, that's so cool, that looks so realistic!

0:56:180:56:22

-Can we go?

-Yeah.

-Oh, wow!

0:56:220:56:25

-It's epic.

-Wow.

-Looks 3D, right?

0:56:250:56:28

Yeah! It's looks like you've got real fish there.

0:56:280:56:31

So these things are actually there, and the rest is projected onto this?

0:56:330:56:37

-You've got it absolutely right.

-How does that work?

0:56:370:56:40

Well, we're reflecting the image from the tablet

0:56:400:56:45

onto some physical background that,

0:56:450:56:47

some of it you can see and some of it you can't see.

0:56:470:56:50

-So, can you see the doll on the right-hand side?

-Yeah.

0:56:500:56:53

So we've pre-programmed in that the fish know where that doll is,

0:56:530:56:57

so when they swim behind it we make them disappear,

0:56:570:56:59

so it gives the illusion the fish are actually there,

0:56:590:57:02

so that's why the whole thing looks so realistic.

0:57:020:57:04

It's also interactive, so I can fish in the fish tank.

0:57:040:57:09

-Whoa!

-Wow!

-That is so cool!

0:57:090:57:12

Wow, that's amazing! You can go fishing! Fishing in your home.

0:57:120:57:16

In this setup, the information is being transferred

0:57:170:57:20

between two devices.

0:57:200:57:22

The phone's accelerometer is the input

0:57:220:57:24

and the display from the tablet, the output.

0:57:240:57:27

I'm just trying to figure out how it's all working!

0:57:270:57:30

Well, it's using Bluetooth to connect between the two,

0:57:300:57:33

and I'm using the accelerometers in here

0:57:330:57:35

-to determine what I'm doing with it, so it knows whether I'm...

-FISHING REEL WHIRRS

0:57:350:57:38

Lifting it up or not.

0:57:380:57:40

-Go on, have a go.

-You go first.

0:57:400:57:41

FISHING REEL WHIRRS

0:57:410:57:43

-That's it.

-You have to wait for a fish to come to you.

0:57:430:57:46

Go on, pull up. Yes!

0:57:460:57:48

That was a big one, as well!

0:57:480:57:49

I think we'll give you the option to put it back in,

0:57:490:57:52

so that people don't get upset.

0:57:520:57:53

But this is only a prototype.

0:57:530:57:55

Yeah, well, what we're going to do is, when we launch these,

0:57:550:57:58

we're going to keep adding the features,

0:57:580:57:59

so it's never going to end, we're always going to put stuff in.

0:57:590:58:02

So if people come up with some good ideas, we can add it to it.

0:58:020:58:05

So, once we want to add a new feature

0:58:050:58:07

you just go back to the program, you write some new coding

0:58:070:58:10

-and then someone can download that app.

-Exactly.

0:58:100:58:13

I bet the makers of this smartphone never imagined

0:58:130:58:16

that it could be used to control a toy like this,

0:58:160:58:19

where a little bit of programming has allowed the creators

0:58:190:58:22

of these toys to use Bluetooth and speech recognition software

0:58:220:58:25

in such a creative way.

0:58:250:58:27

HIGH-PITCHED ROAR

0:58:270:58:28

So maybe in the future, teddy bears and dinosaurs will just appear

0:58:280:58:32

in your room, in 3D, when you open an app on your phone.

0:58:320:58:36

Subtitles by Red Bee Media Ltd

0:59:010:59:03

Download Subtitles

SRT

ASS