Screenshot of my Inkscape optical rotary encoder disc generator with the GRBC menu open

Screenshot of my Inkscape optical rotary encoder disc generator with the GRBC menu open

I added support for creating gray encoded absolute rotary encoder disks to my Inkscape extension (original post: Inkscape extension for creating optical rotary encoder discs). More specifically binary-reflected Gray code encoders!

Basically these encoders enable you to get an absolute position of your encoder disk unlike normal rotary encoders which are incremental and cannot give you an absolute angle without knowing previous movements and starting point.

With n number of tracks (and sensors) you will get 2^n number of distinguishable positions. So with say five tracks you could distinguish 2^5 = 32 different positions which would translate to an angular resolution of 11.25 degrees (360/32 = 11.25).

I will most likely add support for single-track gray encoders (Wikipedia: Single-track_Gray_code) next.

Grab the extension from GitHub (see original post for installation instructions!): GitHub: Inkscape rotary encoder disk generator

If you have any comments (or find any bugs) or wishes for additional features, please let me know!

Categories: Programming

11 Responses so far.


  1. Glen says:

    HI
    I’ve downloaded this and i can see “Optical encoders” in the extensions menu but nothing opens up beneath that when i click on it.

    it’s the same regardless of if i try it on linux or windows.
    am using Inkscape 4.8
    and on the Linux version i have ensured that python is installed
    and that full permsions are correct

    Glen

    • This was a bug in my part which is now fixed with the latest commit to GitHub. Thanks for reporting :)! Should never commit even trivial changes without testing out first…

  2. Leslie says:

    Hi,

    Thanks for this great extension!
    Is it possible to add more than 10 track? (for gray code disc… hard procedure to made modify in the code?)

    Thanks, Leslie

    • Hello Leslie! It should be a simple change, I committed the change to GitHub but did not have time to test it yet. Please report back if it is working correctly for you, thanks :)!

  3. Carlos Benjamin says:

    Hi, I followed the instructions and for some reason I am not able to see the extension on inkscape. Any hints/tips?
    -Running Ubuntu 13.04
    -Inkscape 0.48 – installed with std options.
    -copied both files (.inx and .py) to /home/[user]/.config/inkscape/extensions
    checked for any related errors on extension-errors.log under /home/[user]/.config/inkscape folder and no error related to encoder_disk_generator.
    I am new to inkscape…
    Thanks for any help.
    Carlos.

  4. lospalos says:

    Hallo,
    your tool seems to be very useful for me, but not able to get some results from it. I have got still error even when I try to input parameters from your screenshot (BRGC tab). This is the error message:

    File “encoder_disk_generator.py”, line 10
    if angle 360:
    ^
    IndentationError: expected an indented block

    I tried to sniff in py code but not very familiar with python and don’t understand context of function ‘calculatePoint’.
    Trying on inkscape 0.48.4 r9939
    Pleas help if you can.

    • Are you using the newest version from GitHub? Line 10 in the newest version should be “if angle < 0 or angle > 360:”. The error basically says that the indentation of the code is incorrect but it shouldn’t be so not totally sure whats wrong. What Python version are you using?

      • lospalos says:

        Yes I took latest version from GIT HUB but I only copied the code via clipboard, because when I saved the link it saved the code with HTML tags. I can’t find direct link for downloading the py file – not very familiar with GIT HUB.
        Could you please send me source files to my email?

      • lospalos says:

        At last I got it to work. Nice, very nice, thanks.

  5. jan says:

    Pretty cool, thx

Leave a Reply