Menu
  • HOME
  • TAGS

Android accelerometer sampling rate/delay stabilization

android,accelerometer,sampling

If you want to match the hardware-provided time (event.timestamp) and the System time you can do this by adjusting the times. Usually the times are not the same, but they just differ by a constant amount of milliseconds. I suggest you to print out both times and compare them. You...

Stop SKAction at collision with PhysicsBody

ios,objective-c,sprite-kit,accelerometer,physics

I assume that you have your collision bit masks properly set up to handle collisions. You should confirm this with a test to double check. I believe your issue is with the speed of your object. If the object is moving too fast, and I do not see any velocity...

Why does this angle calculation return only values of 0 or -1?

arduino,accelerometer,angle

Besides the minor problems, like use of uninitialized variable here int y2 = y1 * y2;, You are using int variables for obviously floating point calculations of the angle, which should be a fractional number in radians (which is hinted by the calculation attempt used). You need to work with...

Find the sign of the angles from an accelerometer

c#,math,vector,accelerometer,angle

I think you are confused about what you are actually calculating here. Make sure you are aware that you are simply calculating the angle by using the definition of cosinus: cos(accelAngleN*2*Math.Pi/360) = accelForceN/directionalVector (the multiplication with 2Pi/360 merely transforms an angle into Radian). Now consider that the angular sum in...

Why am I not getting updates to the X/Y/Z values from my GY-521?

arduino,accelerometer,gyroscope,rfduino,gy-521

I switched over to an Arduino Uno R3 and the code and GY-521 seem to be working fine. I think it is some incompatibility with the RFduino at this point. I do not have time to figure it out as I have a deadline for this project and I will...

Reducing Noise in iPad Accelerometer

python,ios,swift,accelerometer,noise

I've used some simple easing that smoothes out any spikes in the values. It'll add a bit of latency, but you can determine the balance of latency vs. smoothness to suit your application by adjusting the easing property. import UIKit import CoreMotion class MyViewController: UIViewController { var displayLink: CADisplayLink? let...

How is it possible that Google Fit app measures number of steps all the time without draining battery?

android,gps,accelerometer,android-sensors,google-fit

Thanks for asking this question! Battery is one of our top most concerns and we work hard to optimize Google Fit's battery usage and provide a magical experience. Google Fit uses a mix of sensors(Accelerometer, Step counter, Significant Motion counter), Machine Learning and heuristics to get the data right. Our...

Restricting movement of box2d body along an axis in andEngine

box2d,andengine,accelerometer,game-physics

I solved the problem by changing the type of box2d body from dynamic to kinematic, read about body types from here, and found that in my case kinematic body was better as a dynamic body it was getting affected by all the forces in physical world. ballBody = PhysicsFactory.createCircleBody(this.mPhysicsWorld, ball,...

Simulate the Accelerometer on desktop (Javascript)

javascript,accelerometer,simulate

You need hardware or emulation for the values to be present. Google Chrome's dev tools has accelerometer emulation. https://developer.chrome.com/devtools/docs/device-mode#device-sensors...

Keep an iOS application running in background forever

ios,accelerometer,background-process

Apple is very clear on this: Implementing Long-Running Background Tasks For tasks that require more execution time to implement, you must request specific permissions to run them in the background without their being suspended. In iOS, only specific app types are allowed to run in the background: Apps that play...

Alert Dialog shows multiple times On device shake Android

android,accelerometer,android-alertdialog

That's natural to be shown multiple times, to control it use a boolean and set it to false for initialize and when the dialog is shown set it to true and when it is dismissed set it to false again. As for controlling every time you want to show the...

Kalman filter - quaternions - angle sensor

c,matlab,vector,accelerometer,quaternions

You can apply a Kalman filter to accelerometer data, it's a powerful technique though and there are lots of ways to do it wrong. If your goal is to learn about the filter then go for it - the discussion here might be helpful. If you just want to smooth...

accelerometer data, Z-axis gives wrong data?

android,data,accelerometer

On Android, the accelerometer results from onSensorChanged are in units of m/sec^2, where the gravitational constant G is commonly known to be 9.81 m/sec^2. Note that this is different from iOS, where the accelerometer API returns data in units of G. So to convert your data to units of G,...

Arduino Accelerometer: detect braking/ deceleration on a bike

arduino,accelerometer,gyroscope

You're going to have to give up on using the acceleration in a particular direction, but you can use the norm of the acceleration measurement and infer the deceleration in the forward direction by assuming that it is roughly perpendicular to the acceleration downwards. As for mounting on the rider,...

how to use accelerometer sensor to detect and match two toy cars' collision

embedded,accelerometer

I will post an answer because there are at least some interesting elements to your question that are close to appropriate for StackOverflow. detect bumps, so I need to distinguish the car bumping into something from being started or some other situations, such as jolts on the road. A collision...

Integrating Android Accelerometer to Find Velocity and Position

java,android,accelerometer

SensorEvent has a timestamp field, which is the time in nanoseconds. Use this instead of System.currentTimeMillis(). Here's an example from the documentation: private static final float NS2S = 1.0f / 1000000000.0f; private float timestamp; public void onSensorChanged(SensorEvent event) { // This timestep's delta rotation to be multiplied by the current...

ML enough features?

machine-learning,accelerometer

Most probably your classifier overfits, when you training it only on 1 person it not generalizes well, it may simply "memorize" dataset with labels instead of capturing general rules of distribution:how each feature correlated with other/how they affect result/etc. Maybe you need more data, or more features. It's not...

Detect vibration with Android accelerometer

android,accelerometer,sensor,detect,vibration

Real answer- you're going to need to study DSP to get good results. This is a non-trivial problem. Quick overview- when a vibration occurs, you're going to see a sinusoidal attenuating wave pattern (the attenuating signal after the main vibration is called "ringing" and is a bad thing for us-...

do ALL android smartphones have accelerometer axis pointing in the same directions?

android,accelerometer,axis,android-orientation

Well I wanted to post an image, but it seems i don't have the reputation to do it You are welcome to post the image elsewhere on the Internet and link to it from your question, until you have enough reputation to be able to post the images more...

Formatting plotline for large dataset

r,layout,accelerometer

Make up data: d <- data.frame(millis=1:1e6,y=rnorm(1e6)) d$c <- rep(1:1e5,length.out=nrow(d)) This is easy to write but takes a long time to render. library(ggplot2) ggplot(d,aes(x=millis,y=y))+facet_grid(c~.)+geom_line() Or (also slow) library(lattice) xyplot(y~millis|c,data=d,layout=c(10,1)) (To be honest I gave up waiting for either of the above to finish.) Fastest in base graphics: par(mfrow=c(10,1),mar=c(0,4,0,1),las=1) for (i in...

Android Accelerometer acting different on different device

android,accelerometer

I have faced same problem , you need to get device default orientaion before setting the gravity of that object. public int getDeviceDefaultOrientation() { WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE); Configuration config = getResources().getConfiguration(); int rotation = windowManager.getDefaultDisplay().getRotation(); if ( ((rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) && config.orientation == Configuration.ORIENTATION_LANDSCAPE)...

Accelerometer data: How to interpret? Sparkfun ADXL335 with Arduino

arduino,accelerometer

I wrote a blog post about this device on an Arduino that should answer your questions. http://chrisheydrick.com/2015/02/05/adxl335-accelerometer-on-an-arduino/ In short, the values you're seeing depend on the power delivered to the ADXl335. The sensitivity (mV/g) is stated to be ratiometric in the data sheet, and the example given is that when...

My Android App is working very slowly

android,graph,real-time,accelerometer

ok, so you are doing a lot of updates on the graph in: public void onSensorChanged(SensorEvent event) { that is a lot of code, to run in a very short amount of time, my best guess is that the phone is simply not fast enough to do all of those...

How can I use the Accelerometer for detecting jump in LibGDX?

android,libgdx,accelerometer

Here are some of the methods: // Check accelerometer availability on device boolean available = Gdx.input.isPeripheralAvailable(Peripheral.Accelerometer); // Get current orientation // Orientation.Landscape or Orientation.Portrait Orientation nativeOrientation = Gdx.input.getNativeOrientation(); // Reading values float accelX = Gdx.input.getAccelerometerX(); float accelY = Gdx.input.getAccelerometerY(); float accelZ = Gdx.input.getAccelerometerZ(); You will have to write your own...

Get rotation and display in degrees

android,rotation,accelerometer,gyroscope,motion-detection

There are a few examples and tutorials on the web, but be careful. Sensor.TYPE_ORIENTATION became deprecated. You need to calculate rotations by listening to these two sensors Sensor.TYPE_ACCELEROMETER and Sensor.TYPE_MAGNETIC_FIELD. The tricky part after registering to receive notifications from these sensors, is to figure out how to handle the data...

How to make azimuth and degree less shaky in Android

android,accelerometer,azimuth

Solution is to apply (LPF) Low Pass Filter. It's smooth and working perfectly now. I found the solution here: Low Pass Filter

Windows phone 8.1 stop accelerometer

windows-phone-8.1,accelerometer

The class you are working with is Windows.Devices.Sensors.Accelerometer, this does not contain a Stop, you are probably looking at the Microsoft.Devices.Sensors.Accelerometer documentation (which does include a Stop method) Instead of Stop just unregister from the Event if(txtX.Text==" .24"){ accelerometer.ReadingChanged -= YourUpdateFunction; MainPage.Score++; this.frame.Navigate(typeof(Final_Score)); } BTW, it is usually a good...

How do you save data that is being produced in a handler?

ios,swift,accelerometer,core-motion

The main thing to be wary of is that these events can come in more quickly than the main thread can process them. As the documentation says: Because the processed events might arrive at a high rate, using the main operation queue is not recommended. Hence, you should your own...

JSON Arduino to Processing?

json,serial-port,arduino,processing,accelerometer

I would recommend transmitting this as binary data which you can unpack on the processing side. It should solve your json problem and will be much more efficient. Something like this should work for you... Arduino code byte Rx_Data[4]; Tx_Data[0] = accelX >> 8 & 0xff; Tx_Data[1] = accelX& 0xff;...

Modify the MPU3050 driver in linux kernel (Android) to use MPU6050

android,kernel,driver,accelerometer

Yes, you can. Consult the data sheets for the difference between the capabilities and registers of each device, but I believe you will find that the mpu-6050 is a superset of the mpu-3050 so extending a driver for one to accommodate the other should be a simple case of programming-by-example....

Rotation on Y axis in degree or radians in iOS

ios,rotation,accelerometer,gyroscope,core-motion

I found the rotation of the device using Compass, created locationManager /** * Location manager class instance */ @property (strong, nonatomic) CLLocationManager *locationManager; Then initializing it - (void) initLocationManager { self.locationManager = [[CLLocationManager alloc] init]; self.locationManager.desiredAccuracy = kCLLocationAccuracyBest; self.locationManager.headingFilter = 0.1; self.locationManager.delegate = self; [self.locationManager startUpdatingHeading]; } And implementing the...

Rotate object in Unity 3D

unity3d,3d,rotation,accelerometer

You can use transform.rotation like this: transform.rotation = new Quaternion(rotx, roty, rotz, rotw); OR You can use transform.Rotate like this: transform.Rotate(rotx, roty, rotz); Documentation for Quaternion Documentation for transform.rotation Example for Rotating screen with accelerometer input: float accelx, accely, accelz = 0; void Update () { accelx = Input.acceleration.x; accely...

Accelerometer's equations

android,accelerometer

The simple (i.e. not rigorous and will have real physicists turning in their graves) is that the usual convention is that if the Z acceleration is negative the device is accelerating downwards i.e. in this case towards the centre of the earth. Since it is staying still in a gravitational...

Intentservice doesn't call runnable

android,accelerometer,runnable,intentservice

I have to use intentservice You have to not use IntentService for this use case. it doesn't call runnable, no log is shown and accelerometer receiver is not unregistered Once onHandleIntent() returns, the IntentService shuts down and goes away. Therefore, you cannot register listeners, fork threads, use poorly-implemented timing...

How to detect X motion using Accelerometer

android,accelerometer

I think you are mistaken, the accelerometer does not work this way, like a position tracker. Check The motion docs on d.android.com to see what I mean. From the docs: Accelerometers use the standard sensor coordinate system. In practice, this means that the following conditions apply when a device is...

What is the sampling frequency of the accelerometers embedded in Android smartphone?

android,accelerometer,frequency,smartphone,sampling

A small googling found Cochibos work on the subject. It takes the data gathered with the Accelerometer Frequency app and reports it to the web page. Looking for were the actual sample rate is defined it seems to be intrinsically connected with the device driver. I.e. the device driver sets...

Accuracy problems using accelerometer android

android,accelerometer

You can check the event timestamp to determine if it's an already measured value, but I would suggest that you implement a kind of smoothing for example a rolling average over the last 3-5 values. That makes your values a lot smoother and better to handle. Here is an example...

Swift Accelerometer keeps crashing with ScrollView

ios,swift,ipad,accelerometer

That's a lot of code. I don't see anything in the line that sets your content offset based on targetX. A couple of possibilities are baseScrollView is getting deallocated and is a zombie (unlikely since it looks like you have it defined as a regular (strong) instance variable.) You're calling...

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

android,accelerometer,android-sensors,gyroscope

You can use the GooglePlayServices for this. It Provides special apis for ActivityRecognition, which returns the User activity with confidence level for each. https://developer.android.com/reference/com/google/android/gms/location/ActivityRecognitionClient.html http://developer.android.com/training/location/activity-recognition.html...

How to handle live data of Accelerometer in android?

android,android-asynctask,accelerometer,android-sensors

One of the solution to address this problem is keeping a threshold for the change in the sensor values. If the change in deltaX, deltaY, deltaZ are greater then you can start the AsyncTask else dont. Since u are not keeping any threshold values the number of threads u create...

Obtain g-force from accelerometer readings

ios,objective-c,accelerometer

It is pretty easy. You'll want to setup a UILabel in Interface Builder and you'll see a property something like this: @property (strong, nonatomic) IBOutlet UILabel *myLabel; Right after your NSLog statement you'll want to insert this code: self.myLabel.text = [NSString stringWithFormat:@"x=%f, y=%f, z=%f", accelerometerData.acceleration.x,accelerometerData.acceleration.y,accelerometerData.acceleration.z]; Of course you may want...

JavaScript addEventListener delay

javascript,accelerometer,addeventlistener

It's called "function debouncing". Basically, you execute your stuff only once in a certain amount of time. A simple implementation would be: var lastExecution; addEventListener("deviceorientation", function (event) { var now = Date.now(); if (now - lastExecution < 17) return; // ~60Hz lastExecution = now; ... }, false); (Yes, lastExecution is...

Android: How to draw objects onto the screen based on GPS and Gyroscope

android,gps,accelerometer,augmented-reality

If you want to understand the general problem, think of it as two steps: combine all those sensor values to tell you where the camera is (GPS), where it is looking (orientation derived from accelerometers and compass: Android should already have something to combine these into one 3D orientation value),...

How do i calculate the orientation/direction and the velocity of a Sun Spot?

java,embedded,accelerometer,physics

Like @John Story stated the best way to handle this is by making an average. Sun spots accelarometers are very unstable and aren't suited for precise velocity prevision. Anyway this is the best code i could make double v=0; double anterior=0; while (true) { double time=System.currentTimeMillis()+200; double currentTime=System.currentTimeMillis(); double offset=0;...

Acelerometer: shake the phone detector

android,accelerometer

You're checking if (mAccel > 12) inside your onCreate(). Move the check to onSensorChanged().

Get an accelerometer's device id(or monitor an accelerometer in the backbround) on WinRT

c#,windows-8,windows-runtime,accelerometer,background-process

Based on msdn, DeviceUseTrigger background task can access the sensors API only from within a Windows Runtime phone app, other winrt devices aren't supported Sensors support in Windows Phone Store apps When running on a phone, a DeviceUseTrigger background task can access the sensors API only from within a Windows...

Followed tutorial on creating a shake listener, having trouble using it

java,android,accelerometer

You don't call Listeners. They call you. Move: while (true) { if (shake) textView.setText(test[RandomNumber]); // this line } to: @Override public void onShake(int count) { /* * HERE */ handleShakeEvent(count); } Should achieve what you're aiming for....

Calibrating an accelerometer

accelerometer

@Nadosh: Yes, data acceleration is 3 bytes. x,y,z in order did you mean line this

Android detect phone lifting action

android,accelerometer

Solved the issue. All I wanted to do was to check for the "Y" value stated in the question and check if the value was greater than 1.0. Note that, if the phone is kept in vertical position the Y is always around 9.8 but in such cases you can...

Decreasing accelerometer's sensitivity

ios,swift,sprite-kit,accelerometer,core-motion

Try: let multiplier = 200.0 let x = data.acceleration.x if x > 0.2 { square.physicsBody!.velocity = CGVector(dx: x * multiplier, dy: -200) } else if x < 0.2 { square.physicsBody!.velocity = CGVector(dx: x * multiplier, dy: -200) } The above will vary the speed of the node depending on how...

Accelerometr stops after a while

c#,windows-runtime,windows-phone-8.1,accelerometer,win-universal-app

As I've tested there are couple of things you need to change: you don't consult your report interval with the minimum value (probably). On my phone (Lumia 820) it's 10 miliseconds - and as I think it's really low (2 ms - huh - it's not a phone it's nice...

Reading Accelerometer data in Android

android,accelerometer

Dear god do NOT use sleep to delay accelerometer readings. That won't actually delay readings, it will just make you react to them slower- the system will still be making readings at the same rate and in fact queue them up. If you want less frequent readings, specify so when...

how sensiya SDK distinct motion sitting and driving?

accelerometer

For full disclosure, I am working at Sensiya. Many algorithms that recognize device's user activity rely mainly on the accelerometer sensor data analytics, as you mentioned, but if you want to fine tune and expand the type of activities you want to track I suggest using other device's sensors like...

class or interface expected

java,android-studio,accelerometer

You accidentally closed your class too soon, with an extra "}": public class MainActivity extends ActionBarActivity implements SensorEventListener { private float mLastX, mLastY, mLastZ; ... mSensorManager = (SensorManager) getSystemService(Context.SEARCH_SERVICE); mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL); } } // Delete this line! ...