Closed anineand closed 9 months ago
Fix found: I read the spatialmath.pose3d code, and found a fix by running T.A[0, 3], T.A[1, 3] and T.A[2, 3] for x, y and z, respectively.
This was based on the SE3 class methods x()
, y()
and z()
, which got the following error when I attempted to run e.g. T.x()
:
AttributeError: 'SE3' object has no attribute 'x'
I believe that there is use for some debugging here, but at least I found a work around.
Also, if one is not supposed to be able to just run T[-1], then the documentation of robotics toolbox for python should be updated. I also think it would be nice if it's easier to access any of the matrix elements, but it's not something I need personally.
Thanks for all your work making and keeping these packages up to date!
Hi @anineand thanks for posting this.
Unfortunately I am not familiar with the robotics toolbox - did a quick search and I assume you were talking about this particular method https://github.com/petercorke/robotics-toolbox-matlab/blob/bd7a9d75176c660f43fc799b24d838f70b02250c/%40SerialLink/fkine.m#L48C46-L49C1 ? Again, I am not familiar with it but looking at the description, the fkine
method returns a tuple (pair): t, allt
, each being a spatialmath.pose3d.SE3
object, which is what you found out, T[-1] would be the second one in the tuple (pair).
In any case, once you have an SE3 object, you will have access to many methods provided by this spatialmath(-python) package, e.g. as described in https://bdaiinstitute.github.io/spatialmath-python/func_nd.html?highlight=tr2rt#spatialmath.base.transformsNd.tr2rt you can easily extract the rotation and translation from it.
Hi both.
Within the Robotics Toolbox fkine
returns an SE3
object that contains a single transform value. It does not return a tuple, that's done by the method fkine_all
.
So, in your case, T
or T[-1]
will be the same thing since there is only one value. To access just the translational part use the .t
property which results in a 1D array with 3 elements.
There are also properties for translation components, eg. T.x
, which is quite concise.
Hi,
I need to only get the position coordinate a from spatialmath.pose3d.SE3 object, so I tried to run T[-1] as it says in the robotics toolbox documentation. However that gives me the entire T matrix, not just the last column (with or without 1 at the end). I have also tried getting T[3,0], T[-1,0] and so on, but then I get warnings.
Example:
I am running spatialmath version 1.1.8 (and robotics toolbox 1.1.0).