Introducing TP+

Filed under: TP+

TP+ is a slightly higher-level language that translates into valid FANUC TP code. Its goal is to make programming FANUC robots easier. TP+ includes a number of features from newer programming languages that TP does not support.

Features

  • Variables for registers, I/O, etc.
  • Automatic label numbering
  • IF-ELSE blocks
  • Improved readability
  • Less stringent syntax
  • Syntax sugar

Demo

You can try out TP+ here: TP+ Demo

Example code:

Paste this code into the demo and see how it’s translated into TP.


  # example
  # this is a comment

  # variable definitions
  foo       := R[1]
  tb_val    := R[2]
  another   := R[3]
  cnt_val   := R[4]
  bar       := DO[1]
  home      := PR[1]
  my_offset := PR[2]

  # variable assignment
  foo = 1
  foo = foo + 1

  # increment/decrement shortcuts
  foo += 1
  foo -= 1
  foo += another

  # label definitions
  # notice automatic label numbering
  @foo
  @bar

  # jump to labels
  jump_to @foo

  # if statements
  # notice automatic mixed logic if possible
  if foo==1
    foo=2
  end

  if foo==1
    # this one cannot be done with mixed logic
    # because it has multiple lines inside
    # the block
    turn_on bar
  end

  # if-else statements
  if foo==1
    foo=2
  else
    foo=3
  end

  # unless statements
  unless foo==1
    foo=0
  end

  # io readability
  turn_on bar
  turn_off bar
  toggle bar

  # inline conditionals
  turn_on bar if foo < 10
  jump_to @bar unless foo == 3

  # program calls
  my_program()
  my_program(1,2,3)
  my_program(foo)

  # motion readability
  linear_move.to(home).at(2000mm/s).term(0)
  # separate motion options onto multiple lines
  linear_move.
    to(home).
    at(max_speed).
    term(cnt_val).
    offset(my_offset).
    time_before(tb_val, open_gripper())

Motivation

TP+ is heavily inspired by the Ruby programming language. It’s simple, readable and therefore easy to understand. You shouldn’t have to worry about getting your capitalization, spacing or semi-colons right; let TP+ take care of all that for you.

Under Construction

TP+ is still in the very early alpha stage of development. I’ll put up a separate mini-site for it eventually. Stay tuned for updates.

For now please try it out and let me know what you think!


Want posts like this delivered right to your inbox?

If you liked this post, please sign up for my mailing list!