Coder Social home page Coder Social logo

Comments (8)

jacobperron avatar jacobperron commented on August 15, 2024 1

See #112 for a fix of the example.

Longer term, I think we need to remove the injection from the CLI tool, or be able to detect that the preamble has already been included to avoid including it more than once.

from launch_ros.

teutobod avatar teutobod commented on August 15, 2024

Any updates here? I'm stuck to the same issue.

from launch_ros.

jacobperron avatar jacobperron commented on August 15, 2024

I can reproduce the issue.

Interestingly, if you run the test with the CLI tool ros2 test, then there is no error:

ros2 test src/ros2/launch_ros/launch_testing_ros/test/examples/talker_listener_launch_test.py

from launch_ros.

jacobperron avatar jacobperron commented on August 15, 2024

I guess it kind of makes sense, since the ROS node is specific to launch_ros and not launch; the node is started by the default launch_ros description here:

def get_default_launch_description(*, rclpy_context=None):
"""
Return a LaunchDescription to be included before user descriptions.
:param: rclpy_context Provide a context other than the default rclpy context
to pass down to rclpy.init.
The context is expected to have already been initialized by the caller
using rclpy.init().
"""
default_ros_launch_description = launch.LaunchDescription([
# ROS initialization (create node and other stuff).
ROSSpecificLaunchStartup(rclpy_context=rclpy_context)
])

I think either the README should be updated to use ros2 test, or the example launch file should be updated to use the get_default_launch_description.

from launch_ros.

jacobperron avatar jacobperron commented on August 15, 2024

Updating the launch file fixes the issue for launching with launch_test, e.g.:

    ld = launch_ros.get_default_launch_description()
    ld.add_action(talker_node)
    ld.add_action(listener_node)
    # Start tests right away - no need to wait for anything
    ld.add_action(launch_testing.actions.ReadyToTest())

But, then two nodes are created if we run with ros2 test and we get the following warning:

[WARN] [rcl.logging_rosout]: Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from being published on the rosout topic.

Seems like a different approach is required.

from launch_ros.

hidmic avatar hidmic commented on August 15, 2024

There's no good solution here really, besides not mixing up launch_test and ros2 test. The former just runs the test, the latter injects launch_ros default launch description. There was a discussion about this in ros2/launch#208. I still think tools should not inject anything, but consensus back then was to reduce boilerplate as much as possible.

from launch_ros.

stonier avatar stonier commented on August 15, 2024

Got burned by this last night as well.

+1 for removing the injection. Reasoning:

  • Prefer to have one launch test file format, not two (e.g. the current launch_test file is broken with launch_test, which makes it something else).
  • Prefer not to depend on user friendly tooling (i.e. ros2 test). There already is an execution framework (i.e. launch_test) so ros2 test should be there to provide conveniences, not dependencies.

from launch_ros.

jacobperron avatar jacobperron commented on August 15, 2024

I've fixed the example in #121 and opened a ticket to discuss removing the injected launch description: #120

from launch_ros.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.