Skip to content

Commit cd577d0

Browse files
committed
update error
Signed-off-by: Mamoru Sobue <[email protected]>
1 parent eae7bea commit cd577d0

File tree

3 files changed

+37
-9
lines changed

3 files changed

+37
-9
lines changed

common/autoware_trajectory/include/autoware/trajectory/interpolator/result.hpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,8 @@ struct InterpolationFailure
3030
const std::string what;
3131
};
3232

33-
inline InterpolationFailure operator+(
34-
const InterpolationFailure & primary, const InterpolationFailure & nested)
35-
{
36-
return InterpolationFailure{primary.what + " ==> " + nested.what};
37-
}
33+
InterpolationFailure operator+(
34+
const InterpolationFailure & primary, const InterpolationFailure & nested);
3835

3936
using InterpolationResult = tl::expected<InterpolationSuccess, InterpolationFailure>;
4037

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2025 TIER IV, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "autoware/trajectory/interpolator/result.hpp"
16+
17+
#include <iostream>
18+
#include <sstream>
19+
20+
namespace autoware::trajectory::interpolator
21+
{
22+
23+
InterpolationFailure operator+(
24+
const InterpolationFailure & primary, const InterpolationFailure & nested)
25+
{
26+
std::stringstream ss;
27+
ss << primary.what << "." << std::endl << "\tReason: " << nested.what << std::endl;
28+
return InterpolationFailure{ss.str()};
29+
}
30+
31+
} // namespace autoware::trajectory::interpolator

common/autoware_trajectory/src/trajectory_point.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -106,25 +106,25 @@ interpolator::InterpolationResult Trajectory<PointType>::build(
106106
bases_, std::move(longitudinal_velocity_mps_values));
107107
!result) {
108108
return tl::unexpected(interpolator::InterpolationFailure{
109-
"failed to interpolate TrajectoryPoint::longitudinal_velocity_mps_values"});
109+
"failed to interpolate TrajectoryPoint::longitudinal_velocity_mps"});
110110
}
111111
if (const auto result =
112112
this->lateral_velocity_mps().build(bases_, std::move(lateral_velocity_mps_values));
113113
!result) {
114114
return tl::unexpected(interpolator::InterpolationFailure{
115-
"failed to interpolate TrajectoryPoint::lateral_velocity_mps_values"});
115+
"failed to interpolate TrajectoryPoint::lateral_velocity_mps"});
116116
}
117117
if (const auto result =
118118
this->heading_rate_rps().build(bases_, std::move(heading_rate_rps_values));
119119
!result) {
120120
return tl::unexpected(interpolator::InterpolationFailure{
121-
"failed to interpolate TrajectoryPoint::heading_rate_rps_values"});
121+
"failed to interpolate TrajectoryPoint::heading_rate_rps"});
122122
}
123123
if (const auto result =
124124
this->acceleration_mps2().build(bases_, std::move(acceleration_mps2_values));
125125
!result) {
126126
return tl::unexpected(interpolator::InterpolationFailure{
127-
"failed to interpolate TrajectoryPoint::acceleration_mps2_values"});
127+
"failed to interpolate TrajectoryPoint::acceleration_mps2"});
128128
}
129129
if (const auto result =
130130
this->front_wheel_angle_rad().build(bases_, std::move(front_wheel_angle_rad_values));

0 commit comments

Comments
 (0)