Hi everyone and welcome, today we're going to be looking into the Choreograph Math Library. It's a runthrough and understand what the math behaviors do. So if you want your robot to do your math homework for you then please stay tuned!
Hi guys! I'm Philip English of Robophil.com and now on this video we're looking to teach you how to use the math behaviors that are in the math library tool on your NAO robot. We'll do this by running through each behavior one by one and solving some math equations. But first of, a cheeky feel robot plug if you'd like to get your hands on a NAO robot or any other education robots then please visit my Robophil Online Store. Here you'll find a whole selection of the latest educational robots.
So today we're gonna be looking at the math library. First of all lets check, see if the robot's online, give him a lil wiggle. Yeah its on, he's moving so he is connected.
NAO Math Library Tutorial
We're gonna look at the behaviors in the math library. So the math related box is for the library:
 Dividing box
 Multiplying box
 Generating random number box ( That it's we're gonna go through. And what it hasn't got, it hasn't got an adding or subtracting box that I'm provided. )
So what we're gonna do is first have a look at the Divide Box:
 Drag in the divide box (Now what we want to do is divide, as your command, that's what it says on tin it would take 2 numbers and it would bring any number output, we should have a vision of those 2 numbers, so what we need is some numbers)

Put in 2 number editor (I'm gonna put that in there, need 2 of them, so it double up and the divided box perform division using the 2 numbers that came in through the input and then produce the result on the output.
 First box this one here is dividend
 Second box is the divisor (So you can see these are all yellow and the divide box, which means that it take new record signals and nothing else.
 Connects up all the noodles
 Put 10 on the dividend box
 Divided by 2
 Attached it up
 If you have a look at the right hand side, if I hit play,
 There we go 5.
Nice and simple, so it's easy peasy. Now what we can do, we can just make it a little bit more interactive. You can just have a say box in here as well, we'll get the robot all interacting, I've shown this before in other tutorial:
 Drag a Say box

Click into it
 Copy and paste into the main box (So this way it will only say, what the outcome of the divide box will be)
 So attach the Divide Box to the Say Box
 Click Play button
 NAO say: 5.0
There you go 5.0 brilliant. So we're good NAO today. So that was nice and easy for the first one. So again you can use a divide box if you're building a game or any mathematical questionnaires. I think you're using to build scripts, that's how you use it. So the next one is the Multiply box:
 Drag the multiply box (So again it gets 2 inputs)
 Cut the inputs on the divide box
 Then attach them into the top and the bottom.
 Click Play button without the NAO
 There we go 20, at the right hand side
 Click the Play button with the NAO
 NAO: 20.0
20.0 brilliant, good job NAO, good job. So that's the divide and the multiplier. So the other one is the random int so this is where, again if you're building a game or you're building something that the kids can use and you need a random number so each time the robot can think of a new number to use then it mixes up whatever the game is been, otherwise it gets be boring if the game is always doing the same number. Destroys a bit the randomness and makes it a little bit more fun. So let's do this again, we will just tap into the search field random int there we go drag that in, pop it down here, pop it this side, actually, right, this one is slightly different and the random int box generates random integers where the minimum value is 0 and the maximum value is at 7 by the parameter so this one has it's own little cog.
We click that there, so as you can see that is the min value of 0 and max value of 10. So that is as far as high or how the robot would actually work out. So just to give you example, if we cut a little bits of here, ring this down here, bring it over here so those the ones we done, will just cut all this up here so we won't get confused and will bring the say box down this side or plug it straight this time, makes it a bit more easier. And again so he's basically gonna think of a random number between 0 and 10, so let's give it a go, let's hit the play button
NAO: 7
7 is the first one, very random
NAO: 1
1 the second one. So it changes obviously. You go in it using the spanner and let's say 100 say to 250. So now it's got a range of that between a 100 to 250 so just hit the play button
NAO: 129
Ok one more time for sample
NAO: 228
228 there you go, so there it's within its parameter. So as you can see, you can use that on a whole variety of ways and now the max is the maximum value of the random number of which is a range, so it ranges from 0 to 1 times 10 to the power of 9, that's quiet a lot, you can go quiet high. Random int box activates only once so the timer box and a loop box must be in order to continously generate random numbers. So again if you're building a game or questionnaire, math questionnaire, then it will be a little bit more advance and use the timer box or loop box. So we'll produce other tutorial where we see that in action. So last one, not the least is the random float. So look at it up there, type random into the search folder so drag this down here oh keep everything in one screen so quickly shuffle everything around, just to look tidy, always keep your box tidy, so its easy to go through and you're not gonna get confused. The random float again attach this straight up again it has only one input and one output differences out there, floating point instead of a, also the difference of floating point instead of an integer and there is no shuffle and the maximum value can be set, adjusted maximum, so basically what this means is you'll get a bit more precise with the random float, so if you ever look in here, obviously lots of 0 after the decimal place so we're gonna get really precise here now, so if we have 10 for example and lets say 12, difference and if we hit the play button now
NAO: 10.9102993011
Brilliant, so you see it gets a little bit more detailed. It goes pass the decimal place, he's a little bit chuddery today cause the connection is a little bit slow today. I'm not sure not quite sure, we'll have another go.
NAO: 10.1180667877
Brilliant, thank you NAO, and again you can have a shuffle around with these vast to give you some more randomness and let's just do it one more between 60 and about 700, so let's see what we get
NAO: 595.1741941336
Brilliant, the maximum value can be set by just in the max which he's done, or has a range of 0.0 all the way up to 9.9 times 10 to the power of 13th.So again guys you can use these boxes to build in a games or quizzes and of course if you have homework that you wanna work out, you can also use NAO as a calculator. Brilliant, hope you enjoy that guys thanks very much.
Right on guys you're not a robot math expert, you can now program your robot to do any complicated math sum. Have play with this behaviour and try out other equations and behaviour combinations to see if your NAO is always correct, have a play guys and use your imagination.
Don't forget guys, if you're after a NAO robot or any other educational robot, please visit my robophil store where you find the latest education robot tech.
If you like this and want even more free video tutorials, news and information then please visit us at robophil.com where you can download the latest free ebooks and get the latest information and techniques on how to become a robot expert.
PARO Product – http://www.robotcenter.co.
Robo Phil Facebook – https://www.facebook.com/
Robo Phil Twitter – https://twitter.com/
==============================
**Click Below to SUBSCRIBE for More Videos:
http://www.youtube.com/
==============================