Skip to content

Commit 90d5b94

Browse files
authored
feat(planning_debug_utils): add update_logger_level.sh (#5888)
* feat(planning_debug_utils): update_logger_level.sh Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * add error handling Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * update README Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> --------- Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
1 parent ad9778e commit 90d5b94

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed

planning/planning_debug_tools/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,6 @@ install(PROGRAMS
5353
scripts/closest_velocity_checker.py
5454
scripts/perception_replayer/perception_reproducer.py
5555
scripts/perception_replayer/perception_replayer.py
56+
scripts/update_logger_level.sh
5657
DESTINATION lib/${PROJECT_NAME}
5758
)

planning/planning_debug_tools/README.md

+17
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This package contains several planning-related debug tools.
66
- **Closest velocity checker**: prints the velocity information indicated by each modules
77
- **Perception reproducer**: generates detected objects from rosbag data in planning simulator environment
88
- **processing time checker**: displays processing_time of modules on the terminal
9+
- **logging level updater**: updates the logging level of the planning modules.
910

1011
## Trajectory analyzer
1112

@@ -264,3 +265,19 @@ The program allows users to customize two parameters via command-line arguments:
264265
- --display_frequency (or -f): This sets the frequency at which the terminal UI updates. The default value is 5Hz.
265266

266267
By adjusting these parameters, users can tailor the display to their specific monitoring needs.
268+
269+
## Logging Level Updater
270+
271+
The purpose of the Logging Level Updater is to update the logging level of the planning modules via ROS 2 service. Users can easily update the logging level for debugging.
272+
273+
```bash
274+
ros2 run planning_debug_tools update_logger_level.sh <module-name> <logger-level>
275+
```
276+
277+
`<logger-level>` will be `DEBUG`, `INFO`, `WARN`, or `ERROR`.
278+
279+
![logging_level_updater](image/logging_level_updater.png)
280+
281+
When you have a typo of the planning module, the script will show the available modules.
282+
283+
![logging_level_updater_typo](image/logging_level_updater_typo.png)
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
declare -A node_name_dict
4+
declare -A logger_name_dict
5+
6+
# behavior path planner
7+
behavior_path_module_list=("avoidance" "avoidance_by_lane_change" "dynamic_avoidance" "lane_change_right" "lane_change_left" "external_request_lane_change_right" "external_request_lane_change_left" "goal_planner" "start_planner" "side_shift")
8+
for module in "${behavior_path_module_list[@]}"; do
9+
node_name_dict[$module]="/planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner"
10+
logger_name_dict[$module]="planning.scenario_planning.lane_driving.behavior_planning.behavior_path_planner."$module
11+
done
12+
13+
# behavior velocity planner
14+
behavior_velocity_module_list=("crosswalk" "walkway" "traffic_light" "intersection" "merge_from_private" "blind_spot" "detection_area" "virtual_traffic_light" "no_stopping_area" "stop_line" "occlusion_spot" "run_out" "speed_bump" "out_of_lane" "no_drivable_lane")
15+
for module in "${behavior_velocity_module_list[@]}"; do
16+
node_name_dict[$module]="/planning/scenario_planning/lane_driving/behavior_planning/behavior_velocity_planner"
17+
logger_name_dict[$module]="planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner."$module
18+
done
19+
20+
# obstacle avoidance planner
21+
node_name_dict["obstacle_avoidance_planner"]=/planning/scenario_planning/lane_driving/motion_planning/obstacle_avoidance_planner
22+
logger_name_dict["obstacle_avoidance_planner"]=/planning/scenario_planning/lane_driving/motion_planning/obstacle_avoidance_planner
23+
24+
# motion velocity smoother
25+
node_name_dict["motion_velocity_smoother"]=/planning/scenario_planning/motion_velocity_smoother
26+
logger_name_dict["motion_velocity_smoother"]=/planning/scenario_planning/motion_velocity_smoother
27+
28+
if [ -z "${node_name_dict[$1]}" ]; then
29+
echo "[ERROR] $1 is not found."
30+
echo -n "[ERROR] The available modules are [ "
31+
for node_name in "${!node_name_dict[@]}"; do
32+
echo -n "${node_name} "
33+
done
34+
echo "]"
35+
exit 0
36+
fi
37+
38+
# update logger
39+
node_name=${node_name_dict[$1]}
40+
logger_name=${logger_name_dict[$1]}
41+
ros2 service call "$node_name/config_logger" logging_demo/srv/ConfigLogger "{logger_name: $logger_name, level: $2}"

0 commit comments

Comments
 (0)