Bob,

Here's an example of how your original program could be "fixed".

Your program had 4 move blocks in a row after the loop.  This issue with multiple threads, the way your program was originally written is that the program could advance from the 2nd move block after the loop to the 3rd block after the loop while the top thread was still running.

One simple technique for synchronizing threads is to use a "One Count Loop"  (another would be to stick the two threads in a myblock).  One property of a loop is that a loop won't exit until all of the threads in it are complete.  A loop set to control=count until=1 will execute exactly 1 time (so it sort of isn't acting like a loop).  However it will wait until both threads inside it are done before allowing execution to pass to the block following the loop.  Putting the multi-threaded little piece of code into a myblock would have had the same effect.  A myblock won't exit until all threads in it are complete. 

To get both threads into the loop you have to use a "crowbar".  A crowbar is an extra block, usually a move block that you use temporarily to get the loop to expand to make room for the extra thread.  Take another move block from the pallet and put it inside the loop next to the last block of the 1st row.  Now expand the data port on the move block.  The bottom of the loop will open up.  Now stick the 1st block of your second thread into the loop.  Then connect the block in the new row to the sequence beam creating the 2nd thread.  Then remove your extra block from inside the loop.  The loop will now shrink back down but only as far as the 2nd thread lets it.

Best Regards,
Jamie Diamond
http://www.cougarrobot.com

On Tue, Oct 23, 2012 at 10:39 PM, Bob and Ann Henshaw <[log in to unmask]> wrote:

Thanks everyone for such rapid and thoughtful suggestions. For those interested, we reinstalled the Fanthom driver and NXT firmware update, and re wrote and recompiled the program from scratch. The robot was still behaving erratically. This is not a traction issue based on observation as well as replacement of our treads with new ones. Eliminating our parallel move blocks and using motor blocks as suggested by Mike (below) seems to have solved the problem.

 

Mike:
Thanks for the suggestion and test code. It seems to have solved our “ghost”. We will incorporate motor blocks into our erratic main programs at our next meeting and see if it solves our intermittent problems as well. Hope to run into you to thank you in person.

 

Sincerely,

Bob Henshaw

Team Dynamite

 

From: Michael Brown [mailto:[log in to unmask]]
Sent: Tuesday, October 23, 2012 9:20 PM


To: Bob and Ann Henshaw
Subject: Re: [VADCFLL-L] looking for help with erratic robot behavior

 

Instead of using move blocks in parralell programing use motor blocks and uncheck wait for completion so that both blocks execute at the same time..  Slow down your turns for accurate turns. see attached.

--
Michael Brown
Coach Team 4773

Waffle Bacon Bots!

"What we learn is more important than what we win."



On Tue, Oct 23, 2012 at 9:11 PM, Bob and Ann Henshaw <[log in to unmask]> wrote:

Here is a simple program where the robot moves, stops on a line, executes a 2 motor 90 degree spin, and moves forward. At the end, it suddenly lurches to the right, despite the stop block.

Thanks for looking at it!

Bob

 

From: Glenn Roberts [mailto:[log in to unmask]]
Sent: Tuesday, October 23, 2012 7:54 PM
To: 'Bob and Ann Henshaw'; [log in to unmask]
Subject: RE: [VADCFLL-L] looking for help with erratic robot behavior

 

My gut says there’s a subtle bug in your software.  Not sure, is there any way to share an NXT program with this email group so others can look at it?

 

From: First Lego League in Virginia and DC [mailto:[log in to unmask]] On Behalf Of Bob and Ann Henshaw
Sent: Tuesday, October 23, 2012 7:16 PM
To: [log in to unmask]
Subject: [VADCFLL-L] looking for help with erratic robot behavior

 

I am a 5 year veteran home based coach with a 2nd year team of 10 year olds. We are working with a Mindstorms NXT system that we purchased new last year, with a fully recharged battery. We are experiencing several intermittent erratic behaviors (listed below) that is driving our team crazy. Please let us know if you have any debugging suggestions.

 

Observed behaviors:

 

1.       After completing a planned series of instructions, with the last instruction having 2 wheels turning equally (straight line), the robot suddenly makes an additional turn (one motor, rotating robot about 30 - 40degrees). This occurs even after deleting the program, recompiling and redownloading it, and even after adding an all motor stop block to the program. Our team is referring to this as a ghost and are convinced that the robot is now haunted, just to get us in the Halloween mood.

2.       The robot, using a two wheeled turn (one motor going forward, one going backward) intermittently turns too far or too short. Programming is being done in rotations for both motors. Because both motors are running together, I can’t tell if it is related to the problem above. This occurs about 1 in 5 runs.

 

I do not think that this is a cable issue, as we are not seeing anything beyond the usual minor navigation errors due to lineup, wrinkles in the mat, etc. That leaves the motors and the NXT itself. Could this be a bad servo motor and if so, is there any way to test them?

 

Appreciate your suggestions!

Sincerely,

Bob Henshaw


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.