Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
davidvng committed Aug 16, 2024
1 parent f677be9 commit 75a81e2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions docs/agents/http_camera.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,26 @@ Agent in a docker container.
OCS Site Config
```````````````

To configure the HTTP Camera Agent we need to add a HTTPCameraAgent
To configure the HTTP Camera Agent we need to add an HTTPCameraAgent
block to our ocs configuration file. Here is an example configuration block
using all of the available arguments::

{'agent-class': 'HTTPCameraAgent',
'instance-id': 'cameras',
'arguments': [['--mode', 'acq'],
['--config-file', 'config_file.yaml']]},
['--config-file', 'cameras.yaml']]},

.. note::
The ``--config-file`` argument should be the config file path relative
to ``OCS_CONFIG_DIR`` and contain an entry for each camera with
relevant information. An example can be found at `config`_.
relevant information. An example is given here which is also found
at `config`_.

.. _config: https://github.com/simonsobs/socs/blob/main/socs/agents/http_camera/sample_config.yaml

.. literalinclude:: ../../../socs/agents/http_camera/sample_config.yaml
:language: yaml

Docker Compose
``````````````

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
package_data={'socs': [
'agents/smurf_file_emulator/*.yaml',
'agents/labjack/cal_curves/*.txt',
'agents/generator/*.yaml'
'agents/generator/*.yaml',
'agents/http_camera/*.yaml'
]},
entry_points={
'console_scripts': [
Expand Down
7 changes: 5 additions & 2 deletions socs/agents/http_camera/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,12 @@ def acq(self, session, params=None):
elif camera['brand'] == 'acti':
payload = {'USER': camera['user'],
'PWD': camera['password'],
'SNAPSHOT': camera['resolution']}
'SNAPSHOT': camera.get('resolution', 'N640x480,100')}
url = f"http://{camera['address']}/cgi-bin/encoder"
else:
self.log.info(f"{camera['brand']} is an unsupported camera brand. Skipping this config block.")
self.config['cameras'].remove(camera)
continue

# Format directory and filename
ctime = int(timestamp)
Expand All @@ -137,7 +141,6 @@ def acq(self, session, params=None):
data[camera['location']]['last_attempt'] = time.time()
data[camera['location']]['connected'] = connected
continue
camera['connected'] = True
self.log.debug("Received screenshot from camera.")

# Write screenshot to file and update latest file
Expand Down

0 comments on commit 75a81e2

Please sign in to comment.