MATLAB: Is it possible to use the Rotational Hard Stop block from Simscape in the SimMechanics model

hardstopSimscape Multibody

I would like to use the Rotational Hard Stop block from Simscape in my SimMechanics model. I have created a model of a simple pendulum and want to set its extent of motion to 45 degrees from its mean position.
However, I am not sure about connecting this block with the other blocks from SimMechanics.

Best Answer

The ability to use the Rotational Hard Stop block in a SimMechanics model is available in Simscape. This can be done with both First and Second Generation SimMechanics models, and also with the Translational Hard Stop block in Simscape.
However, the tuning of the values in the Rotational Hard Stop block is important. This block is not a perfect hard-stop, but a spring-damper system that is enabled only when the joint passes its limits. When the stiffness and damping are not tuned properly, the rotating body can bounce a lot or stick to either limit.
1. SIMMECHANICS FIRST GENERATION
Please refer to the attached example model 'simple_pendulum_modified_1G.mdl' for a better understanding.
Here, instead of directly interfacing the Rotational Hard Stop block with the Custom Joint block, a Revolute Rotational Interface block from the SimMechanics library is included.
Please refer to the documentation link below for a similar example model (mech_interface_rot_spr_damper demo).
<http://www.mathworks.com/access/helpdesk/help/toolbox/physmod/mech/ug/bq8l6vy-1.html#bq8l6vy-3>
2. SIMMECHANICS SECOND GENERATION (R2012a and later)
Please refer to the attached example model 'simple_pendulum_modified_2G.mdl' for a better understanding.
Here, instead of directly interfacing the Rotational Hard Stop block with a Joint block, we can connect an Ideal Torque Sensor and Ideal Velocity Source to the SimMechanics Joint block's Torque and Velocity ports, respectively. This will create a physical coupling between Simscape and SimMechanics.
There are interface blocks available online in the MATLAB Central File Exchange that take care of connections like these. To download these blocks and view some additional examples, please refer to the following URL:
<http://www.mathworks.com/matlabcentral/fileexchange/37636-simmechanics-simscape-interface-examples>