Calculation of Angular Position from Angular Velocity

In summary, Nasu suggests that you can calculate the angular position of the wheel by accumulating the angular position sample from the angular speed sample every 10ms and then adding the accumulated angular position to the previous angular position. Sophiecentaur suggests that you can calculate the angular position of the wheel by integrating all the angular speeds (degrees per second), starting from a given time and that will give you the total angle after t seconds.
  • #1
yadunandan
12
0
Dear All,

After long time, I have to start working again on basic physics for my application in one of our automotive project.
Anyway, my problem is, I receive the angular velocity of wheel from external source like (say CAN bus) for every 10ms, now, I need to calculate the Angular position of the wheel using this angular velocity.
Ofcourse, I need to do it in C-language. I'm completely out of any idea now :(.

Can some one please help me by giving any idea or sample code ?

Thanks
Kasu
 
Physics news on Phys.org
  • #2
FYI, the units for angular velocity that I receive is "deg/sec".
 
  • #3
If the angular velocity remains relatively constant just add measured velocity to a running tally of the position, if you need more precision try adding the average of the newly read velocity with the previous one. How accurate do you need to be?
 
  • #4
Hi JHamm

Thanks a lot for your reply.
My angular speed input looks like something as shown in the attached figure, it is not constant.
Right now, I'm thinking to do below steps to calculate the angular position

Angular Position = (Current Speed Sample - Previous Speed Sample)*(Time difference between current & previous sample)

As I said, I receive the speed sample for every 10ms.

1. So, first I calculate the angular position sample from angular speed sample
2. Then, I accumulate (add the angular position sample) the angular position sample to calculate the current position of the angle..

Do you think, it makes sense ?
 

Attachments

  • angular_speed.jpg
    angular_speed.jpg
    28.5 KB · Views: 921
  • #5
To find the incremental change in angular position you may use
[tex]\Delta \theta= \frac{\omega_{current}+\omega_{previous}}{2} \Delta t[/tex]
Then you add this to the previous angular position, as you mentioned already.
"Omega" is the angular speed and Delta t is the time increment.
 
  • #6
If you want to know the position after a long time, this could be difficult. The total angle moved would be the integral of the velocity over this time and a lot of error can creep in as time progresses.
It's easy for uniform speed or even uniform acceleration (steady increase in speed) but your recorded graph would make things a lot more complicated and prone to error. Do you really want to calculate the final angle after all the speed variations on that graph?
 
  • #7
Hi Nasu and Sophiecentaur

Thank you for your inputs.

@Nasu,
I calculated the angular position using your inputs and simulated the graphs.
Please check it in the attachment.

@Sophiecentaur
I think, I understand your point. The angular speed that I recorded is during random case. Means, I recorded the data when the car was going at random speeds. But, in my real application, I believe I will activate this "angular position" calculated function only at certain speeds.

By checking the attached graphs, do you think I'm going in right path?
 

Attachments

  • angular_position.jpg
    angular_position.jpg
    35.2 KB · Views: 814
  • #8
yadunandan said:
By checking the attached graphs, do you think I'm going in right path?

I can't see what you have done here. You just need to integrate (sum) all the angular speeds (degrees per second), starting from a given time and that will give you the total angle after t seconds (Modify that for whatever your time increment happens to be). That second graph is very puzzling. Why did you do that?

I should think that the answer would be totally unreliable -if you wanted to know the final angle Modulo 360, particularly. But even to find the total angle, the error could be poor. What is the cause of those short 'dips' on the first graph?
 
  • #9
Hi, sophiecentaur

I just did the integration of Angular speed only...
As I said earlier, I receive the angular speed for every 10ms.
So, after every 10ms, I need to find the current angular position of the wheel.
Lets consider the below example with four samples of received wheel Speed.


Speed(deg/sec) Time Angular Position (degree)
------ ----- ------------------------
200 10ms 2.0 deg
220 10ms 2.1 deg --> { (200+220)/2 *10ms }
220 10ms 2.2 + 2.1 = 4.3 deg --> { (220+220)/2 *10ms + 2.1 }
222 10ms 2.21 + 2.2 + 2.1 = 6.51 deg --> { (222+220)/2 *10ms + 4.3 }

So, the final angular position of the wheel after the 4 samples will be 6.51 deg.
The 2nd graph in the attachment is the plot of angular position at each sample.

Is there any problem in the above process, kindly let me know please.

Also, the short 'dips' in the input wheel speed is noise from the wheel speed sensor itself. I think I may have to use some kind of software filter function to avoid these dips.

For easy analysis, I am attaching the graph here calculated with few samples.


Thank You
 

Attachments

  • plots_with_less_samplepoints.jpg
    plots_with_less_samplepoints.jpg
    27.4 KB · Views: 824
  • #10
The total angle is increasing in a nice convincing manner - which has got to be good!

I still don't see why it is a two-step process, though. I would have expected the values on the middle graph to correspond numerically to the first graph(like in your short numerical example). The values do not follow the top graph at all. Why? They seem to produce a more or less constant value- which would clearly give you that nice triangular (integral) plot in the bottom graph.

Why do you just not add all of the speed values together and the result will be what you want - with suitable scaling to take into account the 10ms samples: i.e. divide the sum by 100?
You seem to be working out the distance increment for each interval and then accumulating these values rather than just adding the instantaneous values and accumulating them. I can't see that you accomplish anything by taking the mean of two successive sample values and adding these means together - arithmetically is will be the same as just adding them all up (you are effectively adding half of each value twice).
Working out the probable total error would be difficult without, perhaps, analysing the variation of your original speed samples and their absolute accuracy. Any constant error in speed will just mount up as the time increases. This is the problem with any dead reckoning system.

I may have got this totally wrong but it seems glaringly obvious to me(?)
 
  • #11
There is something funny with your plots. What is the second graph? Maybe the increments of the position at each step?
And what are the units on the axes, anyway?
 
  • #12
Sorry about late reply (Due to Thanks Giving Holidays)

And thank you for your suggestions.

@sophiecentaur
Yes, I reduced the two step process for calculating the angular position to 1 step as you suggested.

And infact, the low dips in the input Wheel speed signal was due to my fault. There was small bug in my filter coding. And here I attached my final graphs here. But, if you see the graph of wheel speed signal graph, there are some samples which goes to zero un-intentionally. It is ok, i confirmed it, its due to some other hardware problem. We have to find some other way to avoid this problem.

I once again thank you for your help.
 

Attachments

  • WheelSpeed_And_Angle.jpg
    WheelSpeed_And_Angle.jpg
    38.6 KB · Views: 732
  • #13
The graph you have obtained of total angle looks more convincing now; it has an uneven gradient in accord with the bumpiness of the input data. Getting rid of those dips was good!

Did you consider putting some false data in (linear acceleration or constant speed) to check that you get the correct answers out?

I'm not clear what you actually want out of the exercise. If you want an estimate of total distance traveled then errors would be reasonable but, if you want to estimate the final position of rotation of the wheel (angle modulo 360) then this method - and in fact any method of integrating velocity - could be extremely error-prone.

Good luck with taking it further.
 
  • #14
After every 10ms, I need to estimate the current wheel position and then calculate the Sine, Cosine values for this angle. For example...

- At first, I calculate the angular position (say for very 1st sample) and then calculate Sine,Cosine values for that angle.
- And now, calculate the next angular position (2nd sample after 10ms) by integrating with the previous angular position sample and then calculate Sine,Cosine values for the current angular position...

Basically, by integrating the angular velocity, I need to calculate the Angular position and finally generate Sine, Cosine waves. Please check the attached graphs, it has the output sine,cosine waves. One graph shows the real wheel speed input and the 2nd graph shows the data with constant input wheel speed (I change the input wheel speed deliberately to a constant value to check the output sine,cos waves).

And as you said, I understand, by integrating any calculations like this (angular velocity, angular position) can cause a serious error prone, .. :(... Is there any better way to do ? Any suggestions please ?

Thank You
 

Attachments

  • 1stGraph_(Original Wheel Speed).jpg
    1stGraph_(Original Wheel Speed).jpg
    34 KB · Views: 783
  • 2ndGraph_(Constant) Wheel Speed).jpg
    2ndGraph_(Constant) Wheel Speed).jpg
    27.4 KB · Views: 841
  • #15
yadunandan said:
And as you said, I understand, by integrating any calculations like this (angular velocity, angular position) can cause a serious error prone, .. :(... Is there any better way to do ? Any suggestions please ?

Thank You

I would have suggested synthesising a sine wave with a frequency based on the reciprocal of an averaged value of the angular velocity. A frequency locked loop (as opposed to a phase locked loop).
 
  • #16
Can you explain what is going on physically or is this just a graph exercise??
 
  • #17
@netgypsy

I logged the data through CAN message from the real Car to get the Wheel Speed data.
So, when I logged the data from the Car, I got around 10,000 samples of Wheel Speed Signal.
And I import these values to excel sheet and at first trying to calculate Wheel position.

And after the excel sheet simulation, I want to implement the same logic in the C language.
I still have to test in the real function in my project and the hardware. That is the next step.
 
  • #18
But you didn't answer the question. Does this have a practical application or is it 'just' an exercise?
 
  • #19
@sophiecentaur

Yes, it does have practical application. The sine, cos values (calculated using angular position) will be used by "function" to control the current input to the Motor in the EPS (Electronic Power Steering) ECU. As of now, I'm not quite sure what that "function" about.
 

1. How is angular position calculated from angular velocity?

Angular position can be calculated by multiplying the angular velocity by the time elapsed. This is because angular velocity is a measure of how quickly an object is rotating, and multiplying it by time gives us the total degree of rotation.

2. What units are used for angular position and angular velocity?

Angular position is typically measured in radians or degrees, while angular velocity is measured in radians per second or degrees per second.

3. Can angular position be negative?

Yes, angular position can be negative. It depends on the direction of rotation and the chosen reference point. Clockwise rotations are considered negative, while counterclockwise rotations are positive.

4. How does angular position differ from linear position?

Angular position is a measure of the angle of rotation, while linear position is a measure of the distance an object has traveled. Angular position is a scalar quantity, while linear position is a vector quantity.

5. What is the relationship between angular position and linear position?

The relationship between angular position and linear position depends on the distance from the center of rotation. The greater the distance, the larger the linear distance traveled for a given angular position.

Similar threads

Replies
15
Views
864
Replies
1
Views
611
Replies
3
Views
1K
Replies
8
Views
1K
Replies
42
Views
4K
Replies
1
Views
893
Replies
4
Views
8K
Replies
7
Views
2K
Replies
6
Views
1K
Back
Top