Intro to Robots Lab 7. Intro to Robots Behaviour-based Robot Control Exercise: Design and implement...

5
Lab 7

Transcript of Intro to Robots Lab 7. Intro to Robots Behaviour-based Robot Control Exercise: Design and implement...

Page 1: Intro to Robots Lab 7. Intro to Robots Behaviour-based Robot Control Exercise: Design and implement a behaviour-based program that has a robot moving.

Lab 7

Page 2: Intro to Robots Lab 7. Intro to Robots Behaviour-based Robot Control Exercise: Design and implement a behaviour-based program that has a robot moving.

Behaviour-based Robot Control

• Exercise: Design and implement a behaviour-based program that has a robot moving back and forth between two flashlights, 10 feet apart and shining at each other. The flashlights are located on top of a couple of books that act as obstacles for the robots.

Page 3: Intro to Robots Lab 7. Intro to Robots Behaviour-based Robot Control Exercise: Design and implement a behaviour-based program that has a robot moving.

Programming Exercises:

• Using the sequence, selection and iteration control structures, design and implement a program that simulates a soda machine. • Accept denominations of 5¢, 10¢, 25¢ and $1. • Sodas should cost 75¢ each. • The machine should give change where appropriate.• The machine should offer 3 choices of soda• Upon sale, the machine should display a message

saying the soda has been delivered• Extra: The machine should keep track of how many

sodas have been sold and know if it is out of a particular soda type.

Page 4: Intro to Robots Lab 7. Intro to Robots Behaviour-based Robot Control Exercise: Design and implement a behaviour-based program that has a robot moving.

Programming Exercises:

• Implement a program that calculates and prints out a list of monthly payments on a home equity loan. The program must allow you to enter: – Loan Amount– Annual interest rate (y%)– Loan Duration (in months)

• Monthly Payment Calculation is:

• Obviously

Monthly Payment = (Loan Balance + Current Monthly Interest Amount) Number of Months Remaining on Loan

New Loan Balance = Old Loan Balance + Monthly Interest – Monthly Payment

Page 5: Intro to Robots Lab 7. Intro to Robots Behaviour-based Robot Control Exercise: Design and implement a behaviour-based program that has a robot moving.

Exercise:

• Go to a local bank and find out the formula for calculating the monthly payment on– A mortgage– A home equity loan– A car loan

• Compare the three mechanisms for total interest paid.