Try to use SetBool and getting error.
I'm trying to use a simple service to switch a server flag, with this code:
// Service bind
ros::ServiceServer switch_srv = n.advertiseService(
"angle_flag_request", angle.serverRequest
);
// angle.serverRequest definition
void RosAngleFlag::serverRequest(
std_srvs::SetBool& req,
std_srvs::SetBool& res)
{
bool req_type = req.request.data;
if(req_type)
ROS_INFO("flag true");
else
ROS_INFO("flag false");
res.response.success = true;
res.response.message = "teste";
}
And the return are that message:
no matching function for call to ‘ros::NodeHandle::advertiseService(const char [19], void(std_srvs::SetBool&, std_srvs::SetBool&))’
I've imported "std_srvs/SetBool.h" in my header file... Someone can help me?