print is working but rospy.log info is not working only in server client node everywhere else it is working fine wheter i run with python or rosrun it is not working

asked 2020-06-29 08:46:48 -0500

updated 2020-06-29 10:58:31 -0500

Code:

#!/usr/bin/env python

import rospy
import sys
from ros_tutorials_service.srv import SrvTutorial,SrvTutorialRequest

def add_numbers_client(x,y):
    rospy.wait_for_service('add_numbers')
    try:
        add_numbers=rospy.ServiceProxy('add_numbers',SrvTutorial)
        resp1 = add_numbers(x,y)
        return resp1.result
    except rospy.ServiceException as e:
        rospy.loginfo("Service called failed: %s"%e)

def usage():
    return "%s [x,y]"%sys.argv[0]

if __name__=="__main__":
    rospy.loginfo("hii")
    if len(sys.argv)==3:
        x= int(sys.argv[1])
        y= int(sys.argv[2])
    else:
        print(usage())
        sys.exit(1)
    print("Requesting %s+%s"%(x,y))
    print("%s + %s = %s"%(x,y,add_numbers_client(x,y)))
edit retag flag offensive close merge delete

Comments

2

It would be much more helpful if you edited your question and provided some information about what is and is not working. What is the behavior you are expecting? What is the behavior you are observing? What are you actually running to have things "work" vs "not work". Also, it would be helpful if you had a nice title for the question and then asked a detailed question in the body of the question, rather than just pasting your code.

Please see the support page for more guidelines on asking questions: http://wiki.ros.org/Support

jarvisschultz gravatar image jarvisschultz  ( 2020-06-29 11:01:01 -0500 )edit