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

“virtual reality”formulastudentrotationsimulinkSimulink 3D Animation

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

Best Answer

  • 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.