8000 add print method · mzahana/spatialmath-python@a4a61d1 · GitHub
[go: up one dir, main page]

Skip to content

Commit a4a61d1

Browse files
committed
add print method
1 parent 8d48e5a commit a4a61d1

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

spatialmath/baseposematrix.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,31 @@ def stack(self):
590590

591591
# ----------------------- i/o stuff
592592

593+
def print(self, label=None, file=None):
594+
"""
595+
Print pose as a matrix (superclass method)
596+
597+
:param label: label to print before the matrix, defaults to None
598+
:type label: str, optional
599+
:param file: file to write to, defaults to None
600+
:type file: file object, optional
601+
602+
Print the pose as a matrix, with an optional line beforehand. By default
603+
the matrix is printed to stdout.
604+
605+
Example:
606+
607+
.. runblock:: pycon
608+
609+
>>> from spatialmath import SE3
610+
>>> SE3().print()
611+
>>> SE3().print("pose is:")
612+
613+
"""
614+
if label is not None:
615+
print(label, file=file)
616+
print(self, file=file)
617+
593618
def printline(self, *args, **kwargs):
594619
r"""
595620
Print pose in compact single line format (superclass method)

0 commit comments

Comments
 (0)
0