Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .github/workflows/cmake-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:
DETECTOR_TYPE_HXRG: Hxrg

jobs:
Archon:
Archon-build:
runs-on: ubuntu-latest

steps:
Expand All @@ -25,20 +25,24 @@ jobs:
.github/workflows/install-deps.sh
shell: bash

- name: Configure CMake Archon
- name: Configure CMake for Archon Interface
run: |
cd ${{github.workspace}}/build
rm -rf *
g++ --version
cmake -DINTERFACE_TYPE=${{env.INTERFACE_TYPE_ARCHON}} -DDETECTOR_TYPE=${{env.DETECTOR_TYPE_HXRG}} ..


- name: Build Archon
# Build your program with the given configuration
- name: Build
run: |
cd ${{github.workspace}}/build
make

- name: Run Unit Tests
run: |
cd ${{github.workspace}}
bin/run_unit_tests

- name: Start Emulator
run: |
cd ${{github.workspace}}
Expand All @@ -49,7 +53,7 @@ jobs:
cd ${{github.workspace}}
bin/camerad Config/demo/demo.cfg --foreground &

- name: Run test commands
- name: Run E2E tests
run: |
cd ${{github.workspace}}
shopt -s expand_aliases
Expand All @@ -72,7 +76,7 @@ jobs:
check $command_printstatus

# Comment AstroCam out for now
# build-astrocam:
# AstroCam-build:
# runs-on: ubuntu-20.04

# steps:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/install-deps.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
sudo apt-get update &&
sudo apt-get install libccfits-dev &&
sudo apt-get install libcfitsio-dev &&
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libcurl4-openssl-dev &&
sudo apt-get install libgtest-dev
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ add_subdirectory( ${PROJECT_BASE_DIR}/utils )
add_subdirectory( ${PROJECT_BASE_DIR}/common )
add_subdirectory( ${PROJECT_BASE_DIR}/camerad )
add_subdirectory( ${PROJECT_BASE_DIR}/emulator )
add_subdirectory( ${PROJECT_BASE_DIR}/tests )
97 changes: 58 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,80 @@
# camera-interface
# Camera Interface

Camera Detector Controller Interface Software

## Requirements:
## Reporting Issues

- Cmake 3.12 or higher
- cfitsio and CCFits libraries (expected in /usr/local/lib)
If you encounter any problems or have questions about this project, please open an issue on the [GitHub Issues page](https://github.com/CaltechOpticalObservatories/camera-interface/issues). Your feedback helps us improve the project!

## Requirements

| Archon controllers | ARC controllers |
| -----------------------| ----------------|
| g++ 8.1 or higher (and c++17) | g++ 8.3 (and c++17) |
| | ARC API 3.6 and Arc66PCIe driver |
- **CMake** 3.12 or higher
- **cfitsio** and **CCFits** libraries (expected in `/usr/local/lib`)

### Controller Compatibility

## Build instructions:
| Archon Controllers | ARC Controllers |
|------------------------------------|----------------------------------------------|
| `g++ 8.1` or higher (and C++17) | `g++ 8.3` (and C++17) |
| | ARC API 3.6 and Arc66PCIe driver |

- change to the build directory
## Build Instructions

- To start with a clean build, delete the contents of the build
directory, including the subdirectory CMakeFiles/,
but not the `.gitignore file`. For example:
1. **Change to the build directory:**

```
% cd build
% rm -Rf *
```
```bash
$ cd build
```

- create the Makefile by running cmake (from the build directory),
2. **Start with a clean build:** Delete the contents of the build directory, including the `CMakeFiles/` subdirectory, but **not** the `.gitignore` file.

| Archon | ARC |
|------------------------------|--------------------------------------------------------|
| `$ cmake -DINSTR=generic ..` | `$ cmake -DINSTR=generic -DINTERFACE_TYPE=AstroCam ..` |
```bash
$ rm -Rf *
```

3. **Create the Makefile by running CMake** (from the build directory):

- compile the sources,
| Archon | ARC |
|------------------------|----------------------------------|
| `$ cmake ..` | `$ cmake -DINTERFACE_TYPE=AstroCam ..` |

```
$ make
```
4. **Compile the sources:**

- run the program using one of these forms,
```bash
$ make
```

```
$ ../bin/camerad <file.cfg>
$ ../bin/camerad -f <file.cfg>
$ ../bin/camerad -d -f <file.cfg>
```
5. **Run the Camera Server:**

where <file.cfg> is an appropriate configuration file. See the example .cfg files
in the Config directory of this distribution. Note that the -f option specifies
a config file and the -d option forces it to run as a daemon, overriding any
DAEMON=no setting in the configuration file.
- **As a foreground process:**

- Note that only when INTERFACE_TYPE is set to Archon will the emulator software
be compiled.
```bash
$ ../bin/camerad <file.cfg> --foreground
```

---
- **As a daemon:**

```bash
$ ../bin/camerad -d <file.cfg>
```

*Replace `<file.cfg>` with an appropriate configuration file. See the example `.cfg` files in the `Config` and `Config/demo` directories.*

6. **(Optional) Run the Archon Emulator:**

David Hale <dhale@astro.caltech.edu>
```bash
$ ../bin/emulator <file.cfg>
```

*Note: The emulator software will only be compiled when `INTERFACE_TYPE` is set to Archon (default).*

7. **(Optional) Run Unit Tests:**

```bash
$ ../bin/run_unit_tests
```

---

David Hale
<dhale@astro.caltech.edu>
14 changes: 14 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.12)

set(PROJECT_TESTS_DIR ${PROJECT_BASE_DIR}/tests)

# Find the Google Test library
find_package(GTest REQUIRED)

add_executable(run_unit_tests utility_tests.cpp) # List all unit test source files here

# Link the Google Test library
target_link_libraries(run_unit_tests
${GTEST_LIBRARIES}
utilities
)
12 changes: 12 additions & 0 deletions tests/utility_tests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "gtest/gtest.h"
#include "../utils/utilities.h"

TEST(UtilitiesTest, TimeStampNotLocalTest) {
struct timespec timezero{};
EXPECT_EQ(timestamp_from("GMT", timezero), "1970-01-01T00:00:00.000000");
}

int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}