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

char type in Python messages is of type uint8_t not str. #775

Open
arjo129 opened this issue Nov 15, 2023 · 1 comment
Open

char type in Python messages is of type uint8_t not str. #775

arjo129 opened this issue Nov 15, 2023 · 1 comment
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@arjo129
Copy link

arjo129 commented Nov 15, 2023

Bug report

Required Info:

  • Operating System:
    • Ubuntu 22.04 and windows 10
  • Installation type:
    • Binaries
  • Version or commit hash:
    • Humble
  • DDS implementation:
    • FastDDS
  • Client library (if applicable):
    • rclpy

Steps to reproduce issue

The documentation page states that chars should corresponf to builtins.str but when I try to set a field of type char to a string in python like so:

my_awesome_msg.char_field = "L"

I get the error

AssertionError: The 'my_awesome_msg.char_field' field must be of type 'int'

Is the documentation wrong or is this unexepected behaviour?

I am willing to submit a fix for this.

@sloretz
Copy link
Contributor

sloretz commented Dec 15, 2023

Thank you for the bug report! It seems like you're correct that the type should be a str field.

It seems like the bug is in rosidl_adapter. It maps ROS msg char to OMG IDL uint8:

.

Would you be willing to open a PR with a fix on the rolling branch? I don't think we could backport it, but we could fix it going forward.

@sloretz sloretz added bug Something isn't working help wanted Extra attention is needed labels Dec 15, 2023
@arjo129 arjo129 self-assigned this Dec 16, 2023
arjo129 added a commit that referenced this issue Jan 4, 2024
This commit addresses #775 for rolling going forward

Note: This commit breaks a lot of down stream stuff. I will be pushing fixes one by one as I discover errors

Signed-off-by: Arjo Chakravarty <arjo@openrobotics.org>
arjo129 added a commit to ros2/ros2_documentation that referenced this issue Jan 17, 2024
This note is pending on approval of #ros2/rosidl#775

Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
arjo129 added a commit to ros2/rosidl_python that referenced this issue Jan 22, 2024
Signed-off-by: Arjo Chakravarty <arjoc@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants