rosserial_windows packet loss while sending data to service server on ROS

asked 2017-10-16 11:56:33 -0500

_nobot.enter gravatar image


I have a question about rosserial windows.

I made a Windows application which has two buttons as below.

  1. Open connection
  2. Send data to Service Server - which is Service client

In constructor of the dialog, I assigned ServiceClient pointer to node handle.
When I click Button #1, it should init node handle by calling initNode function and call spinOnce function.
When I click Button #2, it should call Call function to send data to ServiceServer and receive response.

My test was as shown below.

  1. Compile
  2. Click Button #1
  3. Click Button #2
  4. Wait for a while (longer than 30 sec)
  5. Click Button #2

I put simplified version of my code.

// ROSHandler class
class ROSHandler {
        ros::NodeHandle node_handle_;
       ros::ServiceClient<request, response="">* client_;
        ROSHandler() {
            client_ = new ros::ServiceClient<request, response="">("TOPIC_NAME");
        bool Connect() {
            while (!node_handle_.connected())
            return (node_handle_.spinOnce() == 0);
        bool Send() {
            Request req;
            Response res;
            // set values in req

            if (!node_handle_.connected()) {

            client_->call(request, response);
            return response_.result; // return boolean
void OnClickButton1 {
    Connect(); // connect function above

void OnClickButton2 {
    Send(); // send function above

Thanks! :D

edit retag flag offensive close merge delete