As predicted this introduces a number of new features which I will discuss in more detail in separate posts over the next day or two. The help screen (python arm_1_1.py --help) will provide general guidance for anyone itching to get going!
I've tidied up a few bits of the code into separate functions which I'll write about in coming days in case anyone wished to call them from their own code.
There is still very little error/exception handling built in so be aware that this may crash the program unexpectedly! You should also beware that there is nothing to stop you running the motor continuously at the limit of its range and screwing up the gearbox. I'm toying with the idea of adding some "safety checks" to prevent this - would that be useful or too restrictive?
Tip: if you do end up with the motor running continuously and need it to stop then simply run the program with no command line switches.
The key new features are:
-f FILENAME, --file=FILENAMEFirstly these options are all mutually exclusive, and applied in the priority order given above, using any of these options also ignores any of the individual motor controls (i.e. if -f somefile.txt is used, it will ignore any other options).
path/name of a file describing a sequence arm
-o, --origin Restore arm to the 'origin' position
-z, --zero Zero all values in resetarm file' position
I suggest you move your arm to some sensible origin point (midway on all motors?) and then run python arm_1_1.py -z to define this position as "zero". Now when you run commands (with the s,e,w,g,r, and f options) the program will store the movement details, and this can then be reversed by running python arm_1_1.py -o to bring the arm back to this start point. Beware if you get the dreaded "click click click of the motor going 'too far' the software is unaware of this and will "overshoot" on returning to origin.
The -f option calls a file with comma separated values listed as values of 0,1,2 for shoulder, elbow, wrist, grip, rotate, light and a floating point value for time. Multiple lines may be included. All parameters must be present and must be in the correct order.
EDIT: NOTE: Please read this post too - you will also need this file.