@@ -1036,6 +1036,105 @@ def t(self, v: ArrayLike3):
10361036 v = smb .getvector (v , 3 )
10371037 self .A [:3 , 3 ] = v
10381038
1039+ @property
1040+ def x (self ) -> float :
1041+ """
1042+ First element of translational component of SE(3)
1043+
1044+ :return: first element of translational component of SE(3)
1045+ :rtype: float
1046+
1047+ If ``len(v) > 1``, return an array with shape=(N,).
1048+
1049+ Example:
1050+
1051+ .. runblock:: pycon
1052+
1053+ >>> from spatialmath import SE3
1054+ >>> v = SE3(1,2,3)
1055+ >>> v.x
1056+ >>> v = SE3([ SE3(1,2,3), SE3(4,5,6)])
1057+ >>> v.x
1058+
1059+ :SymPy: supported
1060+ """
1061+ if len (self ) == 1 :
1062+ return self .A [0 , 3 ]
1063+ else :
1064+ return np .array ([v [0 , 3 ] for v in self .A ])
1065+
1066+ @x .setter
1067+ def x (self , x : float ):
1068+ if len (self ) > 1 :
1069+ raise ValueError ("can only assign elements to length 1 object" )
1070+ self .A [0 , 3 ] = x
1071+
1072+ @property
1073+ def y (self ) -> float :
1074+ """
1075+ Second element of translational component of SE(3)
1076+
1077+ :return: second element of translational component of SE(3)
1078+ :rtype: float
1079+
1080+ If ``len(v) > 1``, return an array with shape=(N,).
1081+
1082+ Example:
1083+
1084+ .. runblock:: pycon
1085+
1086+ >>> from spatialmath import SE3
1087+ >>> v = SE3(1,2,3)
1088+ >>> v.y
1089+ >>> v = SE3([ SE3(1,2,3), SE3(4,5,6)])
1090+ >>> v.y
1091+
1092+ :SymPy: supported
1093+ """
1094+ if len (self ) == 1 :
1095+ return self .A [1 , 3 ]
1096+ else :
1097+ return np .array ([v [1 , 3 ] for v in self .A ])
1098+
1099+ @y .setter
1100+ def y (self , y : float ):
1101+ if len (self ) > 1 :
1102+ raise ValueError ("can only assign elements to length 1 object" )
1103+ self .A [1 , 3 ] = y
1104+
1105+ @property
1106+ def z (self ) -> float :
1107+ """
1108+ Third element of translational component of SE(3)
1109+
1110+ :return: third element of translational component of SE(3)
1111+ :rtype: float
1112+
1113+ If ``len(v) > 1``, return an array with shape=(N,).
1114+
1115+ Example:
1116+
1117+ .. runblock:: pycon
1118+
1119+ >>> from spatialmath import SE3
1120+ >>> v = SE3(1,2,3)
1121+ >>> v.z
1122+ >>> v = SE3([ SE3(1,2,3), SE3(4,5,6)])
1123+ >>> v.z
1124+
1125+ :SymPy: supported
1126+ """
1127+ if len (self ) == 1 :
1128+ return self .A [2 , 3 ]
1129+ else :
1130+ return np .array ([v [2 , 3 ] for v in self .A ])
1131+
1132+ @z .setter
1133+ def z (self , z : float ):
1134+ if len (self ) > 1 :
1135+ raise ValueError ("can only assign elements to length 1 object" )
1136+ self .A [2 , 3 ] = z
1137+
10391138 # ------------------------------------------------------------------------ #
10401139
10411140 def inv (self ) -> SE3 :
0 commit comments