Skip to content

Commit

Permalink
[tools] cleanup whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
flixr committed Jun 11, 2014
1 parent 4099445 commit 4b93158
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
14 changes: 7 additions & 7 deletions sw/tools/airframe_editor/airframe_editor.py
Expand Up @@ -44,7 +44,7 @@ def update_combo(self, combo, c_list):
def find_firmwares(self, widget):
list_of_firmwares = paparazzi.get_list_of_firmwares()
self.update_combo(self.firmwares_combo, list_of_firmwares)

def find_modules(self, widget):
list_of_modules = paparazzi.get_list_of_modules()
self.update_combo(self.modules_combo, list_of_modules)
Expand Down Expand Up @@ -117,7 +117,7 @@ def select(self, widget):
# Constructor Functions

def fill_tree_from_airframe(self):

# create a TreeStore with one string column to use as the model
self.treestore = gtk.TreeStore(str, object)

Expand All @@ -134,9 +134,9 @@ def fill_tree_from_airframe(self):
self.tvcolumn.pack_start(self.cell, True)
self.tvcolumn.add_attribute(self.cell, 'text', 0)
self.treeview.set_reorderable(True)

def fill_datagrid_from_section(self):

# create a TreeStore with one string column to use as the model
self.gridstore = gtk.ListStore(str, str, str, str, str)

Expand Down Expand Up @@ -233,7 +233,7 @@ def __init__(self):
self.btnExit.set_tooltip_text("Close application")

self.btnOpen = gtk.Button("Open")
self.btnOpen.connect("clicked", self.open)
self.btnOpen.connect("clicked", self.open)

self.btnRun = gtk.Button("Reorganize XML")
self.btnRun.connect("clicked", self.reorganize_xml)
Expand Down Expand Up @@ -271,7 +271,7 @@ def __init__(self):

self.boards_combo = gtk.combo_box_entry_new_text()
self.find_boards(self.boards_combo)


self.firmwarebar = gtk.HBox()
self.firmwarebar.pack_start(self.btnFirmwares)
Expand Down Expand Up @@ -327,7 +327,7 @@ def __init__(self):

self.load_airframe_xml()

##### Bottom
##### Bottom

self.searchbar = gtk.HBox()

Expand Down
2 changes: 1 addition & 1 deletion sw/tools/airframe_editor/paparazzi.py
Expand Up @@ -36,7 +36,7 @@ def get_list_of_files(directory, extension):

def get_list_of_modules():
return get_list_of_files( modules_dir, ".xml")

def get_list_of_firmwares():
return get_list_of_files( firmwares_dir, ".makefile")

Expand Down
34 changes: 17 additions & 17 deletions sw/tools/process_exif/process_exif.py
Expand Up @@ -32,10 +32,10 @@
def RadOfDeg( deg ):
return (deg / M_PI) * 180.

# converts UTM coords to lat/long. Equations from USGS Bulletin 1532
# East Longitudes are positive, West longitudes are negative.
# converts UTM coords to lat/long. Equations from USGS Bulletin 1532
# East Longitudes are positive, West longitudes are negative.
# North latitudes are positive, South latitudes are negative
# Lat and Long are in decimal degrees.
# Lat and Long are in decimal degrees.
# Written by Chuck Gantz- chuck.gantz@globalstar.com

# ( I had some code here to use GDAL and which looked much simpler, but couldn't get that to work )
Expand All @@ -46,33 +46,33 @@ def UTMtoLL( northing, easting, utm_zone ):
a = 6378137; # WGS-84
eccSquared = 0.00669438; # WGS-84
e1 = (1-math.sqrt(1-eccSquared))/(1+math.sqrt(1-eccSquared));

x = easting - 500000.0; # remove 500,000 meter offset for longitude
y = northing;

is_northern = northing < 0
if ( not is_northern ):
y -= 10000000.0 # remove 10,000,000 meter offset used for southern hemisphere

LongOrigin = (utm_zone - 1)*6 - 180 + 3; # +3 puts origin in middle of zone

eccPrimeSquared = (eccSquared)/(1-eccSquared);

M = y / k0;
mu = M/(a*(1-eccSquared/4-3*eccSquared*eccSquared/64-5*eccSquared*eccSquared*eccSquared/256));

phi1Rad = mu + (3*e1/2-27*e1*e1*e1/32)*math.sin(2*mu) + (21*e1*e1/16-55*e1*e1*e1*e1/32)*math.sin(4*mu) +(151*e1*e1*e1/96)*math.sin(6*mu);
phi1 = RadOfDeg(phi1Rad);

N1 = a/math.sqrt(1-eccSquared*math.sin(phi1Rad)*math.sin(phi1Rad));
T1 = math.tan(phi1Rad)*math.tan(phi1Rad);
C1 = eccPrimeSquared*math.cos(phi1Rad)*math.cos(phi1Rad);
R1 = a*(1-eccSquared)/math.pow(1-eccSquared*math.sin(phi1Rad)*math.sin(phi1Rad), 1.5);
D = x/(N1*k0);

Lat = phi1Rad - (N1*math.tan(phi1Rad)/R1)*(D*D/2-(5+3*T1+10*C1-4*C1*C1-9*eccPrimeSquared)*D*D*D*D/24+(61+90*T1+298*C1+45*T1*T1-252*eccPrimeSquared-3*C1*C1)*D*D*D*D*D*D/720);
Lat = RadOfDeg(Lat)

Long = (D-(1+2*T1+C1)*D*D*D/6+(5-2*C1+28*T1-3*C1*C1+8*eccPrimeSquared+24*T1*T1)*D*D*D*D*D/120)/math.cos(phi1Rad)
Long = LongOrigin + RadOfDeg(Long)

Expand Down Expand Up @@ -136,29 +136,29 @@ def UTMtoLL( northing, easting, utm_zone ):

# Check that there as many photos and pick the indicated one.
# (this assumes the photos were taken correctly without a hiccup)
# It would never be able to check this anyway, since the camera could stall or
# It would never be able to check this anyway, since the camera could stall or
# not interpret the pulse? Leading to an incorrect GPS coordinate.
if len( photos ) < photonr:
print "Photo data %d found, but ran out of photos in directory"%(photonr)
continue
continue

# I've seen log files with -1 as DC_SHOT number due to an int8 I think. This should be
# I've seen log files with -1 as DC_SHOT number due to an int8 I think. This should be
# fixed now, but just in case someone runs this on old data.
if (photonr < 0):
print "Negative photonr found."
continue

# Pick out photo, open it through exiv2,
# Pick out photo, open it through exiv2,
photoname = photos[ photonr - 1 ]
photo = GExiv2.Metadata( photoname )

photo.set_gps_info(lat, lon, alt)
photo.save_file()

print "Photo %s and photonr %d merged. Lat/Lon/Alt: %f, %f, %f"%(photoname, photonr, lat, lon, alt)

except ValueError as e:
print "Cannot read line: %s"%(line)
print "Cannot read line: %s"%(line)
print "Value error(%s)"%(e)
continue

Expand Down
6 changes: 3 additions & 3 deletions sw/tools/stm32loader/stm32loader.py
Expand Up @@ -257,7 +257,7 @@ def readMemory(self, addr, lng):
if usepbar:
widgets = ['Reading: ', Percentage(),', ', ETA(), ' ', Bar()]
pbar = ProgressBar(widgets=widgets,maxval=lng, term_width=79).start()

while lng > 256:
if usepbar:
pbar.update(pbar.maxval-lng)
Expand All @@ -279,7 +279,7 @@ def writeMemory(self, addr, data):
if usepbar:
widgets = ['Writing: ', Percentage(),' ', ETA(), ' ', Bar()]
pbar = ProgressBar(widgets=widgets, maxval=lng, term_width=79).start()

offs = 0
while lng > 256:
if usepbar:
Expand Down Expand Up @@ -324,7 +324,7 @@ def usage():


if __name__ == "__main__":

# Import Psyco if available
try:
import psyco
Expand Down

0 comments on commit 4b93158

Please sign in to comment.