-2
\$\begingroup\$

I am not an electrical engineer but I don't really know where to ask this question so here it is. I have some x,y,z gyroscope data from a car and I want to calculate the steering wheel angle at a point in time. Is that possible and how can I do it?

EDIT

Data comes from a smart phone mounted inside the car.

The thing is that I don't really need to be precise. I just need some way of calculating the steering wheel angle (or the torque if the former is not an option). I want to then use this data for training and evaluating an algorithm, so it doesn;t matter if the steering wheel angles really match the real world that good, at the end of the day I only care about my algorithm being able to predict values close to those used for its training.

\$\endgroup\$
  • \$\begingroup\$ Where is the gyroscope placed? On the steering wheel? On a wheel? On the body of the car? \$\endgroup\$ – Harry Svensson Oct 26 '18 at 9:12
  • \$\begingroup\$ @HarrySvensson Data comes from a smart phone mounted inside the car. \$\endgroup\$ – Sreten Jocić Oct 26 '18 at 9:17
  • \$\begingroup\$ A single snapshot of "These are my co-ordinates, what is my angle?" is possible for the overall car direction, but angle of direction for the car I don't is directly linked to steering wheel angle because cars travel in arcs, not straight lines. I may be wrong though. \$\endgroup\$ – Doodle Oct 26 '18 at 9:32
  • \$\begingroup\$ Depends on the car. For modern cars the steering angle changes with speed \$\endgroup\$ – Alexander von Wernherr Oct 26 '18 at 9:59
  • 3
    \$\begingroup\$ I'm voting to close this question as off-topic because it is not in any way at all about electrical engineering but rather about physics and algorithms. The only parts of the problem that would be appropriate here have already been implemented by the phone maker. \$\endgroup\$ – Chris Stratton Oct 26 '18 at 11:29
2
\$\begingroup\$

Sure, turning a car's steering wheel will enter the vehicle into a circular turn. More steering input creates a tighter turning circle. You can calculate the angle the wheels should be following to trace the diameter of that circle.

But wait. Nothing is ever that simple.

Ackermann steering geometry!

https://en.wikipedia.org/wiki/Ackermann_steering_geometry

Turns out, each wheel wants to follow a slightly different turning circle and so the car's steering rack angles them differently to allow this.

enter image description here

This angle is also affected by suspension geometry, such as caster, camber and toe (in or out).

You can measure all of this and calibrate, but this all assumes that the tyre never loses grip - when sharp turns at speeds above only 20-30mph will cause understeer in most cars.

It would be easier to fit a sensor to the steering rack to measure this.

\$\endgroup\$
  • \$\begingroup\$ What if the sensor is mounted inside the car (at presumably the best spot - data is considered the best public dataset for this kind of thing)? Is there some kind of equation that I can use? \$\endgroup\$ – Sreten Jocić Oct 26 '18 at 9:26
  • \$\begingroup\$ What kind of data do you have? With a 3axis sensor you would have to crudely approximate the turning angle of the vehicle and then calculate the turning circle diameter. \$\endgroup\$ – MIL-SPEC Oct 26 '18 at 9:33
  • \$\begingroup\$ I have just x,y,z values for different points in time. The thing is that I don't really need to be precise. I just need some way of calculating the steering wheel angle (or the torque if the former is not an option). I want to then use this data for training and evaluating an algorithm, so it doesn;t matter if the steering wheel angles really match the real world that good, at the end of the day I only care about my algorithm being able to predict values close to those used for its training. \$\endgroup\$ – Sreten Jocić Oct 26 '18 at 9:44
  • \$\begingroup\$ The Z axis is useless. The X and Y axis measurements would need to be analysed to work out the gradient of any turns. You can use the gradient data from multiple measurements to calculate an angular velocity. Use the angular velocity to calculate the turning circles loci, and use that to work out the path of the wheels. y=mx+c is your friend here, but as I said, its a crude approximation. \$\endgroup\$ – MIL-SPEC Oct 26 '18 at 9:49
1
\$\begingroup\$

As explained in other answers you could work out the likely steering wheel angle provided

  1. The car is in motion.
  2. The car is not drifting.

enter image description here

Figure 1. Vehicle orientation does not always correspond to steering angle. Source: Forza Motor Sport

The steering wheel angle data may already be available via the steering angle sensor on the CAN bus. If this is the case the phone may be able to access the data using a Bluetooth CAN adaptor.

\$\endgroup\$
  • \$\begingroup\$ Deja vu, I've just been in this place before. \$\endgroup\$ – Harry Svensson Oct 27 '18 at 21:05
0
\$\begingroup\$

There is an equation, but you need to know the wheelbase, the tire slip angles, the vehicle speed, and how much the steering geometry, by design, differs from Ackerman (described in another answer). This gives you front wheel position. To get steering wheel position you need to know the steering wheel sensitivity, and it is different for every car. The errors may seem small but they add up.

Why not mount the smart phone on the steering wheel and measure the angle directly?

\$\endgroup\$
  • 1
    \$\begingroup\$ "Why not mount the smart phone on the steering wheel and measure the angle directly?", but OP said that "Data comes from a smart phone mounted inside the car", is it obvious that it is on the steering wheel? \$\endgroup\$ – Harry Svensson Oct 26 '18 at 10:32
0
\$\begingroup\$

You might be able to roughly infer the steering wheel angle using a mobile phone inside the car, but the gyroscope values won't be enough.

The gyroscope tells you the rate of rotation of the phone. Imagine sitting in a stationary car. Now turn the steering wheel. What is the rate of rotation of the phone? Zero.

To work out the steering wheel angle, you also need to know how fast the car is traveling. The steering wheel angle will be proportional to the rate of rotation divided by the car's speed.

But how do you know the speed. One way might be to use the phone's accelerometer to work out the speed, but you'll find that over time it accumulates so much error, that it has really no idea how fast you're traveling.

The most reliable way to determine the car's speed is to ask the GPS receiver, which can calculate speed. It can also calculate the heading, and from the rate of change of heading and the speed, you can determine the rough wheel angle.

For the best accuracy, you must use the GPS, the gyroscope, the accelerometer and the compass in the phone. These readings, fed into a Kalman filter will give you the best estimate of the wheel angle.

\$\endgroup\$
0
\$\begingroup\$

You can strap your phone onto the steering wheel and measure the angle from vertical.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.