Touchbot gesture library utilities addition
The old way of writing programs to the robot's eeprom was very
cumbersome. It required a lot of duplicated code and was almost
impossible to read as each instruction involved ~5 lines of python code,
so even simple gestures were unweildy.
Here I add a some functions to the roibot module to wraps virtually all of
the functionality required for writing programs to the eeprom in a
couple easy functions. They auto-increment line numbers and point table
entries, and retry every instruction behind the scenes. Each
instruction also raises exceptions now if they fail, so the whole script
can be wrapped in a single try: statement to stop on any failure.
To additionally offload more of the overhead a run_program.py gesture
was added. This has a run_program() function that essentially loads a
new program that you pass it into eeprom and then runs it for you
without each gesture script having to do all the setup individually.
You can also run the run_program gesture all on its own to simply
execute whatever program is currently in memory. This saves eeprom
write cycles which are limited, and is convenient when doing many
repeated runs of the same script.
basic.py has been rewritten to use the new methodology of programming
and serve as an example for future gestures. The other gestures will be
converted at a later date
TEST=From the gestures directory, run "make" to build the wrapper
scripts, then use "./basic" to make sure that it can program a new set
of instructions to the eeprom and run them. Once it has completed, run
"./run_program" to re-execute what it currently in memory without
Signed-off-by: Charlie Mooney <firstname.lastname@example.org>
Reviewed-by: Mark Koudritsky <email@example.com>
4 files changed