Skip to content

trapezoidal accepts the zero-blend velocity boundary but returns NaN at the initial sample #924

Open

Description

@Afloat16

Reproduction

import numpy as np
from roboticstoolbox import trapezoidal

trajectory = trapezoidal(0.0, 1.0, np.array([0.0, 0.5, 1.0]), V=1.0)
print(trajectory.q)
print(trajectory.qd)
print(trajectory.qdd)

On current main 879fb363580840e19ee70b6b175e8cd3543e2b38 this prints:

[nan 0.5 1. ]
[nan 1.  1. ]
[inf 0.  0. ]

The accepted lower boundary abs(V) == abs(qf-q0)/T gives tb == 0; TrapezoidalProfile.__init__ divides by tb, and evaluating the initial blend multiplies that infinite acceleration by zero. Reversing the move reproduces the same non-finite initial sample. Controls at V=1.5 and V=2.0 return finite arrays.

Expected: handle the accepted boundary with a defined finite profile, or reject it explicitly if zero-duration blends are unsupported, rather than returning NaN/inf.

Reproduced with the normal source-package import on Linux, Python 3.12.14, NumPy 2.3.5 and SciPy 1.17.0. No robot hardware was used. This is separate from the empty-phase plotting fix in #910; filed following the request there. Searches for trapezoidal with blend and NaN found no existing issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions