problem with rosrun beginner_tutorials add_two_ints_client.py
the address: http://wiki.ros.org/rospy_tutorials/Tutorials/WritingServiceClient.
when i use rosrun beginner_tutorials add_two_ints_client.py 4 5
in my computer, the terminal told me that
rosrun beginner_tutorials add_two_ints_client.py 4 5
Requesting 4+5
Traceback (most recent call last):
File "/home/zhoupizeng/catkin_ws/src/beginner_tutorials/scripts/add_two_ints_client.py", line 27, in <module>
print "%s + %s = %s"%(x, y, add_two_ints_client(x, y))
File "/home/zhoupizeng/catkin_ws/src/beginner_tutorials/scripts/add_two_ints_client.py", line 8, in add_two_ints_client
rospy.wait_for_service('add_two_ints')
File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 160, in wait_for_service
rospy.core.logwarn_throttle(10, "wait_for_service(%s): failed to contact, will keep trying"%resolved_name)
File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/core.py", line 243, in logwarn_throttle
_base_logger(msg, logger_throttle=period, logger_level='warn')
File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/core.py", line 184, in _base_logger
if _logging_throttle(caller_id, throttle):
File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/core.py", line 222, in __call__
now = rospy.Time.now()
File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/rostime.py", line 155, in now
return get_rostime()
File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/rostime.py", line 190, in get_rostime
raise rospy.exceptions.ROSInitException("time is not initialized. Have you called init_node()?")
rospy.exceptions.ROSInitException: time is not initialized. Have you called init_node()?
Asked by zpz1997 on 2018-07-15 21:49:21 UTC
Answers
You probably forgot to start a master, type on another console roscore
, then try to re-run both the server and the client. Hopefully, they should be working fine!
Asked by ffusco on 2018-07-16 11:27:44 UTC
Comments
Can you update your question with the code?
Asked by jayess on 2018-07-16 13:14:21 UTC