{"id":1054,"date":"2010-02-25T22:40:52","date_gmt":"2010-02-26T06:40:52","guid":{"rendered":"https:\/\/mathpirate.net\/log\/?p=1054"},"modified":"2010-02-25T22:40:52","modified_gmt":"2010-02-26T06:40:52","slug":"and-right-into-the-next-bug","status":"publish","type":"post","link":"https:\/\/mathpirate.net\/log\/2010\/02\/25\/and-right-into-the-next-bug\/","title":{"rendered":"And right into the next bug&#8230;"},"content":{"rendered":"<p>So, I fix the bug with the waiting and I realize there&#8217;s another bug close behind.\u00c2\u00a0 It&#8217;s now properly waiting for the action to complete, the trouble is that the action is the last action I told it to do.\u00c2\u00a0 In other words, I start it up and tell it to rotate 10 degrees and it does nothing.\u00c2\u00a0 Then I tell it to rotate 360 degrees and it goes 10.\u00c2\u00a0 Then I tell it to go 180 and it goes 360.<\/p>\n<p>The NXT program is supposed to wait for a &#8220;Go!&#8221; signal, then read two packets from the same mailbox for values to pass to the motor.\u00c2\u00a0 The mailbox is a queue, so if it&#8217;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.<\/p>\n<p>But that&#8217;s the scenario that makes the most sense here.\u00c2\u00a0 It gets a &#8220;Go!&#8221; then goes straight to the motor before the next two packets arrive.\u00c2\u00a0 So it reads zero and does nothing.\u00c2\u00a0 Then the next Go! code comes in.\u00c2\u00a0 By then, the values have been written from the first request, so they&#8217;re what gets sent to the motor.\u00c2\u00a0 But that would make it out of sync.\u00c2\u00a0 The\u00c2\u00a0second Go! code would be reading a boolean, then there&#8217;d be a number where a bool should be, and finally, the bit that should have a number will get the string &#8220;Go!&#8221;.<\/p>\n<p>So&#8230;\u00c2\u00a0 WTF?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, I fix the bug with the waiting and I realize there&#8217;s another bug close behind.\u00c2\u00a0 It&#8217;s now properly waiting for the action to complete, the trouble is that the action is the last action I told it to do.\u00c2\u00a0 In other words, I start it up and tell it to rotate 10 degrees and [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[125,7],"tags":[109,15,14,20,237,26],"_links":{"self":[{"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/posts\/1054"}],"collection":[{"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/comments?post=1054"}],"version-history":[{"count":2,"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/posts\/1054\/revisions"}],"predecessor-version":[{"id":1056,"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/posts\/1054\/revisions\/1056"}],"wp:attachment":[{"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/media?parent=1054"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/categories?post=1054"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/tags?post=1054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}