-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Milestone
Description
I can't watch watch the attributes global_frame, local_frame . It may be that we don't support this or want to support it (or that I am doing it wrong). Please confirm which :-)
This is not strictly necessary because you can watch location, but definitely a "nice to have"
Test code below:
import time
from dronekit import connect
from dronekit.lib import VehicleMode, LocationGlobal
from pymavlink import mavutil
import time
#Set up option parsing to get connection string
import argparse
parser = argparse.ArgumentParser(description='Print out vehicle state information. Connects to SITL on local PC by default.')
parser.add_argument('--connect', default='127.0.0.1:14550',
help="vehicle connection target. Default '127.0.0.1:14550'")
args = parser.parse_args()
# Connect to the Vehicle
print 'Connecting to vehicle on: %s' % args.connect
vehicle = connect(args.connect, wait_ready=True)
print "Got connected baby"
@vehicle.on_attribute('global_frame')
def listener(self, attr_name, value):
# `attr_name` is the observed attribute (used if callback is used for multiple attributes)
# `attr_name` - the observed attribute (used if callback is used for multiple attributes)
# `value` is the updated attribute value.
print " ATTR: %s changed to: %s" % (attr_name, value)
@vehicle.on_attribute('local_frame')
def listener(self, attr_name, value):
# `attr_name` is the observed attribute (used if callback is used for multiple attributes)
# `attr_name` - the observed attribute (used if callback is used for multiple attributes)
# `value` is the updated attribute value.
print " ATTR: %s changed to: %s" % (attr_name, value)
@vehicle.on_attribute('location')
def listener(self, attr_name, value):
# `attr_name` is the observed attribute (used if callback is used for multiple attributes)
# `attr_name` - the observed attribute (used if callback is used for multiple attributes)
# `value` is the updated attribute value.
print " ATTR: %s changed to: %s" % (attr_name, value)
print 'Sleeping for 10'
time.sleep(10)
#Close vehicle object before exiting script
print "Close vehicle object"
vehicle.close()
Metadata
Metadata
Assignees
Labels
No labels