7.4.2 Description
This example opens a TCP connection, kills the single axis group, then initializes and
homes the group. The program then configures the parameters for the gathering (data to
be collected: setpoint and current position). It then defines an action (GatheringRun) to
an event (SGamma.MotionStart). When the positioner moves from 0 to 50, the data is
gathered (with a divisor equal to 100, data is collected every 100
th
servo cycle, or every
10 ms). At the end, the gathering is stopped and saved in a text file (Gathering.dat in
Admin/Public directory of the controller). Finally, the program ends by closing the
socket.
Please see sections:
4 Principle of a Tcl script redirection to a telnet session.
6 Proposed function for error handling.
7.4.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 "SINGLE_AXIS"
set Positioner "SINGLE_AXIS.MY_STAGE"
set Type1 "SINGLE_AXIS.MY_STAGE.SetpointPosition"
set Type2 "SINGLE_AXIS.MY_STAGE.CurrentPosition"
set Event "SGamma.MotionStart"
set Action "GatheringRun"
EDH0307En1041 — 10/17
31