ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
For others in this position, here's my simple script:
#!/usr/bin/env python
import sys
from catkin.find_in_workspaces import find_in_workspaces
try:
script_name, package_name, file_name = sys.argv
except ValueError:
sys.stderr.write("Usage: find_file PACKAGE FILE\n\n")
exit(1)
path = find_in_workspaces(project=package_name, path=file_name)
if len(path) > 0:
sys.stdout.write("%s\n" % path[0])
else:
sys.stderr.write("No file found in package.\n")
exit(1)
Usage is:
rosrun mypkg find_file mypkg myfile