7.7.2 Description
This example opens a TCP connection, kills the Singles Axis group and the XY group.
The program then initializes and homes the groups. It sets the parameters for the master
slave mode (slave: single axis group, master: X positioner from XY group). Then, it
enables the master slave mode and executes a relative move of 20 units with the master
positioner. At the same time, the slave positioner executes the same move as the master.
The master slave mode is then disabled and the program ends by closing the socket.
Please see the sections:
4 Principle of a Tcl script redirection to a telnet session.
6 Proposed function for error handling.
7.7.3 TCL Code
# Set channel’s name to be used for telnet.
# In this example we assume it is passed to the script as the
# first argument, if not specified output to stdio.
# Open the channel for read mode and get its id,
# this is the id that will be passed to puts function.
if {$tcl_argv(0) != 0} {
set telnetOut [ open "/dev/$tcl_argv(0)" r+]
} else {
set telnetOut stdout
}
# Initialization
set TimeOut 60
set SlaveGroup "SINGLE_AXIS"
set XYGroup "XY"
set MasterPositioner "XY.X"
set MasterRatio 1
set code 0
set Displacement 20
# Open TCP socket
set code [catch "OpenConnection $TimeOut socketID"]
if {$code != 0} {
puts stdout "OpenConnection failed => $code"
} else {
# Kill single axis group
set code [catch "GroupKill $socketID $SlaveGroup"]
if {$code != 0} {
DisplayErrorAndClose $socketID $code "Single axis GroupKill"
EDH0307En1041 — 10/17
39