Projects 3&4: PyRobot & Picobot

Slides:



Advertisements
Similar presentations
Getting Started with PowerPoint
Advertisements

Guide to Making Figures Kyle Patrick Matt Nelson Sarah Smith.
Mouse Tutorial for Win XP In this tutorial you will learn to: Move the mouse Click and double click Make selections Manage windows Use menus Click the.
Wait, sound sensor >70, Port 2 Flowchart – Heartbeat 1 Start Motor A, Move Backward, 1/3 Rotation, Power 20 Wait, 1 Second Sound Sensor (Port 2) Less than.
CREATING A MULTIPLE PAGE REPORT Presented by: Dr. Ennis-Cole.
A CTIVITY M OVEMENT TASK USING SENSORS - HUMANS AND ROBOTS (75 MINUTES ) 1.
Intro to Robots Lab 6: Robot Behaviours. Intro to Robots Further Braitenberg Vehicles: Timid: –Moves forward in a straight line –One threshold light sensor.
EECS 110: Lec 16: Projects Aleksandar Kuzmanovic Northwestern University
Maze Running Robots EGR106 Project Spring Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to.
LEGO Mindstorms NXT Programming We will be using the Common Palette for our Robots This is how you download your program onto the brick Drag and drop a.
Using Draw Tools C 2012jkc. Click File on the menu bar and select Page Setup on the drop- down menu to get the Page Setup dialog box. Under the Margins.
Loops and Switches. 1. What kind of blocks are these? 2. Name two kinds of controls that can be specified to determine how long a loop repeats. 3. Give.
Team Project: A Surveillant Robot System Little Red Team Chankyu Park (Michel) Seonah Lee (Sarah) Qingyuan Shi (Lisa) Chengzhou Li JunMei Li Kai Lin System.
Image Processing & Perception Sec 9-11 Web Design.
Scribbler Movements Sec 9-3 Web Design. Objectives The student will: Understand the basic movement commands for the Scribbler Know how to create and execute.
Problem Solving and Mazes
CSC Intro. to Computing Lecture 16: Robotran.
Getting Started! Lego Mindstorms Program NXT 2.0.
Robotics Engineering Basic Maneuvers. Getting the Boe-Bot to Move One of the first tasks we need to do is to get our bots moving.One of the first tasks.
Events Chapter 7 Part 2. While a Key is Pressed Event Specialized event An event occurs when you press a key and continues until you take your finger.
10/10/ Controlling YOUR ROBOT. 10/10/2015 Basic Stamp  Basic Stamp Input - output pins Interpreter Chip Power supply: 5 Volts voltage Memory: EEPROM.
Using Waits, Loops and Switches WAIT please!. Waits, Loops and Switches Pre-Quiz 1. In programming, what is a loop? When is a loop useful? 2. How can.
Microsoft Word Lesson 1. The Undo Button  Don’t worry about making a mistake. If you make a mistake, go up and hit Edit and then hit Undo, Or you can.
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering –Intro to the Robotics –Introducing the IC –Discuss.
The Wait-Until-Event pattern Has it happened  Yes, it happened!
MS Word Lesson Nine Formatting Objects Mrs. Brown.
How to link the robot and the computer (Bluetooth) How to turn on and off How to connect the adaptor Fluke card connection Sec Getting Started How.
Technical Writing for Robotic Coding!.  du/products/teaching_robotc_cort ex/fundamentals/introtoprogramm ing/thinking/videos/fundamentals.
Barclays Robot Challenge Learn how to Program Robots.
Directions for making Jeopardy from template Give the PowerPoint a new file name so that you don’t destroy the template. The next slide identifies by slide.
Wall Encounter By Made easy by Dwayne Abuel.
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering Dr. S. Ahmadi Class 4.
Find the Mindstorms Icon on the computer.. To start a new program click go.
Robotics NXT-G: variables, file Rotation sensor Lab: Use buttons to hit specific ball. Homework: Postings. Start planning mapping the room.
Viewing Individual Photos Click on any photo thumbnail to start viewing photos at that position in the album. To move to the NEXT photo: Click anywhere.
Vex Robotics Program four: reversing and turning.
PROMGRAMING YOUR ROBOT How Servos Work: How to control your robot.
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering Dr. S. Ahmadi Class 4/Lab3.
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class3/Lab 2.
Using MIT Scratch for Programming and Control Exercise 1 Creating movement Year 11 DTG 2012.
BEGINNER FLL PROGRAMMING WORKSHOP BY DROIDS ROBOTICS & EV3LESSONS.
PowerPoint Basics Tutorial 2: A Slide Show In this tutorial you’re going to create a presentation from scratch. You will have to keep this presentation.
Vex Robotics program three: using motors and sensors together.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering Dr. S. Ahmadi Class 4.
Reading & Writing Decimals
WORKSHOP 2 VALVETRAIN MECHANISM
WORKSHOP 2 VALVETRAIN MECHANISM
What you asked me to teach…
Understanding Communication with a Robot? Activity (60 minutes)
Aleksandar Kuzmanovic Northwestern University
Touch Sensor.
Learning to program with Logo
TermiGator Ebrahem Hamdan University of Florida
Controlling YOUR ROBOT
Inserting a table into word
3 1 2 Significant Figures with calculations (Advanced)
SENSORS.
3 1 2 Significant Figures (Advanced) Rotating numbers on a curved path
ACTIVITY MOVEMENT TASK USING SENSORS - HUMANS AND ROBOTS (75 MINUTES)
Which way does the robot have to turn to get to the charger?
ONLINE OPEN ENROLLMENT GUIDE – PLAN YEAR BEGINNING JULY 1, 2011
Variables & getting info from the user
Robotics Week 3 beginning wheel control
Picobot Challenge! inspiration? walls Picobot area not covered (yet!)
Using Waits, Loops and Switches
Creating a Simple Game in Scratch
Ionut Trestian Northwestern University
TITLE BYOT Half Circle (Advanced)
Presentation transcript:

Projects 3&4: PyRobot & Picobot

Goal: get from Pt A to Pt B Project 3: PyRobot Pt A 2d Roomba simulator Goal: get from Pt A to Pt B Pt B

Project 3: PyRobot IMPORTANT: ROBOT CAN START ANYWHERE! IMPORTANT: Pt A IMPORTANT: ROBOT CAN START ANYWHERE! Pt B IMPORTANT: GOAL CAN BE ANYWHERE

Robot control continuously runs three things: Project 3: PyRobot while True: Robot control continuously runs three things: SENSE PLAN ACT [x,y,thd], bump = self.getData() if bump[0] == True or bump[1] == True: print 'BUMP!', print ' [Left bump sensor:', bump[0], '] ', print ' [Right bump sensor:', bump[1], '] ' robotTask = STOP STOP is one of the robot's states. Every 40th of a second, the robot runs through this loop, sets the robot's state and sets the velocities accordingly. Don't sleep! if robotTask == STOP: self.setVels(0,0) robotTask = KBD

Project 3: PyRobot BASIC ROBOT COMMANDS: STOP: self.setVels(0,0) GO FORWARD: self.setVels(FV,0) GO BACKWARD: self.setVels(-FV,0) GO CLOCKWISE: self.setVels(0,RV) GO COUNTERCLOCKWISE: self.setVels(0,-RV)

Project 3: PyRobot To make the robot go forward a set amount use The max forward velocity: FV Example... TIME_ONE_CIRCLE_OVER = RADIUS*2 / FV if state==GO_LEFT_LITTLE: #FIGURE OUT HOW TO TRAVEL pause_stop = time.time() + TIME_ONE_CIRCLE_OVER State = NOW_GOING_LEFT_LITTLE if pause_stop > time.time() and state==NOW_GOING_LEFT_LITTLE: self.setVels(0,0) #STOP! elif state==NOW_GOING_LEFT_LITTLE: self.setVels(0,FV) #KEEP GOING!

Project 3: PyRobot To rotate the robot use the Max Rotational Velocity: RV Example... TIME_ROTATE_90_DEGREES = 90.0 / RV if state==ROTATE_LEFT_DOWN: #FIGURE OUT HOW LONG TO ROTATE pause_stop = time.time() + TIME_ROTATE_90_DEGREES State = NOW_ROTATING_DOWN if pause_stop > time.time() and state==NOW_ROTATING_DOWN: self.setVels(0,0) #STOP! elif state==NOW_ROTATING_DOWN: self.setVels(0,-RV) #KEEP GOING!

Project 3: PyRobot One way to traverse the space is GO DOWN UNTIL BUMP SOMETHING, GO LEFT A LITTLE GO UP UNTIL BUMP SOMETHING GO RIGHT A LITTLE DO THIS UNTIL HIT CORNER THEN REVERSE....

Project 3: PyRobot Required We may test on any map with rectangular objects

Project 4: Picobot Your goal is to…. Create a maze with Go and Stop buttons 2) Read in commands that will guide the robot through the maze 0 xxxx -> N 1 10 Nxxx -> S 2 20 xExx -> W 3

Project 4: Picobot Creating a maze Your program should read maze description from a file. If you mark blue by 1, and white by 0, then the maze could be represented as a 2D list: X = [[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], [1,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,1,0,1], [1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,0,1,0,0,0,0,1], [1,1,0,1,0,1,1,1,0,1,0,1,0,1,0,1,1,1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,0,0,0,1,1], [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]]  

Project 4: Picobot Creating squares…. #Exit button #square in maze p1 = Point(122,360) p2 = Point(198,390) square1 = Rectangle(p1,p2) square1.setFill("gray") square1.draw(win) p = square1.getCenter() t = Text(p, "Exit") t.draw(win)   #square in maze win = GraphWin("MyWindow", 400, 400) p1 = Point(0,355) p2 = Point(400,400) square5 = Rectangle(p1,p2) square5.setFill(“blue") square5.setOutline(“blue") square5.draw(win)

Project 4: Picobot Figuring out when user clicks on a “button” K = win.getMouse() GoStop = 0 if K.getX() > LEFT_X and K.getX() < RIGHT_X and K.getY() > TOP_Y and K.getY() < BOTTOM_Y: GoStop = 1

Project 4: Picobot Remember to have the trail…

Project 4: Picobot Reading in directions from a text file 0 xxxx -> N 1 10 Nxxx -> S 2 20 xExx -> W 3

Project 4: Picobot Reading in directions from text file Map3.txt… f = open('map3.txt', 'r') #read in all commands text = f.read() #split all commands L = text.split() f.close() #everytime you get to an arrow grab the state for i in range(len(L)): if L[i] == '->': if L[i-1] == 'xxxx': Map3.txt… 0 xxxx -> N 1 10 Nxxx -> S 2 20 xExx -> W 3