Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions spatialmath/spline.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ def __init__(
self.control_poses = control_poses
self.timepoints = np.array(timepoints)

if self.timepoints[-1] < self._e:
if self.timepoints[-1] - self.timepoints[0] < self._e:
raise ValueError(
"Difference between start and end timepoints is less than {self._e}"
f"Difference between start and end timepoints is less than {self._e}"
)

if len(self.control_poses) != len(self.timepoints):
Expand Down
23 changes: 23 additions & 0 deletions tests/test_spline.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,29 @@ def test_small_delta_t(self):
np.linspace(0, InterpSplineSE3._e, len(self.waypoints)), self.waypoints
)

@pytest.mark.parametrize(
"start, end",
[
(-5, -1),
(10, 20),
],
)
@pytest.mark.parametrize("normalize_time", [False, True])
def test_nonzero_offset_time_range(self, start, end, normalize_time):
InterpSplineSE3(
np.linspace(start, end, len(self.waypoints)),
self.waypoints,
normalize_time=normalize_time,
)

def test_zero_time_span(self):
with pytest.raises(ValueError, match=str(InterpSplineSE3._e)):
InterpSplineSE3(
np.full(len(self.waypoints), -1.0),
self.waypoints,
normalize_time=True,
)

@pytest.mark.skipif(
plt.get_backend().lower() == "agg" or os.environ.get("CI") == "true",
reason="animate=True busy-waits on a timer callback that never "
Expand Down