Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions dronekit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@
import collections
from pymavlink.dialects.v10 import ardupilotmega


try:
basestring # Python 2
except NameError: # Python 3
basestring = (str, bytes)

class APIException(Exception):
"""
Base class for DroneKit related exceptions.
Expand Down Expand Up @@ -87,7 +91,8 @@ def __init__(self, pitch, yaw, roll):
self.roll = roll

def __str__(self):
return "Attitude:pitch=%s,yaw=%s,roll=%s" % (self.pitch, self.yaw, self.roll)
fmt = '{}:pitch={pitch},yaw={yaw},roll={roll}'
return fmt.format(self.__class__.__name__, **vars(self))


class LocationGlobal(object):
Expand Down Expand Up @@ -2822,7 +2827,7 @@ def connect(ip,

@vehicle.on_message('STATUSTEXT')
def listener(self, name, m):
status_printer(re.sub(r'(^|\n)', '>>> ', m.text.rstrip()))
status_printer(re.sub(r'(^|\n)', '>>> ', m.text.decode('utf-8').rstrip()))

if _initialize:
vehicle.initialize(rate=rate, heartbeat_timeout=heartbeat_timeout)
Expand Down