zoukankan      html  css  js  c++  java
  • 写python获取android设备的GPS及姿态信息

      在android上,我们可以使用QPython来编写、执行Python脚本。它对很多android

    系统函数进行了方便的封装,使用QPython编写功能简单的小程序异常方便。

      这个示例是我之前用来读取手机位置信息并作为进一步处理数据的基础脚本。

    # -*- coding: utf-8 -*-
    import androidhelper
    import time
    from math import radians
    droid = androidhelper.Android()
    droid.startSensingTimed(1, 250)
    droid.startLocating()
    while 1:
        gpsdata = droid.readLocation().result
        s6data = droid.sensorsReadOrientation().result
        if len(gpsdata)>0:
            print gpsdata['gps']['bearing'] #取得Gps导向(bearing)(角度)
        if len(s6data)>0:
            print s6data[0] #取得罗盘方位角(azimuth)(弧度)
        time.sleep(0.5)
    droid.stopLocating()
    droid.stopSensing()
  • 相关阅读:
    Excel教程(5)
    Excel教程(4)
    Excel教程(3)
    Excel教程(2)
    如何在Excel中少犯二(I)
    for zip
    temp
    study
    eclipse
    shell
  • 原文地址:https://www.cnblogs.com/instant7/p/4143975.html
Copyright © 2011-2022 走看看