Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when calling service #284

Open
siddux opened this issue Jul 17, 2023 · 0 comments
Open

Error when calling service #284

siddux opened this issue Jul 17, 2023 · 0 comments

Comments

@siddux
Copy link

siddux commented Jul 17, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant