When I call my service, even though I have made the response true in the callback function, it returns as false!
Here’s my code:
import rospy
from services_quiz.srv import BB8CustomServiceMessage, BB8CustomServiceMessageResponse
from geometry_msgs.msg import Twist
def my_callback(request):
response = BB8CustomServiceMessageResponse()
response.success = True
return response
rospy.init_node(‘service_server’)
my_service = rospy.Service(’/move_bb8_in_square_custom’, BB8CustomServiceMessage , my_callback) # create the Service called my_service with the defined callback
my_pub = rospy.Publisher(’/cmd_vel’, Twist, queue_size=1)
move = Twist()
rate = rospy.Rate(1)
rospy.spin() # maintain the service open.
The response in the terminal is:
success: false
The BB8CustomServiceMessage.srv file is:
float64 side
int32 repetitions
bool success
Thankyou in advance for your help!!