Simulating TP Programs in the Browser with tp.js

Filed under: FANUC TP Programming tp.js

Last week I wrote about Testing TP Programs with Ruby, but you had to trust that I wasn’t just making things up. Over the past few days I’ve ported most of my work into a JavaScript library so you can actually see TP programs running directly in your web browser.

Let’s cut to the chase and do an example. I’ve written a simple TP program below that performs a few basic functions like numeric register assignment, conditional evaluation, jumping to a label and linear motion. Next to the program, I’ve created a simple debugger which gives you some insight into how the program is running and what’s happening to the numeric register.

Click the Run button below to start the program. You can also Pause the program and Step through it one line at a time. Keep an eye on the debugger to the right where the controller is telling you what it’s doing in detail. (Note: the current line is highlighted in the source code)

Program Source Code Debug Log

    R[1] = 0

    
        

    I think there’s a lot of potential in this library. JavaScript is a pretty universal platform that almost every modern device supports. It certainly has it’s limitations, but the accessibility makes a very strong case for its use.

    In future articles about TP programming, I will embed controller runtimes like this one so you can actually modify and execute the code to see what it’s doing. Look out for something similar on KAREL in the future too.


    There's more where that came from.

    I email (almost) every Tuesday with the latest insights, tools and techniques for programming FANUC robots. Drop your email in the box below, and I'll send new articles straight to your inbox!

    No spam, just robot programming. Unsubscribe any time. No hard feelings!