XPS-Q8
Tcl Manual
7.8
Jogging
7.8.1
Configuration
Group type
Number
Group name
Positioner name
XY
1
XY
XY.X and XY.Y
7.8.2
Description
This example opens a TCP connection, kills the XY group, then initializes and homes
the group. It enables the jog mode and sets the parameters to move a positioner in the
positive direction with a velocity of 10 units/s for 1.5 seconds. Then, during the 2 next
seconds, the positioner moves in the reverse direction with a velocity of -20 units/s, and
finally stops (velocity set to 0). The jog functionality 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.8.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
Group "XY"
set
Positioner "XY.X"
set
Velocity1
10
set
Velocity2
-20
set
Acceleration
80
set
code
0
# Open TCP socket
set
code [
catch
"
OpenConnection
$TimeOut socketID"]
if
{$code !=
0
} {
puts
$telnetOut "OpenConnection failed => $code"
# Force transfer to channel’s output buffer
flush
$telnetOut
}
else
{
# Kill group
set
code [
catch
"
GroupKill
$socketID $Group"]
if
{$code !=
0
} {
DisplayErrorAndClose
$socketID $code "GroupKill" $telnetOut
return
}
# Initialize group
EDH0307En1041 — 10/17
42