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

support multiple fields in ros2topic echo #964

Merged
merged 4 commits into from
Jan 24, 2025

Conversation

sangteak601
Copy link
Contributor

Added support for multiple fields in ros2 topic echo. Fixes #951

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

the implementation looks good to me.

@sangteak601 can you add the multiple fields test aligned with

@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_topic_echo_field(self):
with self.launch_topic_command(
arguments=['echo', '/arrays', '--field', 'alignment_check'],
) as topic_command:
assert topic_command.wait_for_output(functools.partial(
launch_testing.tools.expect_output, expected_lines=[
'0',
'---',
], strict=True
), timeout=10)
assert topic_command.wait_for_shutdown(timeout=10)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_topic_echo_field_nested(self):
with self.launch_topic_command(
arguments=['echo', '/cmd_vel', '--field', 'twist.angular'],
) as topic_command:
assert topic_command.wait_for_output(functools.partial(
launch_testing.tools.expect_output, expected_lines=[
'x: 0.0',
'y: 0.0',
'z: 0.0',
'---',
], strict=True
), timeout=10)
assert topic_command.wait_for_shutdown(timeout=10)
@launch_testing.markers.retry_on_failure(times=5, delay=1)
def test_topic_echo_field_not_a_member(self):
with self.launch_topic_command(
arguments=['echo', '/arrays', '--field', 'not_member'],
) as topic_command:
assert topic_command.wait_for_output(functools.partial(
launch_testing.tools.expect_output, expected_lines=[
"Invalid field 'not_member': 'Arrays' object has no attribute 'not_member'",
], strict=True
), timeout=10)
assert topic_command.wait_for_shutdown(timeout=10)

@CWAbhi
Copy link

CWAbhi commented Jan 22, 2025

@sangteak601, you need to add the test files in test_cli.py for the tests to pass. Once you add them, it should work. I faced the same issue, but it got fixed after doing this."
Currently i was issuing some new unknow issue so i don't think you will get that
Let me know if you want further refinements!
For reference you can check my drafted PR .
#958

sangteak601 and others added 3 commits January 24, 2025 11:12
Signed-off-by: Sangtaek Lee <[email protected]>
Signed-off-by: Sangtaek Lee <[email protected]>
Signed-off-by: Sangtaek Lee <[email protected]>
@sangteak601 sangteak601 force-pushed the support_multiple_fields branch from 366cbe2 to 17cb712 Compare January 24, 2025 11:13
Signed-off-by: Sangtaek Lee <[email protected]>
Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

lgtm with green CI.

ros2topic/ros2topic/verb/echo.py Show resolved Hide resolved
@fujitatomoya
Copy link
Collaborator

Pulls: #964
Gist: https://gist.githubusercontent.com/fujitatomoya/1f9e28f0651634736fd6085e208718e9/raw/b4b3a3940ab75725d4b9cce82b27a1c1fabb39ef/ros2.repos
BUILD args: --packages-above-and-dependencies ros2topic
TEST args: --packages-above ros2topic
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/15091

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@fujitatomoya fujitatomoya merged commit e8138a1 into ros2:rolling Jan 24, 2025
3 checks passed
@fujitatomoya
Copy link
Collaborator

@sangteak601 thank you very much for your contribution, PR has been merged 👍

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.

[Question] - does ros2 topic echo support multiple fields
3 participants