accelerometer

Gyroscope Issues with Device Orientation

浪尽此生 提交于 2019-12-20 09:44:44
问题 I'm getting pitch and roll data from my device's gyroscope using this tutorial: http://www.thousand-thoughts.com/2012/03/android-sensor-fusion-tutorial/ All the readings are extremely accurate (there's a filter applied to the code in the tutorial to eliminate gyro drift). Unfortunately, the code only works when my device is placed flat on a surface that is parallel to the ground. The most ideal position for my app to work would be with the top of the device pointing straight up (ie, the

Detect user activity (running, cycling, driving) using Android

試著忘記壹切 提交于 2019-12-20 09:20:50
问题 Using my Android device how can I detect if the user is walking, cycling or driving? I have checked the Google Fit app. It differentiates between running, cycling and driving. I am puzzled about what algorithms I should use to differentiate between these activities. I know I would have to use the accelerometer sensor. But still I can't differentiate these activities. 回答1: You can use the GooglePlayServices for this. It Provides special apis for ActivityRecognition, which returns the User

Accelerometer data: How to interpret?

牧云@^-^@ 提交于 2019-12-20 08:31:11
问题 I'm experimenting with a 3 accelerometer breakout board. The X and Y axis are very easy to control, but the Z axis is a bit of a mystery. I'm trying to find a way of interpreting the data in my code to increase output as the device is lifted up in the air, and reduce as it is lowered down. Is this possible? If so, how? Maybe if someone can point me towards a good reference source that would help. 回答1: Basic Understanding Of Accelerometers: (Only for some conceptual clarification)

Do I get more accurate or faster accelerometer readings with Core Motion?

安稳与你 提交于 2019-12-20 01:07:36
问题 I can use this method of the Core Motion framework: - (void)startAccelerometerUpdatesToQueue:(NSOperationQueue *)queue withHandler:(CMAccelerometerHandler)handler as an alternative to the - (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration UIAccelerationDelegate method of UIKit. There, I have to specify the frequency of updates. I want to get acceleration data as fast and accurate as possible. Is Core Motion my friend here? What's the frequency

Sensor reading in web worker

╄→гoц情女王★ 提交于 2019-12-19 10:17:30
问题 It seems that we can not get sensor data in the web workers. I wonder the reason behind it. The use case is that I am thinking about getting geolocation data in the worker thread and only send the processed version to the main thread. For GPS, this post says it is not supported in the worker thread (no reason is given). And I double checked it, navigator.geolocation is not supported in web workers. For accelerator and gyroscope, we have DeviceOrientationEvent and DeviceMotionEvent. But we

Android get normalized acceleration

爱⌒轻易说出口 提交于 2019-12-19 06:50:09
问题 I wish to get the acceleration vector of an Android phone. The problem is, the accelerometer coordinates are relative to the phone's rotation. What I want is the "absolute" acceleration, i.e., it should return the same values whichever way the phone is facing. (I want to detect if a user that is skiing is sliding down a slope without using GPS. I also need to be able to differentiate sliding and going up the chairlift.) I can probably get those values by combining the accelerometer with the

Bluetooth Chat between Android device and PC [closed]

自古美人都是妖i 提交于 2019-12-19 04:11:54
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . Is it possible to connect the Bluetooth Chat sample with a PC? How can I receive the information to the PC? I thought that I can use the Serial Port Profile (SPP) from the Android device and open a regular COM Terminal on the PC. Actually my application requires sending the

How can I unit test an Android Activity that acts on Accelerometer?

て烟熏妆下的殇ゞ 提交于 2019-12-18 16:56:53
问题 I am starting with an Activity based off of this ShakeActivity and I want to write some unit tests for it. I have written some small unit tests for Android activities before but I'm not sure where to start here. I want to feed the accelerometer some different values and test how the activity responds to it. For now I'm keeping it simple and just updating a private int counter variable and a TextView when a "shake" event happens. So my question largely boils down to this: How can I send fake

Tap pressure strength detection using CPBPressureTouchGestureRecognizer

╄→гoц情女王★ 提交于 2019-12-18 13:38:10
问题 it's working great with one UIButton: – (void) viewDidLoad { [super viewDidLoad]; CPBPressureTouchGestureRecognizer* recognizer = [[CPBPressureTouchGestureRecognizer alloc] initWithTarget:self action:@selector(A_button:)]; [A_button addGestureRecognizer: recognizer]; [recognizer release]; } - (void) A_button: (CPBPressureTouchGestureRecognizer*) recognizer { [pan_A setGain:recognizer.pressure]; [pan_A] play; } i tried to use more but only the second one is working: - (void) viewDidLoad {

Android bouncing ball

自古美人都是妖i 提交于 2019-12-18 13:36:52
问题 So i'm just trying to make a ball bounce around the screen which should slow down due to gravity and reflect (bounce) from the wall like a normal ball would. Can someone give some basics and VERY simple implementation of this? Other examples seem a bit "overdone" and seem to go beyond what I want to do. I've tried this: public void updateLogic() { if (x < -1) { xPos += (-x * gravity); } else if (x > 1) { xPos -= (x * gravity); } if (y > 1) { yPos += (y * gravity); } else if (y < -1) { yPos -=