Your Python program uses the create library. It supplies functions that send commands: to your laptop’s Bluetooth radio, then to the BAM on the Create,

Slides:



Advertisements
Similar presentations
Full Speed Ahead Introductory Presentation. Opening Activity Choose one of the objects to the right and in ten or more steps explain how it goes from.
Advertisements

SNAP CIRCUITS TEACHER MANUAL
InnoSys Process Sequence. End Effector Components End Effector Prox Switch Load Cell Wire Conduit Crows Foot Nut Runner.
Automation and Robotics
Navigating the BOE-BOT
V EX C OACHES ' T RAINING October 12, Agenda for Today 9 – 10 AM : Tina Reeves and the Engineering Notebook 10 – Noon : Finish Building, Basic Robot.
Autonomy using Encoders Intro to Robotics. Goal Our new task is to navigate a labyrinth. But this time we will NOT use motor commands in conjunction with.
EIGHTH GRADE ROBOTICS KITTATINNY REGIONAL HIGH SCHOOL MR. SHEA Introduction to Programming
1 2. Controlling Robot Car in Ogre References: 1. LEGO.com MINDSTORMS NXT Home, 2. OGRE 3D, 3. MSDN,
Right Face Introductory Presentation. Opening Activity How can you use this to make a right turn program? This is your program from Full Speed Ahead to.
CS 1 with Robots IDLE and Myro Institute for Personal Robots in Education (IPRE)‏
LEGO NXT Robot Programming
The Create robot, by iRobot Same as the 4000 series of the Roomba vacuum cleaner, but: Without the vacuum and brush With a port that gives easy access.
1 ©2006 INSciTE Lab Two Task: Make the program from Lab One (Move forward 5 rotations and turn right 90 degrees) into a MyBlock.
Available at: – Program Potentiometer in Autonomous Mode Program potentiometer in autonomous mode.
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.
How to turn on the robot How to start Bluetooth How to connect to robot How to initialize the robot How to not break the robot Sec Getting Started.
Java for Robots How to program an NXT robot with a Java Brain Bert G. Wachsmuth Seton Hall University.
Conditional & Joint Probability A brief digression back to joint probability: i.e. both events O and H occur Again, we can express joint probability in.
BEGINNER PROGRAMMING Lesson
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.
Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.
Fall Week 3 CSCI-141 Scott C. Johnson.  Say we want to draw the following figure ◦ How would we go about doing this?
10/10/ Controlling YOUR ROBOT. 10/10/2015 Basic Stamp  Basic Stamp Input - output pins Interpreter Chip Power supply: 5 Volts voltage Memory: EEPROM.
Minds and Computers 3.1 Preview Spin left motor Spin right motor Wait until the motors have spun two rotations Stop left motor Stop right motor What five.
2 3  A machine  Built to help us  Autonomous (not remote control)  If we want robots to do things for us, we have.
EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright
Moving Around in Scratch The Basics… -You do want to have Scratch open as you will be creating a program. -Follow the instructions and if you have questions.
The Wait-Until-Event pattern Has it happened  Yes, it happened!
Autonomy using Encoders Intro to Robotics. Autonomy/Encoders Forward for Distance In this unit, you will learn to use the encoders to control the distance.
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.
Sentry System Multiple Sensors
Castor Bot. Now, we will begin creating a robot Log onto your computer On your screen, click on the website labeled “castor bot” Your building instructions.
Clap On, Clap Off Introductory Presentation. Opening Activity What is a sensor? Can you give examples? ?
Find the Mindstorms Icon on the computer.. To start a new program click go.
By Droids Robotics INTERMEDIATE PROGRAMMIN G LESSON MOVE DISTANCE MY BLOCK (MOVE_CM)
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.
Automated Mechanisms Help. Potentiometers Potentiometer Check –Analog Port 2 How they work –Analog sensor –Measures rotation of a shaft between 0 and.
Programming 101 The Common Palette Content provided by Connor Statham (9 th Grade Student) Formatting by Shannon Sieber.
The Create robot, by iRobot
Programming - Motion Intro to Robotics. Motors and Sensors Setup The first thing we need to do is tell ROBOTC that we have motors on our robot. Choose.
1- How to connect the robot to the pc Sec Getting Started 3- How to move the robot Sec Scribbler movements 4- How to make a turn 11- How to.
Mindstorm NXT-G Introduction Towson University Robotics.
Repetition everywhere – comparing while in a method and as an event Susan Rodger Duke University July 2010.
CHAPTER 8 Rotational Kinematics. Go to this page on your laptop or computer: ◦ ms/Labs/ClassicCircularForceLab/index.html.
VEX and Robot C Chris Patterson Frisco ISD CTE Center Presented by.
First Meeting. Meeting Guidance  Respect the teachers and volunteers.  Respect other students and share equally.  Be kind to the laptops and the robots!
Obstacle Detection. In the previous program the robot moves forward and then checks for something in the way. As we observed it only checks for things.
Casne.ncl.ac.uk Taking care of the CrumbleBot Please do NOT stress the robot's motors 1.Do NOT push the robot 2.Do NOT hold the.
MEH108 - Intro. To Engineering Applications KOU Electronics and Communications Engineering.
Lego Mindstorm Robots 9797 kit.  Students will learn how to identify how to detect a change in a condition.  Students will learn where and how to identify.
Forward Until Near Stop when near a wall.
ROBOTC for VEX Online Professional Development. Homework Questions Thoughts? Questions?
Python Programming Module 4 Sensors and Loops Python Programming, 2/e1.
Robotics Starter: Quiz Review
What you asked me to teach…
The Create robot, by iRobot
Autonomy using Encoders
Introductory Presentation
Introductory Presentation
Sensors and Logic Switches
Controlling YOUR ROBOT
An Introduction to VEX IQ Programming with Modkit
CBC v2 Using the CBC.
Python programming exercise
P1 : Distributed Bitcoin Miner
Coding Edbot Dream with Scratch
Compiled from various Internet sources Presented by Mr. Hatfield
Presentation transcript:

Your Python program uses the create library. It supplies functions that send commands: to your laptop’s Bluetooth radio, then to the BAM on the Create, then to the Create’s controller. Ditto for the reverse path. The create module (library)

robot.go(20, 0) <next statement>... <next statement>... <much further in program>... The robot “commands” in the Python create module simply send messages to the robot Almost all of the robot commands in the create module do NOT BLOCK. That is, as soon as the message is sent, they continue to the next statement (long before the message has arrived to the robot). The only BLOCKING commands are: the constructor (waits for an acknowledgment that the connection exists), and getSensor (waits for the sensor value to arrive). This causes some commands to behave in ways you might not expect.

The create module (library) Students: The rest of these slides present some of the most common methods in the create module: Connecting and disconnecting Motion Sensors Singing Don’t memorize the details, but DO remember the basics and refer back to this document and others as needed.

Connecting and Disconnecting port = 18 robot = create.Create(port) robot.toFullMode()... robot.shutdown() Set the port per your Bluetooth setup. Or use 'sim' for the simulator. If the program breaks at this point with a message AttributeError: 'Create' object has no attribute 'ser' then it failed to make the Bluetooth connection. In this case, try: Turn the robot off. Wait 10 seconds. Turn the robot on. After the robot beeps, run your program again (several times if necessary). In the worst case, switch robots (but keep the same BAM). Without this, the robot will start ignoring commands when you pick it up or otherwise make it think that it is about to fall off a cliff. This is usually NOT what you want, so run in full mode. Try VERY hard to ensure that your program executes this at the end of each of its runs. It ensures that the robot shuts down in a “clean” state, which greatly increases the chances that (a) you can reconnect, and (b) future sensor data is not garbage.

Motion robot.go(20, 0) time.sleep(3.5) robot.stop() robot.driveDirect(20, -40) time.sleep(3.5) robot.stop() Start moving linearly at 20 cm per second and start rotating at 0 degrees per second. Positive indicates forward, counter-clockwise; negative the reverse. Maximum speeds are something like 50 cm per second and 180 degrees per second. Start moving with the left wheel turning 20 cm per second and the right wheel turning -40 cm per second. Give’s the computer’s processor to other processes for 3.5 seconds (but remember, the robot is still moving). Then tells the robot to stop. So the robot will go ABOUT 70 cm.

Sensors robot.getSensor('DISTANCE') robot.go(20, 0) time.sleep(3.0) robot.stop() distance = robot.getSensor('DISTANCE') print(distance) front_left = robot.getSensor('CLIFF_FRONT_LEFT_SIGNAL') is_playing = robot.getSensor('SONG_PLAYING') for key in create.SENSORS: value = robot.getSensor(key) print(key + ':', value) The getSensor method returns whatever sensor value(s) you ask for; you must spell the sensor-string exactly right. The DISTANCE sensor uses the wheel encoders to estimate how far the robot has traveled linearly since the last time you asked it for the distance. The response is in millimeters (not centimeters). To measure distance traveled, call the method before the motion to initialize the sensor, then again after the motion to get the distance traveled. See the robot documenation for details about the sensors. This snippet gets and prints all the current sensor values.

Singing – What’s a song? def robot_make_song(): song = [] for k in range(40, 100, 5): duration = 16 note = (k, duration) song.append(note) return song song = make_robot_song() robot.playSong(song) A song is a list of up to 16 notes. A note is a 2-tuple (pitch, duration) where pitch is between about 31 and about 127 and duration is the duration of the note in 64 th s of a second. For example, (120, 32) is a high note played for about ½ of a second. The playSong method sends a message asking the robot to start playing the given song (i.e., the given sequence of notes).

Singing – Leaving time to play def robot_sing2(robot, song): total_duration = 0 for k in range(len(song)): note = song[k] duration = note[1] total_duration = total_duration + (duration / 64) robot.playSong(song) time.sleep(total_duration + 1.0) def robot_sing1(robot, song): robot.playSong(song)

Singing – Blocked versus Not Blocked def robot_sing3(robot, song): robot.playSong(song) while True: if not robot.getSensor('SONG_PLAYING'): break def robot_sing1(robot, song): robot.playSong(song) while True:... if the event of interest occurred: break... The Wait-Until-Event pattern