ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This is the service definition of the service your are referring to (from nav_msgs/GetMap):

# Get the map as a nav_msgs/OccupancyGrid
---
nav_msgs/OccupancyGrid map

The part that gets transformed in the GetMapRequest type (the one you import from nav_msgs.srv) contains the fields in the upper part of the message definition (ie: above the ---).

The response would be the lower part (ie: below the ---).

The request part does indeed not contain any fields, just a single comment. So the request type is "empty", but only in the sense it does not contain any additional fields.

This is not the same as the std_srvs/Empty. This is an entirely different service type. It is called Empty, as it does not have any fields in either the request nor the response part (from std_srvs/Empty:

---

Even though it does not contain any fields, this is a different service request type, and it is not used as the request type of the GetMap service.

when I replace the line my_call=GetMapRequest() to my_call=Empty(), I get an error.

Yes. This is expected, as they are not the same service request type.

And technically, GetMapRequest is the request type, while Empty is the name of the service (ie: includes both the request and the response).

So is empty data type not equal to the blank data type of the service request?

Exactly.

But do note: "blank data type of the [GetMap] service request" is not a type. That would be GetMapRequest.

This is the service definition of the service your are referring to (from nav_msgs/GetMap):

# Get the map as a nav_msgs/OccupancyGrid
---
nav_msgs/OccupancyGrid map

The part that gets transformed in the GetMapRequest type (the one you import from nav_msgs.srv) contains the fields in the upper part of the message definition (ie: above the ---).

The response would be the lower part (ie: below the ---).

The request part does indeed not contain any fields, just a single comment. So the request type is "empty", but only in the sense it does not contain any additional fields.

This is not the same as the std_srvs/Empty. This is an entirely different service type. It is called Empty, as it does not have any fields in either the request nor the response part (from std_srvs/Empty:):

---

Even though it does not contain any fields, this is a different service request type, and it is not used as the request type of the GetMap service.

when I replace the line my_call=GetMapRequest() to my_call=Empty(), I get an error.

Yes. This is expected, as they are not the same service request type.

And technically, GetMapRequest is the request type, while Empty is the name of the service (ie: includes both the request and the response).

So is empty data type not equal to the blank data type of the service request?

Exactly.

But do note: "blank data type of the [GetMap] service request" is not a type. That would be GetMapRequest.

This is the service definition of the service your are referring to (from nav_msgs/GetMap):

# Get the map as a nav_msgs/OccupancyGrid
---
nav_msgs/OccupancyGrid map

The part that gets transformed in the GetMapRequest type (the one you import from nav_msgs.srv) contains the fields in the upper part of the message definition (ie: above the ---).

The response would be the lower part (ie: below the ---).

The request part does indeed not contain any fields, just a single comment. So the request type is "empty", but only in the sense it does not contain any additional fields.

This is not the same as the std_srvs/Emptystd_msgs/Empty. This is an entirely different service message type. It is called Empty, as it does not have any fields in either the request nor the response part (from std_srvs/Emptystd_msgs/Empty):

---
 

Even though it does not contain any fields, this is a different service request message type, and it is not used as for the request type of the GetMap service.

when I replace the line my_call=GetMapRequest() to my_call=Empty(), I get an error.

Yes. This is expected, as they are not the same service types (GetMapRequest is the request type.

And technically, GetMapRequest is the request type, while Empty is the name of the service (ie: includes both the request and the response).type).

So is empty data type not equal to the blank data type of the service request?

Exactly.

But do note: "blank data type of the [GetMap] service request" is not a type. That would be GetMapRequest.