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

How to run python script from launch file

asked 2019-12-14 04:36:27 -0600

kiko453 gravatar image

updated 2019-12-14 04:51:00 -0600

I have a launch file, with following:

 <!-- Launch Gazebo -->   
 <include file="$(find turtlebot_gazebo)/launch/turtlebot_world.launch"> </include>
 <!-- Launch AMCL -->  
 <include file="$(find my_package)/launch/my_amcl.launch">    </include>
 <!-- Launch Move base -->  
 <!-- Launch Rviz -->

Inside this launch file I want to also run a python script located in my_package/scripts. I have try <include file="$(find my_package)/scripts/"> </include> but it doesn't works. Is there a way to do that?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-12-14 07:45:17 -0600

fexner gravatar image

This has been asked and answered before:

edit flag offensive delete link more


this is not the same. I tried that, but didn't work. SO I've tried

  <node pkg="my_package" name="" type="" output="screen"> 

but it didn't work

kiko453 gravatar image kiko453  ( 2019-12-14 17:24:29 -0600 )edit

Did you make your script executable? has to be an executable script. See the example python node for details

fexner gravatar image fexner  ( 2019-12-16 06:30:21 -0600 )edit

working now, thanks.

kiko453 gravatar image kiko453  ( 2020-01-24 04:08:25 -0600 )edit

Question Tools

1 follower


Asked: 2019-12-14 04:36:27 -0600

Seen: 2,884 times

Last updated: Dec 14 '19