How to run a python script file for ros ?
I have developed python script to make a drone to fly. I have kept the code inside
tumsimulator/src/scripts/DroneFly.py. ## catkin make is done in this directory When I run the code in tumsimulator directory, it throws an error saying that scripts directory is not found.
I gave chmod 777 permission for directory as well as the file.
Can Somebody help me to run the python script in ros ?
Just to be on the same page
you need to create a catkin workspace a catkin package. For example you create a workspace called
catkin_ws
Create your package called
tumsimulator
in~/home/catkin_ws/src
Put the
scripts
directory intumsimulator/
not intumsimulator/src
. Once after running catkin_make, you should be able to run the script viaRun catkin_make
Finally, run your script
As a side note, scripts should note have the py extension. You can add the python shebang line at the top of your script file
#! /usr/bin/env python
. If your are writing a python module, you may put these files intumsimulator/src/tumsimulator/
next totumsimulator/src/tumsimulator/__init__.py
.