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 imagekiko453 ( 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 imagefexner ( 2019-12-16 06:30:21 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 32 times

Last updated: Dec 14 '19