Exercise 4.1 - Suspended state after running 'rosrun robot_control rotate_robot_integration_test.py' command

I am on Exercise 4.1 where we are supposed to copy the provided code to a ‘rotate_robot_integration_test.py’ file in the test directory in the robot_control package.

I have done that and run the ‘rosrun robot_control rotate_robot_integration_test.py’ to see the test result on the CLI, but it goes in the suspended state. I used Ctrl+z to exit and thought it could be a catkin_make issue.
So I ran the catkin_make and sourced the devel/setup.bash in all the terminals. I ran the command and it is still not giving the appropriate test result. The xml file is empty as well.

Current output screenshot:

Expected output as included in the course notebook:

Please advise. Thanks a lot.

@albertoezquerro Please advise.

Hi @vinaypra ,

thanks for reporting the issue.

With a quick look, I can think of two things that could be wrong:

  1. Could you check the value of the ROS_MASTER_URI variable with the command below?
env | grep ROS_MASTER_URI

The output should be something like:

ROS_MASTER_URI=http://NUMBER_simulation:11311

where NUMBER is an integer.

If the ROS_MASTER_URI doesn’t look like the example here, then could you force the reset of ROS_MASTER_URI with the command below?

 sim_number=$(echo $HOSTNAME| cut -d'_' -f1)
 export ROS_MASTER_URI="http://${sim_number}_simulation:11311"

After that, ROS_MASTER_URI should be ok if it was not ok before.

But even if ROS_MASTER_URI is correctly set, I see that the test is waiting for a service named rotate_robot.

With rosservice list, can you find any service named rotate_robot? If not, maybe you need to run a node that provides that service before running the test.

In any case, we are going to review this course deeper to see what may be wrong in the course.

@ralves , thank you for your response. I will check these and report back by tomorrow.

I’ve tested both unit3 and 4 and it worked.
There might be some small issue sometimes, that it seems more related with ROS timing and the simulator:

ROSUNIT] Outputting test results to /home/user/.ros/test_results/robot_control/rosunit-rotate_robot_integration_test.xml
[Testcase: test_correct_rotation] … FAILURE!
FAILURE: Integration error. Rotation was not between the expected values.
File “/usr/lib/python2.7/unittest/case.py”, line 329, in run
testMethod()
File “/home/user/catkin_ws/src/robot_control/test/rotate_robot_integration_test.py”, line 73, in test_correct_rotation
self.assertTrue((1.3 <= yaw_diff <= 2.1), “Integration error. Rotation was not between the expected values.”)
File “/usr/lib/python2.7/unittest/case.py”, line 422, in assertTrue
raise self.failureException(msg)


SUMMARY:

  • RESULT: FAIL
  • TESTS: 1
  • ERRORS: 0
  • FAILURES: 1 [test_correct_rotation]

But as far as the reported issue goes, if you launch previopusly the service through teh command given in unit 3, it should work without issues: