Error: 'std_srvs::Empty' is not a namespace
Hey everyone,
I'm currently working through "A Gentle Introduction to ROS" and in the chapter about services the following example is shown:
bool toggleForward(std_srvs::Empty::Request &request, std_srvs::Empty::Response &response){...}
Now I don't want to write the std_srvs::Empty:: all the time and I tried the following:
using std_srvs::Empty::Request;
using std_srvs::Empty::Response;
bool toggleForward(Request &request, Response &response){...}
But now I'm getting the following errors:
error: ‘std_srvs::Empty’ is not a namespace
using std_srvs::Empty::Request;
^
error: ‘std_srvs::Empty’ is not a namespace
using std_srvs::Empty::Response;
^
error: ‘Request’ was not declared in this scope
bool toggleForward(Request &request, Response &response)
^
error: ‘request’ was not declared in this scope
bool toggleForward(Request &request, Response &response)
^
error: ‘Response’ was not declared in this scope
bool toggleForward(Request &request, Response &response)
^
error: ‘response’ was not declared in this scope
bool toggleForward(Request &request, Response &response)
^
I don't understand what's happening here. For example, the following works:
using std::cout;
What is the difference between those two?