Touchbot: Fix the imports in the gesture scripts

Previously, when you ran the robot examples and gesture scripts,
python would throw errors about not being able to find modules, etc.
You would have to modify every one to get it to run and change your
environment variable PYTHONPATH.  There was a script already in place
that was trying to get around this "acmescript.sh" but it didn't really
work quite right.  This patch fixes these, so now you can actually run
the example code/gestures.  Additionally, this makes adapting them into
other more useful scripts far easier.  To further simplify the process,
the "examples" and the "gestures" directories have been merged.  They
both used the same acmescript.sh and Makefile and did essentially the
same thing, so instead of fixing each individually, I just merged them
into a single "gestures" directory.

Additionally, now that the libraries are actually getting imported
correctly, a compilation error in program.py was uncovered.  This patch
fixes an indentation error in there too.

BUG=chromium-os:34809
TEST=Connect to robot.  From the platform/touchbot/gestures directory,
run "make" which should make a shell script wrapper for the python
scripts in the folder.  Then run "basic" (one of these generated
scripts) and it should run without error, and the robot should actually
respond, etc.

Change-Id: I98932db8c10996ae6ac36c6b4dc3825bb25d0762
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/34345
Reviewed-by: Mark Koudritsky <kamrik@chromium.org>
diff --git a/examples/Makefile b/examples/Makefile
deleted file mode 100644
index 63e948f..0000000
--- a/examples/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# Simple Makefile to create shell scripts wrappers for python scripts to
-# automatically set PYTHONPATH without needing to install the roibot
-# python support module for the touchbot
-#
-TARGET_FILES := $(patsubst %.py,%,$(wildcard *.py))
-ACMESCRIPT=acmescript.sh
-
-
-all: $(ACMESCRIPT) $(TARGET_FILES)
-
-$(TARGET_FILES):
-	@(for i in $(TARGET_FILES) ; do \
-		echo "Creating $$i ..."; \
-		ln -s $(ACMESCRIPT) $$i; \
-	  done)
-	  @echo "Done."
-
-clean:
-	@(for i in $(TARGET_FILES) ; do \
-		echo "Cleaning wrapper script $$i ..."; \
-		rm -f $$i; \
-	  done)
-	  @echo "Done."
diff --git a/examples/acmescript.sh b/examples/acmescript.sh
deleted file mode 100755
index 8d024e8..0000000
--- a/examples/acmescript.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#/bin/sh
-#
-# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# acmescript.sh
-#
-# This is a script file to hack the PYTHONPATH variable to include the
-# roibot module path.  It depends on the binary being executed out of
-# the examples directory, but it does not depend on this specifically
-# being an absolute or relative path.  It is also insensitive to the
-# paths containing spaces, for you Mac users.
-#
-# This depends on your python being insensitive to trailing :'s in the
-# PYTHONPATH, if it has not been previously set (this has been tested
-# with all current versions of python in use in Chrome OS).
-#
-# The name is an omage to "ACME" in Looney Tunes cartoons, which stood
-# for "[the] American Company [that] Makes Everthing", which is where
-# Wile E. Coyote obtained his devices.
-#
-BASEDIR=`dirname $0`
-BASENAME=`basename $0`
-PYTHONNAME="${BASENAME}.py"
-PYTHONPATH="${BASEDIR}/../roibot":"${PYTHONPATH}"
-
-python "${PYTHONNAME}"
diff --git a/examples/rocontrol.py b/examples/rocontrol.py
deleted file mode 100644
index d40d082..0000000
--- a/examples/rocontrol.py
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-import sys
-
-import roibot
-
-# Open the robot interface.
-robot = roibot.ROIbot(sys.argv[1])
-
-# If the robot doesn't respond in 2 seconds to a command, then something
-# is wrong.
-robot.timeout = 2
-
-#
-# Perform an operation on the robot
-#
-try:
-    print roibot.error.statusReport(robot)
-    line = robot.sendCommand("SYSP")
-    print line
-
-    if not robot.modeHostON():
-        print "Failed to set host mode"
-    else:
-        print "Host mode enabled"
-except roibot.roibot.ROIbotTimeoutException:
-    print "timed out!"
-
-robot.timeout = None
-robot.close()
diff --git a/gestures/acmescript.sh b/gestures/acmescript.sh
index 8d024e8..fed8347 100755
--- a/gestures/acmescript.sh
+++ b/gestures/acmescript.sh
@@ -23,6 +23,6 @@
 BASEDIR=`dirname $0`
 BASENAME=`basename $0`
 PYTHONNAME="${BASENAME}.py"
-PYTHONPATH="${BASEDIR}/../roibot":"${PYTHONPATH}"
+export PYTHONPATH="${BASEDIR}/..":"${PYTHONPATH}"
 
 python "${PYTHONNAME}"
diff --git a/examples/basic.py b/gestures/basic.py
similarity index 100%
rename from examples/basic.py
rename to gestures/basic.py
diff --git a/roibot/program.py b/roibot/program.py
index b4459ec..58026fb 100644
--- a/roibot/program.py
+++ b/roibot/program.py
@@ -221,10 +221,10 @@
     return ("CWIT", "CN%02d%s" % (counterNumber, operator), "%04d" % value)
 
 def end():
-     """Return the program step counter to step 0001 and wait for another
-        START input.  When multitasking, and the end occurs in tasks 2
-        through 4, the task returns to step 0001 and waits for another
-        taskStart().
+    """Return the program step counter to step 0001 and wait for another
+       START input.  When multitasking, and the end occurs in tasks 2
+       through 4, the task returns to step 0001 and waits for another
+       taskStart().
     """
     return ("END")