/* LICENSE: */ This is the code to create decision trees so the robot can detect that it's hung up on a wall. You will need C4.5 R8. Download it, expand the tarball, and replace Src/trees.c with the hacked version from cmu_only (we can't redistributed C4.5 source code, so make sure this doesn't end up in a release) The hack simplifies the way C4.5 prints textual representations of trees and makes it easier for our crappy parser to understand them. An example of the output can be found in sparse.tree.txt - it's easy to hack C4.5 to produce this output - get rid of everything except variables, <=, >, and values. Also make sure C4.5 doesn't print out subtrees separately - you want one monolithic tree (change the width limit at the top of the file). Directions: Gather gsensor data for the robot standing in place, the robot running into a wall, the robot hooked on another robot, and the robot playing freely. Process the logs to get text files. Name them the same things the four files at the top of the Octave .m file are named. Run process_spare.m in Octave. Run build_data.sh playing.txt, wall.txt, hooked.txt, and standing.txt should now be labeled data files that C4.5 will accept. Divide this into data and test sets as you see fit. (I like using head and tail to break them into two chunks) Run the modified version of C4.5 and save the text output to a file. sparse.names has been provided. Edit the text output of C4.5 so that it only contains the pruned decision tree. Run: parse_tree copy out.bintree to /MS/config/stree.prm