Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5


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:
rm_mat = robomath.eye()
# TODO: figure out how to get a robomath.Mat matrix that is equivalent to a numpy matrix
for i in range(np.shape(rm_mat)[0]):
        for j in range(np.shape(rm_mat)[1]):
               rm_mat[i,j] = my_numpy_matrix[i][j]

I am sure this will slow down my code severely.

Is there a built-in way to cast numpy matrices to robomath.Mat matrices?
To cast a numpy array to a RoboDK matrix, you can do something like this:
Please read the Forum Guidelines before posting!
Find useful information about RoboDK by visiting our Online Documentation.
Thanks, Sam. That worked great. Might be good to add that to the reference:
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.

Users browsing this thread:
1 Guest(s)