Random header image... Refresh for more!

And right into the next bug…

So, I fix the bug with the waiting and I realize there’s another bug close behind.  It’s now properly waiting for the action to complete, the trouble is that the action is the last action I told it to do.  In other words, I start it up and tell it to rotate 10 degrees and it does nothing.  Then I tell it to rotate 360 degrees and it goes 10.  Then I tell it to go 180 and it goes 360.

The NXT program is supposed to wait for a “Go!” signal, then read two packets from the same mailbox for values to pass to the motor.  The mailbox is a queue, so if it’s reading the Go! signal, then racing to the motor command before the other two messages arrive, then the mailbox should be out of sync for the next Go! signal.

But that’s the scenario that makes the most sense here.  It gets a “Go!” then goes straight to the motor before the next two packets arrive.  So it reads zero and does nothing.  Then the next Go! code comes in.  By then, the values have been written from the first request, so they’re what gets sent to the motor.  But that would make it out of sync.  The second Go! code would be reading a boolean, then there’d be a number where a bool should be, and finally, the bit that should have a number will get the string “Go!”.

So…  WTF?

0 comments

There are no comments yet...

Kick things off by filling out the form below.

Leave a Comment