Commit f677ed2d authored by Nuno Mendes 's avatar Nuno Mendes

Added feature to save waypoints as yaml file

parent 99aa98a4
...@@ -590,6 +590,8 @@ class MapApp(Frame): ...@@ -590,6 +590,8 @@ class MapApp(Frame):
try: try:
if fn.endswith(".xml"): if fn.endswith(".xml"):
self.savem_xml(fn) self.savem_xml(fn)
elif fn.endswith(".yaml"):
self.savem_yaml(fn)
else: else:
self.savem_csv(fn) self.savem_csv(fn)
except IOError: except IOError:
...@@ -603,6 +605,13 @@ class MapApp(Frame): ...@@ -603,6 +605,13 @@ class MapApp(Frame):
fh.write( ' <id_%s theta="%s" x="%s" y="%s"/>\n'%(l,a,x,y) ) fh.write( ' <id_%s theta="%s" x="%s" y="%s"/>\n'%(l,a,x,y) )
fh.write('</stargazermap>\n') fh.write('</stargazermap>\n')
def savem_yaml(self, filename):
with open(filename, "w") as fh:
fh.write('navigation_goals:\n')
for (l, p) in self.mdb.items():
x, y, a = p[0], p[1], p[2]
fh.write('\t' + l + ': [' + str(x) + ',' + str(y) + ',' + str(a) + ']\n')
def savem_csv(self, filename): def savem_csv(self, filename):
with open(filename, "w") as fh: with open(filename, "w") as fh:
for (l,p) in self.mdb.items(): for (l,p) in self.mdb.items():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment