Skip to content

Commit e44f37e

Browse files
committed
(WIP) cleanup and doc
Signed-off-by: Maxime CLEMENT <maxime.clement@tier4.jp>
1 parent e6335f1 commit e44f37e

File tree

3 files changed

+26
-75
lines changed

3 files changed

+26
-75
lines changed

planning/motion_velocity_planner/autoware_motion_velocity_planner_node/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Overview
44

5-
`motion_velocity_planner` is a planner that adjust the trajectory velocity based on the obstacles around the vehicle.
5+
`motion_velocity_planner` is a planner to adjust the trajectory velocity based on the obstacles around the vehicle.
66
It loads modules as plugins. Please refer to the links listed below for detail on each module.
77

88
<!-- ![Architecture](./docs/BehaviorVelocityPlanner-Architecture.drawio.svg)

planning/motion_velocity_planner/autoware_motion_velocity_planner_node/schema/motion_velocity_planner.schema.json

+3-59
Original file line numberDiff line numberDiff line change
@@ -5,64 +5,8 @@
55
"definitions": {
66
"behavior_velocity_planner": {
77
"type": "object",
8-
"properties": {
9-
"forward_path_length": {
10-
"type": "number",
11-
"default": "1000.0",
12-
"description": "forward path"
13-
},
14-
"backward_path_length": {
15-
"type": "number",
16-
"default": "5.0",
17-
"description": "backward path"
18-
},
19-
"behavior_output_path_interval": {
20-
"type": "number",
21-
"default": "1.0",
22-
"description": "the output path will be interpolated by this interval"
23-
},
24-
"max_accel": {
25-
"type": "number",
26-
"default": "-2.8",
27-
"description": "(to be a global parameter) max acceleration of the vehicle"
28-
},
29-
"system_delay": {
30-
"type": "number",
31-
"default": "0.5",
32-
"description": "(to be a global parameter) delay time until output control command"
33-
},
34-
"delay_response_time": {
35-
"type": "number",
36-
"default": "0.5",
37-
"description": "(to be a global parameter) delay time of the vehicle's response to control commands"
38-
},
39-
"stop_line_extend_length": {
40-
"type": "number",
41-
"default": "5.0",
42-
"description": "extend length of stop line"
43-
},
44-
"max_jerk": {
45-
"type": "number",
46-
"default": "-5.0",
47-
"description": "max jerk of the vehicle"
48-
},
49-
"is_publish_debug_path": {
50-
"type": "boolean",
51-
"default": "false",
52-
"description": "is publish debug path?"
53-
}
54-
},
55-
"required": [
56-
"forward_path_length",
57-
"behavior_output_path_interval",
58-
"backward_path_length",
59-
"max_accel",
60-
"system_delay",
61-
"delay_response_time",
62-
"stop_line_extend_length",
63-
"max_jerk",
64-
"is_publish_debug_path"
65-
],
8+
"properties": {},
9+
"required": [],
6610
"additionalProperties": false
6711
}
6812
},
@@ -71,7 +15,7 @@
7115
"type": "object",
7216
"properties": {
7317
"ros__parameters": {
74-
"$ref": "#/definitions/behavior_velocity_planner"
18+
"$ref": "#/definitions/motion_velocity_planner"
7519
}
7620
},
7721
"required": ["ros__parameters"],

planning/motion_velocity_planner/autoware_motion_velocity_planner_node/src/node.cpp

+22-15
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,6 @@ MotionVelocityPlannerNode::MotionVelocityPlannerNode(const rclcpp::NodeOptions &
146146
"~/service/unload_plugin",
147147
std::bind(&MotionVelocityPlannerNode::on_unload_plugin, this, _1, _2));
148148

149-
// set velocity smoother param
150-
on_param();
151-
152149
// Publishers
153150
trajectory_pub_ =
154151
this->create_publisher<autoware_auto_planning_msgs::msg::Trajectory>("~/output/trajectory", 1);
@@ -157,11 +154,12 @@ MotionVelocityPlannerNode::MotionVelocityPlannerNode(const rclcpp::NodeOptions &
157154
"~/output/velocity_factors", 1);
158155

159156
// Parameters
160-
planner_data_.stop_line_extend_length = declare_parameter<double>("stop_line_extend_length");
161157
// nearest search
162158
planner_data_.ego_nearest_dist_threshold =
163159
declare_parameter<double>("ego_nearest_dist_threshold");
164160
planner_data_.ego_nearest_yaw_threshold = declare_parameter<double>("ego_nearest_yaw_threshold");
161+
// set velocity smoother param
162+
on_param();
165163

166164
// Initialize PlannerManager
167165
for (const auto & name : declare_parameter<std::vector<std::string>>("launch_modules")) {
@@ -199,42 +197,47 @@ void MotionVelocityPlannerNode::on_unload_plugin(
199197
bool MotionVelocityPlannerNode::is_data_ready() const
200198
{
201199
const auto & d = planner_data_;
200+
constexpr auto throttle_duration = 3000; // [ms]
202201
auto clock = *get_clock();
203202

204203
// from callbacks
205204
if (!d.current_odometry) {
206-
RCLCPP_INFO_THROTTLE(get_logger(), clock, 3000, "Waiting for current odometry");
205+
RCLCPP_INFO_THROTTLE(get_logger(), clock, throttle_duration, "Waiting for current odometry");
207206
return false;
208207
}
209208

210209
if (!d.current_velocity) {
211-
RCLCPP_INFO_THROTTLE(get_logger(), clock, 3000, "Waiting for current velocity");
210+
RCLCPP_INFO_THROTTLE(get_logger(), clock, throttle_duration, "Waiting for current velocity");
212211
return false;
213212
}
214213
if (!d.current_acceleration) {
215-
RCLCPP_INFO_THROTTLE(get_logger(), clock, 3000, "Waiting for current acceleration");
214+
RCLCPP_INFO_THROTTLE(
215+
get_logger(), clock, throttle_duration, "Waiting for current acceleration");
216216
return false;
217217
}
218218
if (!d.predicted_objects) {
219-
RCLCPP_INFO_THROTTLE(get_logger(), clock, 3000, "Waiting for predicted_objects");
219+
RCLCPP_INFO_THROTTLE(get_logger(), clock, throttle_duration, "Waiting for predicted_objects");
220220
return false;
221221
}
222222
if (!d.no_ground_pointcloud) {
223-
RCLCPP_INFO_THROTTLE(get_logger(), clock, 3000, "Waiting for pointcloud");
223+
RCLCPP_INFO_THROTTLE(get_logger(), clock, throttle_duration, "Waiting for pointcloud");
224224
return false;
225225
}
226226
if (!map_ptr_) {
227-
RCLCPP_INFO_THROTTLE(get_logger(), clock, 3000, "Waiting for the initialization of map");
227+
RCLCPP_INFO_THROTTLE(
228+
get_logger(), clock, throttle_duration, "Waiting for the initialization of map");
228229
return false;
229230
}
230231
if (!d.velocity_smoother_) {
231232
RCLCPP_INFO_THROTTLE(
232-
get_logger(), clock, 3000, "Waiting for the initialization of velocity smoother");
233+
get_logger(), clock, throttle_duration,
234+
"Waiting for the initialization of velocity smoother");
233235
return false;
234236
}
235237
if (!d.occupancy_grid) {
236238
RCLCPP_INFO_THROTTLE(
237-
get_logger(), clock, 3000, "Waiting for the initialization of occupancy grid map");
239+
get_logger(), clock, throttle_duration,
240+
"Waiting for the initialization of occupancy grid map");
238241
return false;
239242
}
240243
return true;
@@ -415,7 +418,11 @@ autoware_auto_planning_msgs::msg::Trajectory MotionVelocityPlannerNode::generate
415418
motion_utils::findNearestSegmentIndex(output_trajectory_msg.points, stop_point);
416419
const auto insert_idx =
417420
motion_utils::insertTargetPoint(seg_idx, stop_point, output_trajectory_msg.points);
418-
if (insert_idx) output_trajectory_msg.points[*insert_idx].longitudinal_velocity_mps = 0.0;
421+
if (insert_idx) {
422+
output_trajectory_msg.points[*insert_idx].longitudinal_velocity_mps = 0.0;
423+
} else {
424+
RCLCPP_WARN(get_logger(), "Failed to insert stop point");
425+
}
419426
}
420427
for (const auto & slowdown_interval : planning_result.slowdown_intervals) {
421428
const auto from_seg_idx =
@@ -430,7 +437,7 @@ autoware_auto_planning_msgs::msg::Trajectory MotionVelocityPlannerNode::generate
430437
for (auto idx = *from_insert_idx; idx <= *to_insert_idx; ++idx)
431438
output_trajectory_msg.points[idx].longitudinal_velocity_mps = 0.0;
432439
} else {
433-
RCLCPP_WARN(get_logger(), "Failed to insert slowdown points");
440+
RCLCPP_WARN(get_logger(), "Failed to insert slowdown point");
434441
}
435442
}
436443
velocity_factors.factors.push_back(planning_result.velocity_factor);
@@ -450,9 +457,9 @@ rcl_interfaces::msg::SetParametersResult MotionVelocityPlannerNode::on_set_param
450457
planner_manager_.update_module_parameters(parameters);
451458
}
452459

453-
updateParam(parameters, "stop_line_extend_length", planner_data_.stop_line_extend_length);
454460
updateParam(parameters, "ego_nearest_dist_threshold", planner_data_.ego_nearest_dist_threshold);
455461
updateParam(parameters, "ego_nearest_yaw_threshold", planner_data_.ego_nearest_yaw_threshold);
462+
on_param();
456463

457464
rcl_interfaces::msg::SetParametersResult result;
458465
result.successful = true;

0 commit comments

Comments
 (0)