本文整理匯總了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
示例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, ())
示例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
示例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)