machine-logic-sdk 1.13.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- machine_logic_sdk-1.13.0/MANIFEST.in +2 -0
- machine_logic_sdk-1.13.0/PKG-INFO +80 -0
- machine_logic_sdk-1.13.0/README.md +58 -0
- machine_logic_sdk-1.13.0/machine_logic_sdk.egg-info/PKG-INFO +80 -0
- machine_logic_sdk-1.13.0/machine_logic_sdk.egg-info/SOURCES.txt +82 -0
- machine_logic_sdk-1.13.0/machine_logic_sdk.egg-info/dependency_links.txt +1 -0
- machine_logic_sdk-1.13.0/machine_logic_sdk.egg-info/requires.txt +10 -0
- machine_logic_sdk-1.13.0/machine_logic_sdk.egg-info/top_level.txt +1 -0
- machine_logic_sdk-1.13.0/machinelogic/__init__.py +6 -0
- machine_logic_sdk-1.13.0/machinelogic/decorators/__init__.py +0 -0
- machine_logic_sdk-1.13.0/machinelogic/decorators/future_api.py +28 -0
- machine_logic_sdk-1.13.0/machinelogic/decorators/tests/__init__.py +0 -0
- machine_logic_sdk-1.13.0/machinelogic/decorators/tests/test_future_api.py +52 -0
- machine_logic_sdk-1.13.0/machinelogic/decorators/tests/test_undocumented.py +81 -0
- machine_logic_sdk-1.13.0/machinelogic/decorators/undocumented.py +49 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/__init__.py +2 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/event_listener.py +80 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/exception.py +113 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/handle.py +12 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/iac_motor.py +106 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/iactuator.py +305 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/iactuator_group.py +219 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/ibag_gripper.py +125 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/icamera.py +237 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/idigital_input.py +86 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/idigital_io_shared.py +79 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/idigital_output.py +77 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/iestop.py +45 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/imachine.py +308 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/imachine_motion.py +283 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/ipath_follower.py +169 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/ipneumatic.py +136 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/irobot.py +413 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/machine_configuration.py +340 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/mqtt_client.py +201 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/tests/__init__.py +0 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/tests/test_event_listener.py +21 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/tests/test_idigital_input.py +75 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/tests/test_idigital_output.py +57 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/tests/test_imachine.py +349 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/tests/test_ipath_follower.py +116 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/tests/test_mqtt_client.py +87 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/types/__init__.py +0 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/types/ac_motor_details.py +18 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/types/actuator_details.py +48 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/types/bag_gripper_details.py +19 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/types/input_details.py +19 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/types/output_details.py +19 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/types/path_follower_status.py +13 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/types/path_follower_tool.py +15 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/types/pneumatic_details.py +22 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/util/__init__.py +0 -0
- machine_logic_sdk-1.13.0/machinelogic/ivention/util/inheritance.py +34 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/__init__.py +0 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/ac_motor.py +29 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/actuator.py +166 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/actuator_group.py +130 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/api.py +1530 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/bag_gripper.py +79 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/camera.py +83 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/digital_input.py +10 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/digital_output.py +21 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/estop.py +64 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/machine.py +229 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/machine_motion.py +14 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/path_follower.py +153 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/pneumatic.py +76 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/robot/__init__.py +1 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/robot/robot.py +285 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/robot/vention_ros_client_library.py +1138 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/tests/__init__.py +0 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/tests/test_ac_motor.py +64 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/tests/test_actuator.py +194 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/tests/test_bag_gripper.py +47 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/tests/test_machine.py +34 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/tests/test_path_follower.py +147 -0
- machine_logic_sdk-1.13.0/machinelogic/machinelogic/tests/test_pneumatic.py +102 -0
- machine_logic_sdk-1.13.0/machinelogic/state_machine/__init__.py +3 -0
- machine_logic_sdk-1.13.0/machinelogic/state_machine/state_machine.py +208 -0
- machine_logic_sdk-1.13.0/machinelogic/state_machine/state_node.py +129 -0
- machine_logic_sdk-1.13.0/machinelogic/state_machine/state_transition.py +67 -0
- machine_logic_sdk-1.13.0/pyproject.toml +8 -0
- machine_logic_sdk-1.13.0/setup.cfg +4 -0
- machine_logic_sdk-1.13.0/setup.py +38 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: machine-logic-sdk
|
|
3
|
+
Version: 1.13.0
|
|
4
|
+
Summary: SDK for controlling Vention hardware
|
|
5
|
+
Home-page: https://vention.io/resources/guides/machinelogic-python-programming-514
|
|
6
|
+
Author: VentionCo
|
|
7
|
+
Author-email: vention-sw-ci@vention.cc
|
|
8
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.5
|
|
10
|
+
Requires-Python: >=3.6
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: miros==4.2.1
|
|
13
|
+
Requires-Dist: paho-mqtt==1.5.1
|
|
14
|
+
Requires-Dist: types-requests==2.28.11
|
|
15
|
+
Requires-Dist: requests==2.31.0
|
|
16
|
+
Requires-Dist: typing_extensions==4.6.3
|
|
17
|
+
Requires-Dist: parameterized
|
|
18
|
+
Requires-Dist: numpy==1.24.2
|
|
19
|
+
Requires-Dist: roslibpy==1.4.2
|
|
20
|
+
Requires-Dist: scipy==1.11.1
|
|
21
|
+
Requires-Dist: zope.interface==5.5.2
|
|
22
|
+
|
|
23
|
+
Provides a programmatic interface in Python to talk to Vention hardware, as well as a generic state machine for coordinating your programs.
|
|
24
|
+
|
|
25
|
+
## Table of Contents
|
|
26
|
+
|
|
27
|
+
1. [Requirements](#Requirements)
|
|
28
|
+
1. [Development](#Development)
|
|
29
|
+
1. [Documentation](#Documentation)
|
|
30
|
+
1. [Resources](#Resources)
|
|
31
|
+
|
|
32
|
+
## Requirements
|
|
33
|
+
|
|
34
|
+
Python 3.9.2
|
|
35
|
+
Higher versions of python work, but 3.9.2 is shipped on the MachineMotion.
|
|
36
|
+
|
|
37
|
+
### Installing Python
|
|
38
|
+
|
|
39
|
+
You can install python 3.9 on Ubuntu via `sudo apt install python3.9`
|
|
40
|
+
Check your python version via `python3 --version`
|
|
41
|
+
If you already had a python version installed, you'll need to map `python3` to the 3.9 version that you installed.
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
cd /usr/bin
|
|
45
|
+
sudo link python3
|
|
46
|
+
sudo ln -s /usr/bin/python3.9 python3
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Then you'll need these in order to set up a venv
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
sudo apt-get install python3-apt python3-virtualenv python3.9-venv
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Development
|
|
56
|
+
|
|
57
|
+
Always work inside a python `venv` so that your dependencies do not get interfered with:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
python3 -m venv venv
|
|
61
|
+
source venv/bin/activate
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
You will need to upgrade pip before continuing
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
pip install --upgrade pip
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Then install package:
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
pip install machine-logic-sdk
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Documentation
|
|
77
|
+
- [Documentation](https://vention.io/resources/guides/machinelogic-python-programming-514)
|
|
78
|
+
|
|
79
|
+
## Resources
|
|
80
|
+
- [Miros](https://aleph2c.github.io/miros/html/#) is the framework upon which our architecture is based
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Provides a programmatic interface in Python to talk to Vention hardware, as well as a generic state machine for coordinating your programs.
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
|
|
5
|
+
1. [Requirements](#Requirements)
|
|
6
|
+
1. [Development](#Development)
|
|
7
|
+
1. [Documentation](#Documentation)
|
|
8
|
+
1. [Resources](#Resources)
|
|
9
|
+
|
|
10
|
+
## Requirements
|
|
11
|
+
|
|
12
|
+
Python 3.9.2
|
|
13
|
+
Higher versions of python work, but 3.9.2 is shipped on the MachineMotion.
|
|
14
|
+
|
|
15
|
+
### Installing Python
|
|
16
|
+
|
|
17
|
+
You can install python 3.9 on Ubuntu via `sudo apt install python3.9`
|
|
18
|
+
Check your python version via `python3 --version`
|
|
19
|
+
If you already had a python version installed, you'll need to map `python3` to the 3.9 version that you installed.
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
cd /usr/bin
|
|
23
|
+
sudo link python3
|
|
24
|
+
sudo ln -s /usr/bin/python3.9 python3
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Then you'll need these in order to set up a venv
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
sudo apt-get install python3-apt python3-virtualenv python3.9-venv
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Development
|
|
34
|
+
|
|
35
|
+
Always work inside a python `venv` so that your dependencies do not get interfered with:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
python3 -m venv venv
|
|
39
|
+
source venv/bin/activate
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
You will need to upgrade pip before continuing
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
pip install --upgrade pip
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Then install package:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
pip install machine-logic-sdk
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Documentation
|
|
55
|
+
- [Documentation](https://vention.io/resources/guides/machinelogic-python-programming-514)
|
|
56
|
+
|
|
57
|
+
## Resources
|
|
58
|
+
- [Miros](https://aleph2c.github.io/miros/html/#) is the framework upon which our architecture is based
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: machine-logic-sdk
|
|
3
|
+
Version: 1.13.0
|
|
4
|
+
Summary: SDK for controlling Vention hardware
|
|
5
|
+
Home-page: https://vention.io/resources/guides/machinelogic-python-programming-514
|
|
6
|
+
Author: VentionCo
|
|
7
|
+
Author-email: vention-sw-ci@vention.cc
|
|
8
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.5
|
|
10
|
+
Requires-Python: >=3.6
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: miros==4.2.1
|
|
13
|
+
Requires-Dist: paho-mqtt==1.5.1
|
|
14
|
+
Requires-Dist: types-requests==2.28.11
|
|
15
|
+
Requires-Dist: requests==2.31.0
|
|
16
|
+
Requires-Dist: typing_extensions==4.6.3
|
|
17
|
+
Requires-Dist: parameterized
|
|
18
|
+
Requires-Dist: numpy==1.24.2
|
|
19
|
+
Requires-Dist: roslibpy==1.4.2
|
|
20
|
+
Requires-Dist: scipy==1.11.1
|
|
21
|
+
Requires-Dist: zope.interface==5.5.2
|
|
22
|
+
|
|
23
|
+
Provides a programmatic interface in Python to talk to Vention hardware, as well as a generic state machine for coordinating your programs.
|
|
24
|
+
|
|
25
|
+
## Table of Contents
|
|
26
|
+
|
|
27
|
+
1. [Requirements](#Requirements)
|
|
28
|
+
1. [Development](#Development)
|
|
29
|
+
1. [Documentation](#Documentation)
|
|
30
|
+
1. [Resources](#Resources)
|
|
31
|
+
|
|
32
|
+
## Requirements
|
|
33
|
+
|
|
34
|
+
Python 3.9.2
|
|
35
|
+
Higher versions of python work, but 3.9.2 is shipped on the MachineMotion.
|
|
36
|
+
|
|
37
|
+
### Installing Python
|
|
38
|
+
|
|
39
|
+
You can install python 3.9 on Ubuntu via `sudo apt install python3.9`
|
|
40
|
+
Check your python version via `python3 --version`
|
|
41
|
+
If you already had a python version installed, you'll need to map `python3` to the 3.9 version that you installed.
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
cd /usr/bin
|
|
45
|
+
sudo link python3
|
|
46
|
+
sudo ln -s /usr/bin/python3.9 python3
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Then you'll need these in order to set up a venv
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
sudo apt-get install python3-apt python3-virtualenv python3.9-venv
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Development
|
|
56
|
+
|
|
57
|
+
Always work inside a python `venv` so that your dependencies do not get interfered with:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
python3 -m venv venv
|
|
61
|
+
source venv/bin/activate
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
You will need to upgrade pip before continuing
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
pip install --upgrade pip
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Then install package:
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
pip install machine-logic-sdk
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Documentation
|
|
77
|
+
- [Documentation](https://vention.io/resources/guides/machinelogic-python-programming-514)
|
|
78
|
+
|
|
79
|
+
## Resources
|
|
80
|
+
- [Miros](https://aleph2c.github.io/miros/html/#) is the framework upon which our architecture is based
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
MANIFEST.in
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
machine_logic_sdk.egg-info/PKG-INFO
|
|
6
|
+
machine_logic_sdk.egg-info/SOURCES.txt
|
|
7
|
+
machine_logic_sdk.egg-info/dependency_links.txt
|
|
8
|
+
machine_logic_sdk.egg-info/requires.txt
|
|
9
|
+
machine_logic_sdk.egg-info/top_level.txt
|
|
10
|
+
machinelogic/__init__.py
|
|
11
|
+
machinelogic/decorators/__init__.py
|
|
12
|
+
machinelogic/decorators/future_api.py
|
|
13
|
+
machinelogic/decorators/undocumented.py
|
|
14
|
+
machinelogic/decorators/tests/__init__.py
|
|
15
|
+
machinelogic/decorators/tests/test_future_api.py
|
|
16
|
+
machinelogic/decorators/tests/test_undocumented.py
|
|
17
|
+
machinelogic/ivention/__init__.py
|
|
18
|
+
machinelogic/ivention/event_listener.py
|
|
19
|
+
machinelogic/ivention/exception.py
|
|
20
|
+
machinelogic/ivention/handle.py
|
|
21
|
+
machinelogic/ivention/iac_motor.py
|
|
22
|
+
machinelogic/ivention/iactuator.py
|
|
23
|
+
machinelogic/ivention/iactuator_group.py
|
|
24
|
+
machinelogic/ivention/ibag_gripper.py
|
|
25
|
+
machinelogic/ivention/icamera.py
|
|
26
|
+
machinelogic/ivention/idigital_input.py
|
|
27
|
+
machinelogic/ivention/idigital_io_shared.py
|
|
28
|
+
machinelogic/ivention/idigital_output.py
|
|
29
|
+
machinelogic/ivention/iestop.py
|
|
30
|
+
machinelogic/ivention/imachine.py
|
|
31
|
+
machinelogic/ivention/imachine_motion.py
|
|
32
|
+
machinelogic/ivention/ipath_follower.py
|
|
33
|
+
machinelogic/ivention/ipneumatic.py
|
|
34
|
+
machinelogic/ivention/irobot.py
|
|
35
|
+
machinelogic/ivention/machine_configuration.py
|
|
36
|
+
machinelogic/ivention/mqtt_client.py
|
|
37
|
+
machinelogic/ivention/tests/__init__.py
|
|
38
|
+
machinelogic/ivention/tests/test_event_listener.py
|
|
39
|
+
machinelogic/ivention/tests/test_idigital_input.py
|
|
40
|
+
machinelogic/ivention/tests/test_idigital_output.py
|
|
41
|
+
machinelogic/ivention/tests/test_imachine.py
|
|
42
|
+
machinelogic/ivention/tests/test_ipath_follower.py
|
|
43
|
+
machinelogic/ivention/tests/test_mqtt_client.py
|
|
44
|
+
machinelogic/ivention/types/__init__.py
|
|
45
|
+
machinelogic/ivention/types/ac_motor_details.py
|
|
46
|
+
machinelogic/ivention/types/actuator_details.py
|
|
47
|
+
machinelogic/ivention/types/bag_gripper_details.py
|
|
48
|
+
machinelogic/ivention/types/input_details.py
|
|
49
|
+
machinelogic/ivention/types/output_details.py
|
|
50
|
+
machinelogic/ivention/types/path_follower_status.py
|
|
51
|
+
machinelogic/ivention/types/path_follower_tool.py
|
|
52
|
+
machinelogic/ivention/types/pneumatic_details.py
|
|
53
|
+
machinelogic/ivention/util/__init__.py
|
|
54
|
+
machinelogic/ivention/util/inheritance.py
|
|
55
|
+
machinelogic/machinelogic/__init__.py
|
|
56
|
+
machinelogic/machinelogic/ac_motor.py
|
|
57
|
+
machinelogic/machinelogic/actuator.py
|
|
58
|
+
machinelogic/machinelogic/actuator_group.py
|
|
59
|
+
machinelogic/machinelogic/api.py
|
|
60
|
+
machinelogic/machinelogic/bag_gripper.py
|
|
61
|
+
machinelogic/machinelogic/camera.py
|
|
62
|
+
machinelogic/machinelogic/digital_input.py
|
|
63
|
+
machinelogic/machinelogic/digital_output.py
|
|
64
|
+
machinelogic/machinelogic/estop.py
|
|
65
|
+
machinelogic/machinelogic/machine.py
|
|
66
|
+
machinelogic/machinelogic/machine_motion.py
|
|
67
|
+
machinelogic/machinelogic/path_follower.py
|
|
68
|
+
machinelogic/machinelogic/pneumatic.py
|
|
69
|
+
machinelogic/machinelogic/robot/__init__.py
|
|
70
|
+
machinelogic/machinelogic/robot/robot.py
|
|
71
|
+
machinelogic/machinelogic/robot/vention_ros_client_library.py
|
|
72
|
+
machinelogic/machinelogic/tests/__init__.py
|
|
73
|
+
machinelogic/machinelogic/tests/test_ac_motor.py
|
|
74
|
+
machinelogic/machinelogic/tests/test_actuator.py
|
|
75
|
+
machinelogic/machinelogic/tests/test_bag_gripper.py
|
|
76
|
+
machinelogic/machinelogic/tests/test_machine.py
|
|
77
|
+
machinelogic/machinelogic/tests/test_path_follower.py
|
|
78
|
+
machinelogic/machinelogic/tests/test_pneumatic.py
|
|
79
|
+
machinelogic/state_machine/__init__.py
|
|
80
|
+
machinelogic/state_machine/state_machine.py
|
|
81
|
+
machinelogic/state_machine/state_node.py
|
|
82
|
+
machinelogic/state_machine/state_transition.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
machinelogic
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import functools
|
|
2
|
+
from typing import Callable, TypeVar
|
|
3
|
+
|
|
4
|
+
from typing_extensions import ParamSpec
|
|
5
|
+
|
|
6
|
+
Params = ParamSpec("Params")
|
|
7
|
+
ReturnType = TypeVar("ReturnType") # pylint: disable=invalid-name
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def future_api(func: Callable[Params, ReturnType]) -> Callable[Params, ReturnType]:
|
|
11
|
+
"""
|
|
12
|
+
A decorator to mark methods that will be part of a future api.
|
|
13
|
+
These method will be skipped by the documentation generation script.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
func: The function to decorate
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
The decorator
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
@functools.wraps(func)
|
|
23
|
+
def decorator(*args: Params.args, **kwargs: Params.kwargs) -> ReturnType:
|
|
24
|
+
return func(*args, **kwargs)
|
|
25
|
+
|
|
26
|
+
decorator.__future_api__ = True # type: ignore
|
|
27
|
+
|
|
28
|
+
return decorator
|
|
File without changes
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# pylint: disable=missing-function-docstring
|
|
2
|
+
import unittest
|
|
3
|
+
|
|
4
|
+
from machinelogic.decorators.future_api import future_api
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class DecoratedClass:
|
|
8
|
+
def __init__(self, value: int):
|
|
9
|
+
self.__value = value
|
|
10
|
+
|
|
11
|
+
# You cannot wrap @property :(
|
|
12
|
+
@property
|
|
13
|
+
@future_api
|
|
14
|
+
def value(self) -> int:
|
|
15
|
+
return self.__value
|
|
16
|
+
|
|
17
|
+
@future_api
|
|
18
|
+
def get_value(self) -> int:
|
|
19
|
+
return self.__value
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class TestFutureApi(unittest.TestCase):
|
|
23
|
+
def test_given_value_when_getting_future_api_value_property_then_returns_value(
|
|
24
|
+
self,
|
|
25
|
+
) -> None:
|
|
26
|
+
# Arrange
|
|
27
|
+
expected_value = 1
|
|
28
|
+
instance = DecoratedClass(expected_value)
|
|
29
|
+
|
|
30
|
+
# Act
|
|
31
|
+
actual_value = instance.value
|
|
32
|
+
|
|
33
|
+
# Assert
|
|
34
|
+
self.assertEqual(expected_value, actual_value)
|
|
35
|
+
|
|
36
|
+
def test_given_value_when_setting_future_api_value_property_then_raises_attribute_error(
|
|
37
|
+
self,
|
|
38
|
+
) -> None:
|
|
39
|
+
# Arrange
|
|
40
|
+
instance = DecoratedClass(1)
|
|
41
|
+
|
|
42
|
+
# Act & Assert
|
|
43
|
+
with self.assertRaises(AttributeError):
|
|
44
|
+
instance.value = 2 # type: ignore
|
|
45
|
+
|
|
46
|
+
def test_future_api_on_top_of_property_does_not_work(
|
|
47
|
+
self,
|
|
48
|
+
) -> None:
|
|
49
|
+
# Assert
|
|
50
|
+
self.assertFalse(
|
|
51
|
+
getattr(getattr(DecoratedClass, "value"), "__future_api__", False)
|
|
52
|
+
)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# pylint: disable=missing-function-docstring
|
|
2
|
+
import unittest
|
|
3
|
+
|
|
4
|
+
from machinelogic.decorators.undocumented import undocumented, undocumented_property
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class DecoratedClass:
|
|
8
|
+
def __init__(self, value: int):
|
|
9
|
+
self.__value = value
|
|
10
|
+
|
|
11
|
+
@undocumented_property
|
|
12
|
+
def undocumented_value(self) -> int:
|
|
13
|
+
"""This is an undocumented property"""
|
|
14
|
+
return self.__value
|
|
15
|
+
|
|
16
|
+
@property
|
|
17
|
+
def value(self) -> int:
|
|
18
|
+
"""This is a documented property"""
|
|
19
|
+
return self.__value
|
|
20
|
+
|
|
21
|
+
@undocumented
|
|
22
|
+
def get_value(self) -> int:
|
|
23
|
+
"""This is an undocumented method"""
|
|
24
|
+
return self.__value
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class TestUndocumentedDecorator(unittest.TestCase):
|
|
28
|
+
def setUp(self) -> None:
|
|
29
|
+
self.expected_value = 1
|
|
30
|
+
self.instance = DecoratedClass(self.expected_value)
|
|
31
|
+
|
|
32
|
+
def test_get_property_value_when_using_undocumented_property_then_returns_value(
|
|
33
|
+
self,
|
|
34
|
+
) -> None:
|
|
35
|
+
# @property should return the expected value. This test is added for reference
|
|
36
|
+
self.assertEqual(self.expected_value, self.instance.value)
|
|
37
|
+
|
|
38
|
+
# @undocumented_property should return the value
|
|
39
|
+
self.assertEqual(self.expected_value, self.instance.undocumented_value)
|
|
40
|
+
|
|
41
|
+
def test_get_value_when_using_undocumented_method_then_returns_value(
|
|
42
|
+
self,
|
|
43
|
+
) -> None:
|
|
44
|
+
# @undocumented method should still return the value
|
|
45
|
+
self.assertEqual(self.expected_value, self.instance.get_value())
|
|
46
|
+
|
|
47
|
+
def test_undocumnented_attributed_should_be_set_to_true(self) -> None:
|
|
48
|
+
# @undocumented should have '__undocumented__' attribute
|
|
49
|
+
self.assertTrue(
|
|
50
|
+
hasattr(getattr(DecoratedClass, "undocumented_value"), "__undocumented__")
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
# @undocumented should have '__undocumented__' attribute set to True
|
|
54
|
+
self.assertTrue(
|
|
55
|
+
getattr(getattr(DecoratedClass, "undocumented_value"), "__undocumented__")
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
def test_undocumnented_property_attributed_should_be_set_to_true(self) -> None:
|
|
59
|
+
# @undocumented_property should have '__undocumented__' attribute
|
|
60
|
+
self.assertTrue(
|
|
61
|
+
hasattr(getattr(DecoratedClass, "undocumented_value"), "__undocumented__")
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
# @undocumented_property should have '__undocumented__' attribute set to True
|
|
65
|
+
self.assertTrue(
|
|
66
|
+
getattr(getattr(DecoratedClass, "undocumented_value"), "__undocumented__")
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
def test_documentation_should_be_set_when_using_undocumented_property(self) -> None:
|
|
70
|
+
# @undocumented_property should have '__doc__' attribute set to the expected value
|
|
71
|
+
self.assertEqual(
|
|
72
|
+
"This is an undocumented property",
|
|
73
|
+
getattr(getattr(DecoratedClass, "undocumented_value"), "__doc__"),
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
def test_documentation_should_be_set_when_using_undocumented(self) -> None:
|
|
77
|
+
# @undocumented should have '__doc__' attribute set to the expected value
|
|
78
|
+
self.assertEqual(
|
|
79
|
+
"This is an undocumented method",
|
|
80
|
+
getattr(getattr(DecoratedClass, "get_value"), "__doc__"),
|
|
81
|
+
)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import functools
|
|
2
|
+
from typing import Any, Callable, Optional, TypeVar
|
|
3
|
+
|
|
4
|
+
from typing_extensions import ParamSpec
|
|
5
|
+
|
|
6
|
+
Params = ParamSpec("Params")
|
|
7
|
+
ReturnType = TypeVar("ReturnType") # pylint: disable=invalid-name
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class undocumented_property(property): # pylint: disable=invalid-name
|
|
11
|
+
"""
|
|
12
|
+
A decorator to mark property methods that will not be documented.
|
|
13
|
+
These getters will be skipped by the documentation generation script.
|
|
14
|
+
|
|
15
|
+
This decorator is meant to be used in place of '@property', if
|
|
16
|
+
it's meant to be undocumented.
|
|
17
|
+
|
|
18
|
+
Note that the `undocumented` decorator works only on functions and
|
|
19
|
+
doesn't work on top of the `@property` decorator.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
__undocumented__ = True
|
|
23
|
+
|
|
24
|
+
def __init__(self, fget: Callable[Params, ReturnType]) -> None:
|
|
25
|
+
super().__init__(fget)
|
|
26
|
+
|
|
27
|
+
def __get__(self, instance: Any, owner: Optional[type] = None) -> Any:
|
|
28
|
+
return super().__get__(instance, owner)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def undocumented(func: Callable[Params, ReturnType]) -> Callable[Params, ReturnType]:
|
|
32
|
+
"""
|
|
33
|
+
A decorator to mark methods that will never be documented.
|
|
34
|
+
These method will be skipped by the documentation generation script.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
func: The function to decorate.
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
The decorator.
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
@functools.wraps(func)
|
|
44
|
+
def decorator(*args: Params.args, **kwargs: Params.kwargs) -> ReturnType:
|
|
45
|
+
return func(*args, **kwargs)
|
|
46
|
+
|
|
47
|
+
decorator.__undocumented__ = True # type: ignore
|
|
48
|
+
|
|
49
|
+
return decorator
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"""Module for managing generic events
|
|
2
|
+
"""
|
|
3
|
+
from typing import Callable, Optional
|
|
4
|
+
|
|
5
|
+
import paho.mqtt.client as mqtt
|
|
6
|
+
|
|
7
|
+
from .handle import Handle
|
|
8
|
+
|
|
9
|
+
EventCallback = Callable[[str, Optional[str]], None]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class EventListener:
|
|
13
|
+
"""A listener on a topic"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, handle: Handle, topic: str, callback: EventCallback):
|
|
16
|
+
"""_summary_
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
handle (Handle): Handle for the vent
|
|
20
|
+
topic (str): Topic to wait for
|
|
21
|
+
callback (EventCallback): Callback to trigger
|
|
22
|
+
"""
|
|
23
|
+
self.handle = handle
|
|
24
|
+
self.topic = topic
|
|
25
|
+
self.callback = callback
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class EventListenerManager:
|
|
29
|
+
"""
|
|
30
|
+
Generic mechanism for adding, removing, and notifying event listeners.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
_listeners: list[EventListener]
|
|
34
|
+
_handle_count: int
|
|
35
|
+
|
|
36
|
+
def __init__(self) -> None:
|
|
37
|
+
self._listeners = []
|
|
38
|
+
self._handle_count = 0
|
|
39
|
+
|
|
40
|
+
def add_event_listener(self, topic: str, callback: EventCallback) -> Handle:
|
|
41
|
+
"""Add a listener for a topic.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
topic (str): The topic to listen on
|
|
45
|
+
callback (EventCallback): A callback where the first argument is the topic and the second is the message
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
Handle: Provide to 'remove_event_listener' to remove this event
|
|
49
|
+
"""
|
|
50
|
+
handle = Handle(self._handle_count)
|
|
51
|
+
self._handle_count = self._handle_count + 1
|
|
52
|
+
self._listeners.append(EventListener(handle, topic, callback))
|
|
53
|
+
return handle
|
|
54
|
+
|
|
55
|
+
def remove_event_listener(self, handle: Handle) -> bool:
|
|
56
|
+
"""Remove an active event listener
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
handle (Handle): The handle of the listener that you want to remove
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
bool: True if the handle was removed, otherwise False
|
|
63
|
+
"""
|
|
64
|
+
for listener in self._listeners:
|
|
65
|
+
if listener.handle is handle:
|
|
66
|
+
self._listeners.remove(listener)
|
|
67
|
+
return True
|
|
68
|
+
|
|
69
|
+
return False
|
|
70
|
+
|
|
71
|
+
def notify_listeners(self, topic: str, message: Optional[str] = None) -> None:
|
|
72
|
+
"""Calls the callback on all event listeners interested in the provided topic
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
topic (str): Topic
|
|
76
|
+
message (str): Message
|
|
77
|
+
"""
|
|
78
|
+
for listener in self._listeners:
|
|
79
|
+
if mqtt.topic_matches_sub(listener.topic, topic):
|
|
80
|
+
listener.callback(topic, message)
|