To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.nxtOpen lugnet.robotics.nxt in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / NXT / 1166
1165  |  1167
Subject: 
Re: How is this?
Newsgroups: 
lugnet.robotics.nxt
Date: 
Thu, 19 Aug 2010 14:27:12 GMT
Viewed: 
48058 times
  
In lugnet.robotics.nxt, Gus Jansson wrote:
In lugnet.robotics.nxt, Edwin Pilobello wrote:
The program in NXT-G is simple:

Loop forever
  If Touched
  {
     wait for ultrasonic < 9"
     turn MotorA forward unlimited
  }
  else
  {
      turn MotorA off
  }

If touched and distance > 9, MotorA does not move.
If touched and distance < 9 MotorA turns
-- If untouched and distance is < 9, MotorA stops
-- If untouched and distance is > 9. MotorA keeps on turning!

The last condition is what's bugging us.  Why does the motor not stop if
distance is greater than 9"?  I have always assumed the switch block would take
the bottom (negative) logic when untouched.  As it is now, the motor keeps
spinning until the ultrasonic detects < 9".  Obviously, after the motor starts
turning, it ignores the touch sensor.

I can see how this can happen and it depends on the sequence of events.  This
sequence will cause this behavior:
  touched   AND  distance < 9    - Motor turns on
  touched   AND  distance > 9    - Motor running, waiting for distance < 9
  untouched AND  distance > 9    - Motor running, still waiting for distance < 9

This may be a good time to introduce data wires and using the logic block to do
a logical AND.

Gus

Yes, change the "wait for 9" to be a "check for 9", and the problem should go
away...

  Loop forever
    if Touched and distance < 9
    {
      turn on motor
    } else {
      turn off motor
    }

Kevin



Message is in Reply To:
  Re: How is this?
 
(...) I can see how this can happen and it depends on the sequence of events. This sequence will cause this behavior: touched AND distance < 9 - Motor turns on touched AND distance > 9 - Motor running, waiting for distance < 9 untouched AND distance (...) (14 years ago, 23-Jan-10, to lugnet.robotics.nxt)

3 Messages in This Thread:

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

Custom Search

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