Android-gyroscope Sensor

Source: Internet
Author: User

How can we convert the angular velocity information of X, Y, and Z axes obtained from the gyroscope into a full range of information such as Roll, Pitch, and Yaw?

A gyroscope is an internal gyroscope. Its axis is always parallel to the initial direction because of the gyro effect, so that the actual direction can be calculated by deviation from the initial direction. The gyroscope in the mobile phone is actually a very precise chip with an ultra-small gyroscope.

Gyroscope measurement is a reference standard for a gyroscope that rotates in the center vertical to the ground. The angle between the device and the gyro is obtained.

A gyroscope is designed to measure the rotating motion of a device. Better at the movements of devices. However, the location of the device cannot be determined.

The gyroscope detects the Rotation Angle of the device instantly and accurately. It can meet the needs of applications that require high resolution and rapid response, such as FPS game targeting. In addition, the gyroscope can be used with the accelerator to navigate without Satellites and Networks. This is a classic application of the gyroscope.

When processing linear motion and rotating motion at the same time, acceleration and gyroscope shall be combined for use. If you still want to keep the device from getting lost while moving, add a magnetic field.

Because mobile phones do not require high acceleration and accuracy, you can use a accelerometer to replace gyroscope. However, if you are playing games with relatively high precision, it is best to have a gyroscope.

Gyroscope can capture very small changes in motion tracks, so it can perform high-resolution and fast-response rotation detection. However, the current operation direction cannot be measured like msensor or orientation sensor.

In addition, after the gyroscope runs for a period of time, noise and offset will lead to data deviation, and other sensors must be used for correction.

The XYZ of the gyroscope represents the angular velocity of the device rotating around the three axes of XYZ: radians/second. The coordinate system used by XYZ is the same as that used by gsensor. The value of XYZ is positive when it is rotated in the clockwise direction. The following is the Demo code for developing with gyroscope:

[Java]
View plaincopy
  1. Private static final float NS2S = 1.0f/Optional bytes 0.0f;
  2. Private float timestamp;
  3. Public void onSensorChanged (SensorEvent event)
  4. {
  5. If (timestamp! = 0 ){
  6. Final float dT = (event. timestamp-timestamp) * NS2S;
  7. Angle [0] + = event. data [0] * dT;
  8. Angle [1] + = event. data [1] * dT;
  9. Angle [2] + = event. data [2] * dT;
  10. }
  11. Timestamp = event. timestamp;
  12. }

Android is GOOGLE's nexus s.
IPhone 4 and HTC have
Samsung Nexus S has Three-Axis Gyroscope
LG's 2X is also available

Gyroscope
The release of iPhone G4 is a major application-gyroscope. According to Steve Jobs, this device allows iPhone 4 to perceive the movement direction of the human body. Combined with gravity sensing and acceleration sensing devices, it can provide the iPhone 4 with an unprecedented perfect gaming experience!
The role of gyroscope is simply to track location changes, that is, the conjecture of the three-dimensional electronic compass. As long as you get the current location at a certain time point, and then as long as the gyroscope is always running, based on mathematical computation, you can know your action track. Therefore, the most common application of gyroscope is the navigator. When GPS does not have a signal, the gyroscope can still perform Precise navigation.

As far as I know, the three-dimensional Electronic Compass not only provides the compass function, but also supports measuring the inclination. Similar to the gyroscope, the angle of the slope can be calculated by standing on a slope; but the most important thing is that they can all be used when flying...

In short, the application of electronic compass and gyroscope is to improve the navigation accuracy, and the most important role is to increase the control mode for games and applications. Imagine that games will be very fun at that time, for games like CS, you can run the game on the left and right with your cell phone. You can run the game in your living room to the bedroom, and then find the enemy in the bathroom. You can also control the quasi-star with your cell phone, "Head shoot! ". Is it interesting? These two things are much more advanced than gravity sensing, and will also be the mainstream of Mobile Phone applications in the future. New control methods and more interesting applications will be born along with them.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.