Skip to content

Error when calling service #284

Open

Description

@siddux

Hi, I am trying to build a node which include a messageStoreProxy instance and a service server. For instance, I just created a dummy code to show the behavior:

#include <ros/ros.h>
#include <std_srvs/SetBool.h>
#include <geometry_msgs/Pose.h>
#include <mongodb_store/message_store.h>

bool serviceCallback(std_srvs::SetBool::Request& req,
                    std_srvs::SetBool::Response& res)
{
  return true;
}

void unused_function(mongodb_store::MessageStoreProxy& store)
{
  geometry_msgs::Pose stored;
	std::string name("test");
	std::string id(store.insertNamed(name, stored));
}

int main(int argc, char **argv)
{
  ros::init(argc, argv, "test_node");
  ros::NodeHandle nh;
  

  mongodb_store::MessageStoreProxy messageStore(nh, "test_collection");
  
  ros::ServiceServer srv = nh.advertiseService("/test_srv", serviceCallback);
  
  ros::Rate rate(10);

  while(ros::ok)
  {
    ros::spinOnce();
    rate.sleep();
  }
  return 0;
}

I run the node along with mongodb_store and when I call the service I get the following error and the node dies:
ERROR: transport error completing service call: unable to receive data from sender, check sender's logs for details
And any log file is saved.

Debugging the code I noticed that commenting out the "insertNamed..." line solves the error but I can't understand it because it's a line which is never executed. Any idea on where can be the problem and how to solve it?

Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions