陀螺仪相关

Android Sensor Framework允许开发者访问多种类型的传感器,包括硬件和软件传感器。陀螺仪等运动传感器测量三轴的加速度和旋转力。开发者可以确定设备上可用的传感器,了解传感器的能力,并注册监听器来获取传感器数据。传感器事件发生时,系统调用相应的回调方法,提供传感器的名称、时间戳、精度和原始数据。
摘要由CSDN通过智能技术生成

运动传感器Motion sensors

These sensors measure acceleration forces and rotational forces along three axes. This category includes accelerometers, gravity sensors, gyroscopes, and rotational vector sensors.

You can access sensors available on the device and acquire raw sensor data by using the Androidsensor framework. The sensor framework provides several classes and interfaces that help you perform a widevariety of sensor-related tasks. For example, you can use the sensor framework to do the following:
  • Determine which sensors are available on a device.
  • Determine an individual sensor's capabilities, such as its maximum range, manufacturer, power requirements, and resolution.
  • Acquire raw sensor data and define the minimum rate at which you acquire sensor data.
  • Register and unregister sensor event listeners that monitor sensor changes.

The Android sensor framework lets you access many types of sensors. Some of these sensors arehardware-based and some are software-based. Hardware-based sensors are physical components builtinto a handset or tablet device. They derive their data by directly measuring specific environmentalproperties, such as acceleration, geomagnetic field strength, or angular change. Software-basedsensors are not physical devices, although they mimic hardware-based sensors. Software-based sensorsderive their data from one or more of the hardware-based sensors and are sometimes called virtualsensors or synthetic sensors. The linear acceleration sensor and the gravity sensor are examples ofsoftware-based sensors. Table 1 summarizes the sensors that are supported by the Androidplatform.


Few Android-powered devices have every type of sensor. For example, most handset devices andtablets have an accelerometer and a magnetometer, but fewer devices havebarometers or thermometers. Also, a device can have more than one sensor of a given type. Forexample, a device can have two gravity sensors, each one having a different range.


TYPE_ACCELEROMETER Hardware Measures the acceleration force in m/s2 that is applied to a device onall three physical axes (x, y, and z), including the force of gravity. Motion detection (shake, tilt, etc.).

TYPE_GYROSCOPE Hardware Measures a device's rate of rotation in rad/s around each of the threephysical axes (x, y, and z). Rotation detection (spin, turn, etc.).

Sensor Framework

You can access these sensors and acquire raw sensor data by using the Android sensor framework.The sensor framework is part of the android.hardware package and includes the followingclasses and interfaces:

SensorManager
You can use this class to create an instance of the sensor service. This class providesvarious methods for accessing and listing sensors, registering and unregistering sensor eventlisteners, and acquiring orientation information. This class also provides several sensor constantsthat are used to report sensor accuracy, set data acquisition rates, and calibrate sensors.
Sensor
You can use this class to create an instance of a specific sensor. This class provides variousmethods that let you determine a sensor's capabilities.
SensorEv
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值