Drive the Rotation on a body in Virtual Reality from a simulink model signal

4 visualizaciones (últimos 30 días)
Hi, I have a model of a dynamic system (a car) which define 7 DoF (the 4 vertical motion of the wheels + Heave, Pitch and Roll of the body of the car). The car is positioned on 4 pads which are used to provide vertical inputs to the car (similar to a 4-Post rig shaker) The model works fine without the virtual reality.
I realized a virtual reality version of my system (4 wheels + a block for the body + 4 pads)
The virtual reality works fine when only the linear motions are driven
Now I am having problem with driving the "rotation" field of the body.
I tried using a bus creator but this does not work.
I suppose the rotation is a vector(3) with rotation around x,y and z respectively. am I right/
Any help on this is very appreciated
Thanks
G

Respuesta aceptada

Mischa Kim
Mischa Kim el 6 de Dic. de 2013
The problem is, that you have 3 rotation angles (yaw, pitch, roll) about different rotation axes and that the VR model requires one rotation parameter, a 4-vector. As explained by Jan, this 4-vector consists of the rotation axis (first 3 elements) and the rotation angle (4th element). So the questions is, how to convert the 3 – they are basically Euler – angles into one rotation axis and one rotation angle.
One way would be to compute the overall rotation matrix R(psi, theta, phi) and then use Euler’s theorem to compute rotation axis and angle.
So, say you have a typical yaw-pitch-roll (3-2-1) rotation sequence about psi, theta, phi. The overall rotation matrix from inertial to body reference frame is given by
R(psi, theta, phi) = R1(phi)R2(theta)R3(psi),
where
R3(psi) = [ cos(psi) sin(psi) 0;
-sin(psi) cos(psi) 0;
0 0 1]
R2(theta) = [cos(theta) 0 -sin(theta);
0 1 0;
sin(theta) 0 cos(theta)]
R1(phi) = [1 0 0;
0 cos(phi) sin(phi);
0 -sin(phi) cos(phi)]
Careful with the particular notation (minus signs) of your rotation sequence, which might be different from the one shown above.
The last step, backing out rotation axis and angle from the overall rotation matrix, I’ll leave up to you. Once you have those, you can use a Mux block to form the 4-vector and feed the signal into the VR.
  1 comentario
Giuseppe Naselli
Giuseppe Naselli el 7 de Dic. de 2013
Hi Mischa!
Yes it WORKS!!!!!! great!
Just to add my bit to your answer for other people that will look at this.
Build the Rotation matrix as suggested by Mischa (I made sure the 3D Virtual Reality World" had the same Axis system reference of my Simulink model)
Place a simulink block "Rotation Matrix to VRML Rotation" just after the Rotation matrix
This basically transforms the rotation matrix into a quaternion as required by the Virtual Reality rotation field.
[Rotation Matrix]-->[Rotation Matrix to VRML Rotationx]-->[VR block body.rotation field]
Thanks Mischa with your help was easier than expected!
G

Iniciar sesión para comentar.

Más respuestas (2)

Jan Houska
Jan Houska el 4 de Dic. de 2013
Rotation is not a 3-element vector. Instead, it is a 4-element vector where the first three elements specify the direction of the axis to rotate around and the fourth element is the rotation angle. Try to look at e.g the vrmemb1 example to see how this works. For more information about the VRML97 nodes and fields please see the VRML97 Specification.

luis jatar
luis jatar el 4 de Sept. de 2024
Hello, I am facing a similar problem for simulate a quadcopter in MATLAB, I do have three rotations matrices, Rz, Rx, Ry according to Tait-Bryan angles. But using VR matlab I need to make these 3 rotations into the command:
object.rotation = [ux uy uz angle] (u is the unitary vector along the rotation axis) in the case of the z rotation u = [ 0 0 1 ], en el caso de x rotation would be something like u = [1 0 0] and finally the Y rotation u = [0 1 0].
The big question is how can i combine these 3 rotation using the command object.rotation?
Thanks in advance

Categorías

Más información sobre Simulation en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by