I am currently doing an application to detect potholes on the road through the accelerometer in the phone. The problem I have is that I need to reorient the accelerometer axis to align with the cars axis.
I found this explanation below from a report online but I do not know how I use the GPS to calculate the post-rotation and how to monitor the pre-rotation angles.
The explanation online:
"The phone can lie at any arbitrary orientation and, hence, it’s embedded accelerometer. Therefore, it must be oriented along the vehicle’s axis before analyzing the signals. This system uses an algorithm based upon Euler angles for reorientation. The sensor is virtually rotated along the vehicle’s axis using pre-rotation, tilt and post-rotation angles (Euler angles). The post-rotation angle is calculated using GPS, so to avoid extra energy consumption the pre-rotation and tilt angles are monitored continuously and whenever there is any significant change in these angles, GPS is turned on and reorientation process is done again."
I have searched for ways to find the device orientation with phonegap but all I can find is the heading orientation plugin which seems to be used to give the compass direction of the phone.
Any advice or even an alternate way of doing this would be greatly appreciated.
I found the ebook "Pervasive Computing: 10th International Conference, Pervasive 2012 Newcastle, UK" useful for understanding how to program the reorientation of the accelerometer axis's.
Here's a link to the page in the book that describes the process: https://books.google.ie/books?id=VTy6BQAAQBAJ&pg=PA7&lpg=PA7&dq=pre-rotation,+tilt+post-rotation+matrices&source=bl&ots=Py9GXtE7Io&sig=xfur3P7sv_XaR9ihOAsPXvgGiWw&hl=en&sa=X&ved=0ahUKEwiCmc3V0YfLAhXFPRoKHZuODpMQ6AEIKDAC#v=onepage&q=pre-rotation%2C%20tilt%20post-rotation%20matrices&f=false
Hope this helps anyone else trying to do this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With