English 中文(简体)
Anders TYPE_LINEAR_ACCELERATION 感官——它所显示的是什么?
原标题:Android TYPE_LINEAR_ACCELERATION sensor - what does it show?

I am developing application for car acceleration tracking. I used standard accelerometer, calibrating it in specific position beforehand.

然后,假设电话的取向没有变化,我将摄像仪数据贴上一定时间,并计算出移动参数,其中之一就是测试结束时的车速。

It works rather well, on a straight, horizontal road: error of a few percent.

但是,我发现,在APIC级10中,有虚拟传感器称为TYPE_LINEAR_ACCELERATION,而且,根据我的理解,它必须做我需要做的事情:过滤重力、方向变化——因此我可以使用,并完全地加速移动装置。

BUT在实际生活中。

我提出了简单的申请,这没有什么检验:

//public class Accelerometer implements SensorEventListener { ...
public void onSensorChanged(SensorEvent se) 
{
    if(!active)
        return;

    lastX = se.values[SensorManager.DATA_X];
    lastY = se.values[SensorManager.DATA_Y];
    lastZ = se.values[SensorManager.DATA_Z];
    long now = System.currentTimeMillis();
    interval = now - lastEvetn;
    lastEvetn = now;
    out.write(Float.toString(lastX) + ";" + 
                    Float.toString(lastY) + ";" + 
                    Float.toString(lastZ) + ";" + 
                    Long.toString(interval) + "
");
}

我的听众有以下参数:

  mSensorManager.registerListener(linAcc,
                mSensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION),
                SensorManager.SENSOR_DELAY_GAME);

它使用科索沃语,但当我分析数据倾销时,计算速度如<代码>V = V0 + AT时,首先,在<代码>V0 = 0上,在此之前的间隔速度:A = 加速度(SQRT(x*x+y*y+z*z)(t = 间隔时间),我最终获得非常低的速度――比实际速度低三倍。

Changing Sensor type to TYPE_ACCELEROMETER, calibrating and using same formula to calculate speed - I get good results, much closer to reality.

So, the question is:

Sensor.TYPE_LINEAR_ACCELERATION really show?

如果我错了,或与<代码”有过错。 传感器.TYPE_LINEAR_ACCELERATION 执行?

我使用三星Nexus S电话。

问题回答

!

我正在研拟一些与你的申请相似之处。 三、与贫困作斗争 我很高兴。

1) TYPE_LINEAR_ACCELERATION, TYPE_GRAVITY, ecc are implemented only for Android 2.3 (and up) So i have Android 2.2 and i can t test them.

2) TYPE_LINEAR_ACCELERATION isn t so accurate as it would be, because there are some simple problem when substract the gravity. In fact is a "sensor fusion" that uses accelerometer and orientation to know where is directed the gravity and then subs. it.

这里,我找到了一个非常有用的答案来解释:

https://groups.google.com/forum/#!topic/android-developers/GOm9yhTFZaM

TYPE_ACCELEROMETER uses the accelerometer and only the accelerometer. It returns raw accelerometer events, with minimal or no processing at all.

TYPE_GYROSCOPE (if present) uses the gyroscope and only the gyroscope. Like above, it returns raw events (angular speed un rad/s) with no processing at all (no offset / scale compensation).

TYPE_ORIENTATION is deprecated. It returns the orientation as yaw/ pitch/roll in degres. It s not very well defined and can only be relied upon when the device has no "roll". This sensor uses a combination of the accelerometer and the magnetometer. Marginally better results can be obtained using SensorManager s helpers. This sensor is heavily "processed".

TYPE_LINEAR_ACCELERATION, TYPE_GRAVITY, TYPE_ROTATION_VECTOR are "fused" sensors which return respectively the linear acceleration, gravity and rotation vector (a quaternion). It is not defined how these are implemented. On some devices they are implemented in h/w, on some devices they use the accelerometer + the magnetometer, on some other devices they use the gyro.

On Nexus S and Xoom, the gyroscope is currently NOT used. They behave as if there was no gyro available, like on Nexus One or Droid. We are planing to improve this situation in a future release.

Currently, the only way to take advantage of the gyro is to use TYPE_GYROSCOPE and integrate the output by hand.

我希望这一帮助,

Mathias

不管怎么说,在网上的不同地方,由于字面上准确,对电话传感器及其潜力没有最好的字眼。

使用卡曼过滤器可以达到一些更精确的度,但我不知道如何......。

贫穷——贫穷 斜线显示传感器的“批量”数据,它显示由光频过滤器处理的数据,因此,像重力或任何其他缓慢变化的加速速度不能通过过滤器。

你的汽车几乎总是加速,无法通过过滤器。 如果你改变速度非常快的急速,那么就要把冰速计重新 the到当时时代的四角。 这表明结果非常正确,否则总会降低实际加速值。

采用传统方法,然后人工删除G(9.81)。 实际上,当实际加速度为0时,你必须测量G yourself,然后将BTYPE_ACCELEROMETER值作为G。 我的情况是9.6。

* E/CN.6/2009/1。 快速变化的加速速度比起后不到1倍,如把 box子或剑斗.推向你们。

我的回答很晚。 I bumped into this thread whilepping for some info on TYPE_ LINEAR_ACCELERATION。

a = rt2+ay^2+az^2, 然后再=u+at。 只有在情况完全相同的情况下才能做到这一点。 任何偏离都会使错误增加。 加速和速度是病媒的数量,应当予以处理。 你们应当做vx=ux+axt, vy=uy+ayt 和vz=uz+t, 然后 v= sqrt(vx^2+vy^2+vz^2)。

TYPE_LINEAR_ACCELERATION是一种三维媒介,显示每个装置轴心的加速度,但不包括重力。 * E/CN.6/2009/1。 = TYPE_GRAVITY + TYPE_LINEAR_ACCELERATION

如@thxmxx所说,在装置协调框架内提供了<代码>TYPE_LINEAR_ACCELERATION病媒。 因此,为了估算惯性(世界)协调框架的速度,你需要在整合之前按估计的装置方向轮换。

然而,即使你这样做,估计速度不可能长期准确。 假设你的加速估算在装置X-轴心中持续减少0.1米/秒。 这大约是第1/100号,即重度的加速度,与加速度相比,它是一个很小的错误。 然后,在坐十秒后,您的速率估计在X-轴心中为1米/秒。

Even small errors add up to form big ones. If you further integrate your velocity estimate to form a position estimate, errors will compound even faster.

为了获得可靠的速度估计,你需要:

  • A sensor that measures speed, like a pitot/static system on an aircraft or a wheel odometer on a car.
  • A sensor that measures position, like GPS, LIDAR, or vision-based SLAM, and a sensor fusion algorithm that uses the sequence of position estimates over time to correct drift in the velocity estimate.
  • An extremely accurate IMU like the type used in missiles.

第二种方案对电话应用最为有用。

你应当把你从VitPE_LINEAR_ACCELER那里获得的绝对病媒倍增。 缩略语 职权范围。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...