Motion Tracking with Accelerometer
이전 댓글 표시
Hi, I'm very new to coding and accelerometer studies, so any help is appreciated.
I have a device that has only one 3-axis accelerometer, no gyroscope, no magnetometer. After doing movements, I get a csv file with accelerations in x,y,z axes. I want to plot the movements that I did from these data in 3d. I am able to read the files on matlab, filter the noise, and use cumtrapz to get velocity and displacement. But these plots are not helpful, and I don't know how to proceed from here.
How do I track the motion of the device and basically recreate the 3d motion plot?
The figure below shows the plots of x, y and z acceleration, velocity and displacement. Thank you.

댓글 수: 5
James Tursa
2020년 5월 27일
If the device is rotating in any way, then you can't reproduce 3D motion with only accelerometer data. Think about it. How could you tell the difference between sliding all in one linear direction vs sliding halfway, flipping over, and sliding back to the starting place? You couldn't. The sum of the accelerometer data would be the same. So, unless you have no or very little rotational motion, you can't do what you are trying to do since you don't have all the data you need.
Karlee McFarlane
2020년 5월 28일
James Tursa
2020년 5월 28일
편집: James Tursa
2020년 5월 28일
Yes you should remove the gravity component from all of your data first (or, more precisely, add it in so that it cancels the reaction force). Is there a quiescent period at the beginning where the object is not moving? Do you know the direction of gravity in your x-y-z coordinates?
Karlee McFarlane
2020년 5월 30일
James Tursa
2020년 5월 30일
편집: James Tursa
2020년 5월 30일
A quiescent period would allow you to calibrate so you know the sensor biases + gravity. For a rough result, you would just subtract the beginning value (or probably an average of some beginning values) from all of the data. This ignores the fact that the object is actually moving because of Earth rotation (there is in reality a non-zero component of centripetal acceleration present), but for your purposes I am assuming you can ignore that. You would need to decide that.
Without the quiescent period you don't have this information. So in that case you will have to use a formula for the gravity and use your best judgement for direction based on the test setup.
답변 (1개)
Star Strider
2020년 5월 27일
The cumtrapz results do not appear to be accumulating with respect to time. Without being able to see the data or your code, my guess is that you are not integrating across the time dimension. The third argument to cumtrapz is the dimension (with time being the first argument and your signal being the second argument). Check to be certain that you are integrating across the correct dimension, then see if the results change.
The ‘x’ result should probably look something like this simulation:
t = 0:10;
xacc = t.*cos(t*2*pi/9);
xvel = cumtrapz(t, xacc);
xdis = cumtrapz(t, xvel);
figure
subplot(3,1,1)
plot(t, xacc)
title('Acc')
subplot(3,1,2)
plot(t, xvel)
title('Vel')
subplot(3,1,3)
plot(t, xdis)
title('Dsp')
.
댓글 수: 2
Karlee McFarlane
2020년 5월 27일
Star Strider
2020년 5월 27일
‘But still, how do I convert this into a precise 3d animation of the exact movements that I did with the device?’
What you read somewhere is correct, however the might be a way to get something out of the data you have.
I have no idea what you want to animate, however using the animatedline function (R2014b and later versions) would be the place to start.
카테고리
도움말 센터 및 File Exchange에서 Animation에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
