If edge_start is a numpy array of a datatype with no floating point precision (uint, int etc), subtracting a floating point number (implied by the multiplication on L65) will fail with exception numpy.core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'add' output from dtype('float64') to dtype('uint64') with casting rule 'same_kind'.
Example:
import numpy as np
from linen.folding.fold_lines.towel import towel_fold_line
from linen.folding.ordered_keypoints import get_counterclockwise_ordered_keypoints
from linen.folding.trajectories.circular_fold import circular_fold_trajectory
from linen.grasping.slide_grasp import slide_grasp_trajectory
from linen.grasping.towel.towel_grasps import towel_aligned_grasps
depth = 100
keypoints = [
[71, 187, depth], [73, 99, depth], [132, 102, depth], [132, 189, depth]
]
keypoints = np.array(keypoints)
ordered_keypoints = get_counterclockwise_ordered_keypoints(keypoints)
fold_line = towel_fold_line(ordered_keypoints)
grasp_depth = 0.05
grasp_left, grasp_right = towel_aligned_grasps(ordered_keypoints, grasp_depth=grasp_depth)
The reason it fails in this example is because the original input were 3D keypoints specified as being integers. Easily solved by explicitly marking the input array of keypoints as floats but it might be better to solve it in the library.
I propose (and make a PR later) by solving it by casting the edge_start and edge_end copy to floats here.
If edge_start is a numpy array of a datatype with no floating point precision (uint, int etc), subtracting a floating point number (implied by the multiplication on L65) will fail with exception
numpy.core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'add' output from dtype('float64') to dtype('uint64') with casting rule 'same_kind'
.Example:
The reason it fails in this example is because the original input were 3D keypoints specified as being integers. Easily solved by explicitly marking the input array of keypoints as floats but it might be better to solve it in the library.
I propose (and make a PR later) by solving it by casting the edge_start and edge_end copy to floats here.