rosbridge2cpp icon indicating copy to clipboard operation
rosbridge2cpp copied to clipboard

Service call

Open tlund80 opened this issue 5 years ago • 1 comments

Hi

I am trying to call a ros service via your library from a not ROS computer, but I face some problems in getting the feedback from ROS.

I can see that the Socket TCP connection receives the data, but I cannot register a callback function to readout the data.

` I call the service in the following way;

ROSService srv(ros,"/database/get_data","/database/get_data"); bson_t b; bson_init (&b); bson_t *ms = BCON_NEW("", ""); FunVrROSServiceResponseMsg fun = std::bind(&Ros::callback, this,std::placeholders::_1); srv.CallService(ms, fun);`

And I have implemented the callback like this:

void Ros::callback(ROSBridgeServiceResponseMsg &msg){ bson_t bson; msg.FromBSON(bson); }

Do you have any sample code that show how to use the library?

Thanks /Thomas

tlund80 avatar May 13 '20 20:05 tlund80

Hi!

Do you get this output: https://github.com/Sanic/rosbridge2cpp/blob/master/src/ros_bridge.cpp#L119 ? Can you check if https://github.com/Sanic/rosbridge2cpp/blob/master/src/ros_bridge.cpp#L113 is even called when your response is send?

Sanic avatar May 15 '20 09:05 Sanic