app inventor - technocamps.com · task draw a robot. what will it look like? what will it do? how...

39

Upload: hahanh

Post on 04-Aug-2019

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?
Page 2: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

App Inventor

meets NXT

Page 3: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Pre-day Questionnaires

Page 4: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

About Technocamps We go around schools like yours and show you lots of interesting stuff!

We also do things we call “bootcamps” during holidays!

Page 5: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

What is a STEM subject? Science

Technology

Engineering

Maths

They all link with each other!

Page 6: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

What are Robots?

Page 7: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Page 8: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Here is Tom’s Robot

What do you think it does? Now let’s see yours…

Page 9: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Robots This is the iCub, a robot used in research to simulate infant learning.

Page 10: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Robots!

Sometimes it is better to have machinery performing the dangerous

jobs.

This is common in the industry.

Machines may be used instead of humans if a repetitive job is required

e.g. assembly lines,

Page 11: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Robots!

In the 80s there was a program called “Knight Rider”. This car was features in

the program called “Kit”.

The car was designed to talk and interact with the driver and to think

like a human.

Although this is science-fiction, our cars today are pretty smart too!

Page 12: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Robots! Idris is a research robot, sent to complex

environments where it drives around on its own.

Usually use to research the environment.

Page 13: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Robots!

This is BeagleB, similar to Idris but more suitable for the sea.

It is used for example to measure

water quality or listen to dolphins as they communicate to one another.

Page 14: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Robots

Do you think a washing machine is a robot?

Why?

Why not?

Discuss as a group.

Page 15: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Robots… … are devices. … are programmable. …can sense their environment. …can act on and within their environment.

Page 16: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

App Inventor

Page 17: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

The interface: Design

Page 18: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

The interface: Develop

Page 19: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

App Inventor and NXT Robots

Page 20: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Buttons

Add the following buttons to your application: -  Move forward -  Move backward -  Turn Left -  Turn Right -  Stop

Page 21: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Events Button.click is an event. Event loop – Run through checking for events. Blocks correspond to the events. You can use these event blocks to control what happens when an event happens. You can use these events to make your robot move..

Page 22: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Experiment Before we move on, let’s play with some negative numbers. •  Change the numbers for the power that you are using when you go forward,

back, left and right to a negative number.. •  What happens? •  What do negative numbers mean?

•  Also, what is the slowest that our robot can move? Or the minimum speed?

Page 23: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Better Driving How do “normal” vehicles drive? How do you think our robots should drive? Acceleration and Deceleration. Better Turning? Differential Drive.

Page 24: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

How can we do this? We need to: •  Control each motor separately:

•  Use 2 NXT drives, add one now •  Store the speed we are moving, and how much we want to turn:

•  Using variables, create some

•  Change these values with our buttons: •  Use a combination of the variables to get a new speed •  A bit of an explanation first

Page 25: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Movement Speed +

Speed -

Turn + Turn -

Page 26: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Clock A clock allows us to keep changing how we drive. It can be found the the components menu. Use a clock to keep adjusting the motors to the values of speed and turn, using the timer event in the Blocks Editor. But what values do we give the motors?

Page 27: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

What if we are not moving? If we are not moving or:

speed = 0 turn = 0

Then you want to stop moving both motors. To check this we use a conditional statement, also known as an “IF statement”. IF *this* test is true, then do *this*, else do *this*…

Page 28: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

What if we are not moving? So if we are not moving, then we want to test the following: If “speed = 0 and turn = 0” Then

Stop Left motor Stop Right motor

Else…

Page 29: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

What if we are not moving? If we are moving forward, then is the speed of our robot positive or negative?

Page 30: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

What if we are not moving? If we are moving forward, then is the speed of our robot positive or negative? It has to be positive so we can test. If speed > 0 (is greater than) Then

Move left motor forward Move right motor forward

But what about the turn?

Page 31: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Task Speed = 30 Turn = 20 MinSpeed = 50 Left Motor = 0 Right Motor = 0

Page 32: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Task Speed = 30 Turn = 20 MinSpeed = 50 Left Motor = 0 Right Motor = 0 + MinSpeed +MinSpeed

Page 33: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Task Speed = 30 Turn = 20 MinSpeed = 50 Left Motor = 0 Right Motor = 0 + MinSpeed + MinSpeed + Speed + Speed Positive turn means what way?

Page 34: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Task Speed = 30 Turn = 20 MinSpeed = 50 Left Motor = 0 Right Motor = 0 + MinSpeed + MinSpeed + Speed + Speed + Turn - Turn MinSpeed + Speed + Turn MinSpeed + Speed - Turn Put this inside your conditional.

Page 35: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Backwards If we are not moving forward, we must be going backwards. Backwards is a little more complicated because Speed will be negative. So if you go backwards with a speed of -40 what direction are you moving?

Page 36: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Backwards If we are not moving forward, we must be going backwards. Backwards is a little more complicated because Speed will be negative. So if you go backwards with a speed of -40 what direction are you moving?

FORWARDS

You can either use move forward with a minus speed or you can do: 0 – speed

This will make your speed positive because - - = +

Page 37: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Backwards Now you have decided how you want to do it, see if you can move backward by going back through some of the maths we did earlier. Try numbers like: Speed = - 70 MinSpeed = 50 Turn = 10

Page 38: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

If you have finished… Let the delivery assistants know if you have finished and they can provide some sensors. See if you can get your robots to become “Autonomous” – so they move on their own. Make sure you complete all the required documentation! You can take the TOP TIPS home with you. Make a note of the following web address if you wish to make Android Applications at home:

http://beta.appinventor.mit.edu

Page 39: App Inventor - technocamps.com · Task Draw a Robot. What will it look like? What will it do? How will you interact with it?

Don’t forget to save your work!

All of our software is OPEN-SOURCE (Free and available to download)

It can all be found on our Technocamps website:

www.technocamps.com