To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 967
966  |  968
Subject: 
Re: Q: Multitasking, and reacting to sensors
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Mon, 5 Feb 2001 19:14:08 GMT
Viewed: 
1878 times
  
Tobias, 'multi-tasking' means that several tasks run simultaneously.  For
example, a robot arm could grab, lift and swivel, one after the other, as
functions, or simultaneously, as tasks.  Or, the RCX could play a tune and a
walker could walk, one after the other as functions, or simultaneously as
tasks.  In that case, the robot could dance :-) if you could get the timing
right.  The way multi-tasking is accomplished is to start all the tasks, one
after the other, without caring when they finish.  So you, in writing the
program must consider these things.

I have spent the last six months fiddling with NQC.  If I had just
downloaded it and tried to work from the tutorial and manual, I think I
would have never gotten anywhere.  But I bought Dave Baum's Definitive Guide
to Lego Mindstorms which is a wonderful training course.  Each chapter (and
project) taught me something new.  Some of these things are subtle, such as
the differences between 'if', 'while' and 'until'.  Needless to say, I
enjoyed every minute of it.

Get the book!

Jerry



In lugnet.robotics.rcx.nqc, Tobias Möller writes:
I've downloaded NQC, and got it running. I have been able to make the
motors run, to make them run backwards, then forward, etc.

However...

I can't get the sensor thing to work right. I want to make a program for
a robot that backs up and turns when it hits a wall. In RCX code I'd use
a sensor block.

In NQC, I've tried to use the "If" statement, but it doesn't work
correctly... It doesn't react to the sensor!

Does this kind of procedure need to involve multitasking to work right?
I put the if statement inside task main{} or whatever it's called.

Should I instead make one task main, where I run the motors, and one
task bump or something, where I put the if statement?

This leads me to the second question...
Although I already may have the answer...
Could someone give me a simple example of multitasking? I've read the
documentation, I know what it does, I just don't know how to use it.

Can I define a task in the beginning of the program, then run it only
under certain circumstances (like light reading <50), or at a certain
point in the program?

Any help appreciated.

--Tobias



Message has 1 Reply:
  Re: Q: Multitasking, and reacting to sensors
 
Thanks for the replies, and for the sample programs. I'll try them out soon. I'm building a robotic arm (that's why I chose to reply to this message, not the other, later ones) that I plan to program in NQC. It does not need multitasking to work, or (...) (24 years ago, 6-Feb-01, to lugnet.robotics.rcx.nqc)

Message is in Reply To:
  Q: Multitasking, and reacting to sensors
 
I've downloaded NQC, and got it running. I have been able to make the motors run, to make them run backwards, then forward, etc. However... I can't get the sensor thing to work right. I want to make a program for a robot that backs up and turns when (...) (24 years ago, 5-Feb-01, to lugnet.robotics.rcx.nqc)

9 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR