-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmap_saver
executable file
·34 lines (29 loc) · 942 Bytes
/
map_saver
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/python
import roslaunch
import rospy
import rospkg
import os
if (__name__ == "__main__"):
#config
#rosrun <package> <executable>
#node_name
package = 'map_server'
executable = 'map_saver'
node_name = 'map_saver_node'
#Ask for map name
map_name = raw_input("\nPlease enter new map name: ")
#GetPath
package_path = rospkg.RosPack().get_path('mcr_default_env_config')
#create directory
os.mkdir(package_path + "/" + map_name)
#Complete path ...
#Saving map information as map.png and map.yaml
destination_path = package_path + "/" + map_name
print "saving new map in " + destination_path
#Setup Node
node = roslaunch.core.Node(package=package, node_type=executable, name=node_name, args=" -f " + destination_path + "/map")
launch = roslaunch.scriptapi.ROSLaunch()
#Start Node
launch.start()
#process = launch.launch(node)
rospy.sleep(3)