MATLAB: How to set the initial attitude and rotational velocity of a free body in SimMechanics 2.2.1 (R14SP1)

aircraftbodyconditionsfreegroundinitialsimmechanicsSimscape Multibody

I would like to model a system with SimMechanics which is is free in space, such as an actuator mechanism on an aircraft. I would like to connect a Body block to the Ground block in such a manner that I can specify the initial attitude and rotational velocity, without running into singularities.

Best Answer

For a variable step solver you can attach a 6DoF joint and a bushing joint in parallel to the body. The 6DoF has the spherical joint and the bushing has the Euler angles. You should mark the bushing joint with the Euler angles as the preferred cut joint in "Block Parameters -> advanced tab" and assign initial conditions to the bushing joint using the IC block.
To set the initial rotational velocity, you have to give the revolute joints in the bushing initial values. You need to convert your known velocities into the velocities and orientations for the revolute joints.
Attached is a simple example on setting the initial attitude and rotational velocity of a free body in SimMechanics.
For a fixed step solver, you may encouter issues with the above workaround for some parameter settings. As an alternative workaround, the model InitializeSimMech (Fixed Step example model), is included.
A couple of notes regarding its use:
1.You should use the adjoining reference for setting the initialized body position, and its position should be set at [0 0 0] with regard to this adjoining reference. For example, CS1 of “Body” should be set to use the “Adjoining” reference and its position should be [0 0 0] (orientation likewise).
2.Note that all of these vectors entered in the mask parameters list need to be column vectors. These are for setting position, velocity, and angular velocity.