├── .idea
├── .name
├── .gitignore
├── vcs.xml
├── misc.xml
├── inspectionProfiles
│ └── profiles_settings.xml
├── modules.xml
└── ABB-Robot-Machine-Vision.iml
├── docs
├── build
│ ├── html
│ │ ├── _sources
│ │ │ ├── testfile.rst.txt
│ │ │ ├── help.rst.txt
│ │ │ ├── opencvtorapid.rst.txt
│ │ │ ├── open_cv_torapid.rst.txt
│ │ │ ├── robotware.rst.txt
│ │ │ ├── index.rst.txt
│ │ │ ├── installation.rst.txt
│ │ │ ├── camera.rst.txt
│ │ │ ├── license.rst.txt
│ │ │ ├── puck.rst.txt
│ │ │ ├── opencv_to_rapid.rst.txt
│ │ │ ├── imagefunctions.rst.txt
│ │ │ └── robotwebservices.rst.txt
│ │ ├── _static
│ │ │ ├── custom.css
│ │ │ ├── file.png
│ │ │ ├── plus.png
│ │ │ ├── minus.png
│ │ │ ├── documentation_options.js
│ │ │ ├── pygments.css
│ │ │ ├── doctools.js
│ │ │ └── underscore.js
│ │ ├── objects.inv
│ │ ├── .buildinfo
│ │ ├── help.html
│ │ ├── search.html
│ │ ├── robotware.html
│ │ ├── license.html
│ │ ├── index.html
│ │ ├── installation.html
│ │ ├── camera.html
│ │ ├── searchindex.js
│ │ ├── puck.html
│ │ ├── genindex.html
│ │ └── opencv_to_rapid.html
│ └── doctrees
│ │ ├── help.doctree
│ │ ├── puck.doctree
│ │ ├── camera.doctree
│ │ ├── index.doctree
│ │ ├── license.doctree
│ │ ├── environment.pickle
│ │ ├── imagefunctions.doctree
│ │ ├── installation.doctree
│ │ ├── opencv_to_rapid.doctree
│ │ └── robotwebservices.doctree
├── source
│ ├── help.rst
│ ├── index.rst
│ ├── installation.rst
│ ├── license.rst
│ ├── puck.rst
│ ├── conf.py
│ ├── opencv_to_rapid.rst
│ ├── imagefunctions.rst
│ └── robotwebservices.rst
├── Makefile
└── make.bat
├── .DS_Store
├── image_tools
├── cam_adjustments.ini
├── __pycache__
│ ├── Camera.cpython-37.pyc
│ ├── ImageFunctions.cpython-37.pyc
│ └── camera_correction.cpython-37.pyc
├── Camera.py
├── camera_correction.py
└── ImageFunctions.py
├── __pycache__
├── Puck.cpython-37.pyc
├── main.cpython-37.pyc
└── OpenCV_to_RAPID.cpython-37.pyc
├── RobotWebServices
├── __pycache__
│ └── RWS.cpython-37.pyc
├── API_Benchmark
│ ├── __pycache__
│ │ ├── com_testing.cpython-37.pyc
│ │ └── com_testing2.cpython-37.pyc
│ ├── com_testing2.py
│ └── com_testing.py
├── Stop_Norbert.py
└── Start_Norbert.py
├── Procedures.txt
├── PythonCom_lab.txt
├── main_lab.py
├── PythonCom.txt
├── Puck.py
├── cam_adjust_lab.py
└── OpenCV_to_RAPID.py
/.idea/.name:
--------------------------------------------------------------------------------
1 | ABB-Robot-Machine-Vision
--------------------------------------------------------------------------------
/docs/build/html/_sources/testfile.rst.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /workspace.xml
--------------------------------------------------------------------------------
/docs/build/html/_static/custom.css:
--------------------------------------------------------------------------------
1 | /* This file intentionally left blank. */
2 |
--------------------------------------------------------------------------------
/docs/source/help.rst:
--------------------------------------------------------------------------------
1 | Need Help?
2 | ==========
3 | You're on your own now, buddy.
4 |
--------------------------------------------------------------------------------
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/.DS_Store
--------------------------------------------------------------------------------
/docs/build/html/_sources/help.rst.txt:
--------------------------------------------------------------------------------
1 | Need Help?
2 | ==========
3 | You're on your own now, buddy.
4 |
--------------------------------------------------------------------------------
/docs/build/html/objects.inv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/docs/build/html/objects.inv
--------------------------------------------------------------------------------
/image_tools/cam_adjustments.ini:
--------------------------------------------------------------------------------
1 | [EXPOSURE]
2 | exposure = 26
3 |
4 | [SLOPE]
5 | slopex = 0.0230
6 | slopey = 0.0000
7 |
8 |
--------------------------------------------------------------------------------
/__pycache__/Puck.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/__pycache__/Puck.cpython-37.pyc
--------------------------------------------------------------------------------
/__pycache__/main.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/__pycache__/main.cpython-37.pyc
--------------------------------------------------------------------------------
/docs/build/doctrees/help.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/docs/build/doctrees/help.doctree
--------------------------------------------------------------------------------
/docs/build/doctrees/puck.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/docs/build/doctrees/puck.doctree
--------------------------------------------------------------------------------
/docs/build/html/_static/file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/docs/build/html/_static/file.png
--------------------------------------------------------------------------------
/docs/build/html/_static/plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/docs/build/html/_static/plus.png
--------------------------------------------------------------------------------
/docs/build/doctrees/camera.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/docs/build/doctrees/camera.doctree
--------------------------------------------------------------------------------
/docs/build/doctrees/index.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/docs/build/doctrees/index.doctree
--------------------------------------------------------------------------------
/docs/build/html/_static/minus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/docs/build/html/_static/minus.png
--------------------------------------------------------------------------------
/docs/build/doctrees/license.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/docs/build/doctrees/license.doctree
--------------------------------------------------------------------------------
/docs/build/doctrees/environment.pickle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/docs/build/doctrees/environment.pickle
--------------------------------------------------------------------------------
/__pycache__/OpenCV_to_RAPID.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/__pycache__/OpenCV_to_RAPID.cpython-37.pyc
--------------------------------------------------------------------------------
/docs/build/doctrees/imagefunctions.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/docs/build/doctrees/imagefunctions.doctree
--------------------------------------------------------------------------------
/docs/build/doctrees/installation.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/docs/build/doctrees/installation.doctree
--------------------------------------------------------------------------------
/docs/build/doctrees/opencv_to_rapid.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/docs/build/doctrees/opencv_to_rapid.doctree
--------------------------------------------------------------------------------
/docs/build/doctrees/robotwebservices.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/docs/build/doctrees/robotwebservices.doctree
--------------------------------------------------------------------------------
/RobotWebServices/__pycache__/RWS.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/RobotWebServices/__pycache__/RWS.cpython-37.pyc
--------------------------------------------------------------------------------
/image_tools/__pycache__/Camera.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/image_tools/__pycache__/Camera.cpython-37.pyc
--------------------------------------------------------------------------------
/image_tools/__pycache__/ImageFunctions.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/image_tools/__pycache__/ImageFunctions.cpython-37.pyc
--------------------------------------------------------------------------------
/image_tools/__pycache__/camera_correction.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/image_tools/__pycache__/camera_correction.cpython-37.pyc
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/RobotWebServices/API_Benchmark/__pycache__/com_testing.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/RobotWebServices/API_Benchmark/__pycache__/com_testing.cpython-37.pyc
--------------------------------------------------------------------------------
/RobotWebServices/API_Benchmark/__pycache__/com_testing2.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhiversflaten/ABB-Robot-Machine-Vision/HEAD/RobotWebServices/API_Benchmark/__pycache__/com_testing2.cpython-37.pyc
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/docs/build/html/.buildinfo:
--------------------------------------------------------------------------------
1 | # Sphinx build info version 1
2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3 | config: edb953329c4d8de3d9e5f3c318ba3efc
4 | tags: 645f666f9bcd5a90fca523b33c5a78b7
5 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/ABB-Robot-Machine-Vision.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/docs/build/html/_static/documentation_options.js:
--------------------------------------------------------------------------------
1 | var DOCUMENTATION_OPTIONS = {
2 | URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
3 | VERSION: '0.0.1',
4 | LANGUAGE: 'None',
5 | COLLAPSE_INDEX: false,
6 | FILE_SUFFIX: '.html',
7 | HAS_SOURCE: true,
8 | SOURCELINK_SUFFIX: '.txt',
9 | NAVIGATION_WITH_KEYS: false
10 | };
--------------------------------------------------------------------------------
/docs/build/html/_sources/opencvtorapid.rst.txt:
--------------------------------------------------------------------------------
1 | OpenCV_to_RAPID.py
2 | ==================
3 |
4 | .. py:function:: create_robtarget(gripper_height, gripper_rot, cam_pos, image, puck, cam_comp=False)
5 |
6 | Complete a series of transformations to finally create a robtarget of the puck's position from an image.
7 | These transformations are based on the setup at the University of Stavanger, and with a specific RobotStudio setup
8 | (in regards to coordinate systems). This Pack_ file includes this setup.
9 |
10 | _Pack: http://www.ux.uis.no/~karlsk/ELE610/UiS_E458_nov18.rspag
--------------------------------------------------------------------------------
/docs/build/html/_sources/open_cv_torapid.rst.txt:
--------------------------------------------------------------------------------
1 | OpenCV_to_RAPID.py
2 | ==================
3 |
4 | .. py:function:: create_robtarget(gripper_height, gripper_rot, cam_pos, image, puck, cam_comp=False)
5 |
6 | Complete a series of transformations to finally create a robtarget of the puck's position from an image.
7 | These transformations are based on the setup at the University of Stavanger, and with a specific RobotStudio setup
8 | (in regards to coordinate systems). This Pack_ file includes this setup.
9 |
10 | _Pack: http://www.ux.uis.no/~karlsk/ELE610/UiS_E458_nov18.rspag
--------------------------------------------------------------------------------
/RobotWebServices/Stop_Norbert.py:
--------------------------------------------------------------------------------
1 | from requests.auth import HTTPDigestAuth
2 | from RobotWebServices import RWS
3 |
4 | """Script to easily turn the motors off, on Norbert"""
5 |
6 | norbert = RWS.RWS()
7 |
8 | norbert_url = 'http://152.94.0.38'
9 | digest_auth = HTTPDigestAuth('Default User', 'robotics')
10 |
11 | payload = {'ctrl-state': 'motoroff'}
12 | resp = norbert.session.post(norbert_url + "/rw/panel/ctrlstate?action=setctrlstate", auth=digest_auth, data=payload)
13 |
14 | if resp.status_code == 204:
15 | print("Robot motors turned off")
16 | else:
17 | print("Could not turn off motors")
--------------------------------------------------------------------------------
/RobotWebServices/Start_Norbert.py:
--------------------------------------------------------------------------------
1 | from requests.auth import HTTPDigestAuth
2 | from RobotWebServices import RWS
3 |
4 | """Script to easily turn the motors on, on Norbert"""
5 |
6 | norbert = RWS.RWS()
7 |
8 | norbert_url = 'http://152.94.0.38'
9 | digest_auth = HTTPDigestAuth('Default User', 'robotics')
10 |
11 | payload = {'ctrl-state': 'motoron'}
12 | resp = norbert.session.post(norbert_url + "/rw/panel/ctrlstate?action=setctrlstate", auth=digest_auth, data=payload)
13 |
14 | if resp.status_code == 204:
15 | print("Robot motors turned on")
16 | else:
17 | print("Could not turn on motors. The controller might be in manual mode")
--------------------------------------------------------------------------------
/docs/build/html/_sources/robotware.rst.txt:
--------------------------------------------------------------------------------
1 | RobotWare
2 | =========
3 |
4 | .. py:function:: set_zonedata(self, var, zonedata)
5 |
6 | Set the value for a zonedata variable in RAPID.
7 | var: name of variable as declared in RAPID.
8 | zonedata: desired zonedata value [int].
9 |
10 | .. py:function:: set_speeddata(self, var, speeddata)
11 |
12 | Set the value [int] for a speeddata variable in RAPID.
13 | var: name of variable as declared in RAPID.
14 | speeddata: desired speeddata value [int].
15 |
16 | .. py:function:: set_speed_ratio(self, speed_ratio)
17 |
18 | Set the speed ratio of the robot.
19 | speed_ratio: desired speed ratio in percent [1-100].
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line, and also
5 | # from the environment for the first two.
6 | SPHINXOPTS ?=
7 | SPHINXBUILD ?= sphinx-build
8 | SOURCEDIR = source
9 | BUILDDIR = build
10 |
11 | # Put it first so that "make" without argument is like "make help".
12 | help:
13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 |
15 | .PHONY: help Makefile
16 |
17 | # Catch-all target: route all unknown targets to Sphinx using the new
18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19 | %: Makefile
20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21 |
--------------------------------------------------------------------------------
/docs/source/index.rst:
--------------------------------------------------------------------------------
1 | .. test-project documentation master file, created by
2 | sphinx-quickstart on Thu Apr 2 11:32:07 2020.
3 | You can adapt this file completely to your liking, but it should at least
4 | contain the root `toctree` directive.
5 |
6 | ABB Robot with Machine Vision
7 | =============================
8 |
9 | This software is mainly directed toward engineering
10 | students and staff at the University of Stavanger.
11 | It was first created as a Bachelor thesis work.
12 |
13 | User Guide
14 | ^^^^^^^^^^
15 |
16 | .. toctree::
17 | :maxdepth: 2
18 |
19 | license
20 | installation
21 | robotwebservices
22 | imagefunctions
23 | opencv_to_rapid
24 | puck
25 | help
26 |
27 |
28 | Indices
29 | =======
30 |
31 | * :ref:`genindex`
32 | * :ref:`search`
33 |
--------------------------------------------------------------------------------
/docs/source/installation.rst:
--------------------------------------------------------------------------------
1 | Installation
2 | ============
3 |
4 | This documentation covers the source code used in a demonstration program at the University of Stavanger.
5 | This includes a pip installable package, rwsuis_, which is covered in :ref:`RobotWebServices`.
6 |
7 | .. _rwsuis: https://pypi.org/project/rwsuis/
8 |
9 | Here are the different ways of acquiring the software.
10 |
11 | $ pip install
12 | ^^^^^^^^^^^^^
13 |
14 | | To install the rwsuis_ package, simply run this command in your terminal of choice:
15 |
16 | ::
17 |
18 | pip install rwsuis
19 |
20 | Get the source code
21 | ^^^^^^^^^^^^^^^^^^^
22 |
23 | | All code from the docs is on GitHub, and the public repository can be cloned:
24 |
25 | ::
26 |
27 | git clone https://github.com/prinsWindy/ABB-Robot-Machine-Vision.git
28 |
--------------------------------------------------------------------------------
/docs/build/html/_sources/index.rst.txt:
--------------------------------------------------------------------------------
1 | .. test-project documentation master file, created by
2 | sphinx-quickstart on Thu Apr 2 11:32:07 2020.
3 | You can adapt this file completely to your liking, but it should at least
4 | contain the root `toctree` directive.
5 |
6 | ABB Robot with Machine Vision
7 | =============================
8 |
9 | This software is mainly directed toward engineering
10 | students and staff at the University of Stavanger.
11 | It was first created as a Bachelor thesis work.
12 |
13 | User Guide
14 | ^^^^^^^^^^
15 |
16 | .. toctree::
17 | :maxdepth: 2
18 |
19 | license
20 | installation
21 | robotwebservices
22 | imagefunctions
23 | opencv_to_rapid
24 | puck
25 | help
26 |
27 |
28 | Indices
29 | =======
30 |
31 | * :ref:`genindex`
32 | * :ref:`search`
33 |
--------------------------------------------------------------------------------
/docs/build/html/_sources/installation.rst.txt:
--------------------------------------------------------------------------------
1 | Installation
2 | ============
3 |
4 | This documentation covers the source code used in a demonstration program at the University of Stavanger.
5 | This includes a pip installable package, rwsuis_, which is covered in :ref:`RobotWebServices`.
6 |
7 | .. _rwsuis: https://pypi.org/project/rwsuis/
8 |
9 | Here are the different ways of acquiring the software.
10 |
11 | $ pip install
12 | ^^^^^^^^^^^^^
13 |
14 | | To install the rwsuis_ package, simply run this command in your terminal of choice:
15 |
16 | ::
17 |
18 | pip install rwsuis
19 |
20 | Get the source code
21 | ^^^^^^^^^^^^^^^^^^^
22 |
23 | | All code from the docs is on GitHub, and the public repository can be cloned:
24 |
25 | ::
26 |
27 | git clone https://github.com/prinsWindy/ABB-Robot-Machine-Vision.git
28 |
--------------------------------------------------------------------------------
/docs/make.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | pushd %~dp0
4 |
5 | REM Command file for Sphinx documentation
6 |
7 | if "%SPHINXBUILD%" == "" (
8 | set SPHINXBUILD=sphinx-build
9 | )
10 | set SOURCEDIR=source
11 | set BUILDDIR=build
12 |
13 | if "%1" == "" goto help
14 |
15 | %SPHINXBUILD% >NUL 2>NUL
16 | if errorlevel 9009 (
17 | echo.
18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19 | echo.installed, then set the SPHINXBUILD environment variable to point
20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you
21 | echo.may add the Sphinx directory to PATH.
22 | echo.
23 | echo.If you don't have Sphinx installed, grab it from
24 | echo.http://sphinx-doc.org/
25 | exit /b 1
26 | )
27 |
28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29 | goto end
30 |
31 | :help
32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33 |
34 | :end
35 | popd
36 |
--------------------------------------------------------------------------------
/docs/build/html/_sources/camera.rst.txt:
--------------------------------------------------------------------------------
1 | Camera Class
2 | ============
3 |
4 | .. py:class:: Camera(cam_ID=0)
5 |
6 | The Camera class contains methods specifically meant for the University of Stavanger.
7 | These functions have only been tested on a IDS UI-1007XS-C camera, and might not work
8 | as intended on other models.
9 |
10 | Quickstart
11 | ^^^^^^^^^^
12 |
13 | .. code-block:: python
14 |
15 | # Initialization
16 | cam = Camera()
17 | cam.init()
18 | cam.set_parameters()
19 | cam.allocate_memory()
20 | cam.capture_video()
21 |
22 | # Show video
23 | img = cam.get_image()
24 | cv2.imshow("Quickstart", img)
25 | if cv2.waitKey(1) & 0xFF == ord('q'):
26 | cv2.destroyAllWindows()
27 | break
28 |
29 | cam.exit_camera()
30 |
31 | The parameters set are not currently configurable through method inputs.
32 | They are specifically set for laboratory work at the University of Stavanger.
33 |
--------------------------------------------------------------------------------
/docs/source/license.rst:
--------------------------------------------------------------------------------
1 | License
2 | =======
3 |
4 | Copyright 2020 Markus H. Iversflaten & Ole Christian Handegård
5 |
6 | Permission is hereby granted, free of charge,
7 | to any person obtaining a copy of this software
8 | and associated documentation files (the "Software"),
9 | to deal in the Software without restriction, including
10 | without limitation the rights to use, copy, modify, merge,
11 | publish, distribute, sublicense, and/or sell copies of the
12 | Software, and to permit persons to whom the Software is
13 | furnished to do so, subject to the following conditions:
14 |
15 | The above copyright notice and this permission notice shall be included in
16 | all copies or substantial portions of the Software.
17 |
18 |
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | THE SOFTWARE.
26 |
--------------------------------------------------------------------------------
/docs/build/html/_sources/license.rst.txt:
--------------------------------------------------------------------------------
1 | License
2 | =======
3 |
4 | Copyright 2020 Markus H. Iversflaten & Ole Christian Handegård
5 |
6 | Permission is hereby granted, free of charge,
7 | to any person obtaining a copy of this software
8 | and associated documentation files (the "Software"),
9 | to deal in the Software without restriction, including
10 | without limitation the rights to use, copy, modify, merge,
11 | publish, distribute, sublicense, and/or sell copies of the
12 | Software, and to permit persons to whom the Software is
13 | furnished to do so, subject to the following conditions:
14 |
15 | The above copyright notice and this permission notice shall be included in
16 | all copies or substantial portions of the Software.
17 |
18 |
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | THE SOFTWARE.
26 |
--------------------------------------------------------------------------------
/docs/source/puck.rst:
--------------------------------------------------------------------------------
1 | .. _Puck:
2 |
3 | Puck Class
4 | ==========
5 |
6 | .. py:class:: Puck(number, position, angle, height=30)
7 |
8 | .. py:method:: set_position(position)
9 |
10 | Updates :py:class:`Puck` position.
11 |
12 | :param float[] position: New :py:class:`Puck` position [x,y]
13 |
14 | .. py:method:: set_angle(angle)
15 |
16 | Updates :py:class:`Puck` angle.
17 |
18 | :param float[] angle: New :py:class:`Puck` angle
19 |
20 | .. py:method:: set_height(height)
21 |
22 | Updates :py:class:`Puck` height.
23 |
24 | :param float[] height: New :py:class:`Puck` height
25 |
26 | .. py:method:: get_xyz()
27 |
28 | Gets true position of :py:class:`Puck` ([x,y,z] on the work object).
29 |
30 | :returns: :py:class:`Puck` position [x,y,z]
31 |
32 | .. py:method:: check_collision(puck_list)
33 |
34 | Finds an angle of rotation for the gripper which avoids
35 | collisions between the gripper and other pucks
36 | when sliding in to pick up a puck.
37 |
38 | :param Puck[] puck_list: List of all :py:class:`Puck` objects
39 |
40 | :return: Rotation which yields no collision
41 | :return: If puck should be gripped forward or backward
42 |
--------------------------------------------------------------------------------
/docs/build/html/_sources/puck.rst.txt:
--------------------------------------------------------------------------------
1 | .. _Puck:
2 |
3 | Puck Class
4 | ==========
5 |
6 | .. py:class:: Puck(number, position, angle, height=30)
7 |
8 | .. py:method:: set_position(position)
9 |
10 | Updates :py:class:`Puck` position.
11 |
12 | :param float[] position: New :py:class:`Puck` position [x,y]
13 |
14 | .. py:method:: set_angle(angle)
15 |
16 | Updates :py:class:`Puck` angle.
17 |
18 | :param float[] angle: New :py:class:`Puck` angle
19 |
20 | .. py:method:: set_height(height)
21 |
22 | Updates :py:class:`Puck` height.
23 |
24 | :param float[] height: New :py:class:`Puck` height
25 |
26 | .. py:method:: get_xyz()
27 |
28 | Gets true position of :py:class:`Puck` ([x,y,z] on the work object).
29 |
30 | :returns: :py:class:`Puck` position [x,y,z]
31 |
32 | .. py:method:: check_collision(puck_list)
33 |
34 | Finds an angle of rotation for the gripper which avoids
35 | collisions between the gripper and other pucks
36 | when sliding in to pick up a puck.
37 |
38 | :param Puck[] puck_list: List of all :py:class:`Puck` objects
39 |
40 | :return: Rotation which yields no collision
41 | :return: If puck should be gripped forward or backward
42 |
--------------------------------------------------------------------------------
/RobotWebServices/API_Benchmark/com_testing2.py:
--------------------------------------------------------------------------------
1 | from locust import HttpLocust, TaskSequence, task, between, seq_task, constant
2 | import random
3 | from requests.auth import HTTPDigestAuth
4 |
5 |
6 | class UserBehavior(TaskSequence):
7 | """Used for testing communication between Python and RAPID (RobotWare) through the use of RobotWebServices
8 | and REST API"""
9 |
10 | def on_start(self):
11 | pass
12 |
13 | def on_stop(self):
14 | pass
15 |
16 | @seq_task(1)
17 | def motorson(self):
18 | """Turns the motors on"""
19 | payload = {'ctrl-state': 'motoron'}
20 | self.client.post("/rw/panel/ctrlstate?action=setctrlstate",
21 | auth=HTTPDigestAuth(username='Default User', password='robotics'), data=payload)
22 |
23 | @seq_task(2)
24 | def motorsoff(self):
25 | """Turns the motors off"""
26 | payload = {'ctrl-state': 'motoroff'}
27 | self.client.post("/rw/panel/ctrlstate?action=setctrlstate&",
28 | auth=HTTPDigestAuth(username='Default User', password='robotics'), data=payload)
29 |
30 |
31 | class WebsiteUser(HttpLocust):
32 | task_set = UserBehavior
33 |
34 | # Wait time between requests
35 | wait_time = constant(2)
36 |
37 |
38 | """To run the test, type the following in console: locust -f RobotWebServices/API_Benchmark/com_testing2.py
39 | Open localhost:8089 to get to the http page to spawn users and decide spawn rate and address"""
--------------------------------------------------------------------------------
/Procedures.txt:
--------------------------------------------------------------------------------
1 | MODULE Procedures
2 |
3 | TASK PERS wobjdata wobjTableN:=[FALSE,TRUE,"",[[150,-500,8],[0.707106781,0,0,-0.707106781]],[[0,0,0],[1,0,0,0]]];
4 | PERS tooldata tGripper:=[TRUE,[[0,0,114.25],[0,0,0,1]],[1,[-0.095984607,0.082520613,38.69176324],[1,0,0,0],0,0,0]];
5 |
6 |
7 | PROC wait_for_python()
8 | ! wait for python to finish processing image
9 | WHILE NOT image_processed DO
10 | ENDWHILE
11 | image_processed:=FALSE;
12 | ENDPROC
13 |
14 |
15 | ! Pick up puck
16 | PROC getPuckSmoothly(robtarget puck_position)
17 |
18 | MoveL Offs(puck_position, -gripper_camera_offset{1}, -gripper_camera_offset{2}, gripHeight),vSpeed,z50,tGripper\WObj:=wobjTableN;
19 | MoveL Offs(puck_position, 0, 0, gripHeight),v400,fine,tGripper\WObj:=wobjTableN;
20 | closeGripper(TRUE);
21 | MoveL Offs(puck_position, 0, 0, gripHeight + 30),vSpeed,z5,tGripper\WObj:=wobjTableN;
22 |
23 | ENDPROC
24 |
25 |
26 | ! Place puck
27 | PROC putPuckSmoothly(robtarget toTarget, num angle)
28 |
29 | toTarget.rot := OrientZYX(-angle, 0, 180);
30 | MoveJ Offs(toTarget, 0, 0, gripHeight + 30),vSpeed,z10,tGripper\WObj:=wobjTableN;
31 | MoveJ Offs(toTarget, 0, 0, gripHeight + 10),vSpeed,z10,tGripper\WObj:=wobjTableN;
32 | MoveL Offs(toTarget, 0, 0, gripHeight),v200,fine,tGripper\WObj:=wobjTableN;
33 | closeGripper(FALSE);
34 | MoveJ Offs(toTarget, 0, 0, safeHeight),vSpeed,z5,tGripper\WObj:=wobjTableN;
35 |
36 | ENDPROC
37 |
38 |
39 | PROC closeGripper(bool state)
40 | WaitTime 0.1;
41 | IF state=TRUE THEN
42 | setDO PneumaticGripper, 1;
43 | ELSEIF state=FALSE THEN
44 | setDO PneumaticGripper, 0;
45 | ENDIF
46 | WaitTime 0.2;
47 | ENDPROC
48 |
49 | ENDMODULE
--------------------------------------------------------------------------------
/docs/source/conf.py:
--------------------------------------------------------------------------------
1 | # Configuration file for the Sphinx documentation builder.
2 | #
3 | # This file only contains a selection of the most common options. For a full
4 | # list see the documentation:
5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html
6 |
7 | # -- Path setup --------------------------------------------------------------
8 |
9 | # If extensions (or modules to document with autodoc) are in another directory,
10 | # add these directories to sys.path here. If the directory is relative to the
11 | # documentation root, use os.path.abspath to make it absolute, like shown here.
12 | #
13 | # import os
14 | # import sys
15 | # sys.path.insert(0, os.path.abspath('.'))
16 |
17 |
18 | # -- Project information -----------------------------------------------------
19 |
20 | project = 'ABB-Robot-Machine-Vision'
21 | copyright = '2020, Markus Iversflaten & Ole Christian Handegård'
22 | author = 'Markus Iversflaten & Ole Christian Handegård'
23 |
24 | # The full version, including alpha/beta/rc tags
25 | release = '0.0.1'
26 |
27 |
28 | # -- General configuration ---------------------------------------------------
29 |
30 | # Add any Sphinx extension module names here, as strings. They can be
31 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
32 | # ones.
33 | extensions = [
34 | ]
35 |
36 | # Our project uses 'index.rst', not 'contents.rst' which is default
37 | master_doc = 'index'
38 |
39 | # Add any paths that contain templates here, relative to this directory.
40 | templates_path = ['_templates']
41 |
42 | # List of patterns, relative to source directory, that match files and
43 | # directories to ignore when looking for source files.
44 | # This pattern also affects html_static_path and html_extra_path.
45 | exclude_patterns = []
46 |
47 |
48 | # -- Options for HTML output -------------------------------------------------
49 |
50 | # The theme to use for HTML and HTML Help pages. See the documentation for
51 | # a list of builtin themes.
52 | #
53 | html_theme = 'alabaster'
54 |
55 | # Add any paths that contain custom static files (such as style sheets) here,
56 | # relative to this directory. They are copied after the builtin static files,
57 | # so a file named "default.css" will overwrite the builtin "default.css".
58 | html_static_path = ['_static']
--------------------------------------------------------------------------------
/RobotWebServices/API_Benchmark/com_testing.py:
--------------------------------------------------------------------------------
1 | from locust import HttpLocust, TaskSet, task, between
2 | import random
3 | from requests.auth import HTTPDigestAuth
4 |
5 |
6 | class UserBehavior(TaskSet):
7 | """Used for testing communication between Python and RAPID (RobotWare) through the use of RobotWebServices
8 | and REST API"""
9 |
10 | def on_start(self):
11 | pass
12 |
13 | def on_stop(self):
14 | pass
15 |
16 | @task(1)
17 | def executionstate(self):
18 | """Get the state of the controller"""
19 |
20 | self.client.get('/rw/rapid/execution', auth=HTTPDigestAuth(username='Default User', password='robotics'))
21 |
22 | @task(1)
23 | def setrapidvariable(self):
24 | """Sets the *locust* variable to a random value"""
25 |
26 | # TODO: test with both a set variable and also with a random variable, see any difference in timings?
27 | value = random.randint(0,100)
28 | locustvar = "locustvar"
29 | payload = {'value': value}
30 | self.client.post('/rw/rapid/symbol/data/RAPID/T_ROB1/' + locustvar + '?action=set',
31 | auth=HTTPDigestAuth(username='Default User', password='robotics'), data=payload)
32 |
33 | @task(1)
34 | def getrapidvariable(self):
35 | """Reading the locust variable"""
36 |
37 | locustvar = "locustvar"
38 | payload = {'value': 6}
39 | self.client.get('/rw/rapid/symbol/data/RAPID/T_ROB1/' + locustvar + ';value',
40 | auth=HTTPDigestAuth(username='Default User', password='robotics'), data=payload)
41 |
42 | @task(1)
43 | def getgripperpos(self):
44 | """Reading the current gripper position"""
45 |
46 | self.client.get('/rw/motionsystem/mechunits/ROB_1/robtarget/?tool=tGripper&wobj=wobjTableN&coordinate=Wobj',
47 | auth=HTTPDigestAuth(username='Default User', password='robotics'))
48 |
49 | @task(1)
50 | def setrobtarget(self):
51 | """Setting the *locustrobtarg* to a specific value"""
52 |
53 | locustrobtarg = "locustrobtarg"
54 | payload = {'value': "[[0,0,100],[0,1,0,0],[-1,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]]"}
55 | self.client.post('/rw/rapid/symbol/data/RAPID/T_ROB1/' + locustrobtarg + '?action=set',
56 | auth=HTTPDigestAuth(username='Default User', password='robotics'), data=payload)
57 |
58 | class WebsiteUser(HttpLocust):
59 | task_set = UserBehavior
60 |
61 | # Wait time between each request
62 | wait_time = between(0.01, 0.015)
63 |
64 |
65 | """To run the test, type the following in console: locust -f RobotWebServices/API_Benchmark/com_testing.py
66 | Open localhost:8089 to get to the http page to spawn users and decide spawn rate and address"""
67 |
--------------------------------------------------------------------------------
/PythonCom_lab.txt:
--------------------------------------------------------------------------------
1 | MODULE PythonCom
2 |
3 | VAR num WPW:=0; ! What Python Wants
4 | VAR num WRD:=0; ! What RAPID Does
5 | VAR bool ready_flag:= FALSE; ! RAPID's ready flag
6 | VAR bool image_processed:= FALSE; ! Python's ready flag
7 | CONST num gripHeight:= 10;
8 | CONST num safeHeight:= 60; ! Close-up image height
9 |
10 | ! Where the selected puck is located
11 | VAR robtarget puck_target := [[0,0,200],[0,1,0,0],[-1,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
12 |
13 | VAR robtarget put_puck_target; ! Target used to place puck
14 | VAR num puck_angle; ! Angle puck should be rotated (optional)
15 |
16 | CONST robtarget middleOfTable:=[[0,0,0],[0,1,0,0],[-1,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
17 |
18 | ! Overview image position
19 | VAR robtarget overview:=[[0,0,500],[0,1,0,0],[-1,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
20 |
21 | TASK PERS wobjdata wobjTableN:=[FALSE,TRUE,"",[[150,-500,8],[0.707106781,0,0,-0.707106781]],[[0,0,0],[1,0,0,0]]];
22 | PERS tooldata tGripper:=[TRUE,[[0,0,114.25],[0,0,0,1]],[1,[-0.095984607,0.082520613,38.69176324],[1,0,0,0],0,0,0]];
23 |
24 | PROC main()
25 |
26 | closeGripper(FALSE);
27 | MoveJ overview,v100,z10,tGripper\WObj:=wobjTableN;
28 |
29 | ready_flag:=TRUE;
30 |
31 | WHILE TRUE DO
32 |
33 | IF WPW <> 0 THEN
34 | WRD:=WPW;
35 | WPW:=0;
36 |
37 | TEST WRD
38 |
39 | CASE 1:
40 | !!!!!!!!!!!!!!!!!!!!!!!!
41 | ! Move a chosen puck !
42 | !!!!!!!!!!!!!!!!!!!!!!!!
43 | !---insert code here---!
44 |
45 | CASE 2:
46 | !!!!!!!!!!!!!!!!!!!!!!!!
47 | ! Stack pucks !
48 | !!!!!!!!!!!!!!!!!!!!!!!!
49 | !---insert code here---!
50 |
51 | ENDTEST
52 | ENDIF
53 | WRD:=0;
54 | ENDWHILE
55 | ENDPROC
56 |
57 |
58 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
59 | ! Gather/Pick up puck function is needed !
60 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
61 | !------------insert code here------------!
62 |
63 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
64 | ! Place puck function is needed !
65 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
66 | !--------insert code here-------!
67 |
68 | ! wait for python to finish processing image
69 | PROC wait_for_python()
70 | WHILE NOT image_processed DO
71 | ENDWHILE
72 | image_processed:=FALSE;
73 | ENDPROC
74 |
75 | ! Function to open / close the gripper
76 | PROC closeGripper(bool state)
77 | WaitTime 0.1;
78 | IF state=TRUE THEN
79 | setDO PneumaticGripper, 1;
80 | ELSEIF state=FALSE THEN
81 | setDO PneumaticGripper, 0;
82 | ENDIF
83 | WaitTime 0.2;
84 | ENDPROC
85 |
86 | ENDMODULE
--------------------------------------------------------------------------------
/docs/source/opencv_to_rapid.rst:
--------------------------------------------------------------------------------
1 | OpenCV_to_RAPID.py
2 | ==================
3 |
4 | .. py:function:: create_robtarget(gripper_height, gripper_rot, cam_pos, image, puck, cam_comp=False)
5 |
6 | Complete a series of transformations to finally create a robtarget of the puck's position from an image.
7 | These transformations are based on the setup at the University of Stavanger, and with a specific RobotStudio setup
8 | (in regards to coordinate systems). This `Pack and Go`_ file includes this setup.
9 |
10 | :param float gripper_height: Height of gripper above work object
11 | :param tuple gripper_rot: Orientation of gripper, must be a Quaternion (tuple of length 4)
12 | :param float[] cam_pos: Camera position [x,y]
13 | :param ndarray image: An image
14 | :param Puck puck: A :py:class:`Puck` object
15 | :param bool cam_comp: Running camera_adjustment?
16 |
17 | :return: A :py:class:`Puck` object with robtarget as position
18 |
19 | .. _Pack and Go: http://www.ux.uis.no/~karlsk/ELE610/UiS_E458_nov18.rspag
20 |
21 | .. py:function:: transform_position(gripper_rot, puck)
22 |
23 | Transform coordinate system given by image in OpenCV to coordinate system of work object in RAPID.
24 | Swap x & y coordinates and rotate by the same amount that the camera has been rotated.
25 |
26 | :param tuple gripper_rot: Orientation of gripper, must be a Quaternion (tuple of length 4)
27 | :param Puck puck: A :py:class:`Puck` object
28 |
29 | .. py:function:: pixel_to_mm(gripper_height, puck, image)
30 |
31 | Converts coordinates in image from pixels to millimeters.
32 | This depends on the camera's working distance.
33 |
34 | :param float gripper_height: Height of gripper above work object
35 | :param Puck puck: A :py:class:`Puck` object
36 | :param ndarray image: An image
37 |
38 | .. py:function:: overshoot_comp(gripper_height, puck)
39 |
40 | Compensate for the overshoot phenomenon which occurs when trying to pinpoint
41 | the location of a 3D object in a 2D image.
42 |
43 | :param float gripper_height: Height of gripper above work object
44 | :param Puck puck: A :py:class:`Puck` object
45 |
46 | .. py:function:: camera_compensation(gripper_height, gripper_rot, puck)
47 |
48 | Compensate for an angled camera view. Different cameras will be
49 | angled differently both internally and externally when mounted to a surface.
50 | The slope values must first be calculated by running *camera_adjustment*.
51 | Works with any camera orientation.
52 |
53 | :param float gripper_height: Height of gripper above work object
54 | :param tuple gripper_rot: Orientation of gripper, must be a Quaternion (tuple of length 4)
55 | :param Puck puck: A :py:class:`Puck` object
56 |
57 | .. py:function:: get_camera_position(trans, rot)
58 |
59 | Uses the offset between the gripper and camera to find the camera's position.
60 | `Robot Web Services`_
61 |
62 | :param float[] trans: Position of gripper
63 | :param tuple rot: Orientation of gripper, must be a Quaternion (tuple of length 4)
64 |
65 | :returns: Position of camera
--------------------------------------------------------------------------------
/docs/build/html/_sources/opencv_to_rapid.rst.txt:
--------------------------------------------------------------------------------
1 | OpenCV_to_RAPID.py
2 | ==================
3 |
4 | .. py:function:: create_robtarget(gripper_height, gripper_rot, cam_pos, image, puck, cam_comp=False)
5 |
6 | Complete a series of transformations to finally create a robtarget of the puck's position from an image.
7 | These transformations are based on the setup at the University of Stavanger, and with a specific RobotStudio setup
8 | (in regards to coordinate systems). This `Pack and Go`_ file includes this setup.
9 |
10 | :param float gripper_height: Height of gripper above work object
11 | :param tuple gripper_rot: Orientation of gripper, must be a Quaternion (tuple of length 4)
12 | :param float[] cam_pos: Camera position [x,y]
13 | :param ndarray image: An image
14 | :param Puck puck: A :py:class:`Puck` object
15 | :param bool cam_comp: Running camera_adjustment?
16 |
17 | :return: A :py:class:`Puck` object with robtarget as position
18 |
19 | .. _Pack and Go: http://www.ux.uis.no/~karlsk/ELE610/UiS_E458_nov18.rspag
20 |
21 | .. py:function:: transform_position(gripper_rot, puck)
22 |
23 | Transform coordinate system given by image in OpenCV to coordinate system of work object in RAPID.
24 | Swap x & y coordinates and rotate by the same amount that the camera has been rotated.
25 |
26 | :param tuple gripper_rot: Orientation of gripper, must be a Quaternion (tuple of length 4)
27 | :param Puck puck: A :py:class:`Puck` object
28 |
29 | .. py:function:: pixel_to_mm(gripper_height, puck, image)
30 |
31 | Converts coordinates in image from pixels to millimeters.
32 | This depends on the camera's working distance.
33 |
34 | :param float gripper_height: Height of gripper above work object
35 | :param Puck puck: A :py:class:`Puck` object
36 | :param ndarray image: An image
37 |
38 | .. py:function:: overshoot_comp(gripper_height, puck)
39 |
40 | Compensate for the overshoot phenomenon which occurs when trying to pinpoint
41 | the location of a 3D object in a 2D image.
42 |
43 | :param float gripper_height: Height of gripper above work object
44 | :param Puck puck: A :py:class:`Puck` object
45 |
46 | .. py:function:: camera_compensation(gripper_height, gripper_rot, puck)
47 |
48 | Compensate for an angled camera view. Different cameras will be
49 | angled differently both internally and externally when mounted to a surface.
50 | The slope values must first be calculated by running *camera_adjustment*.
51 | Works with any camera orientation.
52 |
53 | :param float gripper_height: Height of gripper above work object
54 | :param tuple gripper_rot: Orientation of gripper, must be a Quaternion (tuple of length 4)
55 | :param Puck puck: A :py:class:`Puck` object
56 |
57 | .. py:function:: get_camera_position(trans, rot)
58 |
59 | Uses the offset between the gripper and camera to find the camera's position.
60 | `Robot Web Services`_
61 |
62 | :param float[] trans: Position of gripper
63 | :param tuple rot: Orientation of gripper, must be a Quaternion (tuple of length 4)
64 |
65 | :returns: Position of camera
--------------------------------------------------------------------------------
/docs/build/html/help.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
42 | Please activate JavaScript to enable the search
43 | functionality.
44 |
45 |
46 |
47 | From here you can search these documents. Enter your search
48 | words into the box below and click "search". Note that the search
49 | function will automatically search for all of the words. Pages
50 | containing fewer words won't appear in the result list.
51 |
Copyright 2020 Markus H. Iversflaten & Ole Christian Handegård
38 |
Permission is hereby granted, free of charge,
39 | to any person obtaining a copy of this software
40 | and associated documentation files (the “Software”),
41 | to deal in the Software without restriction, including
42 | without limitation the rights to use, copy, modify, merge,
43 | publish, distribute, sublicense, and/or sell copies of the
44 | Software, and to permit persons to whom the Software is
45 | furnished to do so, subject to the following conditions:
46 |
The above copyright notice and this permission notice shall be included in
47 | all copies or substantial portions of the Software.
48 |
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
49 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
50 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
51 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
52 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
53 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
54 | THE SOFTWARE.
This software is mainly directed toward engineering
37 | students and staff at the University of Stavanger.
38 | It was first created as a Bachelor thesis work.
This documentation covers the source code used in a demonstration program at the University of Stavanger.
38 | This includes a pip installable package, rwsuis, which is covered in Robot Web Services.
39 |
Here are the different ways of acquiring the software.
122 |
133 |
134 |
135 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/cam_adjust_lab.py:
--------------------------------------------------------------------------------
1 | import os
2 | import numpy as np
3 |
4 | robtarget_pucks = []
5 |
6 | #########################################################
7 | # First, use OpenCV to initialize the camera #
8 | # or use the Camera class given if you #
9 | # prefer to use uEye API #
10 | #########################################################
11 | # ----------------insert code here--------------------- #
12 |
13 | #########################################################
14 | # Second, initialize robot communication, #
15 | # and execute RAPID program #
16 | # (Create RWS object) #
17 | #########################################################
18 | # ----------------insert code here--------------------- #
19 |
20 |
21 | """This will (when completed) calculate the slope which represents how much the lens of the camera is angled.
22 | This should be done by comparing two images taken from different heights.
23 | """
24 | print("---Running camera_adjustment---")
25 |
26 | # Creating a text file for calculations done throughout this program.
27 | # Will be closed and disappear after program is finished
28 | adjustment_file = open('camera_adjustment_XS.txt', 'w')
29 |
30 | #########################################################
31 | # Create a loop where you compare a certain #
32 | # amount of images and check if robot is running #
33 | #########################################################
34 | # ----------------insert code here--------------------- #
35 |
36 | i = 0
37 | while i < 5: # Compare images 5 times
38 | i += 1
39 |
40 | #########################################################
41 | # Start the camera adjustment CASE in RAPID #
42 | # remember to wait for RAPID after entering the case #
43 | #########################################################
44 | # ----------------insert code here--------------------- #
45 |
46 | #########################################################
47 | # Capture image, process it and scan it for QR codes #
48 | # Do this several times if no QR code is found #
49 | #########################################################
50 | # ----------------insert code here--------------------- #
51 |
52 | #########################################################
53 | # Create a robtarget from the QR codes' position #
54 | #########################################################
55 | # ----------------insert code here--------------------- #
56 |
57 | #########################################################
58 | # Send the robtarget to RAPID #
59 | #########################################################
60 | # ----------------insert code here--------------------- #
61 |
62 | #########################################################
63 | # Tell RAPID to move to a close-up image position #
64 | # (Update flag variable) #
65 | #########################################################
66 | # ----------------insert code here--------------------- #
67 |
68 | #########################################################
69 | # Wait for robot to reach close-up position #
70 | # Capture image, process it and scan it for QR codes #
71 | # Do this several times if no QR code is found #
72 | #########################################################
73 | # ----------------insert code here--------------------- #
74 |
75 | #########################################################
76 | # Create a robtarget #
77 | # from the QR codes' position #
78 | #########################################################
79 | # ----------------insert code here--------------------- #
80 |
81 | #########################################################
82 | # Save the translation of the "low" robtarget #
83 | # (will be used later to calculate slope) #
84 | #########################################################
85 | # ----------------insert code here--------------------- #
86 |
87 | #########################################################
88 | # Tell RAPID to go straight up to new height #
89 | # (Update flag variable) #
90 | #########################################################
91 | # ----------------insert code here--------------------- #
92 |
93 | #########################################################
94 | # Again, capture an image and calculate the robtarget #
95 | # (as done in previous steps) #
96 | #########################################################
97 | # ----------------insert code here--------------------- #
98 |
99 | #########################################################
100 | # Save the translation of the "high" robtarget puck #
101 | # (will be used later to calculate slope) #
102 | #########################################################
103 | # ----------------insert code here--------------------- #
104 |
105 | ###########################################################
106 | # Calculate the delta height, as well as the #
107 | # delta in both x and y position #
108 | # (Compare the "high" robtarget with the "low" robtarget) #
109 | ###########################################################
110 | # -----------------insert code here---------------------- #
111 |
112 | #########################################################
113 | # Find the slope in both x and y direction #
114 | #########################################################
115 | # ----------------insert code here--------------------- #
116 | slope_x = None
117 | slope_y = None
118 |
119 | # Write all slope values to .txt-file
120 | adjustment_file.write(f'{slope_x:.4f},{slope_y:.4f}\n')
121 |
122 | adjustment_file.close()
123 |
124 | contents = np.genfromtxt(r'camera_adjustment_XS.txt', delimiter=',')
125 | os.remove('camera_adjustment_XS.txt')
126 |
127 | sum_slope_x = 0
128 | sum_slope_y = 0
129 | for content in contents:
130 | sum_slope_x += content[0]
131 | sum_slope_y += content[1]
132 |
133 | average_slope_x = sum_slope_x / len(contents)
134 | average_slope_y = sum_slope_y / len(contents)
135 | """These slopes is what you will need to compensate for
136 | the camera position error for more accurate picking."""
137 |
--------------------------------------------------------------------------------
/docs/source/robotwebservices.rst:
--------------------------------------------------------------------------------
1 | .. _RobotWebServices:
2 |
3 | Robot Web Services
4 | ==================
5 |
6 | This section covers the communication between Python and *RobotWare*. A package, rwsuis_,
7 | is pip installable and includes all functions provided in this section.
8 |
9 | .. _rwsuis: https://pypi.org/project/rwsuis/
10 |
11 | .. _RWS:
12 |
13 | RWS Class
14 | ^^^^^^^^^
15 |
16 | Take full control of ABB robots through HTTP requests, made easy with the RWS class.
17 | Robot operating mode should be automatic.
18 |
19 | ::
20 |
21 | >>> robot = RWS.RWS(base_url='robot_IP', username='user', password='pass')
22 | >>> robot.request_mastership()
23 | >>> robot.motors_on()
24 | Robot motors turned on
25 | >>> robot.start_rapid()
26 | RAPID execution started from main
27 |
28 | .. py:class:: RWS(base_url, username, password)
29 |
30 | .. py:method:: motors_on(self)
31 |
32 | Sends a request to turn the robot's motors on. Mastership is required.
33 | Prints a message to the console stating whether or not the motors were in fact turned on.
34 |
35 | .. py:method:: motors_off(self)
36 |
37 | Sends a request to turn the robot's motors off. Mastership is required.
38 | Prints a message to the console stating whether or not the motors were in fact turned off.
39 |
40 | .. py:method:: request_mastership(self)
41 |
42 | Requests mastership over controller in automatic mode.
43 | For mastership in manual mode, see :py:func:`request_rmmp`.
44 |
45 | .. py:method:: release_mastership(self)
46 |
47 | Releases mastership over controller.
48 |
49 | .. py:method:: request_rmmp(self)
50 |
51 | Requests RMMP (Request Manual Mode Privileges).
52 | The request needs to be accepted within 10 seconds on controller.
53 | For mastership in automatic mode, see :py:func:`request_mastership`.
54 |
55 | .. py:method:: cancel_rmmp(self)
56 |
57 | Cancels held or requested RMMP.
58 |
59 | .. py:method:: reset_pp(self)
60 |
61 | Resets RAPID program pointer to main procedure.
62 | Prints a message to the console stating whether or not the request was successful.
63 |
64 | .. py:method:: start_RAPID(self)
65 |
66 | Resets RAPID program pointer to main procedure, and starts RAPID execution.
67 | Prints a message to the console stating whether or not the request was successful.
68 |
69 | .. py:method:: stop_RAPID(self)
70 |
71 | Stops RAPID execution.
72 | Prints a message to the console stating whether or not the request was successful.
73 |
74 | .. py:method:: get_rapid_variable(self, var)
75 |
76 | Get the raw value of any variable in RAPID.
77 |
78 | :return: A number if RAPID variable is 'num'
79 | :return: A string if RAPID variable is not 'num'
80 |
81 | .. py:method:: set_rapid_variable(self, var, value)
82 |
83 | Sets the value of any variable in RAPID.
84 | Unless the variable is 'num', value has to be a string.
85 |
86 | :param str var: Name of variable as declared in RAPID
87 | :param value: Desired variable value
88 | :type value: int, float or str
89 |
90 | .. py:method:: set_robtarget_translation(self, var, trans)
91 |
92 | Sets only the translational data of a robtarget variable in RAPID.
93 |
94 | :param str var: Name of robtarget variable as declared in RAPID
95 | :param int[] trans: Translational data [x,y,z]
96 |
97 | .. py:method:: set_robtarget_rotation_z_degrees(self, var, rotation_z_degrees)
98 |
99 | Updates the orientation of a robtarget variable
100 | in RAPID by rotation about the z-axis in degrees.
101 | 0 degrees gives the Quaternion [0,1,0,0].
102 |
103 | :param str var: Name of robtarget variable as declared in RAPID
104 | :param int rotation_z_degrees: Rotation in degrees
105 |
106 | .. py:method:: set_robtarget_rotation_quaternion(self, var, rotation_quaternion)
107 |
108 | Updates the orientation of a robtarget variable in RAPID by a Quaternion.
109 |
110 | :param str var: Name of robtarget variable as declared in RAPID
111 | :param tuple rotation_quaternion: Wanted robtarget orientation. Must be a Quaternion (tuple of length 4)
112 |
113 | .. py:method:: get_robtarget_variables(self, var)
114 |
115 | Gets translational and rotational data of a robtarget variable in RAPID
116 |
117 | :param str var: Name of robtarget variable as declared in RAPID
118 |
119 | :return: Translational data of robtarget [x,y,z]
120 | :return: Rotational data of robtarget (Quaternion: [w,x,y,z]).
121 |
122 | .. py:method:: get_gripper_position(self)
123 |
124 | Gets translational and rotational of the UiS tool 'tGripper'
125 | with respect to the work object 'wobjTableN'.
126 |
127 | :return: Translational data of gripper [x,y,z]
128 | :return: Rotational data of gripper (Quaternion: [w,x,y,z])
129 |
130 | .. py:method:: get_gripper_height(self)
131 |
132 | Uses :py:func:`get_gripper_position` to get the height of the UiS tool
133 | 'tGripper' above the work object 'wobjTableN'.
134 |
135 | .. py:method:: set_rapid_array(self, var, value)
136 |
137 | Sets the values of a num array variable in RAPID.
138 | The length of the num array must match the length of the array from Python.
139 |
140 | :param str var: Name of variable as declared in RAPID.
141 | :param int[] value: Array to be sent to RAPID.
142 |
143 | .. py:method:: wait_for_rapid(self, var='ready_flag')
144 |
145 | Polls a boolean variable in RAPID every 0.1 seconds.
146 | When the variable is TRUE, Python resets it and continues.
147 |
148 | :param str var: Name of boolean variable as declared in RAPID.
149 |
150 | .. py:method:: set_zonedata(self, var, zonedata)
151 |
152 | Set the value for a zonedata variable in RAPID. Mastership is required.
153 |
154 | :param str var: Name of variable as declared in RAPID.
155 | :param int zonedata: desired zonedata value.
156 |
157 | .. py:method:: set_speeddata(self, var, speeddata)
158 |
159 | Set the value [int] for a speeddata variable in RAPID. Mastership is required.
160 |
161 | :param str var: Name of variable as declared in RAPID.
162 | :param int speeddata: Desired speeddata value.
163 |
164 | .. py:method:: set_speed_ratio(self, speed_ratio)
165 |
166 | Set the speed ratio of the robot. Mastership is required.
167 | speed_ratio: desired speed ratio in percent [1-100].
168 |
169 | .. py:method:: is_running(self)
170 |
171 | Uses :py:func:`get_execution_state` to check if RAPID execution is running or stopped.
172 | Returns True if running and False if stopped.
173 |
174 | .. py:method:: get_execution_state(self)
175 |
176 | Polls the RAPID execution state.
177 |
178 | :return: 'running' or 'stopped'
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
--------------------------------------------------------------------------------
/docs/build/html/_sources/robotwebservices.rst.txt:
--------------------------------------------------------------------------------
1 | .. _RobotWebServices:
2 |
3 | Robot Web Services
4 | ==================
5 |
6 | This section covers the communication between Python and *RobotWare*. A package, rwsuis_,
7 | is pip installable and includes all functions provided in this section.
8 |
9 | .. _rwsuis: https://pypi.org/project/rwsuis/
10 |
11 | .. _RWS:
12 |
13 | RWS Class
14 | ^^^^^^^^^
15 |
16 | Take full control of ABB robots through HTTP requests, made easy with the RWS class.
17 | Robot operating mode should be automatic.
18 |
19 | ::
20 |
21 | >>> robot = RWS.RWS(base_url='robot_IP', username='user', password='pass')
22 | >>> robot.request_mastership()
23 | >>> robot.motors_on()
24 | Robot motors turned on
25 | >>> robot.start_rapid()
26 | RAPID execution started from main
27 |
28 | .. py:class:: RWS(base_url, username, password)
29 |
30 | .. py:method:: motors_on(self)
31 |
32 | Sends a request to turn the robot's motors on. Mastership is required.
33 | Prints a message to the console stating whether or not the motors were in fact turned on.
34 |
35 | .. py:method:: motors_off(self)
36 |
37 | Sends a request to turn the robot's motors off. Mastership is required.
38 | Prints a message to the console stating whether or not the motors were in fact turned off.
39 |
40 | .. py:method:: request_mastership(self)
41 |
42 | Requests mastership over controller in automatic mode.
43 | For mastership in manual mode, see :py:func:`request_rmmp`.
44 |
45 | .. py:method:: release_mastership(self)
46 |
47 | Releases mastership over controller.
48 |
49 | .. py:method:: request_rmmp(self)
50 |
51 | Requests RMMP (Request Manual Mode Privileges).
52 | The request needs to be accepted within 10 seconds on controller.
53 | For mastership in automatic mode, see :py:func:`request_mastership`.
54 |
55 | .. py:method:: cancel_rmmp(self)
56 |
57 | Cancels held or requested RMMP.
58 |
59 | .. py:method:: reset_pp(self)
60 |
61 | Resets RAPID program pointer to main procedure.
62 | Prints a message to the console stating whether or not the request was successful.
63 |
64 | .. py:method:: start_RAPID(self)
65 |
66 | Resets RAPID program pointer to main procedure, and starts RAPID execution.
67 | Prints a message to the console stating whether or not the request was successful.
68 |
69 | .. py:method:: stop_RAPID(self)
70 |
71 | Stops RAPID execution.
72 | Prints a message to the console stating whether or not the request was successful.
73 |
74 | .. py:method:: get_rapid_variable(self, var)
75 |
76 | Get the raw value of any variable in RAPID.
77 |
78 | :return: A number if RAPID variable is 'num'
79 | :return: A string if RAPID variable is not 'num'
80 |
81 | .. py:method:: set_rapid_variable(self, var, value)
82 |
83 | Sets the value of any variable in RAPID.
84 | Unless the variable is 'num', value has to be a string.
85 |
86 | :param str var: Name of variable as declared in RAPID
87 | :param value: Desired variable value
88 | :type value: int, float or str
89 |
90 | .. py:method:: set_robtarget_translation(self, var, trans)
91 |
92 | Sets only the translational data of a robtarget variable in RAPID.
93 |
94 | :param str var: Name of robtarget variable as declared in RAPID
95 | :param int[] trans: Translational data [x,y,z]
96 |
97 | .. py:method:: set_robtarget_rotation_z_degrees(self, var, rotation_z_degrees)
98 |
99 | Updates the orientation of a robtarget variable
100 | in RAPID by rotation about the z-axis in degrees.
101 | 0 degrees gives the Quaternion [0,1,0,0].
102 |
103 | :param str var: Name of robtarget variable as declared in RAPID
104 | :param int rotation_z_degrees: Rotation in degrees
105 |
106 | .. py:method:: set_robtarget_rotation_quaternion(self, var, rotation_quaternion)
107 |
108 | Updates the orientation of a robtarget variable in RAPID by a Quaternion.
109 |
110 | :param str var: Name of robtarget variable as declared in RAPID
111 | :param tuple rotation_quaternion: Wanted robtarget orientation. Must be a Quaternion (tuple of length 4)
112 |
113 | .. py:method:: get_robtarget_variables(self, var)
114 |
115 | Gets translational and rotational data of a robtarget variable in RAPID
116 |
117 | :param str var: Name of robtarget variable as declared in RAPID
118 |
119 | :return: Translational data of robtarget [x,y,z]
120 | :return: Rotational data of robtarget (Quaternion: [w,x,y,z]).
121 |
122 | .. py:method:: get_gripper_position(self)
123 |
124 | Gets translational and rotational of the UiS tool 'tGripper'
125 | with respect to the work object 'wobjTableN'.
126 |
127 | :return: Translational data of gripper [x,y,z]
128 | :return: Rotational data of gripper (Quaternion: [w,x,y,z])
129 |
130 | .. py:method:: get_gripper_height(self)
131 |
132 | Uses :py:func:`get_gripper_position` to get the height of the UiS tool
133 | 'tGripper' above the work object 'wobjTableN'.
134 |
135 | .. py:method:: set_rapid_array(self, var, value)
136 |
137 | Sets the values of a num array variable in RAPID.
138 | The length of the num array must match the length of the array from Python.
139 |
140 | :param str var: Name of variable as declared in RAPID.
141 | :param int[] value: Array to be sent to RAPID.
142 |
143 | .. py:method:: wait_for_rapid(self, var='ready_flag')
144 |
145 | Polls a boolean variable in RAPID every 0.1 seconds.
146 | When the variable is TRUE, Python resets it and continues.
147 |
148 | :param str var: Name of boolean variable as declared in RAPID.
149 |
150 | .. py:method:: set_zonedata(self, var, zonedata)
151 |
152 | Set the value for a zonedata variable in RAPID. Mastership is required.
153 |
154 | :param str var: Name of variable as declared in RAPID.
155 | :param int zonedata: desired zonedata value.
156 |
157 | .. py:method:: set_speeddata(self, var, speeddata)
158 |
159 | Set the value [int] for a speeddata variable in RAPID. Mastership is required.
160 |
161 | :param str var: Name of variable as declared in RAPID.
162 | :param int speeddata: Desired speeddata value.
163 |
164 | .. py:method:: set_speed_ratio(self, speed_ratio)
165 |
166 | Set the speed ratio of the robot. Mastership is required.
167 | speed_ratio: desired speed ratio in percent [1-100].
168 |
169 | .. py:method:: is_running(self)
170 |
171 | Uses :py:func:`get_execution_state` to check if RAPID execution is running or stopped.
172 | Returns True if running and False if stopped.
173 |
174 | .. py:method:: get_execution_state(self)
175 |
176 | Polls the RAPID execution state.
177 |
178 | :return: 'running' or 'stopped'
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
--------------------------------------------------------------------------------
/docs/build/html/camera.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Camera Class — ABB-Robot-Machine-Vision 0.0.1 documentation
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
The Camera class contains methods specifically meant for the University of Stavanger.
41 | These functions have only been tested on a IDS UI-1007XS-C camera, and might not work
42 | as intended on other models.
The parameters set are not currently configurable through method inputs.
65 | They are specifically set for laboratory work at the University of Stavanger.
Complete a series of transformations to finally create a robtarget of the puck’s position from an image.
41 | These transformations are based on the setup at the University of Stavanger, and with a specific RobotStudio setup
42 | (in regards to coordinate systems). This Pack and Go file includes this setup.
43 |
44 |
Parameters
45 |
46 |
gripper_height (float) – Height of gripper above work object
47 |
gripper_rot (tuple) – Orientation of gripper, must be a Quaternion (tuple of length 4)
Transform coordinate system given by image in OpenCV to coordinate system of work object in RAPID.
64 | Swap x & y coordinates and rotate by the same amount that the camera has been rotated.
65 |
66 |
Parameters
67 |
68 |
gripper_rot (tuple) – Orientation of gripper, must be a Quaternion (tuple of length 4)
Compensate for an angled camera view. Different cameras will be
110 | angled differently both internally and externally when mounted to a surface.
111 | The slope values must first be calculated by running camera_adjustment.
112 | Works with any camera orientation.
113 |
114 |
Parameters
115 |
116 |
gripper_height (float) – Height of gripper above work object
117 |
gripper_rot (tuple) – Orientation of gripper, must be a Quaternion (tuple of length 4)