-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add log level argument to launch files #473
base: ros2-devel
Are you sure you want to change the base?
Conversation
WalkthroughThis pull request introduces a standardized Changes
Sequence DiagramsequenceDiagram
participant User
participant LaunchSystem
participant ROSNodes
User->>LaunchSystem: Specify log_level (optional)
LaunchSystem->>LaunchSystem: Set default to "info"
LaunchSystem->>ROSNodes: Pass log_level argument
ROSNodes->>ROSNodes: Configure logging verbosity
Possibly related PRs
Suggested reviewers
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (11)
husarion_ugv_battery/launch/battery.launch.py (1)
44-44
: Consider making RCL log level configurableThe RCL log level is hardcoded to "INFO". Consider making it configurable if different RCL logging levels might be needed.
- arguments=["--ros-args", "--log-level", log_level, "--log-level", "rcl:=INFO"], + arguments=["--ros-args", "--log-level", log_level],husarion_ugv_gazebo/launch/simulation.launch.py (1)
42-47
: LGTM! Consider adding description choicesThe log level implementation looks good. Consider enhancing the description by documenting the available log level choices (debug, info, warn, error, fatal).
- description="Logging level", + description="Logging level (debug, info, warn, error, fatal)",husarion_ugv_gazebo/launch/spawn_robot.launch.py (1)
33-38
: LGTM! Consider adding description choicesThe log level implementation looks good. Consider enhancing the description by documenting the available log level choices.
- description="Logging level", + description="Logging level (debug, info, warn, error, fatal)",husarion_ugv_manager/launch/manager.launch.py (1)
61-66
: LGTM! Consider adding description choicesThe log level implementation looks good. Consider enhancing the description by documenting the available log level choices.
- description="Logging level", + description="Logging level (debug, info, warn, error, fatal)",lynx_description/launch/load_urdf.launch.py (2)
87-92
: Enhance the log level argument descriptionThe description could be more detailed to specify:
- Available log levels (debug, info, warn, error, fatal)
- Impact on node verbosity
declare_log_level_arg = DeclareLaunchArgument( "log_level", default_value="info", - description="Logging level", + description="Logging level (debug, info, warn, error, fatal). Controls verbosity of the nodes.", )
187-187
: Consider extracting duplicate log level argumentsThe log level configuration is duplicated across nodes. Consider extracting it into a variable for better maintainability.
+ log_args = ["--ros-args", "--log-level", log_level, "--log-level", "rcl:=INFO"] + robot_state_pub_node = Node( ... - arguments=["--ros-args", "--log-level", log_level, "--log-level", "rcl:=INFO"], + arguments=log_args, ... ) joint_state_publisher_node = Node( ... - arguments=["--ros-args", "--log-level", log_level, "--log-level", "rcl:=INFO"], + arguments=log_args, ... )Also applies to: 179-179
husarion_ugv_gazebo/launch/simulate_robot.launch.py (2)
89-94
: Enhance the log level argument descriptionSimilar to other launch files, the description could be more detailed.
declare_log_level_arg = DeclareLaunchArgument( "log_level", default_value="info", - description="Logging level", + description="Logging level (debug, info, warn, error, fatal). Controls verbosity of the nodes.", )
242-246
: Improve log level arguments formatting in world_transformThe log level arguments are split across multiple lines, which differs from the more concise format used in other nodes. Consider maintaining consistency.
world_transform = Node( ... arguments=[ ... - "--ros-args", - "--log-level", - log_level, - "--log-level", - "rcl:=INFO", + "--ros-args", "--log-level", log_level, "--log-level", "rcl:=INFO", ], ... )husarion_ugv_controller/launch/controller.launch.py (2)
120-125
: Enhance log level argument descriptionConsider expanding the description to include available log levels (debug, info, warn, error, fatal) to improve usability.
declare_log_level_arg = DeclareLaunchArgument( "log_level", default_value="info", - description="Logging level", + description="Logging level (debug, info, warn, error, fatal)", )
292-296
: Consider refactoring repeated log level configurationThe log level configuration pattern is repeated across all spawner nodes. Consider creating a helper function to generate the common arguments.
def get_spawner_arguments(controller_name, log_level): return [ controller_name, "--controller-manager", "controller_manager", "--controller-manager-timeout", "10", "--ros-args", "--log-level", log_level, "--log-level", "rcl:=INFO", ]Also applies to: 319-323
README.md (1)
105-105
: Enhance log level documentation and fix table formatting
- Consider expanding the log level documentation to include available options.
- Fix the table formatting by adding the trailing pipe.
-| ✅ | ✅ | `log_level` | Sets verbosity of launched nodes. <br/> ***string:*** `info` +| ✅ | ✅ | `log_level` | Sets verbosity of launched nodes (debug, info, warn, error, fatal). <br/> ***string:*** `info` |🧰 Tools
🪛 Markdownlint (0.37.0)
105-105: Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe
Table pipe style(MD055, table-pipe-style)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (14)
README.md
(1 hunks)husarion_ugv_battery/launch/battery.launch.py
(2 hunks)husarion_ugv_bringup/launch/bringup.launch.py
(8 hunks)husarion_ugv_controller/launch/controller.launch.py
(5 hunks)husarion_ugv_diagnostics/launch/system_monitor.launch.py
(2 hunks)husarion_ugv_gazebo/launch/simulate_robot.launch.py
(9 hunks)husarion_ugv_gazebo/launch/simulation.launch.py
(2 hunks)husarion_ugv_gazebo/launch/spawn_robot.launch.py
(3 hunks)husarion_ugv_lights/launch/lights.launch.py
(3 hunks)husarion_ugv_localization/launch/localization.launch.py
(5 hunks)husarion_ugv_localization/launch/nmea_navsat.launch.py
(2 hunks)husarion_ugv_manager/launch/manager.launch.py
(3 hunks)lynx_description/launch/load_urdf.launch.py
(3 hunks)panther_description/launch/load_urdf.launch.py
(3 hunks)
🧰 Additional context used
🪛 Markdownlint (0.37.0)
README.md
105-105: Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe
Table pipe style
(MD055, table-pipe-style)
🔇 Additional comments (18)
husarion_ugv_battery/launch/battery.launch.py (1)
24-29
: LGTM: Log level argument properly implemented
The log level configuration follows ROS2 best practices with appropriate default value and description.
husarion_ugv_diagnostics/launch/system_monitor.launch.py (2)
29-34
: LGTM: Consistent log level implementation
The log level configuration matches the pattern used across other launch files.
63-63
: Consider making RCL log level configurable
Similar to other launch files, the RCL log level is hardcoded to "INFO".
husarion_ugv_localization/launch/nmea_navsat.launch.py (3)
29-34
: LGTM: Consistent log level implementation
The log level configuration maintains consistency with other launch files.
71-71
: Consider making RCL log level configurable
Similar to other launch files, the RCL log level is hardcoded to "INFO".
Line range hint 53-71
: Verify logging behavior with remappings
The node has complex topic remappings. Let's verify that log messages properly reflect the remapped topics.
✅ Verification successful
Topic remappings are safe and logging is properly configured
The node's logging configuration is properly set up with:
- A configurable log level via the
log_level
launch argument - Default RCL logging set to "INFO" level
- The remapped topics will be correctly reflected in the logs as the remappings are applied at the ROS node level
The remappings follow the standard ROS 2 convention and will be properly handled by the ROS 2 logging system, which automatically uses the remapped topic names in log messages.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any existing logging statements that might reference the remapped topics
# Search for logging statements in the nmea_navsat_driver package
rg -t py "(?i)(logger|log|debug|info|warn|error|fatal).*?(?:fix|time_reference|vel|heading)"
# Search for any potential logging configuration in the package
rg -t yaml "logger|log_level" $(fd -t f ".*\.yaml$")
Length of output: 11931
Script:
#!/bin/bash
# Let's check the nmea_navsat_driver package for any logging related to topics
rg -t py "(?i)(logger|log|debug|info|warn|error|fatal).*?(fix|time_reference|vel|heading)" $(fd -t f ".*" -d 1 /opt/ros/humble/share/nmea_navsat_driver/)
# Let's also check if the package is installed and its source code is available
fd "nmea_navsat_driver" /opt/ros/humble/share/
# Let's check the configuration file for any logging settings
cat husarion_ugv_localization/config/nmea_navsat.yaml
Length of output: 10593
husarion_ugv_gazebo/launch/simulation.launch.py (1)
101-101
: LGTM! Proper propagation of log level
The log level is correctly passed down to the simulate_robots launch description.
husarion_ugv_manager/launch/manager.launch.py (1)
Line range hint 1-1
: Verify consistent log level implementation across all launch files
The PR mentions updating multiple launch files. Let's verify the consistency of the log level implementation across all of them.
✅ Verification successful
Let me gather more information to check if there are any inconsistencies in how the log level parameter is declared and used across these files.
Log level implementation is consistent across all launch files
The verification shows that log level implementation is consistent across all launch files:
- All files declare the log_level argument with the same default value "info"
- The pattern
arguments=["--ros-args", "--log-level", log_level, "--log-level", "rcl:=INFO"]
is consistently used - The declaration and usage of log_level follows the same structure in all files
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for consistent log level implementation across launch files
# Expected: All launch files should have similar log level argument declarations and usage
# Find all launch files
echo "Checking launch files for log level implementation..."
fd -e launch.py | xargs rg -l "log_level"
# Check for potential inconsistencies in log level usage
echo "\nChecking for potential inconsistencies in log level arguments..."
fd -e launch.py | xargs rg "log_level.*rcl:=INFO"
Length of output: 2647
Script:
#!/bin/bash
# Check how log_level parameter is declared and used across launch files
echo "Checking log_level parameter declarations..."
fd -e launch.py | xargs rg "DeclareLaunchArgument.*log_level"
echo "\nChecking log_level parameter default values..."
fd -e launch.py | xargs rg "default_value.*log_level"
echo "\nChecking for any other log level patterns that might be inconsistent..."
fd -e launch.py | xargs rg "log[_-]level" -A 1
Length of output: 14136
husarion_ugv_bringup/launch/bringup.launch.py (2)
47-52
: LGTM! Well-structured log level argument declaration.
The log level argument is properly declared with a clear description and sensible default value.
72-76
: LGTM! Consistent propagation of log level to all included launches.
The log_level argument is consistently passed to all included launch files, ensuring uniform logging configuration across components.
Also applies to: 89-89, 98-102, 111-111, 120-124, 134-138
husarion_ugv_lights/launch/lights.launch.py (2)
63-68
: LGTM! Well-structured log level argument declaration.
The log level argument is properly declared with a clear description and sensible default value.
134-134
: LGTM! Smart combination of configurable and fixed log levels.
Good practice: Setting rcl:=INFO
alongside the configurable log level ensures that RCL framework logging remains at INFO while allowing component-specific logging to be configured.
husarion_ugv_localization/launch/localization.launch.py (2)
60-65
: LGTM! Well-structured log level argument declaration.
The log level argument is properly declared with a clear description and sensible default value.
135-135
: LGTM! Consistent log level configuration across nodes.
The log level configuration is consistently applied to all nodes and included launches:
- ekf_filter_node
- nmea_navsat_launch
- navsat_transform_node
Good practice: Setting rcl:=INFO
alongside the configurable log level ensures that RCL framework logging remains at INFO while allowing component-specific logging to be configured.
Also applies to: 145-145, 160-160
panther_description/launch/load_urdf.launch.py (1)
86-91
: Same improvements apply as in lynx_description
The changes in this file mirror those in lynx_description/launch/load_urdf.launch.py and would benefit from the same improvements.
Also applies to: 179-179, 187-187
husarion_ugv_gazebo/launch/simulate_robot.launch.py (1)
118-118
: LGTM: Consistent log level propagation
The log_level argument is consistently propagated to all included launch files and nodes, which ensures uniform logging configuration across the system.
Also applies to: 129-133, 142-146, 161-161, 178-182, 215-215
husarion_ugv_controller/launch/controller.launch.py (2)
349-349
: LGTM!
The log level argument is correctly integrated into the launch sequence.
273-277
: Review duplicate log level configuration
The node has two --log-level
arguments. While setting a fixed rcl level is valid, consider documenting why rcl logs are fixed to INFO level to avoid confusion.
✅ Verification successful
Pattern is consistent across the codebase
The duplicate --log-level
configuration with rcl:=INFO
is a consistent pattern used throughout the codebase in multiple launch files. This appears to be an intentional design choice to allow user-specified log levels for components while maintaining a fixed INFO level for RCL logs. No changes needed.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if other spawner nodes in the codebase follow similar pattern
rg -A 2 "spawner.*--log-level.*rcl:=INFO"
Length of output: 43
Script:
#!/bin/bash
# Search for any controller spawner nodes with log level configuration
rg -B 2 -A 2 "controller.*spawner.*--log-level"
# Also search for any log level configurations in launch files
rg -B 2 -A 2 '"--log-level"' '*.launch.py'
Length of output: 146
Script:
#!/bin/bash
# Find launch files first
fd ".launch.py$"
# Then search for log level configurations in all Python files
rg -B 2 -A 2 '"--log-level"' -g '*.py'
Length of output: 8761
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
husarion_ugv_controller/launch/controller.launch.py (1)
120-125
: Enhance the log level argument descriptionThe description could be more helpful by listing the available log levels (debug, info, warn, error, fatal).
- description="Logging level", + description="Logging level (debug, info, warn, error, fatal)",
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
husarion_ugv_controller/launch/controller.launch.py
(6 hunks)husarion_ugv_gazebo/launch/simulate_robot.launch.py
(8 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- husarion_ugv_gazebo/launch/simulate_robot.launch.py
🔇 Additional comments (3)
husarion_ugv_controller/launch/controller.launch.py (3)
268-280
: LGTM! Appropriate log level configuration
The implementation correctly applies the user-specified log level while maintaining INFO level for critical components, which aligns with the PR objectives.
305-309
: Consider keeping spawner at INFO level
Since the spawner is a short-lived process, debug logs might not provide significant value. Consider removing the configurable log level for spawners and keeping them at INFO level.
376-376
: LGTM! Proper launch argument registration
The log level argument is correctly registered in the launch description.
I've reworked ros2_control_node verbosity. It should work in debug level now without flooding console with unnecessary logs |
LGTM but please resolve the conflicts |
Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com>
Signed-off-by: Jakub Delicat <jakub.delicat@husarion.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
README.md (2)
105-105
: Enhance the log_level argument documentationThe description for the new
log_level
argument could be more detailed. Consider adding:
- Available log level choices (e.g., debug, info, warn, error)
- Example usage in command line
- Note about excluded nodes (robot_state_publisher, ros2_control_node) as mentioned in PR objectives
-| ✅ | ✅ | `log_level` | Sets verbosity of launched nodes. <br/> ***string:*** `info` +| ✅ | ✅ | `log_level` | Sets verbosity level for launched nodes. Some nodes (robot_state_publisher, ros2_control_node) maintain their default logging level. <br/> ***string:*** `info` (choices: `debug`, `info`, `warn`, `error`)🧰 Tools
🪛 Markdownlint (0.37.0)
105-105: Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe
Table pipe style(MD055, table-pipe-style)
105-105
: Fix table formatting: Add missing trailing pipeFor consistency with the rest of the table formatting, add a trailing pipe to the line.
-| ✅ | ✅ | `log_level` | Sets verbosity of launched nodes. <br/> ***string:*** `info` +| ✅ | ✅ | `log_level` | Sets verbosity of launched nodes. <br/> ***string:*** `info` |🧰 Tools
🪛 Markdownlint (0.37.0)
105-105: Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe
Table pipe style(MD055, table-pipe-style)
husarion_ugv_gazebo/launch/simulation.launch.py (2)
42-47
: Enhance the log level argument descriptionWhile the implementation is correct, consider enhancing the description to list the available log levels (debug, info, warn, error, fatal) to improve usability.
declare_log_level_arg = DeclareLaunchArgument( "log_level", default_value="info", - description="Logging level", + description="Logging level (debug, info, warn, error, fatal)", )
Line range hint
82-82
: Consider making gz_log_level configurableCurrently, gz_log_level is hardcoded to "1". Consider making it configurable through a launch argument, similar to log_level, to provide consistent logging control across both ROS2 and Gazebo components.
gz_sim = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution( [FindPackageShare("husarion_gz_worlds"), "launch", "gz_sim.launch.py"] ) ), - launch_arguments={"gz_gui": namespaced_gz_gui, "gz_log_level": "1"}.items(), + launch_arguments={ + "gz_gui": namespaced_gz_gui, + "gz_log_level": LaunchConfiguration("gz_log_level", default="1") + }.items(), )
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
README.md
(1 hunks)husarion_ugv_controller/launch/controller.launch.py
(6 hunks)husarion_ugv_gazebo/launch/simulate_robot.launch.py
(8 hunks)husarion_ugv_gazebo/launch/simulation.launch.py
(2 hunks)husarion_ugv_gazebo/launch/spawn_robot.launch.py
(3 hunks)husarion_ugv_lights/launch/lights.launch.py
(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
- husarion_ugv_lights/launch/lights.launch.py
- husarion_ugv_gazebo/launch/simulate_robot.launch.py
- husarion_ugv_gazebo/launch/spawn_robot.launch.py
- husarion_ugv_controller/launch/controller.launch.py
🧰 Additional context used
🪛 Markdownlint (0.37.0)
README.md
105-105: Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe
Table pipe style
(MD055, table-pipe-style)
🔇 Additional comments (4)
README.md (2)
Line range hint 109-109
: LGTM: Clear and well-documented robot_model argument
The updated description clearly specifies the purpose and available choices for the robot model configuration.
🧰 Tools
🪛 Markdownlint (0.37.0)
105-105: Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe
Table pipe style
(MD055, table-pipe-style)
Line range hint 1-150
: LGTM: Well-structured and comprehensive documentation
The README maintains excellent organization and clarity while incorporating the new changes. The use of compatibility indicators (🤖/🖥️) and detailed descriptions helps users understand the available configuration options.
🧰 Tools
🪛 Markdownlint (0.37.0)
105-105: Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe
Table pipe style
(MD055, table-pipe-style)
husarion_ugv_gazebo/launch/simulation.launch.py (2)
106-106
: LGTM!
The declare_log_level_arg is correctly placed in the actions list, ensuring proper initialization before usage.
101-101
: Verify log_level propagation
The log_level is correctly passed to simulate_robot.launch.py. Let's verify that the downstream launch file properly handles this argument.
✅ Verification successful
Log level argument is properly declared and utilized
The verification shows that simulate_robot.launch.py
correctly:
- Declares the log_level argument with a default value of "info"
- Propagates the log_level to multiple downstream components:
- Robot spawn configuration
- Lights launch
- Manager launch
- ROS args configuration (--log-level parameter)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify that simulate_robot.launch.py accepts and uses the log_level argument
# Check if simulate_robot.launch.py declares the log_level argument
rg -l "DeclareLaunchArgument.*log_level" $(fd -t f "simulate_robot.launch.py")
# Check how the log_level is used in the launch file
rg "log_level" $(fd -t f "simulate_robot.launch.py") -A 5
Length of output: 1786
Description
robot_state_publisher
i andros2_control_node
nodes were ommited as they publish a lot of information under debug level.Requirements
Tests 🧪
Summary by CodeRabbit
log_level
launch argument across various components, allowing users to configure logging verbosity with a default value of "info".log_level
and modifications torobot_model
.