def main(): t = telemetry.get_telemetry_by_args(service_in_iter=False, iter_blocks=False) t.start_thread() magic_value = 1122 from dronin.uavo import UAVO_FirmwareIAPObj t.request_object(UAVO_FirmwareIAPObj) time.sleep(0.9) for i in range(3): print magic_value f = UAVO_FirmwareIAPObj._make_to_send(Command=magic_value, Description=(0, ) * 100, CPUSerial=(0, ) * 12, BoardRevision=0, BoardType=0, ArmReset=0, crc=0) magic_value += 1111 t.send_object(f) time.sleep(0.9)
def main(): t = telemetry.get_telemetry_by_args(service_in_iter=False, iter_blocks=False) t.start_thread() magic_value=1122 from dronin.uavo import UAVO_FirmwareIAPObj t.request_object(UAVO_FirmwareIAPObj) time.sleep(0.9) for i in range(3): print magic_value f=UAVO_FirmwareIAPObj._make_to_send(Command=magic_value, Description=(0,)*100, CPUSerial=(0,)*12, BoardRevision=0, BoardType=0, ArmReset=0, crc=0) magic_value += 1111 t.send_object(f) time.sleep(0.9)
def main(): uavo_list = telemetry.get_telemetry_by_args() # Start the log viwer app from PyQt4 import QtGui from logviewer.gui import Window app = QtGui.QApplication(sys.argv) main = Window() main.show() main.plot(uavo_list, uavo_list.uavo_defs) sys.exit(app.exec_())
def main(): import sys, os sys.path.insert(1, os.path.dirname(sys.path[0])) from dronin import telemetry uavo_list = telemetry.get_telemetry_by_args() from dronin.uavo import UAVO_Magnetometer, UAVO_Gyros print mag_calibration(uavo_list.as_numpy_array(UAVO_Magnetometer), uavo_list.as_numpy_array(UAVO_Gyros)) # Wait for user to close window. matplotlib.pyplot.show()
def main(): import sys, os sys.path.insert(1, os.path.dirname(sys.path[0])) from dronin import telemetry uavo_list = telemetry.get_telemetry_by_args() from dronin.uavo import UAVO_PositionActual, UAVO_NEDPosition, UAVO_PathDesired pa = uavo_list.as_numpy_array(UAVO_PositionActual) ned = uavo_list.as_numpy_array(UAVO_NEDPosition) pos_des = uavo_list.as_numpy_array(UAVO_PathDesired) out = "position_overlay.mp4" video_overlay(pa,ned,pos_des,out)
def main(): tStream = telemetry.get_telemetry_by_args(service_in_iter=False) tStream.start_thread() settings_objects = tStream.uavo_defs.get_settings_objects() pipeline = [] tStream.wait_connection() # try to retrieve every object 3 times # this is just intended for robustness; never seen this get an object # on anything other than the first try. for retry in range(3): for s in settings_objects: if tStream.last_values.get(s): continue tStream.request_object(s) pipeline.append(s) # Wait for outstanding requests to complete # Ideally this would continue on a nak for wait in range(20): # Wait minimum 10ms per object time.sleep(0.01) if len(pipeline) < 3: break for p in pipeline[:]: if tStream.last_values.get(p): pipeline.remove(p) else: # We hit the end of the above retry loop pipeline = [] missing = [] for s in settings_objects: val = tStream.last_values.get(s) if val is not None: print val else: missing.append(s._name) for s in missing: print "No instance of %s" % (s)
def main(): tStream = telemetry.get_telemetry_by_args(service_in_iter=False) tStream.start_thread() settings_objects = tStream.uavo_defs.get_settings_objects() # Need to actually control send rates and see when we're done. for s in settings_objects: tStream.request_object(s) time.sleep(0.15) time.sleep(2.5) for s in settings_objects: val = tStream.last_values.get(s) if val is not None: print val else: print "No instance of %s" % (s._name)
def main(): uavo_list = telemetry.get_telemetry_by_args() # retrieve the time from the first object.. also guarantees we can parse base_time = next(iter(uavo_list)).time # Build a new module that will make up the global namespace for the # interactive shell. This allows us to restrict what the ipython shell sees. import imp user_module = imp.new_module('dronin_env') user_module.__dict__.update({ 'operator': __import__('operator'), 'base_time': base_time, }) # Build the "user" (ie. local) namespace that the interactive shell # will see. These variables show up in the output of "%whos" in the shell. user_ns = { 'base_time': base_time, 'log_file': uavo_list.filename, 'githash': uavo_list.githash, 'uavo_defs': uavo_list.uavo_defs, 'uavo_list': uavo_list, } # Extend the shell environment to include all of the uavo.UAVO_* classes that were # auto-created when the uavo xml files were processed. uavo_classes = [(t[0], t[1]) for t in uavo.__dict__.iteritems() if 'UAVO_' in t[0]] user_module.__dict__.update(uavo_classes) # Instantiate an ipython shell to interact with the log data. import IPython from IPython.frontend.terminal.embed import InteractiveShellEmbed e = InteractiveShellEmbed(user_ns=user_ns, user_module=user_module) e.enable_pylab(import_all=True) e("Analyzing log file: %s" % uavo_list.filename)
def main(): uavo_list = telemetry.get_telemetry_by_args() # retrieve the time from the first object.. also guarantees we can parse base_time = next(iter(uavo_list)).time # Build a new module that will make up the global namespace for the # interactive shell. This allows us to restrict what the ipython shell sees. import imp user_module = imp.new_module('dronin_env') user_module.__dict__.update({ 'operator' : __import__('operator'), 'base_time' : base_time, }) # Build the "user" (ie. local) namespace that the interactive shell # will see. These variables show up in the output of "%whos" in the shell. user_ns = { 'base_time' : base_time, 'log_file' : uavo_list.filename, 'githash' : uavo_list.githash, 'uavo_defs' : uavo_list.uavo_defs, 'uavo_list' : uavo_list, } # Extend the shell environment to include all of the uavo.UAVO_* classes that were # auto-created when the uavo xml files were processed. uavo_classes = [(t[0], t[1]) for t in uavo.__dict__.iteritems() if 'UAVO_' in t[0]] user_module.__dict__.update(uavo_classes) # Instantiate an ipython shell to interact with the log data. import IPython from IPython.frontend.terminal.embed import InteractiveShellEmbed e = InteractiveShellEmbed(user_ns = user_ns, user_module = user_module) e.enable_pylab(import_all = True) e("Analyzing log file: %s" % uavo_list.filename)
#!/usr/bin/env python if __name__ == "__main__": from dronin import telemetry uavo_list = telemetry.get_telemetry_by_args() for o in uavo_list: print o
#!/usr/bin/python if __name__ == "__main__": from dronin import telemetry uavo_list = telemetry.get_telemetry_by_args() for o in uavo_list: print o