Skip to content

Worked Examples

Mike Langmayr edited this page Jul 29, 2024 · 12 revisions

COMPILATION

Edit the file CMakeLists.txt. The first few lines contain user definitions, as shown below.

#
#
#
#
#
XXX.XXX.XXX Page 11 of 49
Detector Controller Server Interface 20 September
2022
----------------------------------------------------------------------------
BEGIN USER DEFINITIONS
----------------------------------------------------------------------------
user must define the interface type here
valid types are: "AstroCam" | "Archon"
set(INTERFACE_TYPE "Archon")
# If your software is not installed in the indicated directory then change this:
set(PROJECT_BASE_DIR $ENV{HOME}/Software/camera-interface)
# This prints a large number of debugging messages and may be eliminated in future releases:
#add_definitions(-DLOGLEVEL_DEBUG)

Allowable interface types are (as indicated in the file), AstroCam or Archon . As shown in the above example, this user has set the interface type to Archon. Next, indicate where your software has been installed, using the syntax:

set(PROJECT_BASE_DIR $ENV{HOME}/Software/camera-interface)

Above, this user has installed the software in the Software/camera-interface/ sub-directory in their home directory.

Do not run cmake or make from the same directory as the CMakeLists.txt file. Change to the build directory and run cmake and then make from there, as follows:

[developer@localhost ~]$ cd Software/camera-interface/build
[developer@localhost build]$ cmake ..
[developer@localhost build]$ make

The executable binary programs are located in ~/Software/camera-interface/bin and for the remaining examples in this document it will be assumed that they are in the user's path.

CONFIGURATION

Example configuration files are shown in Figure 2 where an Archon-suitable configuration file is shown at left and one for AstroCam is shown at right. The astrocam.cfg example shown at right illustrates how to define DEFAULT_FIRMWARE as an array for multiple controllers. In this example the system supports four PCI cards.

Example archon.cfg

# Example archon.cfg
#
ARCHON_IP=192.168.1.2
ARCHON_PORT=4242
DEFAULT_FIRMWARE=/home/acf/archon.acf
EXPOSE_PARAM=Expose
IMDIR=/data
BASENAME=image
NBPORT=3030
# non-blocking port
BLKPORT=3031
# blocking port
ASYNCPORT=1234
# asynchronous message port
ASYNCGROUP=239.1.1.234
LOGPATH=/home/logs

Example astrocam.cfg

# Example astrocam.cfg supports 4 controllers
#
DEFAULT_FIRMWARE=(0 /home/dsp/E2V4240/tim.lod)
DEFAULT_FIRMWARE=(1 /home/dsp/E2V4240/tim.lod)
DEFAULT_FIRMWARE=(2 /home/dsp/E2V4240/tim.lod)
DEFAULT_FIRMWARE=(3 /home/dsp/E2V4240/tim.lod)
IMDIR=/Data/E2V4240
BASENAME=image
NBPORT=4000
# non-blocking port
BLKPORT=4001
# blocking port
ASYNCPORT=2345
# asynchronous message port
ASYNCGROUP=239.1.1.234
LOGPATH=/home/E2V4240/logs

RUNNING THE SERVER

It is assumed that the detector controller server has been compiled, that the executable is named "camerad" and that it is in the user's path, and that it is run in the foreground of its own terminal.

[developer@localhost ~]$ camerad /home/user/camera.cfg
2021-07-09T23:28:29.965163 (Camera::main) this version built Jul 9 2021 16:07:03
2021-07-09T23:28:29.965187 (Camera::main) 13 lines read from /home/user/camera.cfg
2021-07-09T23:28:29.965196 (Camera::Server::configure_server) applied 4 configuration
lines to server
2021-07-09T23:28:29.965283 (Archon::Interface::configure_controller)
applied 7 configuration lines to controller

A SIMPLE CLIENT

The most simple example is taking a single exposure and saving it to a FITS file. It is assumed that the user is typing in a terminal on the host which is running the detector controller server and that the server is running in another terminal or as a daemon.

[developer@localhost ~]$ telnet localhost 3031
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
open
DONE
load
DONE
expose
DONE