mirror of https://github.com/ArduPilot/ardupilot
Tools: sim_vehicle.py strips comments in locations.txt
This commit is contained in:
parent
c0303ffe8a
commit
cd67c4c75c
|
@ -1,3 +1,4 @@
|
||||||
|
#NAME=latitude,longitude,absolute-altitude,heading
|
||||||
OSRF0=37.4003371,-122.0800351,0,353
|
OSRF0=37.4003371,-122.0800351,0,353
|
||||||
OSRF0_PILOTSBOX=37.4003371,-122.0800351,2,270
|
OSRF0_PILOTSBOX=37.4003371,-122.0800351,2,270
|
||||||
CMAC=-35.363261,149.165230,584,353
|
CMAC=-35.363261,149.165230,584,353
|
||||||
|
|
|
@ -13,6 +13,7 @@ import getpass
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
import re
|
||||||
import signal
|
import signal
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
@ -488,8 +489,12 @@ def do_build(vehicledir, opts, frame_options):
|
||||||
def find_location_by_name(autotest, locname):
|
def find_location_by_name(autotest, locname):
|
||||||
"""Search locations.txt for locname, return GPS coords"""
|
"""Search locations.txt for locname, return GPS coords"""
|
||||||
locations_filepath = os.path.join(autotest, "locations.txt")
|
locations_filepath = os.path.join(autotest, "locations.txt")
|
||||||
|
comment_regex = re.compile("\s*#.*")
|
||||||
for line in open(locations_filepath, 'r'):
|
for line in open(locations_filepath, 'r'):
|
||||||
line = line.rstrip("\n")
|
line = line.rstrip("\n")
|
||||||
|
line = re.sub(comment_regex, "", line)
|
||||||
|
if len(line) == 0:
|
||||||
|
continue
|
||||||
(name, loc) = line.split("=")
|
(name, loc) = line.split("=")
|
||||||
if name == locname:
|
if name == locname:
|
||||||
return loc
|
return loc
|
||||||
|
|
Loading…
Reference in New Issue