Robotics StackExchange | Archived questions

ResourceNotFound error with rostest absolute path to launch file

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//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>

Asked by Jarvis on 2014-10-22 19:41:54 UTC

Comments

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

Asked by Dirk Thomas on 2014-10-22 20:28:55 UTC

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.

Asked by Dirk Thomas on 2014-10-22 22:12:19 UTC

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.

Asked by Dirk Thomas on 2014-10-23 14:09:22 UTC

@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?

Asked by Jarvis on 2014-10-24 12:23:49 UTC

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?

Asked by Dirk Thomas on 2014-10-24 12:47:12 UTC

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?

Asked by Dirk Thomas on 2014-10-28 13:15:47 UTC

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.

Asked by Jarvis on 2014-10-28 14:16:20 UTC

Answers

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

Asked by juanrh on 2019-07-29 15:00:45 UTC

Comments