Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
ur_py_ctl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Robotlab
ur_py_ctl
Commits
c9574aec
Unverified
Commit
c9574aec
authored
Mar 25, 2022
by
Anton Tetov Johansson
Browse files
Options
Downloads
Patches
Plain Diff
some tests and some docstrings
parent
17ef6459
No related branches found
No related tags found
No related merge requests found
Pipeline
#1627
passed
Mar 25, 2022
Stage: quality
Stage: tests
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
poetry.lock
+23
-53
23 additions, 53 deletions
poetry.lock
pyproject.toml
+1
-2
1 addition, 2 deletions
pyproject.toml
tests/test_urscript_commands.py
+60
-0
60 additions, 0 deletions
tests/test_urscript_commands.py
ur_py_ctl/urscript_commands.py
+44
-12
44 additions, 12 deletions
ur_py_ctl/urscript_commands.py
with
128 additions
and
67 deletions
poetry.lock
+
23
−
53
View file @
c9574aec
...
@@ -126,18 +126,12 @@ python-versions = ">=3.7"
...
@@ -126,18 +126,12 @@ python-versions = ">=3.7"
license
=
[
"ukkonen"
]
license
=
[
"ukkonen"
]
[[
package
]]
[[
package
]]
name
=
"i
sort
"
name
=
"i
niconfig
"
version
=
"
5
.1
0
.1"
version
=
"
1
.1.1"
description
=
"
A Python utility / library to sort Python imports.
"
description
=
"
iniconfig: brain-dead simple config-ini parsing
"
category
=
"dev"
category
=
"dev"
optional
=
false
optional
=
false
python-versions
=
">
=
3.6
.
1
,
<
4.0
"
python-versions
=
"*"
[
package.extras
]
pipfile_deprecated_finder
=
[
"pipreqs"
,
"requirementslib"
]
requirements_deprecated_finder
=
[
"pipreqs"
,
"pip-api"
]
colors
=
[
"colorama (>=0.4.3,<0.5.0)"
]
plugins
=
[
"setuptools"
]
[[
package
]]
[[
package
]]
name
=
"mccabe"
name
=
"mccabe"
...
@@ -147,14 +141,6 @@ category = "dev"
...
@@ -147,14 +141,6 @@ category = "dev"
optional
=
false
optional
=
false
python-versions
=
"*"
python-versions
=
"*"
[[
package
]]
name
=
"more-itertools"
version
=
"8.12.0"
description
=
"More routines for operating on iterables, beyond itertools"
category
=
"dev"
optional
=
false
python-versions
=
">
=
3.5
"
[[
package
]]
[[
package
]]
name
=
"mypy"
name
=
"mypy"
version
=
"0.931"
version
=
"0.931"
...
@@ -221,14 +207,15 @@ test = ["appdirs (==1.4.4)", "pytest (>=6)", "pytest-cov (>=2.7)", "pytest-mock
...
@@ -221,14 +207,15 @@ test = ["appdirs (==1.4.4)", "pytest (>=6)", "pytest-cov (>=2.7)", "pytest-mock
[[
package
]]
[[
package
]]
name
=
"pluggy"
name
=
"pluggy"
version
=
"
0.13.1
"
version
=
"
1.0.0
"
description
=
"plugin and hook calling mechanisms for python"
description
=
"plugin and hook calling mechanisms for python"
category
=
"dev"
category
=
"dev"
optional
=
false
optional
=
false
python-versions
=
">
=
2.7
,
!
=
3.0
.*
,
!
=
3.1
.*
,
!
=
3.2
.*
,
!
=
3.3
.*
"
python-versions
=
">
=
3.6
"
[
package.extras
]
[
package.extras
]
dev
=
[
"pre-commit"
,
"tox"
]
dev
=
[
"pre-commit"
,
"tox"
]
testing
=
[
"pytest"
,
"pytest-benchmark"
]
[[
package
]]
[[
package
]]
name
=
"pre-commit"
name
=
"pre-commit"
...
@@ -283,25 +270,24 @@ diagrams = ["jinja2", "railroad-diagrams"]
...
@@ -283,25 +270,24 @@ diagrams = ["jinja2", "railroad-diagrams"]
[[
package
]]
[[
package
]]
name
=
"pytest"
name
=
"pytest"
version
=
"
5.4.3
"
version
=
"
7.1.1
"
description
=
"pytest: simple powerful testing with Python"
description
=
"pytest: simple powerful testing with Python"
category
=
"dev"
category
=
"dev"
optional
=
false
optional
=
false
python-versions
=
">
=
3.
5
"
python-versions
=
">
=
3.
7
"
[
package.dependencies
]
[
package.dependencies
]
atomicwrites
=
{
version
=
">
=
1.0
", markers = "
sys_platform
=
=
\"
win
32
\"
"}
atomicwrites
=
{
version
=
">
=
1.0
", markers = "
sys_platform
=
=
\"
win
32
\"
"}
attrs
=
">
=
1
7.4
.
0
"
attrs
=
">
=
1
9.2
.
0
"
colorama
=
{
version
=
"*"
,
markers
=
"sys_platform
=
=
\"
win
32
\"
"}
colorama
=
{
version
=
"*"
,
markers
=
"sys_platform
=
=
\"
win
32
\"
"}
more-itertools
=
">
=
4.0
.
0
"
iniconfig
=
"*
"
packaging
=
"*"
packaging
=
"*"
pluggy
=
">
=
0.12
,
<
1
.0
"
pluggy
=
">
=
0.12
,
<
2
.0
"
py
=
">
=
1.
5
.
0
"
py
=
">
=
1.
8
.
2
"
wcwidth
=
"*
"
tomli
=
">
=
1.0
.
0
"
[
package.extras
]
[
package.extras
]
checkqa-mypy
=
[
"mypy (==v0.761)"
]
testing
=
[
"argcomplete"
,
"hypothesis (>=3.56)"
,
"mock"
,
"nose"
,
"pygments (>=2.7.2)"
,
"requests"
,
"xmlschema"
]
testing
=
[
"argcomplete"
,
"hypothesis (>=3.56)"
,
"mock"
,
"nose"
,
"requests"
,
"xmlschema"
]
[[
package
]]
[[
package
]]
name
=
"pyyaml"
name
=
"pyyaml"
...
@@ -372,18 +358,10 @@ six = ">=1.9.0,<2"
...
@@ -372,18 +358,10 @@ six = ">=1.9.0,<2"
docs
=
[
"proselint (>=0.10.2)"
,
"sphinx (>=3)"
,
"sphinx-argparse (>=0.2.5)"
,
"sphinx-rtd-theme (>=0.4.3)"
,
"towncrier (>=21.3)"
]
docs
=
[
"proselint (>=0.10.2)"
,
"sphinx (>=3)"
,
"sphinx-argparse (>=0.2.5)"
,
"sphinx-rtd-theme (>=0.4.3)"
,
"towncrier (>=21.3)"
]
testing
=
[
"coverage (>=4)"
,
"coverage-enable-subprocess (>=1)"
,
"flaky (>=3)"
,
"pytest (>=4)"
,
"pytest-env (>=0.6.2)"
,
"pytest-freezegun (>=0.4.1)"
,
"pytest-mock (>=2)"
,
"pytest-randomly (>=1)"
,
"pytest-timeout (>=1)"
,
"packaging (>=20.0)"
]
testing
=
[
"coverage (>=4)"
,
"coverage-enable-subprocess (>=1)"
,
"flaky (>=3)"
,
"pytest (>=4)"
,
"pytest-env (>=0.6.2)"
,
"pytest-freezegun (>=0.4.1)"
,
"pytest-mock (>=2)"
,
"pytest-randomly (>=1)"
,
"pytest-timeout (>=1)"
,
"packaging (>=20.0)"
]
[[
package
]]
name
=
"wcwidth"
version
=
"0.2.5"
description
=
"Measures the displayed width of unicode strings in a terminal"
category
=
"dev"
optional
=
false
python-versions
=
"*"
[
metadata
]
[
metadata
]
lock-version
=
"1.1"
lock-version
=
"1.1"
python-versions
=
">
=
3.9
,
<
3.11
"
python-versions
=
">
=
3.9
,
<
3.11
"
content-hash
=
"
6f4fb43a3eb03bef2f49af983c6f3badb40dfae20eb298a2e675822bc2477752
"
content-hash
=
"
ab1f88cbf02688daeb723c77086aedf337fd9c15eac50157c4b0481537be2098
"
[
metadata.files
]
[
metadata.files
]
"aspy.refactor-imports"
=
[
"aspy.refactor-imports"
=
[
...
@@ -430,18 +408,14 @@ identify = [
...
@@ -430,18 +408,14 @@ identify = [
{file
=
"identify-2.4.12-py2.py3-none-any.whl"
,
hash
=
"sha256:5f06b14366bd1facb88b00540a1de05b69b310cbc2654db3c7e07fa3a4339323"
}
,
{file
=
"identify-2.4.12-py2.py3-none-any.whl"
,
hash
=
"sha256:5f06b14366bd1facb88b00540a1de05b69b310cbc2654db3c7e07fa3a4339323"
}
,
{file
=
"identify-2.4.12.tar.gz"
,
hash
=
"sha256:3f3244a559290e7d3deb9e9adc7b33594c1bc85a9dd82e0f1be519bf12a1ec17"
}
,
{file
=
"identify-2.4.12.tar.gz"
,
hash
=
"sha256:3f3244a559290e7d3deb9e9adc7b33594c1bc85a9dd82e0f1be519bf12a1ec17"
}
,
]
]
i
sort
=
[
i
niconfig
=
[
{file
=
"i
sort-5
.1
0
.1-py3-none-any.whl"
,
hash
=
"sha256:
6f62d78e2f89b4500b080fe3a81690850cd254227f27f75c3a0c491a1f351ba7
"
}
,
{file
=
"i
niconfig-1
.1.1-
py2.
py3-none-any.whl"
,
hash
=
"sha256:
011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3
"
}
,
{file
=
"i
sort-5
.1
0
.1.tar.gz"
,
hash
=
"sha256:
e8443a5e7a020e9d7f97f1d7d9cd17c88bcb3bc7e218bf9cf5095fe550be2951
"
}
,
{file
=
"i
niconfig-1
.1.1.tar.gz"
,
hash
=
"sha256:
bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32
"
}
,
]
]
mccabe
=
[
mccabe
=
[
{file
=
"mccabe-0.6.1-py2.py3-none-any.whl"
,
hash
=
"sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"
}
,
{file
=
"mccabe-0.6.1-py2.py3-none-any.whl"
,
hash
=
"sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"
}
,
{file
=
"mccabe-0.6.1.tar.gz"
,
hash
=
"sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"
}
,
{file
=
"mccabe-0.6.1.tar.gz"
,
hash
=
"sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"
}
,
]
]
more-itertools
=
[
{file
=
"more-itertools-8.12.0.tar.gz"
,
hash
=
"sha256:7dc6ad46f05f545f900dd59e8dfb4e84a4827b97b3cfecb175ea0c7d247f6064"
}
,
{file
=
"more_itertools-8.12.0-py3-none-any.whl"
,
hash
=
"sha256:43e6dd9942dffd72661a2c4ef383ad7da1e6a3e968a927ad7a6083ab410a688b"
}
,
]
mypy
=
[
mypy
=
[
{file
=
"mypy-0.931-cp310-cp310-macosx_10_9_x86_64.whl"
,
hash
=
"sha256:3c5b42d0815e15518b1f0990cff7a705805961613e701db60387e6fb663fe78a"
}
,
{file
=
"mypy-0.931-cp310-cp310-macosx_10_9_x86_64.whl"
,
hash
=
"sha256:3c5b42d0815e15518b1f0990cff7a705805961613e701db60387e6fb663fe78a"
}
,
{file
=
"mypy-0.931-cp310-cp310-macosx_11_0_arm64.whl"
,
hash
=
"sha256:c89702cac5b302f0c5d33b172d2b55b5df2bede3344a2fbed99ff96bddb2cf00"
}
,
{file
=
"mypy-0.931-cp310-cp310-macosx_11_0_arm64.whl"
,
hash
=
"sha256:c89702cac5b302f0c5d33b172d2b55b5df2bede3344a2fbed99ff96bddb2cf00"
}
,
...
@@ -485,8 +459,8 @@ platformdirs = [
...
@@ -485,8 +459,8 @@ platformdirs = [
{file
=
"platformdirs-2.5.1.tar.gz"
,
hash
=
"sha256:7535e70dfa32e84d4b34996ea99c5e432fa29a708d0f4e394bbcb2a8faa4f16d"
}
,
{file
=
"platformdirs-2.5.1.tar.gz"
,
hash
=
"sha256:7535e70dfa32e84d4b34996ea99c5e432fa29a708d0f4e394bbcb2a8faa4f16d"
}
,
]
]
pluggy
=
[
pluggy
=
[
{file
=
"pluggy-
0.13.1
-py2.py3-none-any.whl"
,
hash
=
"sha256:
966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d
"
}
,
{file
=
"pluggy-
1.0.0
-py2.py3-none-any.whl"
,
hash
=
"sha256:
74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3
"
}
,
{file
=
"pluggy-
0.13.1
.tar.gz"
,
hash
=
"sha256:
15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0
"
}
,
{file
=
"pluggy-
1.0.0
.tar.gz"
,
hash
=
"sha256:
4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159
"
}
,
]
]
pre-commit
=
[
pre-commit
=
[
{file
=
"pre_commit-2.17.0-py2.py3-none-any.whl"
,
hash
=
"sha256:725fa7459782d7bec5ead072810e47351de01709be838c2ce1726b9591dad616"
}
,
{file
=
"pre_commit-2.17.0-py2.py3-none-any.whl"
,
hash
=
"sha256:725fa7459782d7bec5ead072810e47351de01709be838c2ce1726b9591dad616"
}
,
...
@@ -509,8 +483,8 @@ pyparsing = [
...
@@ -509,8 +483,8 @@ pyparsing = [
{file
=
"pyparsing-3.0.7.tar.gz"
,
hash
=
"sha256:18ee9022775d270c55187733956460083db60b37d0d0fb357445f3094eed3eea"
}
,
{file
=
"pyparsing-3.0.7.tar.gz"
,
hash
=
"sha256:18ee9022775d270c55187733956460083db60b37d0d0fb357445f3094eed3eea"
}
,
]
]
pytest
=
[
pytest
=
[
{file
=
"pytest-
5.4.3
-py3-none-any.whl"
,
hash
=
"sha256:
5c0db86b698e8f170ba4582a492248919255fcd4c79b1ee64ace34301fb589a1
"
}
,
{file
=
"pytest-
7.1.1
-py3-none-any.whl"
,
hash
=
"sha256:
92f723789a8fdd7180b6b06483874feca4c48a5c76968e03bb3e7f806a1869ea
"
}
,
{file
=
"pytest-
5.4.3
.tar.gz"
,
hash
=
"sha256:
7979331bfcba207414f5e1263b5a0f8f521d0f457318836a7355531ed1a4c7d8
"
}
,
{file
=
"pytest-
7.1.1
.tar.gz"
,
hash
=
"sha256:
841132caef6b1ad17a9afde46dc4f6cfa59a05f9555aae5151f73bdf2820ca63
"
}
,
]
]
pyyaml
=
[
pyyaml
=
[
{file
=
"PyYAML-6.0-cp310-cp310-macosx_10_9_x86_64.whl"
,
hash
=
"sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53"
}
,
{file
=
"PyYAML-6.0-cp310-cp310-macosx_10_9_x86_64.whl"
,
hash
=
"sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53"
}
,
...
@@ -571,7 +545,3 @@ virtualenv = [
...
@@ -571,7 +545,3 @@ virtualenv = [
{file
=
"virtualenv-20.13.4-py2.py3-none-any.whl"
,
hash
=
"sha256:c3e01300fb8495bc00ed70741f5271fc95fed067eb7106297be73d30879af60c"
}
,
{file
=
"virtualenv-20.13.4-py2.py3-none-any.whl"
,
hash
=
"sha256:c3e01300fb8495bc00ed70741f5271fc95fed067eb7106297be73d30879af60c"
}
,
{file
=
"virtualenv-20.13.4.tar.gz"
,
hash
=
"sha256:ce8901d3bbf3b90393498187f2d56797a8a452fb2d0d7efc6fd837554d6f679c"
}
,
{file
=
"virtualenv-20.13.4.tar.gz"
,
hash
=
"sha256:ce8901d3bbf3b90393498187f2d56797a8a452fb2d0d7efc6fd837554d6f679c"
}
,
]
]
wcwidth
=
[
{file
=
"wcwidth-0.2.5-py2.py3-none-any.whl"
,
hash
=
"sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784"
}
,
{file
=
"wcwidth-0.2.5.tar.gz"
,
hash
=
"sha256:c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83"
}
,
]
This diff is collapsed.
Click to expand it.
pyproject.toml
+
1
−
2
View file @
c9574aec
...
@@ -18,13 +18,12 @@ repository = "https://gitlab.control.lth.se/selectica/py_ur_ctl"
...
@@ -18,13 +18,12 @@ repository = "https://gitlab.control.lth.se/selectica/py_ur_ctl"
python
=
">
=
3.9
,
<
3.11
"
python
=
">
=
3.9
,
<
3.11
"
[tool.poetry.dev-dependencies]
[tool.poetry.dev-dependencies]
pytest
=
"^5.2"
isort
=
"^5.10.1"
flake8
=
"^4.0.1"
flake8
=
"^4.0.1"
mypy
=
"^0.931"
mypy
=
"^0.931"
black
=
"^21.12b0"
black
=
"^21.12b0"
pre-commit
=
"^2.17.0"
pre-commit
=
"^2.17.0"
reorder-python-imports
=
"^3.0.1"
reorder-python-imports
=
"^3.0.1"
pytest
=
"^7.1.1"
[tool.isort]
[tool.isort]
profile
=
"black"
profile
=
"black"
This diff is collapsed.
Click to expand it.
tests/test_urscript_commands.py
0 → 100644
+
60
−
0
View file @
c9574aec
import
pytest
from
ur_py_ctl.urscript_commands
import
_add_whitespace
from
ur_py_ctl.urscript_commands
import
_get_conf
from
ur_py_ctl.urscript_commands
import
_get_func
from
ur_py_ctl.urscript_commands
import
_get_pose
@pytest.fixture
()
def
conf_list
():
return
[
50
,
25
,
12.5
,
100
,
270
,
360
]
@pytest.fixture
def
conf_str
():
return
"
[50.00000, 25.00000, 12.50000, 100.00000, 270.00000, 360.00000]
"
@pytest.fixture
()
def
pose_list
():
return
[
22
,
13
,
25
,
3.14
,
0
,
1.7
]
@pytest.fixture
()
def
pose_str
():
return
"
p[22.00000, 13.00000, 25.00000, 3.14000, 0.00000, 1.70000]
"
def
test__add_whitespace
():
def
func
(
input_
):
return
input_
[::
-
1
]
wrapped_func
=
_add_whitespace
(
func
)
input_
=
"
polyscope
"
output
=
wrapped_func
(
input_
)
assert
output
[
0
]
==
"
\t
"
assert
output
[
-
1
]
==
"
\n
"
assert
output
.
strip
()
==
func
(
input_
)
def
test_get_func
():
func_name
=
"
func
"
urscript_args
=
"
args
"
urscript_kwargs
=
"
kwargs
"
assert
(
_get_func
(
func_name
,
urscript_args
,
urscript_kwargs
)
==
f
"
{
func_name
}
(
{
urscript_args
}
,
{
urscript_kwargs
}
)
"
)
def
test__get_conf
(
conf_list
,
conf_str
):
assert
_get_conf
(
*
conf_list
)
==
conf_str
def
test__get_pose
(
pose_list
,
pose_str
):
assert
_get_pose
(
*
pose_list
)
==
pose_str
This diff is collapsed.
Click to expand it.
ur_py_ctl/urscript_commands.py
+
44
−
12
View file @
c9574aec
...
@@ -26,7 +26,7 @@ def _get_pose(x: float, y: float, z: float, ax: float, ay: float, az: float) ->
...
@@ -26,7 +26,7 @@ def _get_pose(x: float, y: float, z: float, ax: float, ay: float, az: float) ->
return
f
"
p[
{
x
:
.
5
f
}
,
{
y
:
.
5
f
}
,
{
z
:
.
5
f
}
,
{
ax
:
.
5
f
}
,
{
ay
:
.
5
f
}
,
{
az
:
.
5
f
}
]
"
return
f
"
p[
{
x
:
.
5
f
}
,
{
y
:
.
5
f
}
,
{
z
:
.
5
f
}
,
{
ax
:
.
5
f
}
,
{
ay
:
.
5
f
}
,
{
az
:
.
5
f
}
]
"
def
_get_conf
(
j1
,
j2
,
j3
,
j4
,
j5
,
j6
):
def
_get_conf
(
j1
:
float
,
j2
:
float
,
j3
:
float
,
j4
:
float
,
j5
:
float
,
j6
:
float
):
return
f
"
[
{
j1
:
.
5
f
}
,
{
j2
:
.
5
f
}
,
{
j3
:
.
5
f
}
,
{
j4
:
.
5
f
}
,
{
j5
:
.
5
f
}
,
{
j6
:
.
5
f
}
]
"
return
f
"
[
{
j1
:
.
5
f
}
,
{
j2
:
.
5
f
}
,
{
j3
:
.
5
f
}
,
{
j4
:
.
5
f
}
,
{
j5
:
.
5
f
}
,
{
j6
:
.
5
f
}
]
"
...
@@ -48,24 +48,47 @@ def _get_move_kwargs(**kwargs) -> str:
...
@@ -48,24 +48,47 @@ def _get_move_kwargs(**kwargs) -> str:
@_add_whitespace
@_add_whitespace
def
set_tcp
(
*
args
)
->
str
:
def
set_tcp
(
x
:
float
,
y
:
float
,
z
:
float
,
rx
:
float
,
ry
:
float
,
rz
:
float
)
->
str
:
return
_get_func
(
"
set_tcp
"
,
_get_pose
(
*
args
))
return
_get_func
(
"
set_tcp
"
,
_get_pose
(
x
,
y
,
z
,
rx
,
ry
,
rz
))
@_add_whitespace
@_add_whitespace
def
move_to_pose
(
*
pose_args
,
mode
=
Motion
.
JOINT
,
**
kwargs
):
def
move_to_pose
(
x
:
float
,
y
:
float
,
z
:
float
,
rx
:
float
,
ry
:
float
,
rz
:
float
,
mode
=
Motion
.
JOINT
,
v
:
float
=
None
,
a
:
float
=
None
,
t
:
float
=
None
,
r
:
float
=
None
,
)
->
str
:
func_name
=
"
movel
"
if
mode
==
Motion
.
LINEAR
else
"
movej
"
func_name
=
"
movel
"
if
mode
==
Motion
.
LINEAR
else
"
movej
"
pose
=
_get_pose
(
*
pose_args
)
pose
=
_get_pose
(
x
,
y
,
z
,
rx
,
ry
,
rz
)
move_kwargs
=
_get_move_kwargs
(
**
kwargs
)
move_kwargs
=
_get_move_kwargs
(
v
=
v
,
a
=
a
,
t
=
t
,
r
=
r
)
return
_get_func
(
func_name
,
pose
,
move_kwargs
)
return
_get_func
(
func_name
,
pose
,
move_kwargs
)
@_add_whitespace
@_add_whitespace
def
move_to_conf
(
*
conf_args
,
**
kwargs
):
def
move_to_conf
(
conf
=
_get_conf
(
*
conf_args
)
j1
:
float
,
move_kwargs
=
_get_move_kwargs
(
**
kwargs
)
j2
:
float
,
j3
:
float
,
j4
:
float
,
j5
:
float
,
j6
:
float
,
v
:
float
=
None
,
a
:
float
=
None
,
t
:
float
=
None
,
r
:
float
=
None
,
)
->
str
:
conf
=
_get_conf
(
j1
,
j2
,
j3
,
j4
,
j5
,
j6
)
move_kwargs
=
_get_move_kwargs
(
v
=
v
,
a
=
a
,
t
=
t
,
r
=
r
)
return
_get_func
(
"
movej
"
,
conf
,
move_kwargs
)
return
_get_func
(
"
movej
"
,
conf
,
move_kwargs
)
...
@@ -77,15 +100,24 @@ def textmsg(string: str) -> str:
...
@@ -77,15 +100,24 @@ def textmsg(string: str) -> str:
@_add_whitespace
@_add_whitespace
def
set_DO
(
pin
:
int
,
state
:
bool
)
->
str
:
def
set_DO
(
pin
:
int
,
state
:
bool
)
->
str
:
return
f
"
set_digital_out(
{
pin
:
d
}
,
{
state
}
)
"
"""
Construct a function call that sets the state of a digital out.
"""
# bool(state) should convert numeric representation to boolean value and
# then into True or False as string.
return
_get_func
(
"
set_digital_out
"
,
f
"
{
pin
:
d
}
,
{
bool
(
state
)
}
"
)
@_add_whitespace
@_add_whitespace
def
sleep
(
seconds
:
int
)
->
str
:
def
sleep
(
seconds
:
int
)
->
str
:
return
"
sleep({})
"
.
format
(
seconds
)
"""
Construct a function call that instructs the controller to sleep.
"""
return
_get_func
(
"
sleep
"
,
str
(
seconds
))
@_add_whitespace
@_add_whitespace
def
popup
(
string
:
str
)
->
str
:
def
popup
(
string
:
str
)
->
str
:
# Popup title not implemented, neither is error or warning flags
"""
Construct a function call that opens a popup on the teach pendant.
Notes
-----
Popup arguments title, error & warning is not implemented in URScript.
"""
return
f
'
popup(
"
{
string
}
"
)
'
return
f
'
popup(
"
{
string
}
"
)
'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment