rclpy icon indicating copy to clipboard operation
rclpy copied to clipboard

Logger child not publish in /rosout

Open halejo-as opened this issue 1 year ago • 1 comments

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

Execute the next code.

import rclpy                                                    
from rclpy.node import Node                                     
                                                                
                                                                
def main():                                                     
    rclpy.init()                                                
    node = Node("Test")                                         
    node.get_logger().info("Message parent")                    
    node.get_logger().get_child("child").info("Message child")  
    node.destroy_node()                                         
    rclpy.try_shutdown()                                        
                                                                
if __name__ == "__main__":                                      
    main()                                                      
                  

Expected behavior Both loggers should be apeear in rosout. Screenshots Only the message from the parent is received in the topic /rosout Image

Environment (please complete the following information):

  • OS: Ubuntu 22.04
  • Version ROS: humble

halejo-as avatar Jan 30 '25 12:01 halejo-as

@halejo-as thanks for creating issue.

this problem has been addressed by https://github.com/ros2/rcl/pull/1115, jazzy and rolling do not have this problem anymore.

### console output
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 run prover_rclpy rclpy_1407 
[INFO] [1738264388.590734963] [Test]: Message parent
[INFO] [1738264388.591074152] [Test.child]: Message child

### rosout
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 topic echo /rosout
stamp:
  sec: 1738264388
  nanosec: 590734963
level: 20
name: Test
msg: Message parent
file: /root/ros2_ws/colcon_ws/build/prover_rclpy/src/rclpy_1407.py
function: main
line: 8
---
stamp:
  sec: 1738264388
  nanosec: 591074152
level: 20
name: Test.child
msg: Message child
file: /root/ros2_ws/colcon_ws/build/prover_rclpy/src/rclpy_1407.py
function: main
line: 9
---

https://github.com/ros2/rcl/pull/1115 created the new return code RCL_RET_NOT_FOUND and added it to rcl_logging_rosout_add_sublogger, so technically this does not break the API/ABI. However, if client code is compiled with assumptions about a fixed set of return values and behaves incorrectly when receiving a new value, it might cause unintended behavior without breaking ABI in the strictest sense.

at this moment, i do not think we are going to work on the backport for humble.

fujitatomoya avatar Jan 30 '25 19:01 fujitatomoya

Ok thank you for the update

halejo-as avatar Feb 21 '25 08:02 halejo-as

Thank you for the issue!

I'll close this for now since the fix won't be backported to ROS Humble.

sloretz avatar Feb 23 '25 16:02 sloretz