Moving 3d cube using Quaternions
Afficher commentaires plus anciens
Hi,
I am using the following example Track Orientation to visualize a cube / sensor object and it's position should be updated with the sensor incomings. I adapted the example in the following way:
- I am not using BLE but I want to update the position with the reading of a sensor file which includes gyro_data(x,y,z).
- It means for every iteration I am reading one line which consists of gx,gy and gz and I want to update the position. This works fine! --> I am able to read whenever I need one line and get the values out.
- I do not want to use rotations matrices but quaternions, since it is more efficient and easier using them. What I am doing is the following approach:
a) Assume that initial po is (1,0,0,0) and take this as start position.
b) read one line from file and update q (important is that q is normalized)--> after updating q, I am performing the point rotation method rotatepoint(q,[x,y,z]) which depicts the following function : qvq*. See this thread: Information to all the vertices of the patches of the cube.
My problem is that I do not know how to update the points so that the cube is moving. I checked the approach used in the example mentioned above, but they are using rotation matrices and I do not understand how it works. Is there maybe a way to update the points applying only quaternions. what I was trying to do is to update the vertices /overwrite them with the new value and display it with drawnow, but the movements are not correct. Can someone give me a hint how to do it?
Réponses (0)
Catégories
En savoir plus sur Quaternion Math dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!