can't get response from service callback

asked 2019-10-17 00:17:20 -0600

BattlePants gravatar image


I'm trying to use ros2 service feature, but there is an problem

below is simplified version of my code

node = rclpy.create_node('test')
service = node.create_service(serviceType, 'service_name', service_callback)

def service_callback(self, request, response):
    response.success = True
    return response

node = rclpy.create_node('test')
client = node.create_client(serviceType, 'service_name')

request = serviceType.Request()

if client.wait_for_service():
    response =

Server is fine. When I call service with ros2 command line interface, it worked. Problem is the client. Client is stuck in 'response =', like response is never been arrived.

edit retag flag offensive close merge delete


do you have a spin() somewhere ?

ignacio gravatar image ignacio  ( 2019-10-19 08:29:46 -0600 )edit