Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

call nodeHandle->advertiseService


i try to advertise my service, but i am not able to compile.

Here is my msg file:

string sourceRobot
float64 x
float64 y

My srv file:

map_merger/pointFromRobot inputPoint
map_merger/pointFromRobot outputPoint

And here are the cpp parts according to the Service:

in map_merger.h:

 map_merger::pointFromRobot transformPoint(map_merger::transformPoint::Request req);

in map_merger.cpp:

 map_merger::pointFromRobot transformPoint(map_merger::transformPoint::Request req)
     map_merger::pointFromRobot returnValue;
    return returnValue;

in the Constructor the advertiseService is called (that does not work), here is the code:

 nodeHandle = new ros::NodeHandle("~");
    ros::ServiceServer service = nodeHandle->advertiseService("transformPoint",&MapMerger::transformPoint,this);

regard peter