Skip to content

Commit

Permalink
added explicit pyhton2 binding where ambiguous
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkscheper committed Dec 18, 2018
1 parent d875cc7 commit 9a22990
Show file tree
Hide file tree
Showing 71 changed files with 135 additions and 93 deletions.
2 changes: 1 addition & 1 deletion find_confs.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

from __future__ import print_function

Expand Down
2 changes: 1 addition & 1 deletion paparazzi_pkgman.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
#
# Copyright (C) 2012-2014 The Paparazzi Team
#
Expand Down
2 changes: 1 addition & 1 deletion start.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

from __future__ import print_function

Expand Down
2 changes: 2 additions & 0 deletions sw/airborne/modules/loggers/logger_uart_parse.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python2

import struct

with open('uart_log.bin', 'rb') as data:
Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/test/ahrs/compare_ahrs.py
@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python2

# Copyright (C) 2011 Antoine Drouin
#
Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/test/math/compare_utm_enu.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

from __future__ import division, print_function, absolute_import
import sys
Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/test/stabilization/compare_ref_quat.py
@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python2

from __future__ import division, print_function, absolute_import

Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/joystick/gb2ivy.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

from __future__ import print_function

Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/atc/atc.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
#
# Copyright (C) 2016 TUDelft
#
Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/cx10ds/cx10ds_ivy.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
#
# MIT License
#
Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/dashboard/radiowatch.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

import wx
import radiowatchframe
Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/distance_counter/dist.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
#
# Copyright (C) 2016 TUDelft
#
Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/energy_mon/battery_model.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
#
# Copyright (C) 2018 TUDelft
#
Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/energy_mon/energy_mon.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
#
# Copyright (C) 2018 TUDelft
#
Expand Down
8 changes: 5 additions & 3 deletions sw/ground_segment/python/fc_rotor/fc_rotor.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
#
# Copyright (C) 2017 Hector Garcia de Marina <hgdemarina@gmail.com>
# Gautier Hattenberger <gautier.hattenberger@enac.fr>
Expand Down Expand Up @@ -29,6 +29,8 @@
import json
from time import sleep
from os import path, getenv
from __future__ import print_function

PPRZ_HOME = getenv("PAPARAZZI_HOME", path.normpath(path.join(path.dirname(path.abspath(__file__)), '../../../../')))
sys.path.append(PPRZ_HOME + "/var/lib/python/")
from pprzlink.ivy import IvyMessagesInterface
Expand Down Expand Up @@ -183,7 +185,7 @@ def formation(self):
print("The state msg of rotorcraft ", rc.id, " stopped")
sys.stdout.flush()
ready = False
if rc.initialized and 'geo_fence' in self.config.keys():
if rc.initialized and 'geo_fence' in list(self.config.keys()):
geo_fence = self.config['geo_fence']
if not self.ignore_geo_fence:
if (rc.X[0] < geo_fence['x_min'] or rc.X[0] > geo_fence['x_max']
Expand Down Expand Up @@ -251,7 +253,7 @@ def formation(self):
#print "Positions: " + str(X).replace('[','').replace(']','')
#print "Velocities: " + str(V).replace('[','').replace(']','')
#print "Acceleration command: " + str(U).replace('[','').replace(']','')
print "Error distances: " + str(E).replace('[','').replace(']','')
print("Error distances: " + str(E).replace('[','').replace(']',''))
sys.stdout.flush()

i = 0
Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/guided_mode_example.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

from __future__ import print_function

Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/ivytoredis/ivy_to_redis.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

from __future__ import print_function

Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/joystick/arduino_dangerboard.py
@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python2

import time
import serial # sudo apt-get install python-serial
Expand Down
5 changes: 3 additions & 2 deletions sw/ground_segment/python/joystick/ivydanger.py
@@ -1,5 +1,6 @@
#! /usr/bin/env python
#! /usr/bin/env python2

from __future__ import print_function
from arduino_dangerboard import arduino_dangerboard
from ivy.std_api import *
import logging
Expand Down Expand Up @@ -63,7 +64,7 @@ def Usage(scmd):
\t-s S1:S2:S3 | --sliders=S1:S2:S3 where S1, S2, S3 are the names of the slider settings to send
\t-p PORT | --port=PORT where PORT is the name of the serial port for the slider box
'''
print fmt % lpathitem[-1]
print(fmt % lpathitem[-1])

def GetOptions():
# Map dangerboard sliders to these settings from aircraft settings
Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/messages_app/messagesapp.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

import wx
import messagesframe
Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/move_waypoint_example.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

from __future__ import print_function

Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/opensky-network/opensky.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
#
# Copyright (C) 2018 Gautier Hattenberger <gautier.hattenberger@enac.fr>
#
Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/payload_forward/payload.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
#
# Copyright (C) 2016 TUDelft
#
Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/real_time_plot/messagepicker.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

from __future__ import absolute_import, print_function

Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/real_time_plot/realtimeplotapp.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

import wx
import getopt
Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/redundant_link/link_combiner.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

# This file is part of paparazzi.

Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/settings_app/settingsapp.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
#Boa:App:BoaApp

import wx
Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/svinfo/svinfo.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
#
# Copyright (C) 2016 TUDelft
#
Expand Down
9 changes: 5 additions & 4 deletions sw/ground_segment/python/udp_link/datalink_to_w5100.py
@@ -1,5 +1,6 @@
#!/usr/bin/python
#!/usr/bin/python2

from __future__ import print_function
import os
import sys
import socket
Expand Down Expand Up @@ -33,11 +34,11 @@
format = 'B' * (len(data))
strdata = struct.unpack( format, data )

print len( strdata ), ":", strdata
print(len( strdata ), ":", strdata)

# send the command
destsock.sendto( data, (options.dest_addr, options.dest_port) )

except socket.error, e:
print 'Exception', e
except socket.error as e:
print('Exception', e)

@@ -1,11 +1,13 @@
#!/usr/bin/python
#!/usr/bin/python2

import os
import socket
import struct
import sys
from optparse import OptionParser

from __future__ import print_function

sys.path.append(os.getenv("PAPARAZZI_HOME") + "/sw/lib/python")

parser = OptionParser()
Expand Down Expand Up @@ -39,6 +41,6 @@
# send the command
destsock.sendto( data, (options.dest_addr, options.dest_port) )

except socket.error, e:
print 'Exception', e
except socket.error as e:
print('Exception', e)

2 changes: 1 addition & 1 deletion sw/ground_segment/python/udp_link/udp_link.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

import os
import sys
Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/python/wind/wind.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
#
# Copyright (C) 2018 TUDelft
#
Expand Down
4 changes: 2 additions & 2 deletions sw/ground_segment/tmtc/pprzlink_proxy.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
#
# Copyright (C) 2017 Gautier Hattenberger <gautier.hattenberger@enac.fr>
#
Expand Down Expand Up @@ -201,7 +201,7 @@ def __call__ (self, parser, namespace, values, option_string = None):
try:
proxy = Proxy(gcs_conf, acs, args.verbose)
proxy.run()
except ValueError, e:
except ValueError as e:
print(e)


2 changes: 1 addition & 1 deletion sw/lib/python/paparazzi.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

from __future__ import print_function

Expand Down
2 changes: 1 addition & 1 deletion sw/lib/python/paparazzi_health.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

from __future__ import print_function

Expand Down
2 changes: 1 addition & 1 deletion sw/lib/python/settings_tool.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

from __future__ import absolute_import, print_function

Expand Down
2 changes: 1 addition & 1 deletion sw/lib/python/settings_xml_parse.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

from __future__ import absolute_import, print_function

Expand Down
6 changes: 4 additions & 2 deletions sw/logalizer/sdlogger_get_setting_id.py
@@ -1,4 +1,6 @@
#!/usr/bin/env python
#!/usr/bin/env python2

from __future__ import print_function
import sys
from os import path, getenv

Expand All @@ -12,4 +14,4 @@
ac_id = int(sys.argv[1])
command_name = sys.argv[2]
settings = PaparazziACSettings(ac_id)
print settings.name_lookup[command_name].index
print(settings.name_lookup[command_name].index)
2 changes: 1 addition & 1 deletion sw/misc/attitude_reference/att_ref_gui.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
#
# Copyright (C) 2014 Antoine Drouin
#
Expand Down
13 changes: 7 additions & 6 deletions sw/misc/attitude_reference/pat/utils.py
Expand Up @@ -20,6 +20,7 @@
"""
Utility functions
"""
from __future__ import print_function
import math
import numpy as np
import numpy.linalg as linalg
Expand Down Expand Up @@ -216,7 +217,7 @@ def num_jacobian(X, U, P, dyn):
dx = dX[i, :]
delta_f = dyn(X + dx / 2, 0, U, P) - dyn(X - dx / 2, 0, U, P)
delta_f = delta_f / dx[i]
# print delta_f
# print(delta_f)
A[:, i] = delta_f

epsilonU = (0.1 * np.ones(i_size)).tolist()
Expand All @@ -243,17 +244,17 @@ def saturate(V, Sats):

def print_lti_dynamics(A, B, txt=None, print_original_form=False, print_modal_form=False):
if txt:
print txt
print(txt)
if print_original_form:
print "A\n", A
print "B\n", B
print("A\n", A)
print("B\n", B)
w, M = np.linalg.eig(A)
print "modes \n", w
print("modes \n", w)
if print_modal_form:
# print "eigen vectors\n", M
# invM = np.linalg.inv(M)
# print "invM\n", invM
# Amod = np.dot(np.dot(invM, A), M)
# print "Amod\n", Amod
for i in range(len(w)):
print w[i], "->", M[:, i]
print(w[i], "->", M[:, i])
2 changes: 1 addition & 1 deletion sw/misc/attitude_reference/test_att_ref.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Antoine Drouin
Expand Down
2 changes: 2 additions & 0 deletions sw/simulator/mesonh/mesonh.py
@@ -1,3 +1,5 @@
#!/usr/bin/env python2

from __future__ import absolute_import, print_function, division
from mesonh_atmosphere import MesoNHAtmosphere
import os
Expand Down
2 changes: 1 addition & 1 deletion sw/tools/airframe_editor/airframe_editor.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

from __future__ import print_function

Expand Down
2 changes: 1 addition & 1 deletion sw/tools/airframe_editor/xml_airframe.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

from __future__ import print_function

Expand Down
2 changes: 1 addition & 1 deletion sw/tools/attitude_viz.py
@@ -1,4 +1,4 @@
#! /usr/bin/python
#! /usr/bin/python2

# Tool for visualizing quaternion as rotated cube

Expand Down
2 changes: 1 addition & 1 deletion sw/tools/calibration/calib_mag_live.py
@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python2

from __future__ import print_function, division

Expand Down

0 comments on commit 9a22990

Please sign in to comment.