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


Python SenseHat.get_gyroscope方法代码示例

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


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

示例1: Start

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import get_gyroscope [as 别名]
def Start():
    sense=SenseHat()
    rospy.init_node('sense_hat', anonymous=True)
    #TODO
    #temp_pub = rospy.Publisher("/sensehat/temperature", Temperature, queue_size= 10)
    #humidity_pub = rospy.Publisher("/sensehat/humidity", RelativeHumidity, queue_size= 10)
    pose_pub = rospy.Publisher("/sensehat/pose", Imu, queue_size= 10)
    compass_pub = rospy.Publisher("/sensehat/compass", MagneticField, queue_size=10)
    r = rospy.Rate(10) # 10hz
    while not rospy.is_shutdown():
        gyro = Imu()
        gyro.angular_velocity.x = sense.get_gyroscope()['pitch']
        gyro.angular_velocity.y = sense.get_gyroscope()['roll']
        gyro.angular_velocity.z = sense.get_gyroscope()['yaw']
        gyro.orientation.x = sense.get_orientation_degrees()['pitch']
        gyro.orientation.y = sense.get_orientation_degrees()['roll']
        gyro.orientation.z = sense.get_orientation_degrees()['yaw']
        gyro.linear_acceleration.x = sense.get_accelerometer_raw()['x']
        gyro.linear_acceleration.y = sense.get_accelerometer_raw()['y']
        gyro.linear_acceleration.z = sense.get_accelerometer_raw()['z']
        #rospy.loginfo("Sending IMU data:%s", gyro)
        r.sleep()
开发者ID:keshavchintamani,项目名称:triniBot,代码行数:24,代码来源:sensehat_publisher.py

示例2: SenseHat

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import get_gyroscope [as 别名]
import time
import datetime
from sense_hat import SenseHat

sense = SenseHat()

red = (255, 0, 0)
blue = (0, 0, 255)

while True:
    temp = sense.get_temperature()
    humidity = sense.get_humidity()
    pressure = sense.get_pressure()
    gyro = sense.get_gyroscope()
    rawMag = sense.get_compass_raw()
    timestamp = time.ctime()
    accel_only = sense.get_accelerometer()
    north = sense.get_compass()

    print("____________________________________________________________________")
    print("Temperature: %s C" % temp)
    print("Humidity: %s %%rH" % humidity)

    print("Pressure: %s Millibars" % pressure)
    print("North: %s" % north)
    print("Magnetometer x: {x}, y: {y}, z: {z}".format(**rawMag))
    print("Gyro: p: {pitch}, r: {roll}, y: {yaw}".format(**gyro))
    print("Accel: p: {pitch}, r: {roll}, y: {yaw}".format(**accel_only))

    log_record = "%s : temp=%s humidity=%s pressure=%s gyro=%s accel=%s mag=%s" % (
        timestamp,
开发者ID:jkunzelman,项目名称:ceilingcat,代码行数:33,代码来源:watches.py

示例3: HatBar

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import get_gyroscope [as 别名]
    membar.min = 0.0
    membar.max = 100.0

    yawbar = HatBar(2, sense, [64, 64, 64])
    rollbar = HatBar(3, sense, [64, 64, 64])
    pitchbar = HatBar(4, sense, [64, 64, 64])

    tempbar = HatBar(5, sense, [128, 128, 0])
    humbar = HatBar(6, sense, [64, 0, 64])
    prbar = HatBar(7, sense, [0, 128, 128])

    while(True):
        cpubar.draw(getCPU())
        membar.draw(getRAM())

        orientation = sense.get_gyroscope()

        yawbar.draw(orientation['yaw'])
        rollbar.draw(orientation['roll'])
        pitchbar.draw(orientation['pitch'])

        tempbar.draw(sense.get_temperature())
        humbar.draw(sense.get_pressure())
        prbar.draw(sense.get_humidity())

        print(cpubar.curr, membar.curr, tempbar.curr, humbar.curr, prbar.curr, sep="|")

        # Print the actual values to stdout
        # print(cpubar.curr, membar.curr, sep="|")

        # Wait
开发者ID:placidblob,项目名称:hatbar,代码行数:33,代码来源:testbar.py

示例4: SenseHat

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import get_gyroscope [as 别名]
from sense_hat import SenseHat

sense = SenseHat()
gyro_only = sense.get_gyroscope()
while(True):
	print("p: {pitch}, r: {roll}, y: {yaw}".format(**gyro_only))

# alternatives
#print(sense.gyro)
#print(sense.gyroscope)
开发者ID:alexaverill,项目名称:SenseHat,代码行数:12,代码来源:gyro.py


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