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

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 navigate.py located in my_package/scripts. I have try <include file="$(find my_package)/scripts/navigate.py"> </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
0

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

fexner gravatar image

This has been asked and answered before: https://answers.ros.org/question/2298...

edit flag offensive delete link more

Comments

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

  <node pkg="my_package" name="navigate.py" type="navigate.py" output="screen"> 
  </node>

but it didn't work

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

Did you make your script executable? navigate.py 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

Stats

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

Seen: 3,320 times

Last updated: Dec 14 '19