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

Fix byte behavior #693

Merged
merged 4 commits into from
Dec 10, 2021
Merged

Fix byte behavior #693

merged 4 commits into from
Dec 10, 2021

Conversation

kenji-miyake
Copy link
Contributor

@kenji-miyake kenji-miyake commented Dec 10, 2021

Public API Changes

None.

Description

Split from #646.

Fixed the behavior around bytes.

How to test

Before(upstream/ros2)

$ # Terminal 1
$ ros2 run rosbridge_server rosbridge_websocket
[ERROR 1632497492.739524112] [rosbridge_websocket]: [Client 0] [id: publish:/byte:3] publish: example_interfaces/Byte message requires a octet for field data, but got a <class 'int'>
[ERROR 1632497493.727461853] [rosbridge_websocket]: [Client 0] [id: publish:/byte:4] publish: example_interfaces/Byte message requires a octet for field data, but got a <class 'int'>

$ # Terminal 2
$ curl -sL https://github.com/tier4/rosbridge_suite/raw/add-test-scripts/test_scripts/byte.py | python
publish: {'data': 1}
publish: {'data': 1}

After(this PR)

$ # Terminal 1
$ ros2 run rosbridge_server rosbridge_websocket

$ # Terminal 2
$ curl -sL https://github.com/tier4/rosbridge_suite/raw/add-test-scripts/test_scripts/byte.py | python
publish: {'data': 1}
subscribe: {'data': 1}
publish: {'data': 1}
subscribe: {'data': 1}

Kenji Miyake added 4 commits December 10, 2021 14:57
Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>
Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>
Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>
Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>
Copy link
Member

@jtbandes jtbandes left a comment

Choose a reason for hiding this comment

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

Thanks for the fixes!

I think it would be nice to add an integration test to cover these features. Recently I refactored these tests so it's easy to make an end-to-end test using the @websocket_test decorator, where you can send/receive messages across the websocket and set up rclpy publishers/subscribers in the same test code. We could add a test which shows that it's possible to send/receive std_msgs/Byte as JSON.

@jtbandes jtbandes merged commit ea0ef28 into RobotWebTools:ros2 Dec 10, 2021
@kenji-miyake kenji-miyake deleted the fix-byte-behavior branch December 10, 2021 07:13
@kenji-miyake
Copy link
Contributor Author

Thank you for the information, I'll consider that!

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.

None yet

2 participants