本文整理汇总了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)