ros::service::waitForService() blocks infinite
When i use ros::service::call()
to call e.g. gazebo/apply_joint_effort inside a rostest (c++,gtest) the call sometimes fail and sometimes don't fail ?
So i thought, using ros::service::waitForService("gazebo/apply_joint_effort", -1)) to wait for "something" and then use the call() function, but the waitForService() is blocking endless. But when i call the service with the commandline tool "rosservice", the service is available and returns success ?
is waitForService() for another usage?
thanks flo
Change 1: Inserting
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
rosbuild_add_gtest(test/mytest test/mytest.cpp)
into CMakeList.txt file and running then the binary bin/test/mytest the service call returns success, but the service (force) does not get applied to the model in gazebo?
gazebo dies with:
terminate called after throwing an instance of 'std::runtime_error'
what(): Time is out of dual 32-bit range
Aborted (core dumped)
I got ubuntu-12.04-amd64 installed. Someone knows what this error causes?
Also if i use:
rosbuild_add_executable()
rosbuild_add_gtest_build_flags()
rosbuild_add_rostest()
in my CMakeList.txt file instead the two other options mentioned before, and run rostest mypackage mytest the test is run 3 times in a row after building? Why is that so? Also the rostest lib cannot call the service, but the test-binary can call the service (but gazebo dies) ?
Is there a way to prevent the test from running after building it with make test?
the call ros::service::waitForService("/gazebo/apply_joint_effort", -1) blocks also infinite ?
my test is just:
TEST(MyTest, firstTest) { ros::Time::init(); //used for waitForService if(ros::service::waitForService("/gazebo/apply_joint_effort", -1)) EXPECT_EQ(1,2) << "wait for service ok"; }
Are there some other functions i can call to get more info? like what namespace i am in, or something?
thanks flo
Please do not create answers for discussion or comments. Instead, either edit and append to your original post or use the comment functionality.
I think running it is the intended behaviour of make test.