Skip to content

Commit 81d8f9d

Browse files
authored
fix(planning_factor_interface): set control point data independently (#291)
* fix(planning_factor_interface): set shift length properly Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> * chore: add comment Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> --------- Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
1 parent 2ec35a9 commit 81d8f9d

File tree

2 files changed

+26
-19
lines changed

2 files changed

+26
-19
lines changed

Diff for: planning/autoware_planning_factor_interface/include/autoware/planning_factor_interface/planning_factor_interface.hpp

+23-16
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,28 @@ class PlanningFactorInterface
8787
* @param behavior of this planning factor.
8888
* @param safety factor.
8989
* @param driving direction.
90-
* @param target velocity of the control point.
91-
* @param shift length of the control point.
90+
* @param target velocity of the 1st control point.
91+
* @param target velocity of the 2nd control point.
92+
* @param shift length of the 1st control point.
93+
* @param shift length of the 2nd control point.
9294
* @param detail information.
9395
*/
9496
template <class PointType>
9597
void add(
9698
const std::vector<PointType> & points, const Pose & ego_pose, const Pose & start_pose,
9799
const Pose & end_pose, const uint16_t behavior, const SafetyFactorArray & safety_factors,
98-
const bool is_driving_forward = true, const double velocity = 0.0,
99-
const double shift_length = 0.0, const std::string & detail = "")
100+
const bool is_driving_forward = true, const double start_velocity = 0.0,
101+
const double end_velocity = 0.0, const double start_shift_length = 0.0,
102+
const double end_shift_length = 0.0, const std::string & detail = "")
100103
{
101104
const auto start_distance = static_cast<float>(
102105
autoware::motion_utils::calcSignedArcLength(points, ego_pose.position, start_pose.position));
103106
const auto end_distance = static_cast<float>(
104107
autoware::motion_utils::calcSignedArcLength(points, ego_pose.position, end_pose.position));
105108
add(
106109
start_distance, end_distance, start_pose, end_pose, behavior, safety_factors,
107-
is_driving_forward, velocity, shift_length, detail);
110+
is_driving_forward, start_velocity, end_velocity, start_shift_length, end_shift_length,
111+
detail);
108112
}
109113

110114
/**
@@ -151,26 +155,29 @@ class PlanningFactorInterface
151155
* @param behavior of this planning factor.
152156
* @param safety factor.
153157
* @param driving direction.
154-
* @param target velocity of the control point.
155-
* @param shift length of the control point.
158+
* @param target velocity of the 1st control point.
159+
* @param target velocity of the 2nd control point.
160+
* @param shift length of the 1st control point.
161+
* @param shift length of the 2nd control point.
156162
* @param detail information.
157163
*/
158164
void add(
159165
const double start_distance, const double end_distance, const Pose & start_pose,
160166
const Pose & end_pose, const uint16_t behavior, const SafetyFactorArray & safety_factors,
161-
const bool is_driving_forward = true, const double velocity = 0.0,
162-
const double shift_length = 0.0, const std::string & detail = "")
167+
const bool is_driving_forward = true, const double start_velocity = 0.0,
168+
const double end_velocity = 0.0, const double start_shift_length = 0.0,
169+
const double end_shift_length = 0.0, const std::string & detail = "")
163170
{
164171
const auto control_start_point = autoware_internal_planning_msgs::build<ControlPoint>()
165172
.pose(start_pose)
166-
.velocity(velocity)
167-
.shift_length(shift_length)
173+
.velocity(start_velocity)
174+
.shift_length(start_shift_length)
168175
.distance(start_distance);
169176

170177
const auto control_end_point = autoware_internal_planning_msgs::build<ControlPoint>()
171178
.pose(end_pose)
172-
.velocity(velocity)
173-
.shift_length(shift_length)
179+
.velocity(end_velocity)
180+
.shift_length(end_shift_length)
174181
.distance(end_distance);
175182

176183
const auto factor = autoware_internal_planning_msgs::build<PlanningFactor>()
@@ -227,15 +234,15 @@ extern template void
227234
PlanningFactorInterface::add<autoware_internal_planning_msgs::msg::PathPointWithLaneId>(
228235
const std::vector<autoware_internal_planning_msgs::msg::PathPointWithLaneId> &, const Pose &,
229236
const Pose &, const Pose &, const uint16_t behavior, const SafetyFactorArray &, const bool,
230-
const double, const double, const std::string &);
237+
const double, const double, const double, const double, const std::string &);
231238
extern template void PlanningFactorInterface::add<autoware_planning_msgs::msg::PathPoint>(
232239
const std::vector<autoware_planning_msgs::msg::PathPoint> &, const Pose &, const Pose &,
233240
const Pose &, const uint16_t behavior, const SafetyFactorArray &, const bool, const double,
234-
const double, const std::string &);
241+
const double, const double, const double, const std::string &);
235242
extern template void PlanningFactorInterface::add<autoware_planning_msgs::msg::TrajectoryPoint>(
236243
const std::vector<autoware_planning_msgs::msg::TrajectoryPoint> &, const Pose &, const Pose &,
237244
const Pose &, const uint16_t behavior, const SafetyFactorArray &, const bool, const double,
238-
const double, const std::string &);
245+
const double, const double, const double, const std::string &);
239246

240247
} // namespace autoware::planning_factor_interface
241248

Diff for: planning/autoware_planning_factor_interface/src/planing_factor_interface.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ template void
3737
PlanningFactorInterface::add<autoware_internal_planning_msgs::msg::PathPointWithLaneId>(
3838
const std::vector<autoware_internal_planning_msgs::msg::PathPointWithLaneId> &, const Pose &,
3939
const Pose &, const Pose &, const uint16_t behavior, const SafetyFactorArray &, const bool,
40-
const double, const double, const std::string &);
40+
const double, const double, const double, const double, const std::string &);
4141
template void PlanningFactorInterface::add<autoware_planning_msgs::msg::PathPoint>(
4242
const std::vector<autoware_planning_msgs::msg::PathPoint> &, const Pose &, const Pose &,
4343
const Pose &, const uint16_t behavior, const SafetyFactorArray &, const bool, const double,
44-
const double, const std::string &);
44+
const double, const double, const double, const std::string &);
4545
template void PlanningFactorInterface::add<autoware_planning_msgs::msg::TrajectoryPoint>(
4646
const std::vector<autoware_planning_msgs::msg::TrajectoryPoint> &, const Pose &, const Pose &,
4747
const Pose &, const uint16_t behavior, const SafetyFactorArray &, const bool, const double,
48-
const double, const std::string &);
48+
const double, const double, const double, const std::string &);
4949
} // namespace autoware::planning_factor_interface

0 commit comments

Comments
 (0)