No return from arduino service server

asked 2019-11-13 08:55:09 -0600

Hello, I just ran in a similar isse like this one.

I configured a service server on my arduino and trying to make a service call from my PC using python. The content inside of my service callback function gets executed properly. However, the service request gets stuck and does not return any kind of response.

A minimal example of my arduino code looks like this:

#include <ros.h>
#include <std_srvs/Empty.h>
#include <std_msgs/String.h>
#include <rosserial_arduino/Test.h>

// ROS initialization
ros::NodeHandle  nh;
using rosserial_arduino::Test;

ros::ServiceClient<Test::Request, Test::Response> service_client("service_client_name");
Test::Request test_req;
Test::Response test_resp;

void service_callback(const Test::Request & req, Test::Response & res){
// Perform some operations here

ros::ServiceServer<Test::Request, Test::Response> service_server("service_server_name",&service_callback); 

void setup()
 Ethernet.begin(mac, ip);
 // give the Ethernet shield a second to initialize:
 nh.getHardware()->setConnection(server, serverPort);
 while(!nh.connected()) nh.spinOnce();

void loop()

FYI, the service client is called in another interrupt routine which I have not mentioned in my minimal example.

So using python from y PC, the service gets stuck. However, when I am calling the ervice using the terminal

rosservice call /service_server_name "input: 'some_request'"

everything works fine and I get a proper return message from the arduino.

Any Ideas? Is this a well known bug from rosserial using python?

edit retag flag offensive close merge delete