Skip to content

Commit

Permalink
feat(planning_debug_utils): add update_logger_level.sh (autowarefound…
Browse files Browse the repository at this point in the history
…ation#5888)

* feat(planning_debug_utils): update_logger_level.sh

Signed-off-by: Takayuki Murooka <[email protected]>

* add error handling

Signed-off-by: Takayuki Murooka <[email protected]>

* update README

Signed-off-by: Takayuki Murooka <[email protected]>

---------

Signed-off-by: Takayuki Murooka <[email protected]>
  • Loading branch information
takayuki5168 authored Dec 16, 2023
1 parent ad9778e commit 90d5b94
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions planning/planning_debug_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ install(PROGRAMS
scripts/closest_velocity_checker.py
scripts/perception_replayer/perception_reproducer.py
scripts/perception_replayer/perception_replayer.py
scripts/update_logger_level.sh
DESTINATION lib/${PROJECT_NAME}
)
17 changes: 17 additions & 0 deletions planning/planning_debug_tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This package contains several planning-related debug tools.
- **Closest velocity checker**: prints the velocity information indicated by each modules
- **Perception reproducer**: generates detected objects from rosbag data in planning simulator environment
- **processing time checker**: displays processing_time of modules on the terminal
- **logging level updater**: updates the logging level of the planning modules.

## Trajectory analyzer

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

By adjusting these parameters, users can tailor the display to their specific monitoring needs.

## Logging Level Updater

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.

```bash
ros2 run planning_debug_tools update_logger_level.sh <module-name> <logger-level>
```

`<logger-level>` will be `DEBUG`, `INFO`, `WARN`, or `ERROR`.

![logging_level_updater](image/logging_level_updater.png)

When you have a typo of the planning module, the script will show the available modules.

![logging_level_updater_typo](image/logging_level_updater_typo.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions planning/planning_debug_tools/scripts/update_logger_level.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

declare -A node_name_dict
declare -A logger_name_dict

# behavior path planner
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")
for module in "${behavior_path_module_list[@]}"; do
node_name_dict[$module]="/planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner"
logger_name_dict[$module]="planning.scenario_planning.lane_driving.behavior_planning.behavior_path_planner."$module
done

# behavior velocity planner
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")
for module in "${behavior_velocity_module_list[@]}"; do
node_name_dict[$module]="/planning/scenario_planning/lane_driving/behavior_planning/behavior_velocity_planner"
logger_name_dict[$module]="planning.scenario_planning.lane_driving.behavior_planning.behavior_velocity_planner."$module
done

# obstacle avoidance planner
node_name_dict["obstacle_avoidance_planner"]=/planning/scenario_planning/lane_driving/motion_planning/obstacle_avoidance_planner
logger_name_dict["obstacle_avoidance_planner"]=/planning/scenario_planning/lane_driving/motion_planning/obstacle_avoidance_planner

# motion velocity smoother
node_name_dict["motion_velocity_smoother"]=/planning/scenario_planning/motion_velocity_smoother
logger_name_dict["motion_velocity_smoother"]=/planning/scenario_planning/motion_velocity_smoother

if [ -z "${node_name_dict[$1]}" ]; then
echo "[ERROR] $1 is not found."
echo -n "[ERROR] The available modules are [ "
for node_name in "${!node_name_dict[@]}"; do
echo -n "${node_name} "
done
echo "]"
exit 0
fi

# update logger
node_name=${node_name_dict[$1]}
logger_name=${logger_name_dict[$1]}
ros2 service call "$node_name/config_logger" logging_demo/srv/ConfigLogger "{logger_name: $logger_name, level: $2}"

0 comments on commit 90d5b94

Please sign in to comment.