2424import numpy as np
2525
2626from spatialmath .base import argcheck
27- from spatialmath import base as tr
27+ from spatialmath import base as base
2828from spatialmath .baseposematrix import BasePoseMatrix
2929import spatialmath .pose3d as p3
3030
@@ -75,16 +75,16 @@ def __init__(self, arg=None, *, unit='rad', check=True):
7575 super ().__init__ ()
7676
7777 if isinstance (arg , SE2 ):
78- self .data = [tr .t2r (x ) for x in arg .data ]
78+ self .data = [base .t2r (x ) for x in arg .data ]
7979
8080 elif super ().arghandler (arg , check = check ):
8181 return
8282
8383 elif argcheck .isscalar (arg ):
84- self .data = [tr .rot2 (arg , unit = unit )]
84+ self .data = [base .rot2 (arg , unit = unit )]
8585
8686 elif argcheck .isvector (arg ):
87- self .data = [tr .rot2 (x , unit = unit ) for x in argcheck .getvector (arg )]
87+ self .data = [base .rot2 (x , unit = unit ) for x in argcheck .getvector (arg )]
8888
8989 else :
9090 raise ValueError ('bad argument to constructor' )
@@ -126,7 +126,7 @@ def Rand(cls, N=1, arange=(0, 2 * math.pi), unit='rad'):
126126
127127 """
128128 rand = np .random .uniform (low = arange [0 ], high = arange [1 ], size = N ) # random values in the range
129- return cls ([tr .rot2 (x ) for x in argcheck .getunit (rand , unit )])
129+ return cls ([base .rot2 (x ) for x in argcheck .getunit (rand , unit )])
130130
131131 @classmethod
132132 def Exp (cls , S , check = True ):
@@ -146,9 +146,9 @@ def Exp(cls, S, check=True):
146146 :seealso: :func:`spatialmath.base.transforms2d.trexp`, :func:`spatialmath.base.transformsNd.skew`
147147 """
148148 if isinstance (S , (list , tuple )):
149- return cls ([tr .trexp2 (s , check = check ) for s in S ])
149+ return cls ([base .trexp2 (s , check = check ) for s in S ])
150150 else :
151- return cls (tr .trexp2 (S , check = check ), check = False )
151+ return cls (base .trexp2 (S , check = check ), check = False )
152152
153153 @staticmethod
154154 def isvalid (x , check = True ):
@@ -163,7 +163,7 @@ def isvalid(x, check=True):
163163
164164 :seealso: :func:`~spatialmath.base.transform3d.isrot`
165165 """
166- return not check or tr .isrot2 (x , check = True )
166+ return not check or base .isrot2 (x , check = True )
167167
168168 def inv (self ):
169169 """
@@ -229,7 +229,7 @@ def SE2(self):
229229 :rtype: SE2 instance
230230
231231 """
232- return SE2 (tr .rt2tr (self .A , [0 , 0 ]))
232+ return SE2 (base .rt2tr (self .A , [0 , 0 ]))
233233
234234
235235# ============================== SE2 =====================================#
@@ -292,16 +292,16 @@ def __init__(self, x=None, y=None, theta=None, *, unit='rad', check=True):
292292 return
293293
294294 if isinstance (x , SO2 ):
295- self .data = [tr .r2t (_x ) for _x in x .data ]
295+ self .data = [base .r2t (_x ) for _x in x .data ]
296296
297297 elif argcheck .isscalar (x ):
298- self .data = [tr .trot2 (x , unit = unit )]
298+ self .data = [base .trot2 (x , unit = unit )]
299299 elif len (x ) == 2 :
300300 # SE2([x,y])
301- self .data = [tr .transl2 (x )]
301+ self .data = [base .transl2 (x )]
302302 elif len (x ) == 3 :
303303 # SE2([x,y,theta])
304- self .data = [tr .trot2 (x [2 ], t = x [:2 ], unit = unit )]
304+ self .data = [base .trot2 (x [2 ], t = x [:2 ], unit = unit )]
305305
306306 else :
307307 raise ValueError ('bad argument to constructor' )
@@ -310,11 +310,11 @@ def __init__(self, x=None, y=None, theta=None, *, unit='rad', check=True):
310310
311311 if y is not None and theta is None :
312312 # SE2(x, y)
313- self .data = [tr .transl2 (x , y )]
313+ self .data = [base .transl2 (x , y )]
314314
315315 elif y is not None and theta is not None :
316316 # SE2(x, y, theta)
317- self .data = [tr .trot2 (theta , t = [x , y ], unit = unit )]
317+ self .data = [base .trot2 (theta , t = [x , y ], unit = unit )]
318318
319319 else :
320320 raise ValueError ('bad arguments to constructor' )
@@ -367,7 +367,7 @@ def Rand(cls, N=1, xrange=(-1, 1), yrange=(-1, 1), arange=(0, 2 * math.pi), unit
367367 x = np .random .uniform (low = xrange [0 ], high = xrange [1 ], size = N ) # random values in the range
368368 y = np .random .uniform (low = yrange [0 ], high = yrange [1 ], size = N ) # random values in the range
369369 theta = np .random .uniform (low = arange [0 ], high = arange [1 ], size = N ) # random values in the range
370- return cls ([tr .trot2 (t , t = [x , y ]) for (t , x , y ) in zip (x , y , argcheck .getunit (theta , unit ))])
370+ return cls ([base .trot2 (t , t = [x , y ]) for (t , x , y ) in zip (x , y , argcheck .getunit (theta , unit ))])
371371
372372 @classmethod
373373 def Exp (cls , S , check = True ): # pylint: disable=arguments-differ
@@ -394,9 +394,10 @@ def Exp(cls, S, check=True): # pylint: disable=arguments-differ
394394 :seealso: :func:`spatialmath.base.transforms2d.trexp`, :func:`spatialmath.base.transformsNd.skew`
395395 """
396396 if isinstance (S , (list , tuple )):
397- return cls ([tr .trexp2 (s ) for s in S ])
397+ return cls ([base .trexp2 (s ) for s in S ])
398398 else :
399- return cls (tr .trexp2 (S ), check = False )
399+ return cls (base .trexp2 (S ), check = False )
400+
400401 @classmethod
401402 def Tx (cls , x ):
402403 """
@@ -460,7 +461,7 @@ def isvalid(x, check=True):
460461
461462 :seealso: :func:`~spatialmath.base.transform2d.ishom`
462463 """
463- return not check or tr .ishom2 (x , check = True )
464+ return not check or base .ishom2 (x , check = True )
464465
465466 @property
466467 def t (self ):
@@ -516,9 +517,9 @@ def inv(self):
516517
517518 """
518519 if len (self ) == 1 :
519- return SE2 (tr .rt2tr (self .R .T , - self .R .T @ self .t ))
520+ return SE2 (base .rt2tr (self .R .T , - self .R .T @ self .t ))
520521 else :
521- return SE2 ([tr .rt2tr (x .R .T , - x .R .T @ x .t ) for x in self ])
522+ return SE2 ([base .rt2tr (x .R .T , - x .R .T @ x .t ) for x in self ])
522523
523524 def SE3 (self , z = 0 ):
524525 """
0 commit comments