Agent-based/Robotics Programming Lab II

Similar documents
Lab book. Exploring Robotics (CORC3303)

The light sensor, rotation sensor, and motors may all be monitored using the view function on the RCX.

Robot Programming Manual

Parts of a Lego RCX Robot

Robotics using Lego Mindstorms EV3 (Intermediate)

Laboratory 7: CONTROL SYSTEMS FUNDAMENTALS

understanding sensors

Here Comes the Sun. The Challenge

Your EdVenture into Robotics 10 Lesson plans

Ev3 Robotics Programming 101

Nebraska 4-H Robotics and GPS/GIS and SPIRIT Robotics Projects

Line-Follower Challenge

EV3 Advanced Topics for FLL

A Day in the Life CTE Enrichment Grades 3-5 mblock Programs Using the Sensors


Deriving Consistency from LEGOs

An Introduction to Programming using the NXT Robot:

I.1 Smart Machines. Unit Overview:

1. Controlling the DC Motors

Chapter 14. using data wires

Inspiring Creative Fun Ysbrydoledig Creadigol Hwyl. Kinect2Scratch Workbook

Some prior experience with building programs in Scratch is assumed. You can find some introductory materials here:

Let There Be Light. Opening Files. Deleting National Technology and Science Press

LEGO Mindstorms Class: Lesson 1

acknowledgments...xv introduction...xvii 1 LEGO MINDSTORMS NXT 2.0: people, pieces, and potential getting started with the NXT 2.0 set...

Programming a Servo. Servo. Red Wire. Black Wire. White Wire

Downloading a ROBOTC Sample Program

The Challenge. What to Do

EQ-ROBO Programming : bomb Remover Robot

Robotic Manipulation Lab 1: Getting Acquainted with the Denso Robot Arms Fall 2010

The ideal K-12 science microscope solution. User Guide. for use with the Nova5000

D - Robot break time - make a game!

Capstone Python Project Features

Chapter 1. Robots and Programs

Creating Computer Games

introduction to the course course structure topics

Robotics Workshop. for Parents and Teachers. September 27, 2014 Wichita State University College of Engineering. Karen Reynolds

Overview. The Game Idea

2.4 Sensorized robots

Robotics Engineering DoDEA Career Technology Education Robot Programming

Reflection Teacher Notes

Vision Ques t. Vision Quest. Use the Vision Sensor to drive your robot in Vision Quest!

Team Project: A Surveillant Robot System

Using LEGO WeDo kits with Scratch

Introduction to programming with Fable

FLL Programming 101 RoboLab

Robotic Programming. Skills Checklist

ROBOTICS. also enjoy buildi ng things with such manipulatives as Legos. Robotics was the. Real World. technology build engineering intuition.

Programming 2 Servos. Learn to connect and write code to control two servos.

Programmable Control Introduction

Studuino Icon Programming Environment Guide

Starting from LEARNER NOTES edited version. An Introduction to Computing Science by Jeremy Scott

: Robots for Education and Entertainment. Sara Schütz

Rodni What will yours be?

Exercise 2. Point-to-Point Programs EXERCISE OBJECTIVE

CURIE Academy, Summer 2014 Lab 2: Computer Engineering Software Perspective Sign-Off Sheet

Table of Contents. Sample Pages - get the whole book at

EE-110 Introduction to Engineering & Laboratory Experience Saeid Rahimi, Ph.D. Labs Introduction to Arduino

Lego Nxt in Physical Etoys

Team Project: A Surveillant Robot System

1 Lab + Hwk 4: Introduction to the e-puck Robot

App Inventor meets NXT

due Thursday 10/14 at 11pm (Part 1 appears in a separate document. Both parts have the same submission deadline.)

Your challenge is to make the turtles draw a flower pattern on Spaceland and to experiment with different kinds of turtle movement.

Learning serious knowledge while "playing"with robots

Revision for Grade 7 in Unit #1&3

Lab 1: Testing and Measurement on the r-one

Sample Pages. Classroom Activities for the Busy Teacher: NXT. 2 nd Edition. Classroom Activities for the Busy Teacher: NXT -

Welcome to Lego Rovers

Today s Menu. Near Infrared Sensors

Electronic Project Interdisciplinary Creation by Amy Barone and Cindy Bronen

Pre-Activity Quiz. 2 feet forward in a straight line? 1. What is a design challenge? 2. How do you program a robot to move

A Lego-Based Soccer-Playing Robot Competition For Teaching Design

Create Your Own World

6.01, Fall Semester, 2007 Assignment 10 - Design Lab, Issued: Tuesday, November 6th 1

Introduction 1. Download socket (the cable plugs in here so that the GENIE microcontroller can talk to the computer)

For this exercise, you will need a partner, an Arduino kit (in the plastic tub), and a laptop with the Arduino programming environment.

Welcome to. NXT Basics. Presenter: Wael Hajj Ali With assistance of: Ammar Shehadeh - Souhaib Alzanki - Samer Abuthaher

Robotics 2a. What Have We Got to Work With?

MEDIA CONVERSION PROJECT: DIGITIZING HISTORIC PHOTOS

ACTIVE LEARNING USING MECHATRONICS IN A FRESHMAN INFORMATION TECHNOLOGY COURSE

UNIT1. Keywords page 13-14

Scratch for Beginners Workbook

Let s start by making a pencil that can be used to draw on the stage.

Erik Von Burg Mesa Public Schools Gifted and Talented Program Johnson Elementary School

Lab 2, Analysis and Design of PID

Line Detection. Duration Minutes. Di culty Intermediate. Learning Objectives Students will:

Lab 1. Motion in a Straight Line

Chapter 9 The use of the LEGO MINDSTORMS System in Modeling the Foraging Behavior and Strategies of Simple Animals

Toeing the Line Experiments with Line-following Algorithms

VEX IQ Troubleshooting Flowchart Controller & Controller Battery

Learn about the RoboMind programming environment

Problem Solving with Robots

Lab 7 Remotely Operated Vehicle v2.0

Boiloid Premium Kit Smart Car Assembly Manual v1.0. Bioloid Premium Kit Smart Car Assembly Manual

Chanalyzer Lab. Chanalyzer Lab by MetaGeek USER GUIDE page 1

UCL Micro:bit Robotics Documentation

Kashif Shah Member, USI ASME Co-coordinator, USI RC11 (812)

Bioloid Premium Kit Robot Arm Assembly Manual v1.0. Bioloid Premium Kit Robot Arm Assembly Manual

Properties of two light sensors

Transcription:

cis3.5, spring 2009, lab IV.3 / prof sklar. Agent-based/Robotics Programming Lab II For this lab, you will need a LEGO robot kit, a USB communications tower and a LEGO light sensor. 1 start up RoboLab Find the RoboLab icon on your computer and double-click on it to start it up. Click on PROGRAMMER. Double-click on INVENTOR 4. Your screen will look like this: 2 find the icons Locate the functions palette. See if you can find each of the following icons. Make a note of which sub-palette each icon belongs to. As you learn what each icon does, write down its function below. 3 s Loops are structures that allow your program to repeat specific tasks again and again. All s have the same basic structure. This includes a set of commands that you want the program to repeat and something that tells the program when to stop repeating, or ing. beginning of code you want to repeat end of next icon after should I keep ing? yes no

There are three types of s: 1. Some s run for a specific number of times. These are called counter controlled s. We will use these in this lab. 2. Other types of s run until a certain condition occurs, for example, go forward until you hit a wall. Those are called condition controlled s. We will not use these in this lab. 3. A third type of runs forever (i.e., they do not stop unless you force the program to quit in the middle or turn off the robot). These are called forever s or infinite s. We will use these in this lab. 4 forever s using jumps In RoboLab, forever s are implemented using jumps. Jumps begin with a land icon and end with a jump icon. In between the land and the jump is the section of your program that you want to repeat forever. Modify your program from the previous lab in which your robot moves in a square: change the code so that it uses a jump and, instead of copy/pasting the same bits of code four times, repeats the go straight and turn forever. Draw the code in the box below. 5 counter controlled s In RoboLab, counter controlled s begin with a start of icon and end with an end of icon. There is also a counter which tells the how many times to repeat. This is specified using the numeric constant icon. Note that if you do not assign a counter, the default is to (i.e., repeat the set of commands inside the ) only twice. Inside the is the section of your program that you want to repeat. Modify your program from the previous step so that it uses a instead of jumps. Draw the code in the box below.

6 the LEGO light sensor The LEGO light sensor has a transmitter and a receiver. It transmits infrared light (also called IR ), which bounces off objects and then returns in the direction of the receiver. The receiver records a value indicating how much light it read, which basically tells you about the brightness of the object that the light sensor is pointing at. The light sensor produces a value between 0 and 100, where 100 means very bright and 0 means very dark. Did you know that your TV remote control uses IR to talk to your television? Here is how you can see what the light sensor s value is: This is done by turning on the RCX and pressing the VIEW button until the arrow at the top of the screen is under the port the light sensor is plugged into. For example, my light sensor is connected to port 2. I would turn on the RCX and press the VIEW button twice. Next to the image of the robot man, there is a number between 0 and 100 this is the value being read by the light sensor. In order to use the light sensor, you need to tell the RCX that the light sensor is plugged into port 2 (or whichever port you choose we ll use #2 because we re already using #1 and #3 for the touch sensors inside the bumper). The easiest way to do this is to write and download a short program that uses the light sensor plugged into port #2. Try this example: Put your robot on at least four different locations: (a) white foamcore or paper, (b) black tape, (c) green tape, and (d) silver or gold tape. As shown in the previous step, VIEW the different values for the light sensor and record the values in the table below: light sensor value black white green silver/gold

programming challenges 1. Program the robot to go forward until it sees something black, and then stops for one second, then goes backwards for two seconds. 2. Program the robot to go forward until it sees something silver or gold, and then stops for one second, then turns to the left and goes forward for two seconds. 7 decision-making Up to now, your programs have been sequential and linear. In other words, your programs have been executing each command, starting from the green light and going until the red light, without skipping any commands. However there are situations where we might like to program the robot to do one action (i.e., go forward) when some condition is true (i.e., light sensor sees black) or else do some other action (i.e., go backward) when the condition is not true (i.e., light sensor sees white). In order to do this, we need a decision-making mechanism so that our robots can react to their environment autonomously (i.e., without a human touching it). This decision making ability is based on its sensory inputs (e.g., the value of the light sensor) and will make the robot a little more intelligent! Decision making is achieved by conditional execution in the programming environment. In RoboLab, by using fork structures, we can allow programs to behave differently based on different values of sensor inputs. How does a fork work? When a fork is reached in a program, one of two branches will be taken based on the value read from one of the robot s sensors. All of the fork commands on the forks palette use the greater-than (>) or less-than-or-equal ( ) condition to determine which branch to execute. These conditions are based on a threshold value. If the value read by the fork s sensor is greater than the threshold value, then the program follows the top branch. Otherwise, if the value read by the fork s sensor is less than or equal to the threshold value, then the program follows the bottom branch. For example, RoboLab can let a program make a decision depending on the value it gets from the light sensor when you use the light sensor fork. You must attach the correct port number modifier to the fork where your actual sensor is conncected. A fork merge is required at some point in the program with any fork command. It completes your conditional structure and brings the two branches of the program back together.

Example: Create this program in RoboLab and use the light sensor value returned when the robot sees black tape as the threshold value. REMEMBER: The light sensor fork requires you to specify a threshold value. For instance, the above example uses a light sensor fork with a threshold value of 35 but you need to calibrate your robot to determine which value it reads when it sees black tape, and then replace 35 with that value. Don t forget to attach the correct port number to the fork. For example, our light sensor is attached to port 2. programming challenge 1. Program the robot to go forward. If it sees something black, it should stop for one second, then go backwards for two seconds, then go forward again. If it sees something silver or gold, it should stop for one second, then turn to the left and go forward again. It should do this behavior forever. First, draw a flowchart, like the one above, to describe the way you want your robot to behave. Then, write the code in RoboLab and when it works, copy it below.