VADCFLL-L Archives

July 2011

VADCFLL-L@LISTSERV.JMU.EDU

Options: Use Proportional Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Phil Smith III <[log in to unmask]>
Reply To:
Phil Smith III <[log in to unmask]>
Date:
Mon, 11 Jul 2011 13:37:04 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (138 lines)
Caveats: I haven't really been following this discussion, and am far more
familiar with RCX programming than NXT. However, I have been programming for
35+ years, so I can at least claim some expertise there :-)

I think you have to look at it as a state machine rather than a series of
operations: the "go forward forever" is really a "turn on the motor". A "go
forward 1 second" is a shortcut for "turn on the motor, wait 1 second, turn
motor off".

So it isn't a matter of the code interrupting the "forever" block -- it's
more that the state changes when appropriate. As Stuart/Lori suggested, a My
Block for "go forward forever, wait for the touch sensor, back up" is a
shortcut for "turn on the motor UNTIL the touch sensor trips, then reverse
the motor". Again, state changes, not operations.

Does this help? Not sure...!
--
Phil Smith III

Coach, The Capital Girls (retired)
Team 1900 (2002)
Team 2497 (2003)
Team 2355 (2004)
Team 1945 (2005)

-----Original Message-----
From: First Lego League in Virginia and DC
[mailto:[log in to unmask]] On Behalf Of Yi Chu
Sent: Monday, July 11, 2011 12:56 PM
To: [log in to unmask]
Subject: Re: [VADCFLL-L] Programming query- how to count inside of a sensor
loop?

I am new to NXT so please forgive my ignorance.  I find that the loop
approach is more natural, and more generally applicable in
(procedural) programming.

The issue of having a block that says 'go forward forever' to me is
misleading.  One would think the code would just stuck in that block,
and never hit any code thereafter.  I know NXT does check the code
after, but that also means it does interrupt the 'forever' block (or
NXT is not single threaded). There are things in NXT that is beyond
simple procedure programming.  Using a loop accomplishes the same
thing, and the approach is more general in terms of programming in
general, as it is just basic procedural programming

I look forward to being corrected.

yi

On Mon, Jul 4, 2011 at 9:23 PM, Stuart & Lori Roll <[log in to unmask]>
wrote:
> I had Brandy send me an example of her program to clarify the problem.
>
> The program used a loop to repeatedly test the touch sensor and either go
> forward or back up and turn.  She could have used a logic value to exit
the
> loop but really the approach wasn’t the best to begin with.
>
> A better solution would be to tell the motors to go forward “forever”, use
a
> WAIT block to wait for the touch sensor to be pressed, back up and turn.
> This sequence can be repeated as many times as needed.
>
> Of course a better programming approach would be to avoid duplicate code
and
> create a My Block for the “go forward forever, wait for the touch sensor,
> back up” part.  Then the main program would be MB, turn right, MB, turn
> left, MB turn right.  Alternatively, the MB could do the turn itself using
> an input logic value to determine which direction to turn.  Then the main
> program would be MB, MB, MB.
>
> I sent her examples of these solutions directly.
>
> Thank you Brandy, for asking a good question!
>
>
> Stuart Roll
> River Bend Robotics Coach
>
> From: Brandy bergenstock
> Sent: Monday, July 04, 2011 11:46 AM
> To: [log in to unmask]
> Subject: [VADCFLL-L] Programming query- how to count inside of a sensor
> loop?
>
> I created a maze for my students and let them go at it.  One student
choose
> to use a touch sensor, which was a good idea.  Now the maze had the robot
> traveling 1 right turn, two left turns, and then a right to finish the
maze.
> ( On average this maze took 1.5 hours to program for each group.)  The
> student ended up using a timer on the loop, allotting the loops enough
time
> to run until they finished their task and moving on to the next loop.  
Not
> bad for a brand new programmer :)
>   But surely, there has to be a away to make the loops count themselves.
How
> would you tell the robot, after each touch, count it, then stop after you
> reach "x" touches?
> I am really trying to wrap my head around the wires.  I know there is a
> logic and a math block that would possible to use for this idea, but that
I
> can't seem to figure out how to wire it up.
>     Any help to this end would be greatly appreciated!
> (Also to the coach and his son that was considering an advanced robotic
> programming class on-line , I'm still eagerly awaiting that news on that
> seminar set :)
> Regards,
> Brandy
> ________________________________
> To UNSUBSCRIBE or CHANGE your settings, please visit
> https://listserv.jmu.edu/archives/vadcfll-l.html and select "Join or leave
> the list".
> VADCFLL administrative announcements are sent via VADCFLL-ANNOUNCEMENTS-L.
> Visit https://listserv.jmu.edu/archives/vadcfll-announcements-l.html to
> subscribe.
> ________________________________
> To UNSUBSCRIBE or CHANGE your settings, please visit
> https://listserv.jmu.edu/archives/vadcfll-l.html and select "Join or leave
> the list".
> VADCFLL administrative announcements are sent via VADCFLL-ANNOUNCEMENTS-L.
> Visit https://listserv.jmu.edu/archives/vadcfll-announcements-l.html to
> subscribe.

-- To UNSUBSCRIBE or CHANGE your settings, please visit
https://listserv.jmu.edu/archives/vadcfll-l.html and select "Join or leave
the list".

-- VADCFLL administrative announcements are sent via
VADCFLL-ANNOUNCEMENTS-L. Visit
https://listserv.jmu.edu/archives/vadcfll-ANNOUNCEMENTS-l.html to subscribe.

-- To UNSUBSCRIBE or CHANGE your settings, please visit https://listserv.jmu.edu/archives/vadcfll-l.html and select "Join or leave the list".

-- VADCFLL administrative announcements are sent via VADCFLL-ANNOUNCEMENTS-L. Visit https://listserv.jmu.edu/archives/vadcfll-ANNOUNCEMENTS-l.html to subscribe.

ATOM RSS1 RSS2