0

I am trying to calculate the total number of turns of a vehicle over time to be a feature in the prediction of accident likelihood. Unfortunately, I am having issues solving the problem of crossing the 360/0 axis that comes from the nature of the problem. My original thought was - the unit circle - and changed all my degree data to the sin of itself. This creates a new problem of not being able to tell the difference between a large turn from 0 to 180 degrees or vice versa, from 2 turns one 90 degrees from 0 or 180 and back to the original location.

To put a picture of what I am trying to create here. This is a plot of degrees over time of one of the experiments. This should have 9 turns. 8 which are early turns followed by immediate ones in the opposite direction and a 9th turn which crosses the 360 axis. I am trying to consider any turn of more than 60 degrees within a short period as a "turn". Please help!enter image description here

1

1 Answer 1

2

I think you are in the wrong Stack Exchange :)

But I don't think it's possible for anyone to answer without knowing the data source, e.g. is it a lateral inertial sensor that senses side-to-side forces, or is it taken from accelerometer data, etc.?

Personally, I'd go about this with a 2 x len(time_series) matrix with each column as a velocity timepoint (first row for latitudinal with positive being N and negative being S, and second row for longitudinal (+ E, - W)). You could also use polar coordinates for this, speed and azimuth. The other dimension (each column) would simply be time slices.

Then you can check if the azimuth changes by 60 deg in some time period and call it a turn.

Then to plot turns, you could use a stem plot to show turns of some degree (stem height) at each time point, always returning to 0 (the car going in a straight line). Of course, positive could be left turns and negative could be right turns (using right hand rule...). The heading of the car at any point in time would be the sum of all turns up to that point.

Anyway, I haven't done this type of engineering in a LONG time, and think you should ask in a mechanical engineering/python focused Stack Exchange area. But hope I could help or give you some ideas.

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