Drive the Rotation on a body in Virtual Reality from a simulink model signal
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Giuseppe Naselli
am 2 Dez. 2013
Beantwortet: luis jatar
am 4 Sep. 2024
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
0 Kommentare
Akzeptierte Antwort
Mischa Kim
am 6 Dez. 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.
Weitere Antworten (2)
Jan Houska
am 4 Dez. 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.
0 Kommentare
luis jatar
am 4 Sep. 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
0 Kommentare
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!