Skip to content
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

feat: apply autoware_ prefix for system_monitor #10017

Conversation

sasakisasaki
Copy link
Contributor

@sasakisasaki sasakisasaki commented Jan 24, 2025

Currently, we only verified that the build succeeds. Further checks will be performed by using the updated module. This PR will be ready for review after finishing all the necessary checks/tests.

Executed Commands

$ # VCS imported Around 15:00 JST 24th Jan. 2025
$ vcs import src < autoware-nighty.repos    # Commented out autoware.universe repo
$ rosdep install -y --from-paths src --ignore-src --rosdistro humble
$ colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON --packages-up-to autoware_system_monitor
$ source install/setup.bash
$ ros2 launch autoware_system_monitor system_monitor.launch.xml

As shown in the observed log below, I saw an error as follows. Please check if this is needed to be solved.

[ERROR 1737699264.298768084] [net_monitor]: Failed to connect socket. No such file or directory (connect_service() at /home/junyasasaki/forked.repos/autoware_debug/src/universe/autoware.universe/system/autoware_system_monitor/src/net_monitor/net_monitor.cpp:658)

Different Points from Other Packages in Prefix-ing

As the commit message says, this PR follows the following points.

    feat(system_monitor): apply `autoware_` prefix (see below):
    
      * The `system_monitor` operates independently from other modules in `autoware.universe`, so the `autoware_` prefix is added only to the package name.
      * The `autoware::` namespace is not used because C language does not support namespaces.
      * Headers are not moved under `include/autoware` to maintain compatibility for use outside the `autoware` context.
      * For users utilizing this package within `autoware.universe`, only the package name includes the `autoware_` prefix.
    
    This approach explains the unique namespacing and naming conventions for `system_monitor` compared to other packages.
  • Directory Name

    • Add autoware_ as a prefix to the directory name.
  • packages.xml

    • Add autoware_ to the name element.
  • CMakeLists.txt

    • Change the project name to autoware_***.
    • Add autoware:: to PLUGIN.
  • Header Files (.hpp)

    • Start #ifndef guards with AUTOWARE__.
    • Add autoware:: to namespace.
  • Source Files (.cpp)

    • Add autoware:: inside RCLCPP_COMPONENTS_REGISTER_NODE.
  • Launch Files

    • Add autoware_ before find-pkg-share.
    • Change node pkg="<pkgname>" to autoware_<pkgname>.
  • Include

    • Add autoware folder as necessary and update include statements accordingly.
    • Check for impacts on other packages.
  • Verification Points

    • Search find-pkg-share in autoware
    • Check README file (especially json schema)
    • Pay attention to complex cases like sensor_launch as seen in gnss_poser

Observed Logs after ROS2 launch

$ ros2 launch autoware_system_monitor system_monitor.launch.xml 
[INFO] [launch]: All log files can be found below /home/junyasasaki/.ros/log/2025-01-24-15-14-23-881290-npc2307030-440738
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [component_container_mt-1]: process started with pid [440750]
[component_container_mt-1] [INFO 1737699264.283868718] [system_monitor.system_monitor_container]: Load Library: /home/junyasasaki/forked.repos/autoware_debug/install/autoware_system_monitor/lib/libcpu_monitor_lib.so (create_component_factory() at ./src/component_manager.cpp:118)
[component_container_mt-1] [INFO 1737699264.285594298] [system_monitor.system_monitor_container]: Found class: rclcpp_components::NodeFactoryTemplate<CPUMonitor> (create_component_factory() at ./src/component_manager.cpp:131)
[component_container_mt-1] [INFO 1737699264.285622712] [system_monitor.system_monitor_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<CPUMonitor> (create_component_factory() at ./src/component_manager.cpp:133)
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/cpu_monitor' in container '/system_monitor/system_monitor_container'
[component_container_mt-1] [INFO 1737699264.293256231] [system_monitor.system_monitor_container]: Load Library: /home/junyasasaki/forked.repos/autoware_debug/install/autoware_system_monitor/lib/libmem_monitor_lib.so (create_component_factory() at ./src/component_manager.cpp:118)
[component_container_mt-1] [INFO 1737699264.293569537] [system_monitor.system_monitor_container]: Found class: rclcpp_components::NodeFactoryTemplate<MemMonitor> (create_component_factory() at ./src/component_manager.cpp:131)
[component_container_mt-1] [INFO 1737699264.293580842] [system_monitor.system_monitor_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<MemMonitor> (create_component_factory() at ./src/component_manager.cpp:133)
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/mem_monitor' in container '/system_monitor/system_monitor_container'
[component_container_mt-1] [INFO 1737699264.295579455] [system_monitor.system_monitor_container]: Load Library: /home/junyasasaki/forked.repos/autoware_debug/install/autoware_system_monitor/lib/libnet_monitor_lib.so (create_component_factory() at ./src/component_manager.cpp:118)
[component_container_mt-1] [INFO 1737699264.296308683] [system_monitor.system_monitor_container]: Found class: rclcpp_components::NodeFactoryTemplate<NetMonitor> (create_component_factory() at ./src/component_manager.cpp:131)
[component_container_mt-1] [INFO 1737699264.296325993] [system_monitor.system_monitor_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<NetMonitor> (create_component_factory() at ./src/component_manager.cpp:133)
[component_container_mt-1] [ERROR 1737699264.298768084] [net_monitor]: Failed to connect socket. No such file or directory (connect_service() at /home/junyasasaki/forked.repos/autoware_debug/src/universe/autoware.universe/system/autoware_system_monitor/src/net_monitor/net_monitor.cpp:658)

Notes for Reviewers

As above.

Interface Changes

None.

Effects on System Behavior

All the developers who were using system_monitor needs to modify their code. This is maybe kind of non quick-win task.

  * The `system_monitor` operates independently from other modules in `autoware.universe`, so the `autoware_` prefix is added only to the package name.
  * The `autoware::` namespace is not used because C language does not support namespaces.
  * Headers are not moved under `include/autoware` to maintain compatibility for use outside the `autoware` context.
  * For users utilizing this package within `autoware.universe`, only the package name includes the `autoware_` prefix.

This approach explains the unique namespacing and naming conventions for `system_monitor` compared to other packages.

Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
@github-actions github-actions bot added type:documentation Creating or refining documentation. (auto-assigned) component:system System design and integration. (auto-assigned) component:launch Launch files, scripts and initialization tools. (auto-assigned) labels Jan 24, 2025
Copy link

github-actions bot commented Jan 24, 2025

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

@sasakisasaki sasakisasaki added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Jan 24, 2025
@sasakisasaki sasakisasaki marked this pull request as ready for review January 24, 2025 06:20
@TetsuKawa
Copy link
Contributor

@sasakisasaki
Please change package name at .github/CODEOWNERS.

Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
…ntext-awared' of github.com:sasakisasaki/autoware.universe into feat-apply-autoware-prefix-for-system-system-monitor-context-awared

Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
@github-actions github-actions bot added the type:ci Continuous Integration (CI) processes and testing. (auto-assigned) label Jan 24, 2025
@sasakisasaki
Copy link
Contributor Author

@TetsuKawa Thank you! Now I fixed .github/CODEOWNERS. Hopefully this is the correct fix 👍

Copy link

codecov bot commented Jan 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 29.10%. Comparing base (8b0b9a7) to head (11e623d).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10017      +/-   ##
==========================================
- Coverage   29.78%   29.10%   -0.68%     
==========================================
  Files        1436     1459      +23     
  Lines      108308   110821    +2513     
  Branches    42956    43344     +388     
==========================================
  Hits        32256    32256              
- Misses      72920    75433    +2513     
  Partials     3132     3132              
Flag Coverage Δ *Carryforward flag
differential 0.00% <ø> (?)
total 29.78% <ø> (ø) Carriedforward from fe7d683

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TetsuKawa
Copy link
Contributor

@sasakisasaki
You should modify tier4_system_launch/launch/system.launch.xml

<group if="$(var launch_system_monitor)">
  <push-ros-namespace namespace="system_monitor"/>
  <include file="$(find-pkg-share system_monitor)/launch/system_monitor.launch.xml">
    <arg name="cpu_monitor_config_file" value="$(var system_monitor_cpu_monitor_param_path)"/>
    <arg name="gpu_monitor_config_file" value="$(var system_monitor_gpu_monitor_param_path)"/>
    <arg name="hdd_monitor_config_file" value="$(var system_monitor_hdd_monitor_param_path)"/>
    <arg name="mem_monitor_config_file" value="$(var system_monitor_mem_monitor_param_path)"/>
    <arg name="net_monitor_config_file" value="$(var system_monitor_net_monitor_param_path)"/>
    <arg name="ntp_monitor_config_file" value="$(var system_monitor_ntp_monitor_param_path)"/>
    <arg name="process_monitor_config_file" value="$(var system_monitor_process_monitor_param_path)"/>
    <arg name="voltage_monitor_config_file" value="$(var system_monitor_voltage_monitor_param_path)"/>
  </include>
</group>

Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
@sasakisasaki
Copy link
Contributor Author

OMG, sorry for leaving the missing fix! @TetsuKawa Thank you so much for your careful check! Honestly, I was forgetting to apply the fix when I switch to the new branch from the old one 😅 .

@sasakisasaki
Copy link
Contributor Author

@TetsuKawa Also, I'll fix the CODEOWNERS (please give me time, ...)

Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
@sasakisasaki
Copy link
Contributor Author

Now ready to review 👍

Copy link
Contributor

@TetsuKawa TetsuKawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sasakisasaki sasakisasaki merged commit 59071ca into autowarefoundation:main Jan 24, 2025
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:launch Launch files, scripts and initialization tools. (auto-assigned) component:system System design and integration. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) type:ci Continuous Integration (CI) processes and testing. (auto-assigned) type:documentation Creating or refining documentation. (auto-assigned)
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants