ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ROS2 Launch File

asked 2020-05-19 13:58:03 -0500

forbiddenfruit gravatar image

Hey Folks! So I have a question relating to the Launch Files with ROS2. I have two separate packages (call them Package A and Package B). Package B has a normal node_executable. So, Package B runs via the launch file just fine.

Node(
        package='B',
        namespace='node_example',
        node_executable='node_example_cpp'
    )

Now, Package A has an executablelogic that is not a node. It is a python script that initalises all the nodes in the package and runs it as it needs to.

I added:

Node(
    package='A',
    namespace='script_example',
    node_executable='script_example_py',
    output="screen"
)

In short. It isnt working out. It runs the Package B but does not run Package A. I removed Package B call from the launch. And there was still no effect.

for reference script_example_py does run when you just call it normally (ros2 run A script_example_py)

Thanks in advance! Any help is appreciated!

edit retag flag offensive close merge delete

Comments

1

It is a python script that initalises all the nodes in the package and runs it as it needs to.

why do you do this? Isn't that the role of a launch file?

christophebedard gravatar image christophebedard  ( 2020-05-19 14:59:48 -0500 )edit

also, without the code itself (not just the launch files) we won't be able to help much

christophebedard gravatar image christophebedard  ( 2020-05-19 15:00:20 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2022-01-19 10:25:52 -0500

ljaniec gravatar image

This line:

https://github.com/ros-planning/navig...

And this:

https://github.com/ros-planning/navig...

Show what you wanted, I think - how to invoke a Python script from a launch file.

I would rethink your use case though, as @christophebedard commented. What do you want is really similar to the role of launch files.

edit flag offensive delete link more
0

answered 2022-01-19 06:56:56 -0500

Raza Rizvi gravatar image

Try to create a executable inside the directory by:

chmod +x script_example.py

And then try to execute.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-05-19 13:58:03 -0500

Seen: 577 times

Last updated: Jan 19 '22