Coder Social home page Coder Social logo

Comments (5)

wjwwood avatar wjwwood commented on August 15, 2024

Maybe you need to use the scoped argument for the GroupAction? I need to look in more detail at why you are using the group, but I guess the scope option needs to be flipped or the scope mechanism has a bug in it or something.

from launch_ros.

wjwwood avatar wjwwood commented on August 15, 2024

Maybe it has to do with the delayed evaluation of the substitution? I'm not sure...

from launch_ros.

wjwwood avatar wjwwood commented on August 15, 2024

I think since the load of the composable nodes is done asynchronously (with an event handler) the group has already ended and undone the scope:

composable_node_descriptions=self.__composable_node_descriptions,

I'm not sure how to fix this, a few options:

  • perform the substitutions in ComposableNodeContainer::execute() before registering the event
  • change how the containers are loaded to avoid the delay in evaluating the substitutions (i.e. do not use an event)
  • store the launch config state and make sure it is used for the evaluation in the event handler (sort of like lambda capture or something)

from launch_ros.

jrgnicho avatar jrgnicho commented on August 15, 2024

Also experiencing the same issue with ComposableNodeContainer where my python launch file looks like this

def generate_launch_description():
   
    container =  ComposableNodeContainer(
            node_name= 'perception',
            node_namespace= launch.substitutions.LaunchConfiguration('global_ns'),
            package= 'rclcpp_components',
            node_executable = 'component_container',
            composable_node_descriptions = [
                ComposableNode(
                package='crs_perception',
                node_plugin='crs_perception::LocalizeToPart',
                node_name='part_localization',
                node_namespace = launch.substitutions.LaunchConfiguration('global_ns')),
                ],
            output = 'screen'
        )    
    
    return launch.LaunchDescription([
        launch.actions.DeclareLaunchArgument('global_ns', default_value = ['/my_ns']),
        container])

It runs fine when I call it from the command line
but when I call it from an xml launch file

	    <include file="$(find-pkg-share crs_application)/launch/perception.launch.py">
	    	<arg name="global_ns" value="$(var group_ns)"/>
	    </include>

It errors out saying that the launch configuration 'global_ns' does not exist. Removing the argument has no effect either

from launch_ros.

jacobperron avatar jacobperron commented on August 15, 2024

I did some investigation and I can confirm the launch configuration dropped by the event handler:

RegisterEventHandler(
event_handler=OnProcessStart(
target_action=self,
on_start=[
LoadComposableNodes(
composable_node_descriptions=self.__composable_node_descriptions,
target_container=self
)
]
)
)

Looking through the commit history, the whole event handler strategy for loading seems vestigial; it was originally used in the LoadComposableNodes action, but since moved to the container action (see #16). I don't think it is necessary to use an event and we can simply return the load node action. See #170 for proposed fix.

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.