Hardware Reference
In-Depth Information
Save your program. Double check that all your indentation is correct before you run it.
Now run up to a tree and hug it (stand as close as you can to its trunk), and run your
scan3D.py program. What happens?
Did anything happen at all? Remember that this program scans an object to a CSV file,
so you have to look at the CSV file tree.csv to see what numbers have been stored in
it. Open the file tree.csv by choosing File Open from the editor window. Figure 6-6
shows a section of the tree.csv file that I captured after hugging a tree on my com-
puter! Because the scanning space is quite small, you might regularly only get half a
tree scanned, but you can always change the SIZE constants to scan a bigger area.
FIGURE.6-6 Contents of CSV file after hugging and scanning a tree
Remember that the direction that your player is facing is not necessarily the
direction that is scanned, so make sure you look around the area. The 3D scanner
will scan from where your player is standing, through increasing values in
coordinates. So, if you are standing at 0,0,0, the 3D scanner will scan from there
through to coordinates that are larger such as 4,4,4. Look back at the diagram
in Adventure  2 where you first learnt about coordinates to understand which
direction each part of the coordinate represents.
IDLE normally only shows files that end in the .py extension in its Open and
Save windows, but you can see your .csv files by choosing Files of Type All
Files.
Search WWH ::




Custom Search