ROBOMATH.MAT AND NUMPY.NDARRAY EQUIVALENCY- Printable Version +- RoboDK Forum (//www.sinclairbody.com/forum) +-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN) +--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API) +--- Thread: ROBOMATH.MAT AND NUMPY.NDARRAY EQUIVALENCY (/Thread-ROBOMATH-MAT-AND-NUMPY-NDARRAY-EQUIVALENCY) |
ROBOMATH.MAT AND NUMPY.NDARRAY EQUIVALENCY-sig.johnnson-05-08-2023 I am doing some math that requires numpy / scipy matrix operations. Numpy and scipy functions handle robomath.Mat matrices quite well. However, I cannot item.SetPose(np.ndarray), unfortunately. As a workaround, I have the following kind of gross passage in my code:
Code:
rm_mat = robomath.eye()
I am sure this will slow down my code severely. Is there a built-in way to cast numpy matrices to robomath.Mat matrices? RE: ROBOMATH.MAT AND NUMPY.NDARRAY EQUIVALENCY-Sam-05-09-2023 将一系列numpy RoboDK矩阵,可以do something like this: robomath.Mat(np_array.tolist()) RE: ROBOMATH.MAT AND NUMPY.NDARRAY EQUIVALENCY-sig.johnnson-05-10-2023 Thanks, Sam. That worked great. Might be good to add that to the reference: //www.sinclairbody.com/doc/en/PythonAPI/robodk.html#robomath-py ``` classrobodk.robomath.Mat(rows=None, ncols=None) Mat is a matrix object. The main purpose of this object is to represent a pose in the 3D space (position and orientation). A pose is a 4x4 matrix that represents the position and orientation of one reference frame with respect to another one, in the 3D space. Poses are commonly used in robotics to place objects, reference frames and targets with respect to each other. ``` |