To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.org.us.laflrcOpen lugnet.org.us.laflrc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Organizations / United States / LafLRC / 336
335  |  337
Subject: 
Re: 3T
Newsgroups: 
lugnet.org.us.laflrc
Date: 
Fri, 3 Mar 2006 19:13:10 GMT
Viewed: 
1839 times
  
In lugnet.org.us.laflrc, John Brost wrote:
program 3T{
// lots of variables declared
event scancomplete when scandone = 1
main {
   scandone = 0
   start scan
   wait until scancomplete
   stop scan
}
task Scan {

   if A = 0 {
      //move to A location and scan for block
      CurX = 1
      CurY = 1

      <code here to scan and set A to 1 if block is present>

      if A = 1 {
          // if block was present A is 1 now
          // return scanner to home position
          CurX = 0 // set variable CurX to 0-- home position of scanner
          CurY = 0 // set variable CurY to 0-- home position of scanner
          set scandone = 1 // scandone variable is watched by an event
                           // when event fires scan task stops
      }
   }
   If B = 0 {
      //repeat same steps for B location
   }
}



Actually, John, I think I may be able to explain the problem.  You have two
tasks running at the same time.  For the most part, the processor will switch
between the main task, and the scan tast.  So, the order of execution would be
something like this with the main (M:) and scan (S:) tasks

...
S: if A=1
M: check for event scandone =1 (not 1, so false)
S: CurX = 0
M: wait until scancomplete (no event; false)
S: CurY = 0
M: check for event scandone =1 (not 1, so false)
S: scandone = 1
M: wait until scancomplete (no event; false)
S: (brackes don't count as lines) if B=0
M: check for event scandone =1 (true)
S: CurX = 1
M: wait until scancomplete (event = true)
S: CurY = 2
M: Stop scan
S: May execute next line or stop

Does that make sense?  This sort of timing problem is very common with threaded
applications.

Again, my suggestion is to add: "if scandone=1" the line before every "if b=0"

Steve



Message has 1 Reply:
  Re: 3T
 
In lugnet.org.us.laflrc, Steve Hassenplug wrote: <snip> (...) Ok, that makes some sense, thank you very much. I hate the thought of nesting that many more if statements, but that does appear to be the best way to solve the problem. Thanks John (19 years ago, 3-Mar-06, to lugnet.org.us.laflrc)

Message is in Reply To:
  3T
 
Well, I've had some time on my hands, and being totally unhappy with my 3T robot I decided a re-build was in order. Probably an 85% - 90% rebuild. About the only thing that wasn't touched was my cube magazine & the dropper mechanism. Everything else (...) (19 years ago, 3-Mar-06, to lugnet.org.us.laflrc)

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