Skip to content

Commit 9c0289a

Browse files
committed
Pretty print for ets
1 parent e0043d5 commit 9c0289a

File tree

2 files changed

+123
-7
lines changed

2 files changed

+123
-7
lines changed

.gitignore

Lines changed: 94 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,96 @@
1-
__pycache__
1+
22
spatialmath/docs/build
3+
4+
### Python ###
5+
# Byte-compiled / optimized / DLL files
6+
__pycache__/
7+
*.py[cod]
8+
*$py.class
9+
10+
# C extensions
11+
*.so
12+
13+
# Distribution / packaging
14+
.Python
15+
build/
16+
develop-eggs/
17+
dist/
18+
downloads/
19+
eggs/
20+
.eggs/
21+
lib/
22+
lib64/
23+
parts/
24+
sdist/
25+
var/
26+
wheels/
27+
pip-wheel-metadata/
28+
share/python-wheels/
29+
*.egg-info/
30+
.installed.cfg
331
*.egg
4-
*.egg-info
5-
*.egg-info/*
32+
MANIFEST
33+
34+
# PyInstaller
35+
# Usually these files are written by a python script from a template
36+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
37+
*.manifest
38+
*.spec
39+
40+
# Installer logs
41+
pip-log.txt
42+
pip-delete-this-directory.txt
43+
44+
# Unit test / coverage reports
45+
htmlcov/
46+
.tox/
47+
.nox/
48+
.coverage
49+
.coverage.*
50+
.cache
51+
nosetests.xml
52+
coverage.xml
53+
*.cover
54+
.hypothesis/
55+
.pytest_cache/
56+
57+
# Translations
58+
*.mo
59+
*.pot
60+
61+
# Scrapy stuff:
62+
.scrapy
63+
64+
# Sphinx documentation
65+
docs/_build/
66+
67+
# PyBuilder
68+
target/
69+
70+
# pyenv
71+
.python-version
72+
73+
# pipenv
74+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
75+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
76+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
77+
# install all needed dependencies.
78+
#Pipfile.lock
79+
80+
# mkdocs documentation
81+
/site
82+
83+
# mypy
84+
.mypy_cache/
85+
.dmypy.json
86+
dmypy.json
87+
88+
# Pyre type checker
89+
.pyre/
90+
91+
### VisualStudioCode ###
92+
.vscode/settings.json
93+
94+
### VisualStudioCode Patch ###
95+
# Ignore all local history of files
96+
.history

rtb/robot/ets.py

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,18 @@
66
"""
77

88
import numpy as np
9-
# import time
109

1110

1211
class ets(object):
1312
"""
14-
The Elementary Transform Sequence (ETS). A superclass which represents the kinematics of a serial-link manipulator
13+
The Elementary Transform Sequence (ETS). A superclass which represents the
14+
kinematics of a serial-link manipulator
1515
16-
:param et_list: List of elementary transforms which represent the robot kinematics
16+
:param et_list: List of elementary transforms which represent the robot
17+
kinematics
1718
:type et_list: list of etb.robot.et
18-
:param q_idx: List of indexes within the ets_list which correspond to joints
19+
:param q_idx: List of indexes within the ets_list which correspond to
20+
joints
1921
:type q_idx: list of int
2022
:param name: Name of the robot
2123
:type name: str, optional
@@ -117,6 +119,29 @@ def dh_to_ets(cls, robot):
117119
robot.base,
118120
robot.tool)
119121

122+
def __str__(self):
123+
"""
124+
Pretty prints the ETS Model of the robot. Will output angles in degrees
125+
126+
:return: Pretty print of the robot model
127+
:rtype: str
128+
"""
129+
axes = ''
130+
131+
for i in range(self._n):
132+
axes += self._ets[self._q_idx[i]]._axis_s
133+
134+
model = '\n%s (%s): %d axis, %s, ETS\n'\
135+
'Elementary Transform Sequence:\n'\
136+
'%s\n'\
137+
'tool: t = (%g, %g, %g), RPY/xyz = (%g, %g, %g) deg' % (
138+
self._name, self._manuf, self._n, axes,
139+
self._ets,
140+
self._tool[0, 3], self._tool[1, 3], self._tool[2, 3], 0, 0, 0
141+
)
142+
143+
return model
144+
120145

121146
class et(object):
122147
"""This class implements a single elementary transform (ET)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy