a1tD0000003mAq0IAE

Course: Visual Programming( VPL) with Autonomous Cars
VPL 1: Introduction to Algorithms

  • 9-12 grade
  • Intermediate

Lesson Description:

Introduction to The RobotLAB Autonomous Car and the Microsoft VPL programming environment. 


 

Standards Covered

CCSS.MATH.PRACTICE.MP1

Make sense of problems and persevere in solving them.

CCSS.MATH.PRACTICE.MP2

Reason abstractly and quantitatively.

CCSS.MATH.PRACTICE.MP3

Construct viable arguments and critique the reasoning of others.

CCSS.MATH.PRACTICE.MP4

Model with mathematics.

CCSS.MATH.PRACTICE.MP5

Use appropriate tools strategically.

CCSS.MATH.PRACTICE.MP6

Attend to precision.

CCSS.MATH.PRACTICE.MP7

Look for and make use of structure.

CCSS.MATH.PRACTICE.MP8

Look for and express regularity in repeated reasoning.

HS-ETS1-2

Design a solution to a complex real-world problem by breaking it down into smaller, more manageable problems that can be solved through engineering.

HS-ETS1-3

Evaluate a solution to a complex real-world problem based on prioritized criteria and trade-offs that account for a range of constraints, including cost, safety, reliability, and aesthetics as well as possible social, cultural, and environmental impacts.

image description

Lesson Modules


Teaching Tips:

Teacher Demo

What's really the difference between a development environment and a programming language?


Microsoft Robotics Developer Studio is the name of the development environment we will use to program the RobotLAB Autonomous Car.  A development environment is a set of programming tools used to create a program.  

Development environments come in many forms.  Most commonly, they look something like this:

Children and beginners may start with something like this:


Microsoft VPl is something in between:


 

Everyone please try opening up Microsoft Visual Studio on your computer.

Microsoft Visual Programming Language is the name of the programming language we will use.  A programming language is a language designed to communicate instructions to a machine.  Thousands of programming languages exist, but a small minority of popular ones are currently in use.  



 

A common right of passage for teenagers here in the US is learning to drive a car.  A driver’s license is a symbol of freedom, maturity, and responsibility that no 16-year-old can deny. ​ But the drivers licence may disappear sooner than you think!

  

This silly looking thing is Google's new self-driving car.

Google announced the project in 2010, and since then their cars have driven more than 1.5 million miles.  They set out with the goal of creating a fully autonomous passenger vehicle, called "level 4 autonomy” by the Society of Automotive Engineers (SAE). Many luxury cars on the market today boast level 2 and 3 features.  Level 1 features like cruise control and power steering are standard among nearly all cars.

You're probably wondering what all these "levels" mean.  Here is an excerpt from the Wired  article "Everyone wants a Level 5 Self-Driving Car" that explains them clearly and simply.


Level 0 : You do all the work.  

Level 1 : SAE calls Level 1 “driver assistance,” and even that feels generous. This is a car that helps out by doing a single task. Usually, that means cruise control, where the car holds whatever speed you command. No turning, no staying in its lane, no hitting the brakes before plowing into the stopped semi up ahead.

Level 2 : Like a toddler “helping” with the dishes, a Level 2 car can “help” you drive, as long as you keep a careful eye on it. Sure, the car maintain its speed, slow down to avoid other cars, and stay in its lane. But if any trouble comes up, it’s up to the human to take over.

Level 3 : No one’s put a Level 3 car on the market yet, but you can expect a few within about five years. These cars don’t just stay in their lane and away from other cars, they make decisions. Instead of braking to avoid hitting that slow-moving semi, they’ll take a look around, decide to change lanes, and pass.  They still need a human around if the weather messes with their sensors or the painted lane lines disappear, so no falling asleep at the wheel.

Level 4 :  This is the stage where the human becomes expendable: The car can handle any situation all by itself, as long as it stays in its safe place. That will most likely be a geographically limited area like a college campus or city downtown.

Level 5 :  This is what Google’s aiming for: The car that can handle all driving tasks and go anywhere. No human, no steering wheel, no pedals. Climb in, tell it where you want to go (if it doesn’t already know from reading your calendar), and get back to looking at your phone.


Simply put:

Level 0 : You do all the work.  

  • No power steering
  • No power windows

Level 1 : “driver assistance”

  • Cruise control
  • No turning
  • No staying in its lane
  • No hitting the brakes

Level 2 : Car can “help” you drive.

  • Maintains its speed
  • Slows down to avoid other cars
  • Stays in its lane

Level 3 :Doesn't exist yet

  • Can change lanes to avoid obstacles
  • Needs human help in irregular conditions

Level 4 :  No need for humans.

  • Autonomous
  • Confined to a limited area like a college campus

Level 5 :  Fully autonomous.

  • No human
  • No steering wheel
  • No pedals.
  • Climb in, tell it where you want to go

What level autonomy does your parents car have?
  • Level 1
  • Level 2
  • Level 3
  • Level 4
  • Level 5


What does it take to design a self-driving car? STEM

What does STEM stand for?
  • Science, Technology, Engineering, Math
  • Science, Technology, Ecology, Math
  • Sales, Technology, Engineering, Management
  • Science, Trains, Engineering, Magic


 


Teaching Tips:

Whether or not you've taken a Physics class before, you've probably heard about Newton's Laws of Motion:


  1. An object in motion tends to remain in motion, and an object at rest tends to remain at rest.

  2. Force equals mass times acceleration.

  3. For every action there is an equal and opposite reaction.


Question 1: Do those sound right to you? Can you think of a situation where the first law doesn't make sense?

If the poll comes back and more than 50% of studends answered yes, have a discussion about their ideas.
Some students may feel that this law doesn’t make sense because an object in motion will almost always slow to a stop.


Did we just disprove Newton?

Thankfully, we didn't, and your science textbooks will retain their resale value. Because Newton's First Law of motion is true, but only in a vacuum! If you threw a ball in space, it would keep moving at the same speed and in the same direction forever.

  

Question 2: Why is that?
Because the moving ball has momentum. Momentum is the quantity of motion of a moving body, measured as a product of its mass and velocity. In the vacuum of space there is nothing to stop that momentum.


Question 3: What is the main difference between this classroom and the vacuum of space?
In the real world there are many things that will stop that momentum. One way is letting the ball hit a wall, or catching it in your hands. Those ways are easy to see. But the biggest difference between the vacuum of space and this classroom is not visible. This classroom is on a planet with an atmosphere. That atmosphere is full of oxygen that we breath.

Friction slows things down, and gravity pulls them to the ground. If you rolled a ball down a 1000 meter hallway, it will eventually stop due to these two things. And until you pick it up and roll it again, it will tend to remain at rest.


Question 4: Can you think of a situation where the second law doesn't make sense?

If the poll comes back and more than 50% of studends answered yes, have a discussion about their ideas.
This one is just an equation.


Question 5: Can you think of a situation where the third law doesn't make sense?

If the poll comes back and more than 50% of studends answered yes, have a discussion about their ideas.
Some students will probably point out that when you push something like a building, there is no equal and opposite reaction.


Amazingly, when you push on the Earth, the Earth does push back, but it is so large in comparison to you that you’d never be able to feel it. It may help to think of it like this.  If two 100lb people run into each other (going the same speed), they will both bounce off of each other and travel the same distance.  If one 100lb person and one 300lb person run into each other (going the same speed), the smaller person will travel much further and feel the reaction much more than the larger one!


Now you have an understanding of three most fundamental laws of Physics. From here, you can begin to understand all kinds of things about the world and the way it works.



 

Whether or not you've taken a Physics class before, you've probably heard about Newton's Laws of Motion:


  1. An object in motion tends to remain in motion, and an object at rest tends to remain at rest.

  2. Force equals mass times acceleration.

  3. For every action there is an equal and opposite reaction.


Do those sound right to you? Can you think of a situation where the first law doesn't make sense?
  • Yes
  • No


 
Did we just disprove Newton?

Thankfully, we didn't, and your science textbooks will retain their resale value. Because Newton's First Law of motion is true, but only in a vacuum! If you threw a ball in space, it would keep moving at the same speed and in the same direction forever.


Why is that?


What is the main difference between this classroom and the vacuum of space?


Can you think of a situation where the second law doesn't make sense?
  • Yes
  • No


Can you think of a situation where the third law doesn't make sense?
  • Yes
  • No


 


Amazingly, when you push on the Earth, the Earth does push back, but it is so large in comparison to you that you’d never be able to feel it. It may help to think of it like this.  If two 100lb people run into each other (going the same speed), they will both bounce off of each other and travel the same distance.  If one 100lb person and one 300lb person run into each other (going the same speed), the smaller person will travel much further and feel the reaction much more than the larger one!


Now you have an understanding of three most fundamental laws of Physics. From here, you can begin to understand all kinds of things about the world and the way it works.


 


Teaching Tips:

At this point the teacher should do the PB&J experiment as outlined here:

  1. 1. Bring a loaf of bread, a jar of peanut butter, a jar of jelly and a butter knife to class on the day of the lesson.  (Components for other sandwiches and food could work too, but PB&J is simple and cheap)

  2. 2. Put the students into small groups and tell them to write a set of step-by-step instructions for making a PB&J sandwich.  

  3. 3. Have one group read their instructions aloud, and act them out exactly.  EX: if step one is “take a piece of bread and put some peanut butter on it” take a piece of bread and set the whole jar of peanut butter on it.  

  4. 4. After you act out the first set of instructions, have the students revise their lists to be more specific.

  5. A successful list will look something like this:

    1. 1. Take two pieces of bread out of the packaging, and set them on the desk.  

    2. 2. Open the jar of peanut butter using a twisting motion with your right hand

    3. 3. Set down the peanut butter jar, pick up the knife

    4. 4. Put the knife in the jar, and take it out again

    5. 5. Swipe the knife across one piece of bread     

And so on.


 

What is an algorithm?

Despite it’s intimidating name, an algorithm is simply a series of specified steps used to solve a problem.

Knitting patterns are one type of algorithm humans follow:



It is a set of steps that, when repeated, can create something useful and beautiful.

What makes a knitting pattern special?  Why is it an algorithm, while making a sandwich isn't?  Sandwich making requires completing some steps, and it certainly solves the problem of needing lunch.  Let's break it down:


A series of specified steps used to solve a problem.

  • The steps must be performed in a specific order.  Switching steps 2 and 4 in the knitting instructions would not yield a successful result.  Putting mustard on your sandwich before cheese wouldn't make it an unsuccessful sandwich.

A series of specified steps used to solve a problem.

  • No step can be replaced with a similar one.  Replacing a step in the knitting instructions would result in a different pattern, or no pattern at all. Replacing ham with turkey, on the other hand, does not risk the integrity and success of the sandwich.

A series of specified steps used to solve a problem.

  • An algorithm is usually designed to solve one particular problem.  They are seldom able to complete two or more tasks, instead focusing on precision in completing their one goal.  Knitting is an excellent strategy for making a blanket from yarn, and far less useful for weaving leaves into a basket.


When it comes to following specific instructions, executing repetitive steps, and working quickly and without tiring, computers are simply the best there is. Algorithms designed for computers are usually far too long and mathematically strenuous for humans to implement ourselves, but computers can complete them with ease.  However, without humans to translate our instructions into code, computers wouldn't do anything!

 

Exercise Instructions:

Write a set of step-by-step instructions for making a PB&J sandwich.

When you are finished, try reading it as though you are an alien from another planet who's never heard of a sandwich before.  Is there anything you'd change?  For example, if you said "spread the peanut butter on a peice of bread", you might want to change that to "take a knife, put the pointy side in the jar labelled "Peanut Butter", take it out, rub the knife against one side of the piece of bread."

Try making it more specific.


 


Teaching Tips:

Teacher Demo

What's really the difference between a development environment and a programming language?


Microsoft Robotics Developer Studio is the name of the development environment we will use to program the RobotLAB Autonomous Car.  A development environment is a set of programming tools used to create a program.  

Development environments come in many forms.  Most commonly, they look something like this:

Children and beginners may start with something like this:


Microsoft VPl is something in between:


 

Everyone please try opening up Microsoft Visual Studio on your computer.

Here is the demo code: Lesson 1 Demo Code


Microsoft Visual Programming Language is the name of the programming language we will use.  A programming language is a language designed to communicate instructions to a machine.  Thousands of programming languages exist, but a small minority of popular ones are currently in use.  



 

All the coding for the RobotLAB Autonomous Car will be done with a programming language called Microsoft Visual Programming Language.

Before we can start coding, we need to learn the Activities and Services you can use to make up your code.  Activities, Services, and the connections between them are all we need to write our programs.  


Activities are used to  store and name numbers, control data flows, and generally provide assistance to the Services.

Activity

Description                                                                                     


Used to name and set (or get) the value of a variable.


Performs simple arithmetic or logical operations.

(add, subtract, multiply, divide, mod, AND, OR, NOT)


Used to supply a simple data value (int, bool, double, float, string, decimal, byte, sbyte, uint, short, ushort, long, ulong, char) to another activity or service.


Combines two or more dataflows.  Messages must be received on all incoming connections before before the activity passes the data onward.


Merges two or more dataflows.  Unlike Join, there is no dependency on  other connections, merge passes any message along to the next activity.


Provides a choice of outputs to forward the incoming message based on the test condition (==, !=, <, >, <=, >=) entered.

Routes messages based whether the incoming message matches the one in the text box.

Creates an empty list of data items. (store it using a variable)

Modifies an existing list.

Just a way to comment code.


Services communicate directly with the RobotLAB Autonomous Car and your computer.

Service

Description                                                                                     


This service will be present in every program.  It establishes a connection with the robot.


Controls the robot’s movements and direction (All Stop, Drive Distance, Enable Drive, Get, Set Drive Power, Set Drive Speed, Rotate Degrees)


Controls and receives data from the robot’s six IR sensors (Get, Sonar Replace, Sonar Update, Hardware Identifier, Angular Range, Distance Measurement)


Controls the robot's 8x8 matrix of lights, as well as the head lights, tail lights, and side lights.


This prints info from any of the RobotLAB Autonomous Car's sensors to the log that appears when a program is started.


This measures the acceleration of the robot as it drives.


This outputs the voltage level of the battery used on Altino.


This is a service that displays  the output value of RobotLAB Autonomous Car motor load.



 


Teaching Tips:

Question 1: What was the coolest thing you learned today?  Write your answer in the box, and see it appear which your classmates answers!
Any answer will do here.  If time permits, have a short discussion with students about their answers.

Question 2: Check the concepts you understand.  Don’t worry, this isn’t for a grade, it’s just so your teacher can check the classes’ understanding.
This is the students' self-assessment of their understanding of the material.  You will see a bar graph once all the poll answers are submitted.  

Question 3: What is an algorithm?
An algorithm is a set of (specific) rules a computer follows to complete a task.  (Anything similar to this answer is correct.)




AFTER CLASS
Store Student Files
Put the student files on a thumb drive or store them in some way so that the students can continue working on their project in the next lesson. 



What was the coolest thing you learned today?

Check the concepts you understand.  Don’t worry, this isn’t for a grade, it’s just so your teacher can check the classes’ understanding.
  • Services
  • Activities
  • Algorithms

What is an algorithm?