1
$\begingroup$

I am following this ROS tutorial to create a server and client: https://wiki.ros.org/ROS/Tutorials/WritingServiceClient%28python%29. However, when I run the code, I get this:

$ rosrun beginner_tutorials add_two_ints_server.py
Ready to add two ints.

$ rosrun beginner_tutorials add_two_ints_client.py 1 3 
Requesting 1+3
^CTraceback (most recent call last):
  File "/home/cindy/catkin_ws/devel/lib/beginner_tutorials/add_two_ints_client.py", line 15, in <module>
    exec(compile(fh.read(), python_script, 'exec'), context)
  File "/home/cindy/catkin_ws/src/beginner_tutorials/scripts/add_two_ints_client.py", line 29, in <module>
    print("%s + %s = %s"%(x, y, add_two_ints_client(x, y)))
  File "/home/cindy/catkin_ws/src/beginner_tutorials/scripts/add_two_ints_client.py", line 10, in add_two_ints_client
    rospy.wait_for_service('add_two_ints')
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 164, in wait_for_service
    time.sleep(0.3)
KeyboardInterrupt

I have to interrupt, because it doesn't stop running otherwise. It seems to be that wait_for_service keeps blocking. Any suggestions?

I am using Noetic and my OS is Ubuntu 20.04.

Edit: when I originally made this post, I was using a virtual machine on a Mac. I am now doing this on a different computer (dual booted, still Noetic and Ubuntu 20.04) and I'm still having this exact issue.

$\endgroup$
0

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.