How do you detect how parallel a car is in a parking spot?

As the title says, I am working on a project for which I have to determine how parallel a car is in a parking spot. Essentially, how many degrees off is it from the line? This would be a scenario that looks something like this: |500x153

Anyways, my thought process was this - Have two ultrasonic sensors, a known distance apart, aiming at the car. If the car was assumed to be a flat plane, a little bit of math would easily get you angle. Problem is that cars have curves...

Any ideas on how this could possible be done otherwise? You can assume that I can set up sensors wherever they are needed.

Thanks :)

A lot of variables. What are you measuring from ? No adjacent parked cars ? Do you have control of the lines ? Wet / dry operation ?

Dirt operation? Stones being thrown by other cars against the sensors? A kind of optical lines follower thing mounted inside the car is thinkable?

What are you measuring from ? No adjacent parked cars ? Do you have control of the lines ? Wet / dry operation ?

Measuring from the line (not sure what your asking, if you wouldn't mind clarifying) We can assume no adjacent cars for now Not sure what you mean for this question either. This would have to work in all weather conditions (rain, snow, sun, etc)

Dirt operation? Stones being thrown by other cars against the sensors?

Yes and yes

A kind of optical lines follower thing mounted inside the car is thinkable?

In this case, the device should be able to work with any stock vehicle

"Problem is that cars have curves."

So which part of the curve is important to you?

1) Lines are variable, (light on dark, reflective, raised (rumble type)). 2) So if another car is mis-parked at an angle across the lines - it won't be a problem? 3) If [u]you[/u] can (control) paint the lines, then you can choose their characteristics. 4) Wet surfaces are reflective. (both incident and oblique light sources)

In short, I'll take a guess at what you're trying to achieve - and it isn't easy or straightforward. You may be better off with sensors above the parking areas (over the spaces or gaps), and sensing presence/position with those.

So which part of the curve is important to you?

Good question. Imagine you were to open the CAD for the car - the datum plane that intersects the car right down the middle. I guess the plane that the car is (sorta) symmetric across.

1) Lines are variable, (light on dark, reflective, raised (rumble type)). 2) So if another car is mis-parked at an angle across the lines - it won't be a problem? 3) If you can (control) paint the lines, then you can choose their characteristics. 4) Wet surfaces are reflective. (both incident and oblique light sources)

Ah I see what your saying. Lets say I am able to set up the sensor ON the lines. This way, we can assume that I already know EXACTLY where the line is, no sensor required to determine that. We can also assume that no one will park ON the line, so the next car over should have no effect. Mounting sensors above the parking space would be challenging due to the scale this would have to be built at, but it is certainly not something I considered and is good food for thought! That being said, any alternatives you can think of? Just so that I have all my options before making a decision to this challenging problem!

This may make things clearer (or more confusing!). The dots represent potential places for sensors. Of course, there could be more or fewer, I would just prefer to either put them on the line or in front of the car, as illustrated.

With a sensor capable of detecting the tires you could get bearing and range info and massage that with some math to develop a profile for each tire and determine their positions relative to the sensor.

parking sensor.png

.02

parking sensor.png

Interesting. I think it would be a little bit difficult though. Take the back (closest to sensor) left tire for example - how would I ensure that the lower right corner of the tire would be detected and not the upper right? These would change the readings. Also, if the driver leaves the wheel turned, the front wheels would give meaningless readings.

I circled the bits I'm talking about in blue |500x351

Can you calibrate the orientation of the spots relative to magnetic north and use a magnetometer to estimate the car's angle relative to that?

For example, the MLX90393 (Sparkfun https://www.sparkfun.com/products/14571)

using a library like this:

https://github.com/tedyapo/arduino-MLX90393

Would take away the need to have other cars present or to have visual cues (e.g. lines).

This has to work with any car that happens to come by and uses the spot, right?

Sensors are not attached to the car itself, but somewhere outside of it, right?

Curves are not important, as long as you can assume the curves are identical on either side (and with pretty much all cars that have not been in an accident being symmetrical, that's a reasonable assumption). That means that for any line across the parking spot the distance between the line and the side of the car on either side should be equal if the car is parked in the middle. For any two such lines, the ratio between the two distances should be equal if the car is parked perfectly straight.

Easiest would be four distance sensors a bit above the ground placed right on the lines. It would of course require drivers that have the ability to park between the lines, and not run over your sensors.

electricviolin: how would I ensure that the lower right corner of the tire would be detected and not the upper right?

I dunno. Use a sensor with a narrow field set a known, fixed height above the ground? It's not a fully formed idea, just speculation on a possibility.

electricviolin: Also, if the driver leaves the wheel turned, the front wheels would give meaningless readings.

More speculation: With a good enough sensor and some algorithms you could develop the slope of the line represented by the tread. The opposite side tire should have a slope pretty close to that. If the slope is greater than X ignore those two readings and use the other end of the car.

electricviolin: I circled the bits I'm talking about in blue

The image didn't come through.

OK, thinking a little differently...
How about lasers reflected or bounced along these paths ?

parking.jpg
You could make this as clever or dumb as you like... a single beam with multiple reflector & sensors, or multiple beams etc.

parking.jpg

"Anyways, my thought process was this - Have two ultrasonic sensors, a known distance apart, aiming at the car. If the car was assumed to be a flat plane, a little bit of math would easily get you angle. Problem is that cars have curves..."

Well, if you assume that most cars are symmetrical on both sides, why not use four sensors, two on each side of the parking space, with one near the front and one near the rear of the parking space. With four distance data points from the sides of the car, you should be able to do some mathematical magic to determine the front/rear center line of the car and the angle difference between the center line of the parking space and the parked car.

Have the driver open his door and look at how his/her car is parked relative to the line? Always worked for me.

...R

I thought the goal of this forum was to use technology for technology’s sake... (not Japanese rice wine - sakė).

It’s all good fun, conceiving and imagining how to solve random problems... keeps us young !

Robin2: Have the driver open his door and look at how his/her car is parked relative to the line? Always worked for me.

...R

My first thought also...

Thing is, some things are just not meant to be automated and I can think of a few.

bluejets:
Thing is, some things are just not meant to be automated and I can think of a few.

To be honest I made my comment in Reply #15 because it strikes me this problem is enormously more complex than the OP is imagining.

The OP has not specifically said so but I suspect from his diagram that what really lies behind the question is the business of assisting the driver to park properly. It’s hard to imagine much practical value from knowing that the Ford is straight, the Volkswagen is 5° off and the Fiat is 3° off.

…R

"The OP has not specifically said so but..."

Its a docking station for alien space ships!