1 / 13

Apply

Robotics. Learn. Apply. Mr. Mundo. Objectives. In this lesson you will learn: What is a robot What is a computer program What is program structure What is Pseudo code. What is a robot?. None Moving robot (None Functional Robot). Program (NXT Program). Program (NXT Program).

nijole
Télécharger la présentation

Apply

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Robotics Learn Apply . Mr. Mundo

  2. Objectives • In this lesson you will learn: • What is a robot • What is a computer program • What is program structure • What is Pseudo code

  3. What is a robot? None Moving robot (None Functional Robot) Program (NXT Program) Program (NXT Program) Moving robot (Functional Robot)

  4. What is a robot? Definition 1: is a human-shaped mechanical device that acts as human. Definition 2: is an electronic machine that functions independently, without human control. Mundo’s Definition: A robot is a device that is built and programmed to perform specific actions and interact with its surroundings.

  5. What is a computer program? A computer program is a set (list) of instructions that are executed by a computer A computer program is written in a language that a computer understand A computer program is written to solve a specific problem Programming is the act of writing programs

  6. Programs are for humans too Monday: be at school at 7:10 7:25 start 1th P 8:25 start 2th P 9:25 start 3th P 10:25 start 4th P 11:25 start 5th P 12:25 start 6th P 1:25 start conference P Repeat steps for next four days • Do you follow a similar program every week? We all follow or perform programs in some way in our daily lives Example: here is the program I follow every working week:

  7. Programs for our robotics class • Our programs will give our robots behavior, the ability to respond to events • The forward.rbt you wrote for your robot made it move forward • The complexity of a program is only limited by your imagination We’ll be writing programs that will make our robots perform actions.

  8. Program Structure Example1: Mr. Mundo: Class, drag a Move block into Says the NXT programming area. Mr. Mundo: Class, open your NXT software. Says Mr. Mundo: Class create a file named moveBack Says • Does this program structure makes sense? Structure means the way a set of things are put together or organized Program structure refers to the way instructions (commands) are organized.

  9. Program Structure Revised example 1 Mr. Mundo: Class, open your NXT software. Says Mr. Mundo: Class create a file named moveBack Says Mr. Mundo: Class, drag a Move block into the Says NXT programming area. The structure of the previous instructions were wrong Each instruction was correct, but the way they were placed together was wrong and confusing

  10. What is pseudo code? This is Pseudo Code Mr. Mundo: Class, open your NXT software. Says Mr. Mundo: Class create a file named moveBack Says Mr. Mundo: Class, drag a Move block into Says the NXT programming area. • Pseudo code is program instructions written in plain English • Pseudo code is not to be understood by the computer or robot, but by the programmer • Pseudo code helps us plan and organize our programs • With pseudo code, we accomplish three things when programming our robots • We gain a better understanding of the tasks our robot will perform. • We look at the world from the robot’s point of view, which is extremely important when programming it. • We create an ordered set of instructions (structure) for our robot to follow.

  11. Pseudo Example 1 ROBOT, move forward until your Touch sensor is pressed and released. Then, stop. ROBOT, I want you to turn left 90 degrees. Now, I want you to give a loud Beep! ROBOT. Now move backward until your light sensor detects something black. Then, stop. Now, ROBOT, do a little dance for 2 seconds. Then stop

  12. Pseudo Cont… Pseudo code Example 1: ROBOT, move forward about 10 inches; turn left 90 degrees, and start moving forward; then start looking for a black object with your Ultrasonic sensor, because I want you to stop when you find a black object; then turn right 90 degrees, and move backward 2 feet, OK? Pseudo code Example 2 1. ROBOT, move forward 10 inches and stop. 2. Now turn left 90 degrees. 3. Starting moving forward, and turn on your Ultrasonic sensor. 4. Stop when you find a black object. 5. Turn right 90 degrees and stop. 6. Now move backwards 2 feet and stop. • Which one is less confusing? Pseudo code instructions should be simple and possible Look at the following two examples:

  13. Hints for writing pseudo code REMEMBER, you will convert this English instructions into programming code for your robot to perform. The easier and clearer your pseudo code is the easier will be for you to convert them to computer code . Do not combine instructions Keep your instructions short and simple Write your instructions in clear English statements Be specific

More Related