Tuesday, 18 January 2011

Another version...

Well, we now have v1.1 (download here)

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 --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=FILENAME
                        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
Firstly 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).

I suggest you move your arm to some sensible origin point (midway on all motors?) and then run python -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 -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.


  1. Whilst I realise you are not continuing with this project, the code you have created is still very useful.

    However, I am a newbie to Python and cannot work out from the code, what format the file needs to be for the "-f" option. Other than it needs to be in CSV.

    It would be really helpful if you could post an example file to use with the "-f" option.

    Many thanks,

    1. Alan - I've put a new post up ( which might help you.

  2. Alan, happy to help if I can. Its been a while since I looked at this but will see what I can remember when I look back at the files tonight. My gut feel is I was probably a simple file edited in leafpad (or any other notepad application). I will try to post an example later.

    I may resuscitate the project briefly at some point as my son is keen that we try to put it together with a RaspberryPi at somepoint.