Introduction to Robots and the Mind - Programming with Sensors - Bert Wachsmuth & Michael Vigorito Seton Hall University.

Slides:



Advertisements
Similar presentations
VEX and Robot C Chris Patterson Presented by Modified by J. Andazola.
Advertisements

Navigating the BOE-BOT
Behavior-Based Robots Bert G. Wachsmuth Seton Hall University.
The Turtle Laboratory Sequence Myles McNally LMICSE Workshop November , 2004 University of Mississippi.
The Turtle Laboratory Sequence LMICSE Workshop August , 2006 Villanova University.
Introduction to Computers and Programming for Loops  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course. Introduction to.
The Turtle Laboratory Sequence LMICSE Workshop June , 2005 Alma College.
26-Jun-15 Methods. About methods A method is a named group of declarations and statements You execute those declarations and statements by calling the.
IR SENSORS AND ENCODERS. LCDs Timothy Friez Class # 2.
Patent Liability Analysis Andrew Loveless. Potential Patent Infringement Autonomous obstacle avoidance 7,587,260 – Autonomous navigation system and method.
Programming Part 1 Armond R. Smith Zhenying Wu. Overview of this Class ● Transition from FTC -> FRC ● Using Your Resources ● Java Keywords o Data Types.
Testbed: Exercises.
Java for Robots How to program an NXT robot with a Java Brain Bert G. Wachsmuth Seton Hall University.
Program ultrasonic range sensor in autonomous mode
Programming Concepts Part B Ping Hsu. Functions A function is a way to organize the program so that: – frequently used sets of instructions or – a set.
ORTOP WORKSHOP 3 ROBOT NAVIGATION & MISSIONS ORTOP WORKSHOP 3 ROBOT NAVIGATION & MISSIONS.
LabVIEW Program and Data Flow Review LabVIEW Robotics Fundamentals.
Karel J Robot An introduction to BlueJ and Object- Oriented Programming.
Programming Concepts (Part B) ENGR 10 Introduction to Engineering 1 Hsu/Youssefi.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Available at: Lesson 3.6 – Program Line Follower in Autonomous Mode Program Line Follower in Autonomous Mode.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
How to Control a Robot Kickoff Why, How, Where? Sense, think, act Robot, laptop, your brain GameRobot Human Game State Score External Sensors Internal.
7.2 V battery pack and charger Put the battery in the charger station at the end of the lab. period. Red light indicates charging. Ken Youssefi Introduction.
Robotics Light sensor. Calibration. Reverse engineering challenge. Lab work: Create and show your program. Add light sensor (different orientations). Robot.
EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright
Four Fundamental Pieces Instruction Control Structure Function Expression.
2008 SBPLI/FIRST Programming Workshop Tom Boehm Patchogue Medford High School, Team 329 Motorola Inc. Mark McLeod Hauppauge High School Team 358 Northrop.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Robotics NXT-G: variables, file Rotation sensor Lab: Use buttons to hit specific ball. Homework: Postings. Start planning mapping the room.
EV3 Software EV3 Robot Workshop
ROBOTC Software EV3 Robot Workshop
BEGINNER FLL PROGRAMMING WORKSHOP BY DROIDS ROBOTICS & EV3LESSONS.
Enables your robot to see, recognize, avoid objects, and detect movement. It uses the same scientific principle that bats use. It measures distance in.
VEX and Robot C Chris Patterson Frisco ISD CTE Center Presented by.
Introduction to Robots and the Mind - Proportional Controller - Bert Wachsmuth & Michael Vigorito Seton Hall University.
Introduction to Programming G50PRO University of Nottingham Unit 6 : Control Flow Statements 2 Paul Tennent
Introduction to Robots and the Mind - Sensors - Bert Wachsmuth & Michael Vigorito Seton Hall University.
Introduction to Robots and the Mind - Programming Basics - Bert Wachsmuth & Michael Vigorito Seton Hall University.
USING SWITCHES TO PROGRAM A CANDY SORTER DESIGNED FOR USE WITH LMS EV3 PROGRAMMING AND BUILDING ENVIRONMENT.
Python Programming Module 4 Sensors and Loops Python Programming, 2/e1.
Introduction to Programming in RobotC
VEX IQ Curriculum Smart Machines Lesson 09 Lesson Materials:
Lecture 10 Sensors.
By Sanjay and Arvind Seshan
Introduction to Robots and the Mind - Path Integration -
Touch Sensor.
Introduction To Robot Sensors
Programming Part 2 Mod Kit
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
The Finch Robot and the While Loop
Introduction to Robots and the Mind - Methods -
Decision statements. - They can use logic to arrive at desired results
Introduction to Computer Programming
Sensors Training.
Automation and Robotics
Writing Methods.
Motors and Sensors Large Motor
LRobot Game.
An Introduction to Java – Part I, language basics
Holyoke Codes LEGO ROBOTICS
Storing Values as Variables
Robotics and EV3 - Behavior-Based Robots -
An Introduction to VEX IQ Programming with Modkit
Robotics and EVT - line follower -
Compiled from various Internet sources Presented by Mr. Hatfield
Loops CGS3416 Spring 2019 Lecture 7.
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Lego MINDSTORMS EV3.
LEGO MINDSTORMS NXT PROGRAMMING
Presentation transcript:

Introduction to Robots and the Mind - Programming with Sensors - Bert Wachsmuth & Michael Vigorito Seton Hall University

Last Time  Open vs Closed Loop controllers –Controls a system using only the current state and its model of the system –Has a feedback loop that measures differences between actual and desired state and takes corrective action if necessary  Active vs passive sensors –Modify their environment and measure results –Record some parameters of their environment

EV3 Sensors  EV3TouchSensor –getTouchMode() – registers touch  EV3ColorSensor –getColorIDMode() – measures one of 8 colors –getRedMode() – measure mount of reflected red light –getAmbientMode() – measures the ambient light intensity –setFloodlight(int colorID) – turn LED on in given color  EV3UltrasonicSensor –getDistanceMode() – returns distance in meter –getListenMode() – listens to other active ultrasound sensors  EV3GyroSensor –getAngleMode() – measures orientation in degree –getRateMode() – measures rotational velocity –getAngleAndRateMode() – measures both direction and velocity

Sensor Framework For each sensor you want to use:  Define field of type “EV3 sensor name”  Define field of type SensorProvider and initialize to the desired sensor mode  Define field of type float[] to store the data measured by sensor  Define a method to query the sensor and return the sensor data in appropriate type

Example public static EV3UltrasonicSensor distanceSensor = new EV3UltrasonicSensor(SensorPort.S1); public static SampleProvider distanceProvider = distanceSensor.getDistanceMode(); public static float[] distanceSample = new float[distanceProvider.sampleSize()]; public static double getDistance() { distanceProvider.fetchSample(distanceSample, 0); return distanceSample[0]; }

Using the Sensor If you follow the recommended sensor framework, it is easy to use a sensor: public static void main(String[] args) { System.out.println(“D = “ + getDistance()); Button.ENTER.waitForPressAndRelease(); }

Loops Usually we want to query a sensor repeatedly: employ a while loop, which is deceptively simple: while (condition_is_true) { // do this }

Distance Measuring Tool Assuming you created the standard framework for the distance sensor, create the following main method: public static void main(String[] args) { while (Button.ENTER.isUp()) { System.out.println(“D=“ + getDistance()); Delay.msDelay(500); }

Distance Measuring Tool v2 public static void main(String[] args) { while (Button.ENTER.isUp()) { double dist = getDistance(); Sound.playTone((int)(1000*dist), 100); System.out.println("d = " + dist); }

A Complete Program Task: Create a robot that drives forward if possible, avoiding any obstacle. Need to clarify: “avoiding any obstacle” Create a robot that drives forward as long as there is no obstacle ahead. If there is an obstacle, it avoids it by turning 90 degrees clockwise

A Complete Program (2) Robot needs to have:  Two motors  One distance sensor Robot needs to do:  Drive forward  Detect obstacle  Avoid obstacle

A Complete Program (3) public class Avoider { // fields (not shown) // methods public static void driveForward() {} public static void avoidObstacle() {} public static boolean obstacleDetected() {} public static void main(String[] args) { while (Button.ENTER.isUp()) { driveForward(); if (obstacleDetected()) { avoidObstacle(); }

Making Decisions: if The if statement lets you selectively execute code only if a certain condition is true Syntax: if (condition_is_true) { // execute this code } Or if (condition_is_true) { // execute this code } else { // execute this code }

A WallHugger Robot Create a robot that drives parallel to a wall if possible. If there is an obstacle ahead, it turns 90 degrees away from the wall.