SyntaxHighlighter

Monday 19 August 2013

Day 46: Bugs

Donald fixed, the future of debugging

Got ethernet on Donald working again, and went on a wild goose chase trying to find the right drivers for this annoying unmarked WiFi card. Finally found them, WiFi works, all good to go.

Back to AR, upon every model acquisition there was some code that read in the marker nodes referenced by the config.txt file and assigned them to the model. Previously this code had been repeated at the start of every demo add method which was the cause of a lot of redundancy. I moved all the code into one place a single array that iterated and did everything in a choice few non-repeated lines. It is all done during the marker tracking initialization method. Unfortunately since doing this, none of the models are showing up on the markers when the demo is run. So today I set about fixing it.

This is a great example of how easy it is to debug when you have two machines that can run the same code. I had the older working code debugging on Walter and the new broken code debugging on Donald alongside. It allowed me to compare variables directly, observe what differences in execution my code changes made, and various other stuff. I'm somewhat surprised that debuggers do not offer this functionality actually (or maybe they do but I just haven't found it), of debugging through two code versions simultaneously. Was immensely useful to me!

So first off for the new working code on Walter, in debug mode I checked out the complete MarkerNode's that were being added to the scene graph after the code completed. I then checked the same variables on Donald debugging the non working code, comparing them to check for differences.

And the answer was immediately clear, my new code was resulting in two variables remaining null: MarkerNode.markerConfigs and MarkerNode.MarkerID

Whereas with the working version these variables were set as follows:
markerConfigs = { [object 2] }
MarkerID = "AlvarConfig6.txt"

Or if the marker node was a single marker and not a marker array then:
markerConfigs = { [object 1] }
MarkerID = 86

And after some step-through action, I discovered that in the new code my scene.MarkerTracker was null whilst the markers were being assigned to it. Oops. A quick rearrangement of code, and all now works perfectly.

Rearranged and organised markers in a sensible order, adding them to the arrays in a natural manner.

Fixed some bugs, for some reason ship flying through fire demo wasn't showing, I realised I had a firePlacer that was being disabled at odd times not too sure why. Removed the code now it works.


Continuing coding sound. Going well.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.