-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
72 changed files
with
5,329 additions
and
1,416 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ on: | |
- '.flake8' | ||
- '.pre-commit-config.yaml' | ||
- '.readthedocs.yaml' | ||
- '.github/dependabot.yml' | ||
workflow_call: | ||
|
||
jobs: | ||
|
@@ -18,7 +19,7 @@ jobs: | |
|
||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/[email protected].0 | ||
uses: styfle/[email protected].1 | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
|
@@ -27,7 +28,7 @@ jobs: | |
sudo apt-get install -y socat | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v4 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.8 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-ast | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
rev: 5.13.2 | ||
hooks: | ||
- id: isort | ||
name: isort (python) | ||
- repo: https://github.com/hhatto/autopep8 | ||
rev: v2.0.4 | ||
rev: v2.1.0 | ||
hooks: | ||
- id: autopep8 | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 6.1.0 | ||
rev: 7.0.0 | ||
hooks: | ||
- id: flake8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM simonsobs/sodetlib:v0.5.2 | ||
FROM simonsobs/sodetlib:v0.5.2-20-gdd529b5 | ||
|
||
ENV OCS_CONFIG_DIR /config | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
.. highlight:: rst | ||
|
||
.. _acti_camera: | ||
|
||
==================== | ||
ACTi Camera Agent | ||
==================== | ||
|
||
The ACTi Camera Agent is an OCS Agent which grabs screenshots from ACTi cameras | ||
and saves files to a directory. | ||
|
||
.. argparse:: | ||
:filename: ../socs/agents/acti_camera/agent.py | ||
:func: add_agent_args | ||
:prog: python3 agent.py | ||
|
||
Configuration File Examples | ||
--------------------------- | ||
|
||
Below are configuration examples for the ocs config file and for running the | ||
Agent in a docker container. | ||
|
||
OCS Site Config | ||
``````````````` | ||
|
||
To configure the ACTi Camera Agent we need to add a ACTiCameraAgent | ||
block to our ocs configuration file. Here is an example configuration block | ||
using all of the available arguments:: | ||
|
||
{'agent-class': 'ACTiCameraAgent', | ||
'instance-id': 'cameras', | ||
'arguments': [['--mode', 'acq'], | ||
['--camera-addresses', ['10.10.10.41', '10.10.10.42', '10.10.10.43']], | ||
['--locations', ['location1', 'location2', 'location3']], | ||
['--resolutions', ['N640x480,100', 'N640x480,100', 'N640x480,100']], | ||
['--user', 'admin'], | ||
['--password', 'password']]}, | ||
|
||
.. note:: | ||
The ``--camera-addresses`` argument should be a list of the IP addresses | ||
of the cameras on the network. | ||
The ``--locations`` argument should be a list of names for camera locations. | ||
This should be in the same order as the list of IP addresses. | ||
The ``--resolutions`` argument should be a list of resolutions for each camera. | ||
For example, ``N640x480,100`` gives a 640x480 image with 100% quality. | ||
|
||
Docker Compose | ||
`````````````` | ||
|
||
The iBootbar Agent should be configured to run in a Docker container. An | ||
example docker-compose service configuration is shown here:: | ||
|
||
ocs-cameras: | ||
image: simonsobs/socs:latest | ||
hostname: ocs-docker | ||
environment: | ||
- INSTANCE_ID=cameras | ||
- SITE_HUB=ws://127.0.0.1:8001/ws | ||
- SITE_HTTP=http://127.0.0.1:8001/call | ||
- LOGLEVEL=info | ||
volumes: | ||
- ${OCS_CONFIG_DIR}:/config:ro | ||
- /mnt/nfs/data/cameras:/screenshots | ||
user: 9000:9000 | ||
|
||
The ``LOGLEVEL`` environment variable can be used to set the log level for | ||
debugging. The default level is "info". | ||
The volume must mount to ``/screenshots``. The user must have permissions to write | ||
to the mounted local directory. | ||
|
||
Description | ||
----------- | ||
|
||
The ACTi cameras will be used to monitor conditions at the SO site. | ||
The ACTi Camera Agent periodically (1 minute) grabs screenshots from each | ||
camera on the network. The images are saved to a location on disk. A webserver | ||
should then be configured to serve this directory to some URL. Then we can use | ||
HTML to access the webserver and display ``latest.jpg`` for an up-to-date | ||
view of the camera. For example, this can be done directly in Grafana | ||
using the Text panel in HTML mode. | ||
|
||
Agent API | ||
--------- | ||
|
||
.. autoclass:: socs.agents.acti_camera.agent.ACTiCameraAgent | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
.. highlight:: rst | ||
|
||
.. _Hi6200: | ||
|
||
============== | ||
Hi6200 Agent | ||
============== | ||
|
||
This agent uses Modbus TCP to communicate with the Hi6200 Weight Sensor. | ||
This agent uses ModbusClient from pyModbusTCP to facilitate the communication. | ||
The agent is able to communicate over ethernet to read and monitor the net and | ||
gross weights of the scale. | ||
|
||
.. argparse:: | ||
:filename: ../socs/agents/hi6200/agent.py | ||
:func: make_parser | ||
:prog: python3 agent.py | ||
|
||
|
||
Configuration File Examples | ||
--------------------------- | ||
Below are configuration examples for the ocs config file and for running the | ||
Agent in a docker container. | ||
|
||
OCS Site Config | ||
``````````````` | ||
|
||
To configure the Hi6200 Agent we need to add a block to our ocs | ||
configuration file. Here is an example configuration block using all of | ||
the available arguments:: | ||
|
||
{'agent-class': 'Hi6200Agent', | ||
'instance-id': 'hi6200', | ||
'arguments': [ | ||
['--ip-address', '192.168.11.43'], | ||
['--tcp-port', '502'] | ||
]}, | ||
|
||
The Hi6200 Agent requires the IP address and ModbusTCP port of the Hi6200 | ||
in order to connect to the Hi6200. The default ModbusTCP port on the Hi6200 | ||
is 502. | ||
|
||
Docker Compose | ||
`````````````` | ||
|
||
The SCPI PSU Agent should be configured to run in a Docker container. | ||
An example docker-compose service configuration is shown here:: | ||
|
||
ocs-hi6200: | ||
image: simonsobs/socs:latest | ||
hostname: ocs-docker | ||
network_mode: "host" | ||
environment: | ||
- INSTANCE_ID=hi6200 | ||
volumes: | ||
- ${OCS_CONFIG_DIR}:/config:ro | ||
|
||
Agent API | ||
--------- | ||
|
||
.. autoclass:: socs.agents.hi6200.agent.Hi6200Agent | ||
:members: | ||
|
||
Example Clients | ||
--------------- | ||
|
||
Below is an example client demonstrating full agent functionality.:: | ||
|
||
from ocs.ocs_client import OCSClient | ||
|
||
# Initialize the power supply | ||
scale = OCSClient('hi6200') | ||
scale.init.start() | ||
scale.init.wait() | ||
|
||
# Begin Monitoring Weight | ||
scale.monitor_weight.start() | ||
|
||
#Stop Monitoring Weight | ||
scale.stop_monitoring.start() | ||
|
||
Supporting APIs | ||
--------------- | ||
|
||
.. autoclass:: socs.agents.hi6200.drivers.Hi6200Interface | ||
:members: | ||
:noindex: |
Oops, something went wrong.