Skip to content

aligh with rcl that a rosout publisher of a node might not exist - #1196

Merged
clalancette merged 5 commits into
ros2:rollingfrom
iuhilnehc-ynos:topic-rosout-publisher-logger-entry-not-exist
Nov 15, 2023
Merged

clalancette merged 5 commits into
ros2:rollingfrom
iuhilnehc-ynos:topic-rosout-publisher-logger-entry-not-exist

Conversation

@iuhilnehc-ynos

Copy link
Copy Markdown
Contributor

align with ros2/rcl#1115

Chen Lihui added 2 commits November 6, 2023 09:30
Signed-off-by: Chen Lihui <[email protected]>
reset error message for RCL_RET_NOT_FOUND as well

Signed-off-by: Chen Lihui <[email protected]>
Comment thread rclpy/src/rclpy/_rclpy_logging.cpp Resolved
Comment thread rclpy/test/test_rosout_subscription.py Resolved

@clalancette clalancette left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we need to add a test for this situation, but it otherwise looks good.

self.executor.spin_until_future_complete(self.fut, 3)
self.assertTrue(self.fut.done())

def test_node_logger_not_exist(self):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we want to add a test to ensure that the situation from #1195 doesn't occur again. The following code (which needs to be adapted into a test) reproduced for me:

import rclpy
from rclpy.action import ActionServer

from example_interfaces.action import Fibonacci

class MyClass:
    def __init__(self, node):
        self.action_server = ActionServer(
            node,
            Fibonacci,
            "/fibonacci_action_1",
            self.execute_callback,
        )

    def execute_callback(self):
        print("Execute callback")

rclpy.init()
node = rclpy.create_node("mynode", enable_rosout=False)
x = MyClass(node)
node.destroy_node()
rclpy.try_shutdown()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks.
I used the similar logic to test the case. Updated in fc84c5e.

Chen Lihui added 2 commits November 14, 2023 09:27
@clalancette

Copy link
Copy Markdown
Contributor

CI for this is in ros2/rcl#1115 (comment)

@clalancette
clalancette merged commit f909278 into ros2:rolling Nov 15, 2023
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.

3 participants