Skip to content
Snippets Groups Projects
Commit 8649b34f authored by Matthias Bodenbenner's avatar Matthias Bodenbenner
Browse files

repo-clean up & bug fix

parent b98a4910
Branches
Tags
No related merge requests found
Showing
with 98 additions and 97 deletions
**/.idea/
.idea
**/__pycache__/
**/logs/
**/log/
**/build/
**/*.egg-info/
**/venv*/
**/dist
dist
wiki
*.pyc
test/server/server_config.toml
\ No newline at end of file
......@@ -18,7 +18,7 @@ Build Wheel:
- master
- legacy
script:
- '& cmd /k "C:\Anaconda3\Scripts\activate.bat E:\environments\$env:UUID & python setup.py sdist bdist_wheel"'
- python setup.py sdist bdist_wheel
Copy To Package Registry:
image: python:3.9
......@@ -32,24 +32,25 @@ Copy To Package Registry:
- master
- legacy
script:
- '& cmd /k "C:\Anaconda3\Scripts\activate.bat E:\environments\$env:UUID & pip install twine & python -m twine upload -u gitlab-ci-token -p $CI_JOB_TOKEN --repository-url https://git-ce.rwth-aachen.de/api/v4/projects/${CI_PROJECT_ID}/packages/pypi dist/*"'
pages:
image: python:3.9
stage: deploy
tags:
- frodo
only:
- master
script:
- pip3 install -r requirements.txt
- mkdir public
- cd doc
- make html
- cp -r ./build/html/. ../public
artifacts:
paths:
- public
- pip install twine
- python -m twine upload -u gitlab-ci-token -p $CI_JOB_TOKEN --repository-url https://git-ce.rwth-aachen.de/api/v4/projects/${CI_PROJECT_ID}/packages/pypi dist/*
#pages:
# image: python:3.9
# stage: deploy
# tags:
# - frodo
# only:
# - master
# script:
# - pip3 install -r requirements.txt
# - mkdir public
# - cd doc
# - make html
# - cp -r ./build/html/. ../public
# artifacts:
# paths:
# - public
......
......
[![Build](https://git-ce.rwth-aachen.de/wzl-mq-ms/forschung-lehre/lava/unified-device-interface/python/badges/master/pipeline.svg)](https://git-ce.rwth-aachen.de/wzl-mq-ms/forschung-lehre/lava/unified-device-interface/python/commits/master)
# Python Unified Device Interface
Current stable version: 6.1.1
Current stable version: 6.1.2
Stable legacy version: 5.2.7
## Installation
......@@ -20,46 +20,52 @@ pip install --extra-index-url https://package-read:sTkDQPiyBqkUyYVXZfeK@git-ce.r
## Usage
For using the PUDI device interface you need to have a SOIL-Model of your device in JSON-Format. See the Wiki for more information.
You can design the model by hand our use the [SOIL-Editor](https://git-ce.rwth-aachen.de/wzl-mq-ms/forschung-lehre/modelizer), to generate the source code and get a ready-to-run python script for your device server.
You can design the model by hand our use the [SOIL-Web-Editor](https://iot.wzl-mq.rwth-aachen.de/soil/), to generate the source code and get a ready-to-run python script for your device server.
Please keep in mind, that creating a service with the SOIL-Editor gives your more features you can use.
### Manual setup
If you do not use the SOIL-Editor, create a JSON-Model of your device and a mapping dictionary by hand.
Please refer to the Servetize section of the repository's Wiki.
Setup your server as follows:
```python
# set up servers
executor = ThreadPoolExecutor(max_workers=100)
loop = asyncio.get_event_loop()
loop.set_default_executor(executor)
# configure model
macs = ['AC-DE-48-00-00-80', 'AE-DE-48-00-00-80', 'BC-DE-48-00-00-80']
sensors = [Sensor(macs[i]) for i in range(3)]
implementation = Environment(sensors)
# configure HTTP server
mapping = src.test.devices.mapping.mapping(implementation)
model = Component.load('./src/test/devices/environmental_sensor/Environment.json', mapping)
http = HTTPServer(loop, HTTP_ADDRESS, HTTP_PORT, model)
# start servers
try:
loop.run_forever()
except:
pass
finally:
loop.close()
```
Please refer to the Servetize section of the repository's Wiki. Additionally, you can check the _example_ directory for exemplary implementation(s).
## Citation & References
Scientific background and publications related to the _(Python) Unified Device Interface_ are:
[Bodenbenner, M.](mailto:m.bodenbenner@wzl-mq.rwth-aachen.de); Sanders, M. P.; Montavon, B.; Schmitt, R. H. (2021):
Domain-Specific Language for Sensors in the Internet of Production.
In: Bernd-Arno Behrens, Alexander Brosius, Wolfgang Hintze, Steffen Ihlenfeldt und Jens Peter Wulfsberg (Hg.):
Production at the leading edge of technology. Proceedings of the 10th Congress of the German Academic Association for Production Technology (WGP), Dresden, 23-24 September 2020. Berlin, Heidelberg, 2021. 1st ed. 2021. Berlin, Heidelberg: Springer (Lecture Notes in Production Engineering), S. 448–456,
http://dx.doi.org/10.1007/978-3-662-62138-7_45
[Bodenbenner, M.](mailto:m.bodenbenner@wzl-mq.rwth-aachen.de); Montavon, B.; Schmitt, R.H. (2021):
FAIR sensor services - Towards sustainable sensor data management.
In: Measurement: Sensors 18, S. 100206,
https://doi.org/10.1016/j.measen.2021.100206
[Montavon, B.](mailto:b.montavon@wzl-mq.rwth-aachen.de)(2021):
Virtual Reference Frame Based on Distributed Large-Scale Metrology Providing Coordinates as a Service.
Aachen: Apprimus Verlag,
https://doi.org/10.18154/RWTH-2021-10238
1. Do not change the three lines below `# set up servers` and below `# start servers`.
2. Replace the lines below `# configure model` by the initialization of your device.
3. Pass your initialized device to the docstring parser for MQTT and HTTP.
4. If you are not using MQTT or HTTP leave out the respective lines.
[Montavon, B.](mailto:b.montavon@wzl-mq.rwth-aachen.de); Peterek, M.; Schmitt, R. H. (2019):
Model-based interfacing of large-scale metrology instruments.
In: Ettore Stella (Hg.): Multimodal Sensing: Technologies and Applications. 26-27 June 2019, Munich, Germany. Multimodal Sensing and Artificial Intelligence: Technologies and Applications. Munich, Germany, 6/24/2019 - 6/27/2019. Bellingham, Washington: SPIE (Proceedings of SPIE. 5200-, volume 11059), S. 11,
https://doi.org/10.1117/12.2527461
## Acknowledgements
The authors acknowledge funding from the LaVA project (Large Volume Applications, contract 17IND03 of the
European Metrology Programme for Innovation and Research EMPIR). The EMPIR initiative is co-funded by
the European Union’s Horizon 2020 research and innovation programme and the EMPIR Participating States.
Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany's Excellence Strategy – EXC-2023 Internet of Production – 390621612.
## Recent changes
6.1.2 | 5.2.7 - 2022-04-14
- bug fix of loop handling of aiohttp web application
6.1.1 | 5.2.7 - 2021-05-19
- improved error output for developers
......
......
@echo off
rmdir dist /s /q
rmdir build /s /q
rmdir wzl_udi.egg-info /s /q
python setup.py bdist_wheel
:: TODO complete line below
:: copy "../dist/" "D:\users\bdn\Forschungsprojekte\Virtual Metrology Frame\SourceCode\PyPi server"
\ No newline at end of file
......@@ -4,7 +4,7 @@
contain the root `toctree` directive.
Welcome to Python Unified Device Interface's documentation!
==============================================
===========================================================
.. toctree::
:maxdepth: 2
......
......
src
===
.. toctree::
:maxdepth: 4
src
from typing import List
from .enums import StateEnum
from device.enums import StateEnum
class COMBaseTOP(object):
......
......
from ..hwc.com_base import COMBase
from hwc.com_base import COMBase
class COMBaseStations(object):
......
......
import datetime
from .com_basestations import COMBaseStations
from .com_mobileentities import COMMobileEntities
from .enums import StateEnum
from device.com_basestations import COMBaseStations
from device.com_mobileentities import COMMobileEntities
from device.enums import StateEnum
class COMLasertrackerTOP(object):
......
......
from ..hwc.com_target import COMTarget
from .enums import StateEnum, ModeEnum
from hwc.com_target import COMTarget
from device.enums import StateEnum, ModeEnum
class COMMobileEntities(object):
......
......
from typing import Callable
from typing import List
from .enums import StateEnum, ModeEnum
from device.enums import StateEnum, ModeEnum
class COMTargetTOP(object):
......
......
class Device(object):
def __init__(self):
# TODO implement
pass
def __del__(self):
# TODO implement
pass
\ No newline at end of file
......@@ -7,17 +7,17 @@ from typing import Dict
from wzl.mqtt import MQTTPublisher
from wzl.utilities import root_logger
from src.http.server import HTTPServer
from src.soil.component import Component
from src.soil.event import Event, EventSeverity, EventTrigger
from src.soil.stream import FixedJob, EventJob, UpdateJob, StreamScheduler
from .enums import StateEnum
from ..hwc.com_lasertracker import COMLasertracker
from wzl.http.server import HTTPServer
from wzl.soil.component import Component
from wzl.soil.event import Event, EventSeverity, EventTrigger
from wzl.soil.stream import FixedJob, EventJob, UpdateJob, StreamScheduler
from device.enums import StateEnum
from hwc.com_lasertracker import COMLasertracker
sys.setswitchinterval(0.0005)
def start(com_lasertracker: COMLasertracker, config: Dict):
def start(com_lasertracker: COMLasertracker, config: Dict, soil_model_file: str):
# server settings
address = config['http']['address']
port = config['http']['port']
......@@ -119,7 +119,7 @@ def start(com_lasertracker: COMLasertracker, config: Dict):
submapping['FUN-Trigger'] = {
'method': com_lasertracker._com_mobileentities._com_target[child0_uuid].fun_trigger,
'signature': {'arguments': {}, 'returns': []}, 'mqtt_callback': mqtt.publish}
model = Component.load('../Lasertracker.json', mapping['COM-Lasertracker'])
model = Component.load(soil_model_file, mapping['COM-Lasertracker'])
http = HTTPServer(loop, address, port, model)
......
......
import random
from math import pi, cos, sin
from ..device.com_base_top import COMBaseTOP
from device.com_base_top import COMBaseTOP
class COMBase(COMBaseTOP):
......
......
import datetime
from ..device.com_lasertracker_top import COMLasertrackerTOP
from device.com_lasertracker_top import COMLasertrackerTOP
class COMLasertracker(COMLasertrackerTOP):
......
......
import json
import time
from ..device.com_target_top import COMTargetTOP
from device.com_target_top import COMTargetTOP
class COMTarget(COMTargetTOP):
......
......
......@@ -12,4 +12,4 @@ if __name__ == "__main__":
lasertracker = COMLasertracker(device)
device.start()
start(lasertracker, config)
start(lasertracker, config, './Lasertracker.json')
FOR /F "delims=~" %f in (packages.txt) DO conda install --yes "%f" || pip install "%f"
\ No newline at end of file
from setuptools import setup, find_packages
setup(name='wzl-udi',
version='6.1.1',
url='',
version='6.1.2',
url='', # TODO add url after moving to public group
author='Matthias Bodenbenner',
author_email='m.bodenbenner@wzl.rwth-aachen.de',
author_email='m.bodenbenner@wzl.mq.rwth-aachen.de',
description='Provides REST-server, publisher-interface and serializer for the Unified Device Interface in Python.',
package_dir={'wzl': 'src'},
packages=['wzl.http', 'wzl.soil', 'wzl.utils'],
long_description=open('./README.md').read(),
install_requires=['nest-asyncio', 'strict-rfc3339', 'docstring_parser==0.7.1', 'aiohttp', 'wzl-mqtt', 'wzl-utilities', 'deprecated'],
install_requires=['aiohttp==3.8.1',
'Deprecated==1.2.13',
'docstring_parser==0.7.3',
'nest-asyncio==1.4.3',
'strict-rfc3339==0.7',
'wzl-mqtt==2.5.1',
'wzl-utilities==1.2.2'
],
zip_safe=False)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment