Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d9212bb

Browse filesBrowse files
committed
simplify constructor from SE3
1 parent 1b05196 commit d9212bb
Copy full SHA for d9212bb

File tree

Expand file treeCollapse file tree

1 file changed

+8
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-5
lines changed

‎spatialmath/twist.py

Copy file name to clipboardExpand all lines: spatialmath/twist.py
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,18 @@ def __init__(self, arg=None, w=None, check=True):
341341

342342
if w is None:
343343
# zero or one arguments passed
344-
if super().arghandler(arg, convertfrom=(SE3,), check=check):
344+
if super().arghandler(arg, check=check):
345345
return
346+
elif isinstance(arg, SE3):
347+
self.data = [arg.twist().A]
346348

347349
elif w is not None and base.isvector(w, 3) and base.isvector(arg,3):
348350
# Twist(v, w)
349351
self.data = [np.r_[arg, w]]
350352
return
351353

352-
raise ValueError('bad twist value')
354+
else:
355+
raise ValueError('bad value to Twist constructor')
353356

354357
# ------------------------ SMUserList required ---------------------------#
355358

@@ -1564,8 +1567,8 @@ def _repr_pretty_(self, p, cycle):
15641567

15651568
if __name__ == '__main__': # pragma: no cover
15661569

1570+
tw = Twist3( SE3.Rx(0) )
15671571

1572+
# import pathlib
15681573

1569-
import pathlib
1570-
1571-
exec(open(pathlib.Path(__file__).parent.parent.absolute() / "tests" / "test_twist.py").read()) # pylint: disable=exec-used
1574+
# exec(open(pathlib.Path(__file__).parent.parent.absolute() / "tests" / "test_twist.py").read()) # pylint: disable=exec-used

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.