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

Need help with map_saver

asked 2015-11-28 12:36:03 -0500

jhajj96 gravatar image

updated 2015-11-28 13:46:19 -0500

Hey, I'm a beginner to ros so I apologize if this is a dumb question, but I have been wanting to use the map_server package to save an OccupancyGrid. I found a tutorial for using map_saver but it was related to gmapping, which I am not using. In order to test it out, I created the following node to just publish a simple 2x2 OccupancyGrid. However when I run "rosrun map_server map_saver", it will say it is waiting for a map even though my node is running. I was wondering what I'm doing wrong here. I am using Windows 10 and running ros on the Oracle Virtual Machine using Vagrant, and have roscore running.

#!/usr/bin/env python

import rospy import sys

from nav_msgs.msg import *

from std_msgs.msg import *

def mapMethod():

pub = rospy.Publisher('saved_maps', OccupancyGrid, queue_size=10)

rospy.init_node('saved_maps_node', anonymous=True)

rate = rospy.Rate(0.5) #delay time (times per second)

while not rospy.is_shutdown():
    test_map = OccupancyGrid() = X_VALUE = Y_VALUE = 0 = 0
    array = []
    for i in range(0, X_VALUE * Y_VALUE):
        array.append(1) = array



if __name__ == '__main__': try: mapMethod() except rospy.ROSInterruptException: pass

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-11-28 13:29:10 -0500

Check your topics - I think map_saver will be subscribing to the topic /map and waiting for a map to be published on that topic

edit flag offensive delete link more

Question Tools


Asked: 2015-11-28 12:36:03 -0500

Seen: 277 times

Last updated: Nov 28 '15