Behavior Programming. Structured Programming A series of if-thens Easy to get started in and hardly requires any thought or design beforehand But the.

Slides:



Advertisements
Similar presentations
ArrayLists The lazy mans array. Whats the matter here? int[] list = new int[10]; list[0] = 5; list[2] = hey; list[3] = 15; list[4] = 23;
Advertisements

ArrayList Difference of Array and ArrayList [Sample code] TestArrayList.java.
CS18000: Problem Solving and Object-Oriented Programming.
Problem Solving 5 Using Java API for Searching and Sorting Applications ICS-201 Introduction to Computing II Semester 071.
Follow The Guidelines Introductory Presentation. Opening Activity Make a prediction about how light sensors will use thresholds. Keep in mind: We used.
queues1 Queues Data structures that wait their turn.
Behavior-Based Robots Bert G. Wachsmuth Seton Hall University.
Priority Queues and Heaps. Overview Our last ADT: PriorityQueueADT A new data structure: heaps One more sorting algorithm: heapsort Priority Queues and.
Stacks.
Building robots Spring Mindstorms Programming Java + leJOS, NQC, and others.
Created by Chris Bracken
1 Ultrasonic Distance Sensor. 2 How it Works The distance sensor emits short bursts of sound and listens for this sound to echo off of nearby objects.
PROG Mobile Java Application Development PROG Mobile Java Application Development Event Handling Creating Menus.
Sensors Material taken from Robotics with the Boe-Bot.
LEGO Mindstorms NXT Introduction. Component NXT Brick Touch Sensor Light Sensor Ultrasonic Sensor Interactive Servo Motors MMN Lab.
Using Thread in leJOS. Introduction to thread A thread is a thread of execution in a program The Java Virtual Machine allows an application to have multiple.
Practical Electronics & Programming
Reactive robots UPNA The Public University of Navarra Material for pupils & students.
LabVIEW Basics Review LabVIEW Robotics Fundamentals.
Writing JavaDocs Mimi Opkins CECS 274 Copyright (c) Pearson All rights reserved.
Jan 12, 2012 Introduction to Collections. 2 Collections A collection is a structured group of objects Java 1.2 introduced the Collections Framework Collections.
Computer Science II 810:062 Section 01. How is CS I different from CS II? When you teach Java there are a series of decisions that have to be made…
Sound, Touch Sensor, and Motors. Wheeled Vehicles Using the Pilot class: –Constructor Pilot(float wheelDiameter, float trackWidth,Motor leftMotor, Motor.
Light, Sound, and Ultrasonic Sensor. Doc leJOS API – leJOS Tutorial –
CS 1 with Robots Behavior Based Control Institute for Personal Robots in Education (IPRE)‏
Department of Computing and Information Sciences Kansas State University Design Methodology for State based Embedded Systems Case Study: Maze Navigator.
ALL TERRAIN ROBOT 1 Wilmer Arellano. The Client’s Need  Verbally presented at class time.  Modify the All Terrain Manual Robot into an autonomous Gripper.
Response actuatorcontrol program analog quantity, e.g. pulse train digital quantity, e.g. power % interface stimuli sensorcontrol program analog quantity,
1 ENGI 2420 Structured Programming (Lab Tutorial 7) Memorial University of Newfoundland.
In Java processes are called threads. Additional threads are associated with objects. An application is associated with an initial thread via a static.
AP Computer Science A – Healdsburg High School 1 Unit 9 - Why Use Classes - Anatomy of a Class.
Basic Circuits – Lab 4 Serial and OSC (maybe some theory too) Xmedia Spring 2011.
ROBOTIC ARM 2 Wilmer Arellano © Hardware  Next slide shows sensor connection to analog pin 0 and Motor 1 connection. Lecture is licensed under.
Iterators, Iterator, and Iterable 2015-T2 Lecture 8 School of Engineering and Computer Science, Victoria University of Wellington COMP 103 Thomas Kuehne.
1 ENGI 2420 Structured Programming (Lab Tutorial 7) Memorial University of Newfoundland.
TechKnowTone Contents: Sensor Features Sensor Connections Sample Sketch Questions …Sensor Features… Arduino Coding – Distance Sensors.
Iteration Abstraction SWE Software Construction Fall 2009.
CLASS AND OBJECTS Valerie Chu, Ph.D. LeMoyne-Owen College 1.
Topic 13 Iterators. 9-2 Motivation We often want to access every item in a data structure or collection in turn We call this traversing or iterating over.
Lecture 3: Blocks 1 TEALS MINECRAFT PROJECT. MINECRAFT BLOCKS Blocks form the terrain & buildings in the Minecraft world. Blocks can change appearance,
Object Orientated Programming in Perl Simulated Models of Termites.
Adding Sounds Games Programming in Scratch. Games Programming in Scratch L6 Adding Sounds Learning Objectives Learn how to add sound to a Scratch game.
Lecture 8 the Preference Menu. Settings... Sudoku settings s Music Play background music Hints Show hints during play We add some strings to the strings.xml.
Introduction to Robots and the Mind - Programming with Sensors - Bert Wachsmuth & Michael Vigorito Seton Hall University.
Programming in Java Transitioning from Alice. Becomes not myFirstMethod but …. public static void main (String[] arg) { // code for testing classes goes.
Programming in C++ Ryan Kafuman 07/06/09. Programming in C++ ● Classes and Object Oriented Design ● Error Handling ● Function Overloading ● Operator Overloading.
Java Arrays and ArrayLists COMP T1 #5
Lecture 10 Sensors.
A First Look at GUI Applications Radio Buttons and Check Boxes
Follow The Guidelines.
Ultrasonic Distance Sensor
Advanced Swing Lists.
Lists The List ADT.
LEGO Robotics Ultrasonic Sensor
Iteration Abstraction
Real time operating system
Follow The Guidelines Light Sensor
Introductory Presentation
Chapter 8 Collection Types.
L2. Necessary Java Programming Techniques
Robotics and EV3 - Behavior-Based Robots -
Introductory Presentation
The Object-Oriented Thought Process Chapter 04
Recitation 7 October 7, 2011.
The Vector Class An object of class Vector is similar to an array in that it stores multiple values However, a vector only stores objects does not have.
L2. Necessary Java Programming Techniques
Unit 1 Lab14 & Lab15.
Mobile Programming Dr. Mohsin Ali Memon.
Ultrasonic Distance Sensor
Presentation transcript:

Behavior Programming

Structured Programming A series of if-thens Easy to get started in and hardly requires any thought or design beforehand But the code ends up as spaghetti code MMN Lab.

Behavior programming Requires a little more planning before coding Each behavior is nicely encapsulated within an easy to understand structure Very easy to add or remove specific behaviors MMN Lab.

The Behavior API Only one interface and one class –Behavior interface –Arbitrator class MMN Lab.

Behavior Interface API –boolean takeControl() Returns a boolean value to indicate if this behavior should become active –void action() Initiates an action when the behavior becomes active –void suppress() Immediately terminate the code running in the action() method MMN Lab.

Arbitrator Constructor –public Arbitrator(Behavior [] behaviors) Higher index has the higher priority Method: –public void start(); MMN Lab.

Coding Behaviors MMN Lab.

Coding Behaviors cont’d MMN Lab.

Coding Behaviors cont’d MMN Lab.

Coding Behaviors cont’d Add a new behavior MMN Lab.

Coding Behaviors cont’d Add the new behavior to the Arbitrator MMN Lab.

Sensor Listener MMN Lab.

Lab6 Based on the sample code, design the following behaviors with proper priorities DriveForward (included in sample code) HitWall (included in sample code) Turn 360 degree by triggering ultrasonic sensor Play music by triggering sound sensor DoStop (included in sample code) MMN Lab. Low High Priority

Lab6 Hint: –You can use SensorListener for more accurate sensor action –Add delay if the program starts in the unexpected way MMN Lab.