Skip to content

Commit c8084ef

Browse files
committed
check resolution is not zero
Signed-off-by: Masaya Kataoka <[email protected]>
1 parent d5b6c97 commit c8084ef

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

common/math/geometry/src/spline/catmull_rom_spline.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ auto CatmullRomSpline::getTrajectory(
101101
const double start_s, const double end_s, const double resolution, const double offset) const
102102
-> std::vector<geometry_msgs::msg::Point>
103103
{
104+
if (std::fabs(resolution) <= std::numeric_limits<double>::epsilon()) {
105+
THROW_SIMULATION_ERROR(
106+
"Resolution should not be zero.",
107+
"This message is not originally intended to be displayed, if you see it, please contact ",
108+
"the developer of traffic_simulator.");
109+
}
104110
if (start_s > end_s) {
105111
std::vector<geometry_msgs::msg::Point> ret;
106112
double s = start_s;
@@ -126,6 +132,12 @@ auto CatmullRomSpline::getTrajectoryPoses(
126132
const double start_s, const double end_s, const double resolution) const
127133
-> std::vector<geometry_msgs::msg::Pose>
128134
{
135+
if (std::fabs(resolution) <= std::numeric_limits<double>::epsilon()) {
136+
THROW_SIMULATION_ERROR(
137+
"Resolution should not be zero.",
138+
"This message is not originally intended to be displayed, if you see it, please contact ",
139+
"the developer of traffic_simulator.");
140+
}
129141
if (start_s > end_s) {
130142
std::vector<geometry_msgs::msg::Pose> ret;
131143
double s = start_s;

0 commit comments

Comments
 (0)