
19
6.2. From a Specific Environment
In the previous section the stand alone operation is shown. However, often there is a need to
integrate the detector in an existing environment.
The PILATUS3 detector can be easily integrated in any system. To do this, one has to send
commands through a socket connection to Camserver. Any client can connect to Camserver
via a socket connection, and issue plain text commands. However, only the first connection
will get full control and can execute commands. All following connections will only have read
access. The command syntax (see section 14) over the socket is identical to the syntax to be
typed directly in the Camserver window. Thus, direct typing is helpful for testing.
The reply from Camserver (acknowledgement) consists of a command index number,
followed by a space and either "OK" or "ERR", followed by another space and possibly a
message. The acknowledgement arrives after the requested action is completed, typically in
1-2 ms; some commands, such as trimming commands (e.g. SetCu), take longer, especially
for a big detector. All acknowledgements end in 0x18 (ASCII 'CAN') without a newline; there
may be internal newlines in long messages.
Since there is no terminating linefeed, MS Windows sockets must be opened in binary mode;
this is not a consideration for UNIX-like systems.
Because of the socket connection protocol, the camera hardware and server can reside on a
different machine from the high level controller.
Camserver implements a token mechanism to prevent more than one outside process from
having control over the hardware. The Camserver window has full control at all times.
There is a debug facility to help with setting up the interface. If you type "dbglvl 5", the file
'camdbg.out' will contain many messages, including the exact contents of socket messages.
Be sure to set "dbglvl 1" (the default) before doing real work, else 'camdbg.out' can grow
without limit. If there are difficult problems with the detector, a run with "dbglvl 6" reproducing
the error can be helpful for diagnosis. Simply capture 'camdbg.out' and send it including a
description of the issue to DECTRIS Ltd support.
The Camserver program of the PILATUS3 detector provides a simple to use interface for
either EPICS or SPEC. Several clients for these protocols have been written at the Swiss
Light Source (SLS) at the Paul Scherrer Institute (PSI) and by Mark Rivers of the University of
Chicago:
http://cars.uchicago.edu/software/epics/areaDetector.html
6.2.1. Steps to Bring Up a PILATUS3 Detector in a New Environment
1. If needed, change the hostname to be compatible with the local network.
2. Set up the detector on the network, if needed. Note that the detector does not require
an external network.
3. Configure Camserver, and the client TVX, as needed. Probably the defaults will be
adequate, but many parameters can be adjusted in "camrc", and "tvxrc", both of which
reside in the $HOME/p2_det directory.
4. Start the detector by ./runtvx in the $HOME/p2_det directory.
5. If you are using your own client (see section 6.2.2) for Camserver (e.g., SPEC or
EPICS) disconnect TVX (type “disconnect” in TVX). This can be done automatically
in the startup script after the test images are shown. Connect your client and begin
issuing commands (see section 14).
6. Alternatively it also possible to start only Camserver with the command ./camonly in
the $HOME/p2_det directory.