Skip to content

Conversation

@ipa-rwu
Copy link
Member

@ipa-rwu ipa-rwu commented Oct 10, 2025

This pull request introduces several improvements and refactorings to the ROS 2 model extraction toolchain, focusing on compatibility, usability, and maintainability. The most significant changes include enhanced runtime parsing for ROS distributions, improved handling of node and system model generation, and updates to documentation and configuration for modern ROS 2 practices.

Runtime compatibility and refactoring:

  • Added robust detection of the active ROS distribution and refactored parameter client logic to support both rclpy.parameter_client.AsyncParameterClient and legacy ros2param.api methods, improving compatibility across ROS 2 Humble and Rolling. [1] [2] [3] [4] [5]
  • Prevented duplicate interface entries when parsing runtime topics and endpoints by checking for existing interface names before appending, ensuring model correctness. [1] [2]

Node and system model generation enhancements:

  • Extended RunTimeNode and RuntimeRossystem classes to store package/executable information and apply launch file mappings for more accurate model extraction, including new options for hidden nodes, interfaces, and robot descriptions. [1] [2] [3] [4]

Documentation and usability improvements:

  • Updated README.md to clarify installation for ROS 2 Humble/Rolling, provide explicit instructions for generating node, system, and interface models, and document new command-line options and usage patterns. [1] [2]

Configuration and template updates:

  • Upgraded pre-commit hooks and Python formatting/linting tool versions in .pre-commit-config.yaml for improved code quality checks.
  • Fixed template path resolution in message_generator.py to ensure correct template selection and compatibility.

… extraction and package/executable identification
…d-line arguments for including robot_description parameters and refining package/executable information from launch files.
Removes leading '/' from node names to ensure cleaner output
and prevent inconsistencies when referencing node identifiers
across generated artifacts.
…connection mapping

Improves node interface handling and connection mapping

Refactors the template to better collect node interfaces and
systematically map connections between publishers, subscribers,
services, and actions. Enhances clarity and future extensibility
of generated files by centralizing data and connection logic.
…nhance usage examples for node and system model generation
@ipa-rwu ipa-rwu requested a review from Copilot October 10, 2025 13:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request enhances the ROS 2 model extraction toolchain to improve compatibility across ROS distributions (Humble/Rolling), implement dynamic system model generation with connection mapping, and add comprehensive message interface modeling capabilities.

  • Added robust ROS distribution detection and parameter client compatibility for both AsyncParameterClient (Rolling) and legacy ros2param.api methods
  • Implemented dynamic rossystem template with automatic connection generation between publishers/subscribers, services, and actions
  • Created new message verb for generating .ros models from interface packages with proper type formatting and namespace handling

Reviewed Changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
templates/rossystem.rossystem.j2 Enhanced template with connection generation and improved node/interface mapping
templates/message.ros.j2 Added proper type formatting for message fields with namespace qualification
templates/component.ros2.j2 Fixed node name stripping for consistent formatting
setup.py Added message template and new message verb to package configuration
ros2model/verb/runtime_system.py Added launch file parsing and mapping functionality for package/executable resolution
ros2model/verb/runtime_node.py Enhanced node generation with launch mapping and description parameter filtering
ros2model/verb/message.py New verb implementation for generating interface models from packages
ros2model/core/utils.py Improved process detection with better parsing of ROS node arguments and environment
ros2model/api/runtime_parser/rossystem_runtime_parser.py Extended RuntimeRossystem with configuration options and launch mapping support
ros2model/api/runtime_parser/rosmodel_runtime_parser.py Added ROS distribution detection and improved parameter handling compatibility
ros2model/api/model_generator/message_generator.py Fixed template path resolution for message generation
README.md Updated documentation with clearer installation and usage instructions
.pre-commit-config.yaml Updated tool versions for code quality checks

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +18 to +44
{% set collected.pub = collected.pub + [{'topic': interface.full_name, 'display': interface.name, 'type': interface.type, 'node': node_identifier}] %}
- "{{ interface.name }}": pub-> "{{ exec_name }}::{{ interface.name }}"
{% endfor %}
{% for interface in node.subscriber %}
{% if interface.name in publisher_names %}
{% set sub_display = 'sub_' ~ interface.name %}
{% else %}
{% set sub_display = interface.name %}
{% endif %}
{% set collected.sub = collected.sub + [{'topic': interface.full_name, 'display': sub_display, 'type': interface.type, 'node': node_identifier}] %}
- "{{ sub_display }}": sub-> "{{ exec_name }}::{{ interface.name }}"
{% endfor %}
{% for interface in node.actionserver %}
{% set collected.action_server = collected.action_server + [{'topic': interface.full_name, 'display': interface.name, 'type': interface.type, 'node': node_identifier}] %}
- "{{ interface.name }}": as-> "{{ exec_name }}::{{ interface.name }}"
{% endfor %}
{% for interface in node.actionclient %}
{% set collected.action_client = collected.action_client + [{'topic': interface.full_name, 'display': interface.name, 'type': interface.type, 'node': node_identifier}] %}
- "{{ interface.name }}": ac-> "{{ exec_name }}::{{ interface.name }}"
{% endfor %}
{% for interface in node.serviceserver %}
{% set collected.srv_server = collected.srv_server + [{'topic': interface.full_name, 'display': interface.name, 'type': interface.type, 'node': node_identifier}] %}
- "{{ interface.name }}": ss-> "{{ exec_name }}::{{ interface.name }}"
{% endfor %}
{% for interface in node.serviceclient %}
{% set collected.srv_client = collected.srv_client + [{'topic': interface.full_name, 'display': interface.name, 'type': interface.type, 'node': node_identifier}] %}
- "{{ interface.name }}": sc-> "{{ exec_name }}::{{ interface.name }}"
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

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

The subscriber display name logic creates potential naming conflicts. Consider using a more robust naming scheme that ensures uniqueness, such as incorporating the interface type or a counter.

Copilot uses AI. Check for mistakes.
{% endfor %}
{% endfor %}
{% endif %}
{% if model.actions()|length > 0 %}
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

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

This condition should check model.services()|length > 0 instead of model.actions()|length > 0 based on the original logic. The actions section should remain separate from the services condition.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants