I write a service client code. But I always take same error. I send codes. Please help. Error processing request: 'geriSayRequest' object has no attribute 'sonuc'
This is service code:
import rospy
from temizlik_robotu_pkg.srv import *
def servisCevapCB(istek):
print(istek.sayi)
istek.sonuc=1
return istek
def servisSayma():
rospy.init_node("servis_geri_say_nd")
rospy.Service("geri_say", geriSay, servisCevapCB)
rospy.spin()
servisSayma()
And this is client code:
import rospy
from temizlik_robotu_pkg.srv import *
def client():
rospy.init_node("client_geri_say_nd")
rospy.wait_for_service("geri_say")
servis=rospy.ServiceProxy("geri_say", geriSay)
try:
gelen_cevap=servis(5)
print("sonuc: " +gelen_cevap.sonuc)
except rospy.ServiceException:
print("servisde hata var")
client()
and this is .srv file:
int32 sayi
---
int32 sonuc