There are two coordinate systems: accelerometer and world. The accelerometer will have fixed x / y / z directions in its worldview, but they change relative to world coordinates based on orientation.
If you use the accelerometer values as is, then you can get positive or negative impulses when hit. But when you convert them into a world coordinate system, that is, always down to the center of the Earth, you will always get the same values for the back and the opposite for forehand.
Suppose that the direction of the accelerometer x corresponds to the normal of the network, z is parallel to the handle, and y is “up” when the racket is its normal lateral position.
Since in tennis the racket is basically on the same plane (for example, you don’t get into the net down), and if you don’t do overhead (in this case, I think that there can be no question in the background), you will always indicate 1 or -1 when the racket is at rest. The simplest (but not the most accurate!) Way is to check which sign y has and change x accordingly. This way you will not get exact vectors, but you will get information about whether it was a striker or a forward.
The problem with this also is that you have to track the racket before the strike, since if the strike is not absolutely even (rarely), the acceleration y will also change when the racket moves up or down on impact and will not show the orientation of the racket in moment of impact.
For more accurate readings you will need to determine the difference between the coordinate systems and rotate accordingly.
source share