krishauser / Klampt

Kris' Locomotion and Manipulation Planning Toolkit
BSD 3-Clause "New" or "Revised" License
377 stars 96 forks source link

Undefined behavior when start and end are the same for Cartesian interpolation: ZeroDivisionError #154

Closed smeng9 closed 2 years ago

smeng9 commented 2 years ago

This is more of a corner case (however still a valid case) when a and b passed into this function are the same.

https://github.com/krishauser/Klampt/blob/d538be26ecc1af1977c7e235fd9f6589413506a8/Python/klampt/model/cartesian_trajectory.py#L189

The proposed solution would be return a path with times as [0, 1] and milestones as [a.CSpaceConfig, b.CSpaceConfig] if a == b, instead of throwing ZeroDivisionError.

krishauser commented 2 years ago

That would actually be incorrect behavior in case the start / end configurations are fixed, e.g., for a redundant robot. Fixed in master via upper bounding denominator.