tp_plus
tp_plus copied to clipboard
FANUC TP abstraction
TP+
TP+ is a higher-level language abstraction that translates into FANUC TP. It features many useful utilities that makes creating TP programs easier:
- Functions and inline functions
- Importing numerous files
- Namespacing
- Variable declaration for registers, position registers, IO, etc.
- Local variables
- Readable motion statements
- Streamlined position declaration
- Position manipulation
- Build the same program for multiple controllers through the use of environment files and imports
- Managing Register sets on controller
- Register and Postion ranges for easy declaration of blocks of registers
- Preprocessor
- Automatic label numbering
- Improved looping
- Easier managment of numerous TP files
- Can be used with the package manager Rossum
This branch was forked from the archived repo TP+
[!NEW]
- A Preprocessor ppr was added! See examples.md for details.
- Local variables can be declared! See examples.md for details.
[!INFO]
- see Features for a quick look at the features
- see examples.md for an indepth introduction to TP+
- Test example .tpp files can be found in ./examples directory of this repository
-
TP+
- Install
- Updating
- Usage
-
Features
- Pose Declarations
- Namespaces
- Functions
- Inline Functions
- Importing Files
- Local Variables
- Expressions in Arguments
- Preprocessor
- Environment Files
- Documentation
- License
Install
[!NOTE] A Standalone
.exe
can be found in https://github.com/kobbled/tp_plus/releases, where you do not have to install anything. Simply add the location where thetpp.exe
file resides onto your environmentPath
. However, with this method you will not recieve up to date changes to TP+.
- Install Ruby
- Install git
- Install bundler
gem install bundler
- Clone the repo
git clone https://github.com/kobbled/tp_plus.git
- move into tp_plus folder;
cd tp_plus
- Install dependencies with
bundle
- Build the parser and run the tests with
bundle exec rake
- Make sure all tests pass
- Add full path of ./tp_plus/bin to your environment path
set PATH=%PATH%;\path\to\tp_plus\bin
[!INFO] Alternatively there is a docker image located in the docker-container branch. However due to Roboguide and Fanuc tools being windows only, the workflow is too awkward for the standard user and is not recommended. Furthermore, the build tools vscode-tpp-extension, and Rossum currently do not have docker interoperability support.
Updating
In a command prompt, or git shell run
git fetch && git pull
rake
Usage
print output to console:
tpp filename.tpp
print output to file (must be the same filename):
tpp filename.tpp -o filename.ls
interpret using an environment file:
tpp filename.tpp -e env.tpp
include folders:
tpp filename.tpp -i ../folder1 -i ../folder2
build karel hash table from environment file. The first argument is to specify the filename (without the extension) that the hash will be written to. The second argument specifies if you also want to clear the register values on execution of the karel program.
[!WARNING] Setting to
true
will wipe the registers, position registers, and string registers from the controller
tpp filename.tpp -k 'karelFilename',false
See tpp --help
for options.
[!INFO] All of these options can be accessed through vscode using the Fanuc TP-Plus Language Extension
[!INFO] All of these options can be specified in the Rossum package manager through the
package.json
file
Features
Pose Declarations
TP+ | TP |
|
|
Namespaces
TP+ | TP |
|
|
Functions
TP+ | TP |
|
|
Inline Functions
TP+ | TP |
|
|
Importing Files
TP+ | TP |
math_imp.tpp
|
|
Local Variables
TP+ | TP |
|
|
Expressions in Arguments
TP+ | TP |
|
|
Preprocessor
With the ppr preprocessor things like conditional inclusion, file inclusion, text macros, executing internal ruby code is possible.
Below is an example of running a ruby script to output the arc motion path of a circle in TP.
TP+ | TP |
|
|
Environment Files
You can save the robot controller configuration into an environment file. This can be swiched out depending on which robot you are using, and can be used to manage the register names on the controller (see: examples.md)
#----------
#Constants
#----------
FINE := -1
CNT := 100
PI := 3.14159
#----------
#Frames
#----------
world := UFRAME[1]
frame := UFRAME[2]
tool := UTOOL[1]
#----------
#Laser IO
#----------
Laser_Enable := DO[1]
Laser_Ready := DI[2]
Laser_On := DO[3]
Laser_Power := AO[1]
#----------
# User IO
#----------
system_ready := UO[2]
Prgm_Run := UO[3]
Prgm_Pause := UO[4]
#-----------
# HMI Flags
#-----------
Hmi_Start := F[1]
Hmi_Stop := F[2]
Hmi_Laser_Enable := F[3]
Hmi_Laser_Disable := F[4]
#----------
#Program Registers
#----------
program_name := SR[1]
Alarm_Reg := R[1]
Mem_Tool_No := R[2]
Mem_Frame_No := R[3]
j := R[50]
passes := R[51]
l := R[52]
layers := R[53]
#----------
#Workstations
#----------
namespace Headstock
frame := UTOOL[2]
select := F[38]
home := PR[3]
.def Headstock_GROUP :< 2
.def Headstock_DIRECTION :< -1
end
namespace Positioner
frame := UTOOL[3]
select := F[37]
home := PR[4]
.def Positioner_GROUP :< 3
.def Positioner_DIRECTION :< 1
end
#----------
#EEF Tools
#----------
namespace Tool1
frame := UTOOL[1]
read_pin := AI[1]
interupt_pin := DI[8]
SEARCH_DIST := 10
SEARCH_SPEED := 3
end
namespace Tool2
frame := UTOOL[3]
read_pin := AI[2]
interupt_pin := DI[10]
SEARCH_DIST := 50
SEARCH_SPEED := 6
end
#----------
#LAM Parameters
#----------
namespace Lam
power := R[60]
flowrate := R[26]
speed := R[61]
strt := DO[3]
enable := DO[1]
end
# ----------
# local variables
# -----------
local := R[250..300]
local := PR[80..100]
Documentation
Build rdocs with:
rake rdoc
License
TP+ is released under the MIT License.