Presentation is loading. Please wait.

Presentation is loading. Please wait.

Robot Programming. Programming Behaviors Behaviors describe the actions and decisions of your robot.

Similar presentations


Presentation on theme: "Robot Programming. Programming Behaviors Behaviors describe the actions and decisions of your robot."— Presentation transcript:

1 Robot Programming

2 Programming Behaviors Behaviors describe the actions and decisions of your robot

3 Basic Behaviors Individual, bite-size functions that your robot performs directly Basic Behavior Turn motor A on forwards

4 Simple Behaviors Built of several basic behaviors Let you describe a full action of the robot Simple Behavior Go forward until you hit a wall and then turn Turn motor A on forwards Get touch sensor reading from Port 1 Turn off motors A & C Turn motor A on backwards Turn motor C on forwards Compare sensor reading to constant 0

5 Complex Behaviors Describe the full scope of what the robot can do Always composed of smaller behaviors, so you can break them down Complex Behavior Navigate a maze Drive forward Turn right Stop when you hit a wall Drive forward Stop when you hit a wall Turn right Turn left

6 Flowcharts Visually organizes steps in different shaped bubbles Good way to work out steps before you translate them into code Start End Drive forward Have you hit a wall? Stop motors Yes No

7 Flowcharts Parts of a Flowchart Have you hit a wall? Start End Drive forwardStop motors Yes No Start of Program — Marks the beginning of the program. Begin here. Follow the line to get to the next block. Statement Block — A statement to execute,or a behavior to perform. Decision Block — A decision point in your program. Ask a simple question, and do different things depending on the answer. Yes/No (also True/False, etc.) — Answers to the question posed in the decision block. Follow the line labeled with the appropriate answer. End of Program - Marks the end of the program. If you reach this point, the program is done!

8 Flowcharts What does this flowchart describe? Tire at rated pressure? What about this one? Yes No Pump air Start End Stop Motors Touch sensor pushed? Start motors Yes No Start End Go when touch sensor is pushed Filling a tire

9 Pseudocode Halfway inbetween English and computer code Describe what sensors and motors do and see with simple behaviors

10 Pseudocode What behavior does this pseudocode describe? Back up when you hit a wall and turn right 1.Move forward until the touch sensor is pressed 2.Stop all motors 3.Reverse for 1 second 4.Stop all motors 5.Turn right

11 Review Basic behaviors are actions the robot performs directly Simple behaviors are actions like we think about them Complex behaviors describe more interesting functions of the robot Flowcharts organize the steps Pseudocode describes the steps using the robot’s motors and sensors


Download ppt "Robot Programming. Programming Behaviors Behaviors describe the actions and decisions of your robot."

Similar presentations


Ads by Google