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

ResourceNotFound error with rostest absolute path to launch file

asked 2014-10-22 19:41:54 -0600

Jarvis gravatar image

updated 2014-10-28 12:30:40 -0600

Hi,

I have a bunch of "*.launch" files which starts different nodes on my machine. Since, these launch files are not specific to any package, I have kept these files in the catkin workspace directory.

catkin_workspace/src/<pkg1>, <pkg2>
catkin_workspace/mylaunch.launch

After running catkin_make and source devel.setup.sh I can run my launch file from anywhere just by supplying path to launch file.

cd catkin_worksapce
roslaunch mylaunch.launch

and it starts the configured nodes as desired.

Now I am trying to add test tags to this launch file as well. I followed the wiki page rostest. However running the rostest as follows throws ResourceNotFound error.

cd catkin_workspace
rostest mylaunch.test

I am able to run the same test+launch file if I put it under src/<package1>/mylaunch.launch and run by

rostest src/<pkg1>/mylaunch.launch.

Anyone can shed light on this problem?To me it seems to a bug. Because rostest should work similar to roslaunch.

As per Dirk's advice updating the tracestack of exception

... logging to /home/dev/.ros/log/rostest-localhost-32420.log
Traceback (most recent call last):
  File "/opt/ros/indigo/bin/rostest", line 36, in <module>
    rostestmain()
  File "/opt/ros/indigo/lib/python2.7/dist-packages/rostest/__init__.py", line 268, in rostestmain
    _main()
  File "/opt/ros/indigo/lib/python2.7/dist-packages/rostest/rostest_main.py", line 126, in rostestmain
    pkg_dir = r.get_path(pkg)
  File "/usr/lib/pymodules/python2.7/rospkg/rospack.py", line 190, in get_path
    raise ResourceNotFound(name, ros_paths=self._ros_paths)
rospkg.common.ResourceNotFound

The launch file

<launch>
    <node 
        pkg="listner"
        type="listner.py"
        name="listner"
        output="screen"
    />  
    <node
        pkg="talker"
        type="talker.py"
        name="talker"
    />  
    <param name="hztest1/topic" value="chatter" />
    <param name="hztest1/hz" value="10.0" />
    <param name="hztest1/hzerror" value="0.5" />
    <param name="hztest1/test_duration" value="5.0" />
    <test test-name="hztest_test" pkg="rostest" type="hztest" name="hztest1"/>
</launch>
edit retag flag offensive close merge delete

Comments

It might help if out post the exact error message which will contain the name of the not found resource.

Dirk Thomas gravatar image Dirk Thomas  ( 2014-10-22 20:28:55 -0600 )edit

Please format the posted stacktrace in a readable way. It also looks like it is truncated. When I force this I get output similar to this: rospkg.common.ResourceNotFound: test_rosparam followed by some lines listing the ROS_PACKAGE_PATH.

Dirk Thomas gravatar image Dirk Thomas  ( 2014-10-22 22:12:19 -0600 )edit
1

Usually the ResourceNotFound exception should print the package name which was not found. You could tweak the file locally to print the name in question. Also try running rospack profile to refresh your cache.

Dirk Thomas gravatar image Dirk Thomas  ( 2014-10-23 14:09:22 -0600 )edit

@Dirk Thomas, Sorry I was busy in other task so couldn't reply yesterday. rospack profile didn't solved the problem. The package name in RosPack is None. But when you are providing absolute path package name is expected to be None, right?

Jarvis gravatar image Jarvis  ( 2014-10-24 12:23:49 -0600 )edit

The package name is not based on the launch file you invoke. It is coming from somewhere in your launch file. Can you please post your lunch file?

Dirk Thomas gravatar image Dirk Thomas  ( 2014-10-24 12:47:12 -0600 )edit

And you do have two packages with the names listner and talker? And you can manually run these nodes using rosrun listner listner.py and rosrun talker talker.py?

Dirk Thomas gravatar image Dirk Thomas  ( 2014-10-28 13:15:47 -0600 )edit

Yes. I can run these packages individually as well with roslauch and rostest with package name. I trying to compare the source code for roslaunch and rostest to figure out the difference, just swamped with other tasks.

Jarvis gravatar image Jarvis  ( 2014-10-28 14:16:20 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-07-29 15:00:45 -0600

juanrh gravatar image

I had the same error and I was able to solve it. For some reason I was able to run the test script directly with rosrun, but not with rostest. The problem was that I in CMakeLists.txt was installing the test file and script to ${CATKIN_PACKAGE_BIN_DESTINATION} instead of to ${CATKIN_PACKAGE_SHARE_DESTINATION}. After fixing that I can run it with rostest

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-10-22 19:41:54 -0600

Seen: 2,224 times

Last updated: Oct 28 '14