Marty the Robot.

Slides:



Advertisements
Similar presentations
Robots Leslie B.. What is a robot? A robot is a machine that is capable of doing many kinds of actions.
Advertisements

Final Project Web Design. Final Project Your robot will be placed in a room with the red cone. Your robot will need to find the cone in the room and run.
Simple Python Loops Sec 9-7 Web Design.
Python Programming Using Variables and input. Objectives We’re learning to make use of if statements to enable code to ask questions. Outcomes Build an.
ITEC 109 Lecture 11 While loops. while loops Review Choices –1 st –2 nd to ?th –Last What happens if you only use ifs? Can you have just an else by itself?
Introduction to TouchDevelop Lesson 3 – Comments & Lists Created by S. Johnson
PYTHON WHILE LOOPS. What you know While something is true, repeat your action(s) Example: While you are not facing a wall, walk forward While you are.
Introduction to Scratch We will be using the Scratch Environment today, so please log in to the Scratch website (scratch.mit.edu)
WARNING YOU MAY FIND SOME OF THE IMAGES IN THIS BRIEF DISTRESSING. THEY COME FROM A RECOGNISED SAFETY CAMPAIGN THAT HAS BEEN USED IN AMERICA TO ENCOURAGE.
PYTHON PROGRAMMING Year 9. Objective and Outcome Teaching Objective Today we will look at conditional statements in order to understand how programs can.
Lesson 06: Functions Class Participation: Class Chat:
Canvas and Arrays in Apps
Software Development.
Broadcasting (Adding a new level)
What is speech? When do we use it?
AP Computer Science Principles
Week of 12/12/16 Test Review.
Introduction to Programming: Module #2 Python, Trinket, and Turtle Graphics Lois Delcambre.
Topic: Conditional Statements – Part 1
Lesson 4 - Challenges.
Do it now activity Last lesson we used Flowol to create a solution to a problem a computer could solve. Identify what each symbol does:
Intro CS – Probability and Random Numbers
Quick one: Do you know what these are?
ECS10 10/10
Days of the week NEXT.
FAMILY RELATIONS. Prezentacii.com.
Monday, April 4th Entry Task Schedule: Lego stoichiometry
Algorithm and Ambiguity
Lesson 9: Add fractions making like units numerically.
Starter Write a program that asks the user if it is raining today.
Frozen Graphics Lesson 3.
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Learning to Program in Python
Learning to Program in Python
Learning to Program in Python
Exploring Computer Science Lesson 6-2
Introduction to TouchDevelop
Introduction to pseudocode
Lesson 05: Iterations Topic: Introduction to Programming, Zybook Ch 4, P4E Ch 5. Slides on website.
Sunday Monday Tuesday Wednesday Sunday Monday Tuesday Wednesday
Lesson 1: Fundamentals of Programming
UNIT 3 CHAPTER 1 LESSON 4 Using Simple Commands.
Lesson Objectives Aims You should be able to:
Escape sequences: Practice using the escape sequences on the code below to see what happens. Try this next code to help you understand the last two sequences.
An Introduction to VEX IQ Programming with Modkit
Programming – Remote Control Statements
CISC101 Reminders Quiz 1 grading underway Next Quiz, next week.
Programming – Remote Control Statements
Coding Concepts (Basics)
Algorithm and Ambiguity
Higher order questions
Python 19 Mr. Husch.
FAMILY RELATIONS. Prezentacii.com.
IPC144 Introduction to Programming Using C Week 4 – Lesson 1
An Introduction to VEX IQ Programming with Modkit
Unit 2 My week (A Let’s learn).
BIT116: Scripting Lecture 6 Part 1
CISC101 Reminders Quiz 1 marking underway.
Unit 3 Year 2 – Part B Lesson 1 - Practice.
Year 6 (National Numeracy Strategy) (Based on DFEE Sample Lessons)
Python While Loops.
Introduction to Python
Contact
Do it now activity Log onto the computer.
Python 19 Mr. Husch.
Maths.
Year 6 (National Numeracy Strategy) (Based on DFEE Sample Lessons)
2011年 5月 2011年 6月 2011年 7月 2011年 8月 Sunday Monday Tuesday Wednesday
Lesson 7 On the School Bus
Recapitulation of Lecture 13
Presentation transcript:

Marty the Robot

Lesson 1 – Introduction to Marty the Robot By the end of this lesson you will be able to, Describe what a robot is Describe what things you think Marty can do Create a program to control Marty using Python Predict what will happen before running small Python scripts

Is a Printer a Robot??

What is a Robot? A robot is a machine that can carry out a number of tasks automatically that can usually be programmed by a computer.

What movements do you think Marty can do?

Predict what you think the following commands will do…

mymarty.walk()

mymarty.kick(‘right’)

mymarty.stop()

mymarty.lean(‘forward’,200,3000)

mymarty.sidestep(‘left’,26,3000)

mymarty.circle_dance(‘right’,3000)

Try programming Marty using Python to move into some of the poses using the Marty Says cards. Here are a few examples of the poses..

Lesson 2 – Marty Dance Party By the end of this lesson you will be able to, Write loops or repeat statements using Python Predict the outcome of a Python script using a loop Understand when to use loops whilst programming

Yesterday we started making small programs like this… mymarty.walk() mymarty.sidestep(‘left’,26,1000) Can you see any patterns in this code snippet? What moves do you think this would make me do?

We can use loops to make this neater and easier to read! for x in range(2): mymarty.walk() mymarty.sidestep(‘left’,26,1000)

How would we rewrite this code snippet to make use of loops? mymarty.walk() mymarty.kick(‘left’) mymarty.kick(‘right’)

for x in range(2): mymarty. walk() mymarty. kick(‘left’) mymarty for x in range(2): mymarty.walk() mymarty.kick(‘left’) mymarty.kick(’right’) mymarty.kick(‘right’)

Challenge: Marty Dance-Off!

Lesson 3 – Building a Marty Remote Control By the end of this lesson you will be able to, Explain if statements using real life examples Create a small program using if statements with Python Explain a Python script that uses if statements and predict what will happen

If Statements IF there is a green man present THEN it is safe to cross the road

If Statements IF I have done all of my chores THEN I can get my pocket money

If Statements If today is Monday THEN I have math homework to do ELSE IF today is Wednesday THEN I have English homework to do ELSE I have no homework to do

Can you think of any other examples?

What do you think the outcome of the following code snippets will be? value = 10 dayOfTheWeek = ’Monday’ if dayOfTheWeek == ‘Monday’: value = value * 10 else: value = value – 5 print(value)

What about... value = 10 dayOfTheWeek = ’Sunday’ if dayOfTheWeek == ‘Saturday’ OR dayOfTheWeek == ‘Sunday’: value = value + 50 else: value = 0 print(value)

Or... value = 10 dayOfTheWeek = ‘Tuesday’ homework = true if dayOfTheWeek != ‘Saturday’ AND dayOfTheWeek != ‘Sunday’: if homework == true: value = value * 10 else: value = value * 2 else: value = 0 print(value)

Try programming Marty using if statements to decide on what his behaviors should be IF it’s Monday, Wednesday OR Friday then dance ELSE show angry eyes IF it’s sunny outside THEN take 3 steps forwards ELSE IF it is raining THEN take 2 steps backwards ELSE take 1 step to the left IF it’s Monday AND it’s raining outside THEN show angry eyes ELSE IF it’s NOT Monday AND sunny outside THEN dance ELSE take 1 step to the left

Functions! Look at the following code and predict the values of the 2 variables multiplier and count global multiplier = 2 def multiply(count): return count * multiplier count = 3 multiplier = multiplier + 2 count = multiply(count)

Create a remote control program where users can type in commands to control what movements Marty makes

Lesson 4 – Obstacle Course Challenge By the end of this lesson you will be able to, Explain what kinds of things we use robots for and the environments they usually work in Program Marty to go around an obstacle course using Python

What kinds of things do you think we can use robots for?

Try researching 2 kinds of robots and take note of the following in your workbooks Robot Name What it does Where you would find it Draw a picture of it

Repeat statements / Loops So far we have covered a few different programming concepts – can you think of when you would use each of them? Repeat statements / Loops If Statements Functions

1. Design an obstacle course that Marty could go around in your workbook 2. Build your obstacle course in groups 3. Plan out how Marty will tackle the course by using your remote control to walk him around 4. Finally, program him to do it automatically without your input Don’t forget to think about what kind of movements I can make so you can design obstacles that I can go around!