@@ -1809,7 +1809,7 @@ def tr2adjoint(T):
18091809 raise ValueError ('bad argument' )
18101810
18111811
1812- def trprint (T , orient = 'rpy/zyx' , label = None , file = sys .stdout , fmt = '{:8.2g }' , degsym = True , unit = 'deg' ):
1812+ def trprint (T , orient = 'rpy/zyx' , label = None , file = sys .stdout , fmt = '{:.3g }' , degsym = True , unit = 'deg' ):
18131813 """
18141814 Compact display of SO(3) or SE(3) matrices
18151815
@@ -1821,7 +1821,7 @@ def trprint(T, orient='rpy/zyx', label=None, file=sys.stdout, fmt='{:8.2g}', deg
18211821 :type orient: str
18221822 :param file: file to write formatted string to. [default, stdout]
18231823 :type file: file object
1824- :param fmt: conversion format for each number
1824+ :param fmt: conversion format for each number in the format used with ``format``
18251825 :type fmt: str
18261826 :param unit: angular units: 'rad' [default], or 'deg'
18271827 :type unit: str
@@ -1832,16 +1832,19 @@ def trprint(T, orient='rpy/zyx', label=None, file=sys.stdout, fmt='{:8.2g}', deg
18321832 The matrix is formatted and written to ``file`` and the
18331833 string is returned. To suppress writing to a file, set ``file=None``.
18341834
1835- - ``trprint(R)`` displays the SO(3) rotation matrix in a compact
1835+ - ``trprint(R)`` prints the SO(3) rotation matrix to stdout in a compact
18361836 single-line format:
18371837
18381838 [LABEL:] ORIENTATION UNIT
18391839
1840- - ``trprint(T)`` displays the SE(3) homogoneous transform in a compact
1841- single-line format:
1840+ - ``trprint(T)`` prints the SE(3) homogoneous transform to stdout in a
1841+ compact single-line format:
18421842
18431843 [LABEL:] [t=X, Y, Z;] ORIENTATION UNIT
18441844
1845+ - ``trprint(X, file=None)`` as above but returns the string rather than
1846+ printing to a file
1847+
18451848 Orientation is expressed in one of several formats:
18461849
18471850 - 'rpy/zyx' roll-pitch-yaw angles in ZYX axis order [default]
@@ -1864,7 +1867,9 @@ def trprint(T, orient='rpy/zyx', label=None, file=sys.stdout, fmt='{:8.2g}', deg
18641867 - If the 'rpy' option is selected, then the particular angle sequence can be
18651868 specified with the options 'xyz' or 'yxz' which are passed through to ``tr2rpy``.
18661869 'zyx' is the default.
1867- - Default formatting is for readable columns of data
1870+ - Default formatting is for compact display of data
1871+ - For tabular data set ``fmt`` to a fixed width format such as
1872+ ``fmt='{:.3g}'``
18681873
18691874 :seealso: :func:`~spatialmath.base.transforms2d.trprint2`, :func:`~tr2eul`, :func:`~tr2rpy`, :func:`~tr2angvec`
18701875 :SymPy: not supported
0 commit comments