Styleguide for programming

  • Hey all,


    Over the time I have created my own styleguides to get my projects standardized as good as possible. These docs describes for example the naming conventions for programs, variables or signals, etc. and many more information. Let's make an example for a digital input:


    diDoorLockedSt1


    di/do + functional description + station/fixture


    I wonder if you also have your own naming conventions, standards, etc. and how it looks.

  • AD
  • Hello,


    Can you show me your example (If it possible)? Or tell please the sources on which you search the information.

    I also look for information to create my own standard, but so far I have little experience with robots.

  • This will probably vary some between robot brands -- you can't name variables in Fanuc TP language, for example.


    This is the header from my main library of KUKA KRL functions that I wrote years ago:


    ; Variables are named using "Upper Camel Case" aka "Pascal Case"

    ; First letter of variable name (ignoring prefix) is capitalized, also

    ;each 'part' of the variable name: MyVariableName

    ;

    ; Prefixing:

    ; _xVariableName for "local" variables with scope limited to subroutine/function

    ; .DAT file variables (module or GLOBAL scope) have no _ prefix

    ; Arguments receives by subroutine/functions have special pre-prefixes:

    ; FO_ for :OUT arguments (pass by reference)

    ; FI_ for :IN arguments (pass by value)

    ;

    ; "Routine" scope variables (DECL'd inside a subroutine or function) begin with _ like so:

    ; DECL INT _nIndex

    ;

    ; For xVariableName, _xVariableName, FI_xVariableName, or FO_xVariableName "x" is:

    ; e=E6POS, f=FRAME, p=POS, r=REAL, n=INT, ch=CHAR, a=E6AXIS, b=BOOL

    ;

    ; Variables with no 'x' prefix are unique variable types, usually ENUM or STRUC

    ;

    ; KRL System Variables and/or System Calls are FULLY CAPITALIZED

  • i mostly work with KUKA and while KRL is quite flexible it has some limitations too such as max 24 characters for names. so sometimes using descriptive name can be a problem. one workaround is to make some custom format and place list of abbreviations in one of the files for a reference. KRL already uses some such as $ prefix indicates system variable, _ACT suffix indicates actual (current) value etc. another option is using structures where possible, then element names are added to a parent variable name through dot separator, example xHOME.A1 or $POS_ACT.X or $AXIS)ACT.E1 or


    IF CNC1.OperatorDoor.IsClosed THEN ...

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now