init_map.py
Go to the documentation of this file.
1 #!/usr/bin/python
2 
3 """
4 Initialize a map for use by fiducial_slam by adding one ceiling fiducial at the orgin,
5 rotates so that will be in the co-ordiante system of the floor.
6 """
7 
8 import sys, os
9 
10 if __name__ == "__main__":
11  argc = len(sys.argv)
12  if argc < 2 or argc > 3:
13  print "Usage: %s fiducial_id [map_file]" % sys.argv[0]
14  sys.exit(1)
15 
16  fid = int(sys.argv[1])
17  if argc == 3:
18  map_file = sys.argv[2]
19  else:
20  map_file = os.environ['HOME'] + "/.ros/slam/map.txt"
21 
22  dir=os.path.dirname(map_file)
23  if dir and not os.path.exists(dir):
24  os.makedirs(dir)
25  if os.path.exists(map_file):
26  print "File %s already exists, remove or rename it first" % map_file
27  sys.exit(1)
28 
29  file = open(map_file, "w")
30  file.write("%d 0.0 0.0 0.0 180.0 0 180.0 0 1\n" % fid)
31  file.close()
32  print "Map file %s created with fiducial %d" % (map_file, fid)


fiducial_slam
Author(s): Jim Vaughan
autogenerated on Tue Jun 1 2021 03:03:29