The sensor will measure acceleration in both directions along each of the 3 axis. Acceleration along the X or Y axis in the direction of the silkscreened arrows will produce a larger reading, while acceleration in the opposite direction will produce a smaller reading. For the Z axis, upward acceleration (in the direction of the board’s face) produces larger values, and downward acceleration (toward the board’s back) produces lower values.
It’s just calculus. Essentially what you’re doing is find the “area under the curve” of an acceleration graph with respect to time twice. You can probably find a formula online somewhere but if you haven’t taken calculus yet I don’t know how feasible this will be for you, unless I’m missing something.
Lol I’m in BC right now. I know what you’re talking about, just wondering if the math library allows you to do integrals in VexCode or do you need to do Riemann sums or smthn else? Like can you literally type integral(x^2,x) and it’ll give u the area or do you have to do it a different way? Or were you just suggesting it as a possibility to find total displacement?
You use Riemann sums (or other, more sophisticated algorithms) for integration of real-time systems. You can’t just find the antiderivative and plug in two endpoints because you don’t have a formula to find the antiderivative of.
Wait but wouldn’t that not work for constant velocity as it would have 0 acceleration? Is there a way to find distance using the inertial sensor in this case? As I understand, it only detects rotation and acceleration, so wouldn’t that mean that if you have constant velocity in a single direction, there would be no way of knowing total displacement without using separate sensors?
You start integrating from a known position and known velocity, so the integral and double-integral of acceleration will represent the displacement and change in velocity, respectively, from the known initial position and velocity.
There are probably multiple ways of doing it. This was just a suggestion given the known data.
That is possible. I’m not sure exactly how the sensor works and the robot is almost never traveling exactly at a constant velocity. You can account for that regardless. If you know the robot’s max velocity, when there is no acceleration, you can just add the integral of the velocity with respect to time to the displacement (assuming you’re tracking displacement with a seperate variable) for that period of time.