Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b84fe84

Browse files
committedMay 24, 2024·
cleanup and doc
Signed-off-by: Maxime CLEMENT <maxime.clement@tier4.jp>
1 parent 735b78b commit b84fe84

File tree

7 files changed

+604
-2648
lines changed

7 files changed

+604
-2648
lines changed
 

‎planning/motion_velocity_planner/autoware_motion_velocity_planner_common/include/autoware_motion_velocity_planner_common/planner_data.hpp

-7
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ struct PlannerData
5757
explicit PlannerData(rclcpp::Node & node)
5858
: vehicle_info_(vehicle_info_util::VehicleInfoUtil(node).getVehicleInfo())
5959
{
60-
system_delay = node.declare_parameter<double>("system_delay");
61-
delay_response_time = node.declare_parameter<double>("delay_response_time");
6260
}
6361

6462
// msgs from callbacks that are used for data-ready
@@ -87,11 +85,6 @@ struct PlannerData
8785
// parameters
8886
vehicle_info_util::VehicleInfo vehicle_info_;
8987

90-
// additional parameters
91-
double system_delay;
92-
double delay_response_time;
93-
double stop_line_extend_length;
94-
9588
/**
9689
*@fn
9790
*@brief queries the traffic signal information of given Id. if keep_last_observation = true,

‎planning/motion_velocity_planner/autoware_motion_velocity_planner_node/README.md

+41-41
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,57 @@
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

8-
<!-- ![Architecture](./docs/BehaviorVelocityPlanner-Architecture.drawio.svg)
9-
10-
- [Blind Spot](../behavior_velocity_blind_spot_module/README.md)
11-
- [Crosswalk](../behavior_velocity_crosswalk_module/README.md)
12-
- [Walkway](../behavior_velocity_walkway_module/README.md)
13-
- [Detection Area](../behavior_velocity_detection_area_module/README.md)
14-
- [Intersection](../behavior_velocity_intersection_module/README.md)
15-
- [MergeFromPrivate](../behavior_velocity_intersection_module/README.md#merge-from-private)
16-
- [Stop Line](../behavior_velocity_stop_line_module/README.md)
17-
- [Virtual Traffic Light](../behavior_velocity_virtual_traffic_light_module/README.md)
18-
- [Traffic Light](../behavior_velocity_traffic_light_module/README.md)
19-
- [Occlusion Spot](../behavior_velocity_occlusion_spot_module/README.md)
20-
- [No Stopping Area](../behavior_velocity_no_stopping_area_module/README.md)
21-
- [Run Out](../behavior_velocity_run_out_module/README.md)
22-
- [Speed Bump](../behavior_velocity_speed_bump_module/README.md)
23-
- [Out of Lane](../behavior_velocity_out_of_lane_module/README.md)
24-
25-
When each module plans velocity, it considers based on `base_link`(center of rear-wheel axis) pose.
26-
So for example, in order to stop at a stop line with the vehicles' front on the stop line, it calculates `base_link` position from the distance between `base_link` to front and modifies path velocity from the `base_link` position.
8+
![Architecture](./docs/MotionVelocityPlanner-InternalInterface.drawio.svg)
9+
10+
- [Out of Lane](../autoware_motion_velocity_out_of_lane_module/README.md)
11+
12+
Each module calculates stop and slow down points to be inserted in the ego trajectory.
13+
These points are assumed to correspond to the `base_link` frame of the ego vehicle as it follows the trajectory.
14+
This means that to stop before a wall, a stop point is inserted in the trajectory at a distance ahead of the wall equal to the vehicle front offset (wheelbase + front overhange, see the [vehicle dimensions](https://autowarefoundation.github.io/autoware-documentation/main/design/autoware-interfaces/components/vehicle-dimensions/).
2715

2816
![set_stop_velocity](./docs/set_stop_velocity.drawio.svg)
2917

3018
## Input topics
3119

32-
| Name | Type | Description |
33-
| ----------------------------------------- | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
34-
| `~input/path_with_lane_id` | autoware_auto_planning_msgs::msg::PathWithLaneId | path with lane_id |
35-
| `~input/vector_map` | autoware_auto_mapping_msgs::msg::HADMapBin | vector map |
36-
| `~input/vehicle_odometry` | nav_msgs::msg::Odometry | vehicle velocity |
37-
| `~input/dynamic_objects` | autoware_auto_perception_msgs::msg::PredictedObjects | dynamic objects |
38-
| `~input/no_ground_pointcloud` | sensor_msgs::msg::PointCloud2 | obstacle pointcloud |
39-
| `~/input/compare_map_filtered_pointcloud` | sensor_msgs::msg::PointCloud2 | obstacle pointcloud filtered by compare map. Note that this is used only when the detection method of run out module is Points. |
40-
| `~input/traffic_signals` | autoware_perception_msgs::msg::TrafficSignalArray | traffic light states |
20+
| Name | Type | Description |
21+
| -------------------------------------- | ---------------------------------------------------- | ----------------------------- |
22+
| `~/input/trajectory` | autoware_auto_planning_msgs::msg::Trajectory | input trajectory |
23+
| `~/input/vector_map` | autoware_auto_mapping_msgs::msg::HADMapBin | vector map |
24+
| `~/input/vehicle_odometry` | nav_msgs::msg::Odometry | vehicle position and velocity |
25+
| `~/input/accel` | geometry_msgs::msg::AccelWithCovarianceStamped | vehicle acceleration |
26+
| `~/input/dynamic_objects` | autoware_auto_perception_msgs::msg::PredictedObjects | dynamic objects |
27+
| `~/input/no_ground_pointcloud` | sensor_msgs::msg::PointCloud2 | obstacle pointcloud |
28+
| `~/input/traffic_signals` | autoware_perception_msgs::msg::TrafficSignalArray | traffic light states |
29+
| `~/input/virtual_traffic_light_states` | tier4_v2x_msgs::msg::VirtualTrafficLightStateArray | virtual traffic light states |
30+
| `~/input/occupancy_grid` | nav_msgs::msg::OccupancyGrid | occupancy grid |
4131

4232
## Output topics
4333

44-
| Name | Type | Description |
45-
| ---------------------- | ----------------------------------------- | -------------------------------------- |
46-
| `~output/path` | autoware_auto_planning_msgs::msg::Path | path to be followed |
47-
| `~output/stop_reasons` | tier4_planning_msgs::msg::StopReasonArray | reasons that cause the vehicle to stop |
34+
| Name | Type | Description |
35+
| --------------------------- | ------------------------------------------------- | -------------------------------------------------- |
36+
| `~/output/trajectory` | autoware_auto_planning_msgs::msg::Trajectory | Ego trajectory with updated velocity profile |
37+
| `~/output/velocity_factors` | autoware_adapi_v1_msgs::msg::VelocityFactorsArray | factors causing change in the ego velocity profile |
38+
39+
## Services
40+
41+
| Name | Type | Description |
42+
| ------------------------- | -------------------------------------------------------- | ---------------------------- |
43+
| `~/service/load_plugin` | autoware_motion_velocity_planner_node::srv::LoadPlugin | To request loading a plugin |
44+
| `~/service/unload_plugin` | autoware_motion_velocity_planner_node::srv::UnloadPlugin | To request unloaded a plugin |
4845

4946
## Node parameters
5047

51-
| Parameter | Type | Description |
52-
| ---------------------- | -------------------- | ----------------------------------------------------------------------------------- |
53-
| `launch_modules` | vector&lt;string&gt; | module names to launch |
54-
| `forward_path_length` | double | forward path length |
55-
| `backward_path_length` | double | backward path length |
56-
| `max_accel` | double | (to be a global parameter) max acceleration of the vehicle |
57-
| `system_delay` | double | (to be a global parameter) delay time until output control command |
58-
| `delay_response_time` | double | (to be a global parameter) delay time of the vehicle's response to control commands | -->
48+
| Parameter | Type | Description |
49+
| ---------------- | ---------------- | ---------------------- |
50+
| `launch_modules` | vector\<string\> | module names to launch |
51+
52+
In addition, the following parameters should be provided to the node:
53+
54+
- [nearest search parameters](https://github.com/autowarefoundation/autoware_launch/blob/main/autoware_launch/config/planning/scenario_planning/common/nearest_search.param.yaml);
55+
- [vehicle info parameters](https://github.com/autowarefoundation/sample_vehicle_launch/blob/main/sample_vehicle_description/config/vehicle_info.param.yaml);
56+
- [common planning parameters](https://github.com/autowarefoundation/autoware_launch/blob/main/autoware_launch/config/planning/scenario_planning/common/common.param.yaml);
57+
- [smoother parameters](https://autowarefoundation.github.io/autoware.universe/main/planning/motion_velocity_smoother/#parameters)
58+
- Parameters of each plugin that will be loaded.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
/**:
22
ros__parameters:
3-
stop_line_extend_length: 5.0
4-
system_delay: 0.5
5-
delay_response_time: 0.5

‎planning/motion_velocity_planner/autoware_motion_velocity_planner_node/docs/BehaviorVelocityPlanner-Architecture.drawio.svg

-2,523
This file was deleted.

‎planning/motion_velocity_planner/autoware_motion_velocity_planner_node/docs/MotionVelocityPlanner-InternalInterface.drawio.svg

+538
Loading

‎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)
Please sign in to comment.