create_markers.py
Go to the documentation of this file.
1 #!/usr/bin/python
2 
3 import os, sys
4 
5 """
6 Generate a PDF file containaing one or more fiducial marker for printing
7 """
8 
9 def checkCmd(cmd, package):
10  rc = os.system("which inkscape > /dev/null")
11  if rc != 0:
12  print """This utility requires %s. It can be installed by typing:
13  sudo apt install %s""" % (cmd, package)
14  sys.exit(1)
15 
16 if __name__ == "__main__":
17  checkCmd("inkscape", "inkscape")
18  checkCmd("pdfunite", "poppler-utils")
19  if len(sys.argv) != 4:
20  print "Usage: %s startId endId pdfFile" % sys.argv[0]
21  sys.exit(1)
22  outfile = sys.argv[3]
23  tags = range(int(sys.argv[1]), int(sys.argv[2])+1)
24  pdfs = map(lambda i: "tag%d.pdf" % i, tags)
25 
26  for i in tags:
27  print " Tag %d\r" % i,
28  sys.stdout.flush()
29  os.system("rosrun fiducial_lib Tags %d" % i)
30  os.system("inkscape --without-gui --export-pdf=tag%d.pdf tag%d.svg" % (i, i))
31  os.remove("tag%d.svg" % i)
32  print "Combining into %s" % outfile
33  os.system("pdfunite %s %s" % (" ".join(pdfs), outfile))
34  for f in pdfs:
35  os.remove(f)
def checkCmd(cmd, package)


fiducial_lib
Author(s): Wayne Gramlich
autogenerated on Thu Dec 28 2017 04:06:53