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

3.3k views Asked by At

I am using Accelerometer Sensor to collect a toy car's acceleration data to tell whether it bumps into something or collide with another toy car. My idea is checking whether there is a sharp change of its acceleration data (for simplicity, just considering its x and y axis acceleration data since it is a toy car running on a smooth ground). But when the car is started from stop, there is also a dramatic change with its acceleration data. So I need to distinguish them. Based on my instinct, bumping will cause a sharp changed acceleration in short time, while engine starting will cause a smooth changed acceleration data. I think this should be a quite common question. But I am a really new hand. So I'd like to know whether there is an algorithm or method to distinguish them. It would be great if there is an implementation in C. Thanks a lot.

[update the bumping situations]
Let me make my question more specific. My project involves several toy cars, they can bump into each other, or bump to other things(such as walls). What I need to do is to find out which two cars are collided into each other. My idea is to try to compare two cars' acceleration data to see if they are matched with the same pattern. I divided this project into several steps:
1. 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.
2. match two cars' bump features to see if they are bumped into each other. What kind of features can I use?

[update]

I found this url containing very useful information for peak finding.
http://terpconnect.umd.edu/~toh/spectrum/PeakFindingandMeasurement.htm

2

There are 2 answers

2
Clifford On BEST ANSWER

I will post an answer because there are at least some interesting elements to your question that are close to appropriate for StackOverflow.

  1. 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 generally involves a large negative acceleration of high magnitude. Normal starting is positive, while stopping is normally of low magnitude.

Moreover you could use the motor control in fusion with the accelerometer. If the acceleration matches what is being demanded from the motors, it is normal, while if the acceleration is uncorrelated with the motor demand, it is independent and caused by some external force.

Acceleration caused by uneven terrain (I am deliberately avoiding your terms "bumps" and "jolts" as they are confusing and imprecise) generally has a vertical component and is short-term such that in a windowed integrator integrates to zero (i.e. the terrain is "flat" on average). Such accelerations are damped by any suspension the vehicle may have, so handling this will necessarily be vehicle specific, but simply ignoring the vertical component may be all that is necessary.

  1. match two cars' bump features to see if they are bumped into each other. What kind of features can I use?

If the two vehicles share a common or synchronised time source, such as from GPS or a common remote controller, then both vehicles experiencing abnormal acceleration at precisely the same time is an indication that they collided with each other. Moreover a head-on collision of vehicles with the same mass will have broadly equal acceleration profiles. Oblique collisions are more complex (and more likely), they will involve a larger acceleration component perpendicular to the intended direction of travel (i.e. sideways). You might correlate sideways acceleration to steering demand in a similar manner to that for motor demand. If there is a sideways movement without steering demand, then it is by external force.

I think overall your question requires empirical data. You need to run experiments that produce the kind of situations you wish to distinguish, capture the data, plot it and observe the distinguishing characteristics each situation. The data should include all accelerometer axes, plus the motor demand. Then you can determine how they may be distinguished mathematically. You can then build prospective algorithms and pass your captured data through them to verify that they work before implementing them on the vehicles.

I believe that in any case the solution will involve elements of digital signal processing - it is unlikely to be a decision that can be made in discrete instantaneous inputs.

Since the nature any collision is largely non-deterministic and variable, it is probably simpler to model "normal" driving situations over a range of terrain, and then to simply detect anything outside the normal as a potential collision. So rather then try to characterise a collision, you characterise "normal" and detect "abnormal".

0
mfro On

This is more a physics question than one about coding. Nevertheless:

the maximum acceleration the toy car can reach from it's own power (speedup/slowdown/centripetal force) would be the maximum acceleration it's rubber tyres are able to transfer to the ground surface. This maximum acceleration is limited by the frictional coefficient between tyre and ground.

In theory (unless you have very soft tyres on ideal ground with a frictional coefficient > 1), this will be a maximum of 1g (probably less since your engine might not have enough power).

Considering that, the only thing you can tell from acceleration data is that once you measure anything above 1g, you must have hit something.

This doesn't necessarily mean everything below that value is "normal movement", since - especially if your car has a soft shell or you bump into something soft or if you have a tangential hit into an obstacle - acceleration resulting from this bump might be below 1g as well.

You might need to play with lower values according to your car's structure, power and terrain.

Depending on all this, you might as well recognize that acceleration data alone might not be enough to clearly identify what happened.