I was going through exercise 2.7 solution when I had this doubt in my mind.
-
GetMap, when launched, prints -1 -1 -1 all over the terminal. Is that resolution or dimension ?
- Doesn’t GetMap print more than just resolution and dimension of the map ? If yes, the question asks only resolution and dimension.
Thank you
Hello @abdulbasitisdost,
Yes, that solution is not correct because it prints ALL the message. The right solution would be something like this:
#! /usr/bin/env python
import rospy
from nav_msgs.srv import GetMap, GetMapRequest
import sys
rospy.init_node('service_client') # Initialise a ROS node with the name service_client
rospy.wait_for_service('/static_map') # Wait for the service /static_map to be running
get_map_service = rospy.ServiceProxy('/static_map', GetMap) # Create the connection to the service
get_map = GetMapRequest() # Create an object of type GetMapRequest
result = get_map_service(get_map) # Call the service
print result.map.info.resolution # Print the result given by the service called
print result.map.info.width
print result.map.info.height
I will update this in the notebooks.
Best,
1 Like