1 / 11

Robot Programming

Robot Programming. Programming Behaviors. Behaviors describe the actions and decisions of your robot. Basic Behaviors. Individual, bite-size functions that your robot performs directly. Basic Behavior Turn motor A on forwards. Simple Behaviors. Built of several basic behaviors

gladysf
Download Presentation

Robot Programming

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. 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 Turn motor A on backwards Simple Behavior Go forward until you hit a wall and then turn Turn motor A on forwards Turn motor C on forwards Turn motor C on forwards Get touch sensor reading from Port 1 Compare sensor reading to constant 0 Turn off motors A & C

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

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

  7. Have you hit a wall? Flowcharts End of Program - Marks the end of the program. If you reach this point, the program is done! • Parts of a Flowchart No Start Drive forward Stop motors End Yes 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. Yes/No (also True/False, etc.) — Answers to the question posed in the decision block. Follow the line labeled with the appropriate answer. Decision Block — A decision point in your program. Ask a simple question, and do different things depending on the answer.

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

  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? • Move forward until the touch sensor is pressed • Stop all motors • Reverse for 1 second • Stop all motors • Turn right Back up when you hit a wall and 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

More Related