当前位置: 首页>>代码示例>>Python>>正文


Python AstroPi.get_orientation方法代码示例

本文整理汇总了Python中astro_pi.AstroPi.get_orientation方法的典型用法代码示例。如果您正苦于以下问题:Python AstroPi.get_orientation方法的具体用法?Python AstroPi.get_orientation怎么用?Python AstroPi.get_orientation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在astro_pi.AstroPi的用法示例。


在下文中一共展示了AstroPi.get_orientation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _get_orientation_threaded

# 需要导入模块: from astro_pi import AstroPi [as 别名]
# 或者: from astro_pi.AstroPi import get_orientation [as 别名]
 def _get_orientation_threaded(self):
     """
     Internal. called in a thread to continuously read the astro pi data
     """
     self.stopped = False
     self.running = True
     while not self.stopped:
         self._orientation = AstroPi.get_orientation(self)
         sleep(self.sample_rate)
     self.running = False
开发者ID:idreamsi,项目名称:SpaceCRAFT,代码行数:12,代码来源:astropithreaded.py

示例2: __init__

# 需要导入模块: from astro_pi import AstroPi [as 别名]
# 或者: from astro_pi.AstroPi import get_orientation [as 别名]
    def __init__(
        self, fb_device="/dev/fb1", imu_settings_file="RTIMULib", text_assets="astro_pi_text", sample_rate=0.01
    ):

        self.sample_rate = sample_rate

        AstroPi.__init__(self, fb_device, imu_settings_file, text_assets)

        self._orientation = AstroPi.get_orientation(self)

        # start the orientation thread
        thread.start_new_thread(self._get_orientation_threaded, ())
开发者ID:idreamsi,项目名称:SpaceCRAFT,代码行数:14,代码来源:astropithreaded.py

示例3: print

# 需要导入模块: from astro_pi import AstroPi [as 别名]
# 或者: from astro_pi.AstroPi import get_orientation [as 别名]
        self.ap.clear()
        self.mcastropi.clear()


# run
if __name__ == "__main__":

    print("SpaceCRAFT - Minecraft Interactive Astro Pi")

    # create connection to minecraft
    mc = Minecraft.create()

    # create the astro pi object
    ap = AstroPi()
    # read data from the astro pi to initialise it
    ap.get_orientation()
    ap.get_humidity()
    ap.get_pressure()

    # find the players position and create the astro pi 10 blocks above them
    pos = mc.player.getTilePos()
    pos.y += 10
    mcap = MCInteractiveAstroPi(mc, ap, pos)

    try:
        print("CTRL C to quit")
        while True:
            # each time a block is hit pass it to the interactive astro pi
            for blockHit in mc.events.pollBlockHits():
                mcap.interact(blockHit.pos)
            # keep reading the astro pi orientation data otherwise it goes out of sync
开发者ID:idreamsi,项目名称:SpaceCRAFT,代码行数:33,代码来源:mcinteractiveastropi.py

示例4: AstroPi

# 需要导入模块: from astro_pi import AstroPi [as 别名]
# 或者: from astro_pi.AstroPi import get_orientation [as 别名]
from astro_pi import AstroPi
ap = AstroPi()
import time

while True:
    pitch,roll,yaw = ap.get_orientation().values()
    print("pitch=%s,roll=%s.yaw=%s" % (pitch,yaw,roll))
    time.sleep(0.5)
开发者ID:LornaLynch,项目名称:getting-started-with-astro-pi,代码行数:10,代码来源:orientation.py


注:本文中的astro_pi.AstroPi.get_orientation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。