Problems calling services within classes
Hello Community, I have a couple of services and subscribers that are functions of a class that I created. The services are being advertised correctly and I can see them in rosservice list. However when the service gets called, it spins indefinitely never calling the appropriate callback function. However the subscribers work perfectly well within the same class. I am also able to call the same function (service callbacks) through normal function calls on the object. Could someone please suggest to me what the problem could be here. Here is how I advertise the service in my main() method:
trader::Trader a;
ros::ServiceServer auction_service = n.advertiseService(PACKAGE_NAME + "/auction", &trader::Trader::auctionCB, &a);
Here is the function:
bool Trader::auctionCB(multiagent_coordination_msgs::Auction::Request &req, multiagent_coordination_msgs::Auction::Response &res){return true;}
Here is the function declaration in the .h file:
bool auctionCB(multiagent_coordination_msgs::Auction::Request &req, multiagent_coordination_msgs::Auction::Response &res);
As I said the subscribers work perfectly. Thanks Ammar