Hello Community,

i started my first project off with a friend here: https://xdk.bosch-connectivity.com/community/-/message_boards/message/320751

So that Franjo said it would be nice to make a new thread we are here now. :-)

It took approx. 2 weeks now to inform me about the orientation data (quarternions) and their calculation. Despite the fact that i found a few dissertations about this i could not get any calculation to work. 

So i ask you guys to help me.

We want to calculate the orientation data with the accelerometer to an x,y,z coordination system (x,y would work also). At the beginning we need to set a zero reference point. 

Did anyone face this problem already and would provide us any code examples or something?

How to calculate this would also help very much.

I know thats much to ask for but I am not getting forward and we are running out of time.

 

Thank you very much in advance.

 

0 (0 Votes)
RE: Calculate Movement with orientation data
Answer
1/12/18 4:40 PM as a reply to Christian.

Hello Christian,

I think I can provide some guidance on the way to implement your use case. Please note that calculating movement in the three-dimensional room is not quite an easy task to solve, as you probably have realized so far.

As far as I know, there is, unfortunately, no example code from a similar use case in the XDK community available yet.

Since you mentioned that you have spent two weeks on researching how to work with quaternion values, I assume that you know how to read the orientation and map the dimensions x, y and z to the new orientation.

With that, you would need to calculate the velocity and distance vector to keep track of the movement of the XDK with the following equation:

S(t) = s0 + v(t)*t + 0.5*a(t)*t^2
All coefficients of this equation should be regarded as vectors (since we are talking about a 3-dimensional space), only time (t) is one-dimensional here.

To calculate velocity and distance, you can measure the time between two samples of the quaternion values and integrate them twice. Here, I recommend looking up on numerical integration techniques to minimize the integration error.

Additionally, you would need to set an origin point from where the movement distance can be calculated. This could be solved by hardcoding it as current position during initialization, or when pressing a button.

Furthermore, it is helpful to use sensor fusion algorithms to combine the orientation data with the data of an additional accelerometer or gyroscope to receive more precise acceleration data for further calculation.

For that, I recommend, putting some research into sensor fusion algorithms.

Overall, please do not regard this information as a solution - mapping the XDK in 3D space with only orientation and accelerometer data is very difficult to do, and as such, I can only give you pointers.

Please let me know if that was helpful and feel free to ask if you have further questions.

Kind regards,
Franjo

 

0 (0 Votes)