當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。