Tasks An NQC program consists of at most 10 tasks. Each task has a name. One task must have the name main, and this task will be executed. The other tasks.

Slides:



Advertisements
Similar presentations
Mindstorms State Machines A structured method for handling tasks and events using RoboLab and NQC Brian Smith
Advertisements

Robofest 2005 Introduction to Programming RIS 2.0 RCX Code.
RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological University.
NXTG Workshop Day 2 Programming with Touch Sensor Light Sensor Ultrasonic Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological.
Sensing the World Intro to Robots.
VEX and Robot C Chris Patterson Presented by Modified by J. Andazola.
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.
Global Variables When we introduced variables we defined them inside task main() task main() { int x; statement; …. } The variable x is only defined inside.
Lab 6: Sensor Based Planning Lab TA: Neil Abcouwer Sid Soundararajan.
Alternative Programming Languages Myles McNally LMICSE Workshop November , 2004 University of Mississippi.
LEGO Robotics Lecture 1: Getting acquainted with your robotic environment.
Not Quite C: A CS 0 Option LMICSE Workshop June , 2005 Alma College.
Sending, Receiving and Processing Messages NQC Tutorial pp
LEGO Mindstorms RIS 2.0 Programming: NQC Code B.A. Juliano and R.S. Renner September 2004 California State University, Chico Intelligent Systems Laboratory.
Debugging (updated 9/20/06 12:48pm) It doesn’t work…. What do I do????
Using Variables Variables form a very important aspect of every programming language. Variables are memory locations in which we can store a value. We.
Repeating Blocks of Code (updated 9/20/05 7:35pm) Reference NQC Tutorial pp 9-12.
BEGINNER EV3 PROGRAMMING Lesson
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.
Program ultrasonic range sensor in autonomous mode
LabVIEW Program and Data Flow Review LabVIEW Robotics Fundamentals.
Walking Lego Robot Driving Lego Robot
Obstacle Detection Introductory Presentation. Opening Activity If you were blindfolded, what senses would you use to find things in the room?
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.
Lab 6: Sensor Based Planning Lab TAs: Ben Morse Sarun Savetsila (Pong)
3 | Touch sensors Created by H. Robinson & A. Gostelow TOUCH SENSORS.
THE TOUCH SENSOR The Touch Sensor, shown in the picture, gives the robot the sense of touch. It gives too different signals when the orange part is ether.
Lego MindStorm An Introduction to Blocks. Blocks Blocks are used to give instructions to your robot. There are many types of blocks You can use the blocks.
Com.Tech 3104 Outcome 12 By: Evan And Mark Progress Report.
Program Flow LabVIEW Robotics Fundamentals. Unintuition You know what this program does… So what does this one do? Inserted code.
Vex Robotics Program four: reversing and turning.
Oregon Robotics Tournament and Outreach Program RCX Basics.
Programming 101 The Common Palette Content provided by Connor Statham (9 th Grade Student) Formatting by Shannon Sieber.
Rescue Robot Day 2 Exploring Computer Science Lesson 6-11.
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.
BEGINNER EV3 PROGRAMMING LESSON By: Droids Robotics Topics Covered: Touch Sensor.
Lesson 2 Inputs. Lesson objectives To understand how inputs can be used to control an output To consider how to make mimics more realistic.
Barclays Robot Challenge Learn how to Program Robots.
VEX and Robot C Chris Patterson Frisco ISD CTE Center Presented by.
Vex Robotics program three: using motors and sensors together.
Python Programming Module 4 Sensors and Loops Python Programming, 2/e1.
Sensor Information: while loops and Boolean Logic.
Presentation Outline I. Background Information II. Design Project
By Sanjay and Arvind Seshan
Programming Part 2 Mod Kit
What is a Robot? A Electro-Mechanical system Plus Artificial intelligence Can do certain tasks that human like Robot Arm Honda Asimo Robot Fish Robot Vacuum.
Using the Distance sensor
Introductory Presentation
BEGINNER EV3 PROGRAMMING Lesson
BEGINNER EV3 PROGRAMMING Lesson
Introductory Presentation
Obstacle Detection Ultrasonic Sensor.
Introductory Presentation
BEGINNER PROGRAMMING LESSON
Forward Until Touch Robot goes forward until it hits a wall.
Line Following Behavior
BEGINNER PROGRAMMING LESSON
Automation and Programming
SENSORS.
Debugging It doesn’t work…. What do I do????
Building a Game in Scratch
Introductory Presentation
Introductory Presentation
creating a ecosystems model in net logo
Obstacle Detection.
Intro to Robotics It’s YOUR FUTURE.
Oregon Robotics Tournament and Outreach Program
Exploring Computer Science Lesson 6-11
Basic Robotic Programming
Presentation transcript:

Tasks An NQC program consists of at most 10 tasks. Each task has a name. One task must have the name main, and this task will be executed. The other tasks will only be executed when a running tasks tells them to be executed using a start command. From this moment on both tasks are running simultaneously (so the first task continues running).

A running task can also stop another running task by using the stop command. Later this task can be restarted again, but it will start from the beginning; not from the place where it was stopped. Let’s write a program in which the robot moves around in a pattern of right turns, but when it senses it hits an obstacle it should react to it. –task hunt: drive around making right hand turns –task detect_bump: check the sensors and react if there is an obstacle.

task main() { SetSensor(SENSOR_1,SENSOR_TOUCH); start detect_bump; start hunt; } The main task just sets the sensor type and then starts both other tasks. After this, task main is finished. task hunt() { while (true) { OnFwd(OUT_A+OUT_C); Wait(Random(200)); OnRev(OUT_C); Wait(Random(100)); } Task hunt() moves the robot in a random walk. task detect_bump() { while (true) { if (SENSOR_1 == 1) { stop hunt; OnRev(OUT_A+OUT_C); Wait(50); OnFwd(OUT_A); Wait(85); start hunt; } Task detect_bump() checks whether the touch sensor is pushed. If so, it takes the following actions: First of all it stops task hunt. This is very important. detect_bump now takes control over the motions of the robot. Next it moves the robot back a bit and makes it turn. Then it starts hunt() again to let the robot execute the random pattern of motion.

Tasks are Run in Parallel Tasks which have been started are all running in parallel. That is before a bump (before detect_bump() stops task hunt() both are running. At every point in time the logic is flowing in both of these tasks RCX permits up to 10 tasks to run simultaneously.