Random header image... Refresh for more!

Don’t Ask Questions. Just Roll With It.

So, my code on the PC was sending “Go!, direction, angle” because the code on the NXT was expecting “Go!, direction, angle”.

Turns out that’s wrong.

Since the NXT is expecting “Go!, direction, angle”, you obviously have to have the PC send “direction, angle, Go!”.  Because that’s what makes sense.

Whatever.  It’s working now.

February 25, 2010   No Comments

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?

February 25, 2010   No Comments

This Code Doesn’t Work And Here’s Why