Skip to content

feat: make HRIConnector and ARIConnector classes generic #375

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

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

rachwalk
Copy link
Contributor

Purpose

Currently when creating a connector derived from HRI/ARIConnector additional type checking is required e.g.:

def send_message(self, message: ARIMessage. target: str):
    if not is instance(message, ROS2ARIMessage):
         raise ValueError("Message must be of type ROS2ARIMessage")
    ....

This could get tedious for SDK users, a call signature like:

def send_message(self, message: ROS2ARIMessage. target: str):

would be preferable.

Proposed Changes

This PR makes HRI/ARIConnector classes generic, allowing for specifying message type on creation of a derived connector like so (example):

class ROS2ARIConnector[ROS2ARIMessage](ARIConnector):

which will cause all method signatures to automatically use ROS2ARIMessage as the type hint.

Issues

  • Links to relevant issues

Testing

Tests pertaining to sound device connector check this functionality adequately.

@maciejmajek maciejmajek merged commit 1595c52 into development Jan 17, 2025
5 checks passed
@maciejmajek maciejmajek deleted the fix/template-connectors branch January 17, 2025 16:52
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