App Inventor
meets NXT
Pre-day Questionnaires
About Technocamps We go around schools like yours and show you lots of interesting stuff!
We also do things we call “bootcamps” during holidays!
What is a STEM subject? Science
Technology
Engineering
Maths
They all link with each other!
What are Robots?
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…
Robots This is the iCub, a robot used in research to simulate infant learning.
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,
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!
Robots! Idris is a research robot, sent to complex
environments where it drives around on its own.
Usually use to research the environment.
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.
Robots
Do you think a washing machine is a robot?
Why?
Why not?
Discuss as a group.
Robots… … are devices. … are programmable. …can sense their environment. …can act on and within their environment.
App Inventor
The interface: Design
The interface: Develop
App Inventor and NXT Robots
Buttons
Add the following buttons to your application: - Move forward - Move backward - Turn Left - Turn Right - Stop
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..
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?
Better Driving How do “normal” vehicles drive? How do you think our robots should drive? Acceleration and Deceleration. Better Turning? Differential Drive.
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
Movement Speed +
Speed -
Turn + Turn -
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?
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*…
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…
What if we are not moving? If we are moving forward, then is the speed of our robot positive or negative?
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?
Task Speed = 30 Turn = 20 MinSpeed = 50 Left Motor = 0 Right Motor = 0
Task Speed = 30 Turn = 20 MinSpeed = 50 Left Motor = 0 Right Motor = 0 + MinSpeed +MinSpeed
Task Speed = 30 Turn = 20 MinSpeed = 50 Left Motor = 0 Right Motor = 0 + MinSpeed + MinSpeed + Speed + Speed Positive turn means what way?
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.
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?
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 - - = +
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
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
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
Top Related