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

ROBOMATH.MAT AND NUMPY.NDARRAY EQUIVALENCY

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()
#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:
robomath.Mat(np_array.tolist())
Please read theForum Guidelinesbefore posting!
Find useful information about RoboDK by visiting our2022世界杯32强赛程表时间 .
Thanks, Sam. That worked great. Might be good to add that to the reference:
//www.sinclairbody.com/doc/en/PythonAPI/robo...obomath-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.
```




Users browsing this thread:
1 Guest(s)