You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The CatmullRomSpline member function getCollisionPointIn2D calculates wrong values.
This member function uses its component curves member function getCollisionPointIn2D here:
auto s = curves_[i].getCollisionPointIn2D(point0, point1, search_backward);
and simply adds the obtained value to the sum of the preceding curves. This produces an incorrect result, because HermiteCurve operates on normalized lengths, meaning the s value is from range <0; 1> like in the function below.
And CatmullRomSpline operates on absolute lengths, so not normalized ones. This means that the normalized value is added to not normalized ones - which makes the incorrect result.
Many member functions in the HermiteCurve class offer a denormalize_s argument which - when set to true - converts normalized s to the absolute value of s, independent from the curvature length.
In my opinion, the best solution would be to call the HermiteCurve member function getCollisionPointIn2D with such argument denormalize_s set to true. However this member function does not offer such a functionality, so I suggest adding it the same way it is implemented here:
Context:
I am adding unit tests for the geometry package and wanted to add tests for the getCollisionPointIn2D function, but it generates the wrong results.
To Reproduce
Steps to reproduce the behavior:
Edit any existing source code file or create a new one
Create a CatmullRomSpline from points spaced apart for more than 2 units (like (0, 0), (2, 0) and (4, 0) )
Call the getCollisionPointIn2D member function with two points creating a parallel line to the spline (e.g. (0.1, 1) and (0.1, -1)
Print the result to the console
Compile and execute
See the incorrect result
Expected behavior
The CatmullRomSpline member function getCollisionPointIn2D should return the correct result (in the example above 0.1, not 0.05).
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
OS: [e.g. iOS]: Ubuntu
Browser [e.g. chrome, safari]: Firefox
Version [e.g. 22]: 22
ROS 2 version: Humble
DDS: CycloneDDS
The text was updated successfully, but these errors were encountered:
Describe the bug
The
CatmullRomSpline
member functiongetCollisionPointIn2D
calculates wrong values.This member function uses its component curves member function
getCollisionPointIn2D
here:scenario_simulator_v2/common/math/geometry/src/spline/catmull_rom_spline.cpp
Line 383 in 173a8c1
and here:
scenario_simulator_v2/common/math/geometry/src/spline/catmull_rom_spline.cpp
Line 391 in 173a8c1
and simply adds the obtained value to the sum of the preceding curves. This produces an incorrect result, because
HermiteCurve
operates on normalized lengths, meaning the s value is from range <0; 1> like in the function below.scenario_simulator_v2/common/math/geometry/src/spline/hermite_curve.cpp
Lines 122 to 181 in 173a8c1
And
CatmullRomSpline
operates on absolute lengths, so not normalized ones. This means that the normalized value is added to not normalized ones - which makes the incorrect result.Many member functions in the
HermiteCurve
class offer adenormalize_s
argument which - when set to true - converts normalized s to the absolute value of s, independent from the curvature length.In my opinion, the best solution would be to call the
HermiteCurve
member functiongetCollisionPointIn2D
with such argumentdenormalize_s
set to true. However this member function does not offer such a functionality, so I suggest adding it the same way it is implemented here:scenario_simulator_v2/common/math/geometry/src/spline/hermite_curve.cpp
Lines 194 to 197 in 173a8c1
Context:
I am adding unit tests for the geometry package and wanted to add tests for the
getCollisionPointIn2D
function, but it generates the wrong results.To Reproduce
Steps to reproduce the behavior:
CatmullRomSpline
from points spaced apart for more than 2 units (like (0, 0), (2, 0) and (4, 0) )getCollisionPointIn2D
member function with two points creating a parallel line to the spline (e.g. (0.1, 1) and (0.1, -1)Expected behavior
The
CatmullRomSpline
member functiongetCollisionPointIn2D
should return the correct result (in the example above 0.1, not 0.05).Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: