# Simscape Multibody: How can I lock a revolute/spherical joint?

16 views (last 30 days)
Irina-Stefana Bulgaru on 2 Jun 2021
I am trying to model a system composed of 2 bodies connected by a revolute joint. The movement is generated by one of the bodies, while the second body follows along and can oscillate like a pendulum around the revolute joint. What I need in this system is a way to lock the revolute joint at any point in time so that the second body is not moving anymore relative to the first body, and it maintains its orientation with respect to the first body at the time of "locking".
I tried the answer described here, however I don't think this solution is appropriate for revolute joints because I obtained a different behaviour than the one expected. As we can see in the animated gif below, the joint is meant to lock at t=200, and it indeed does not allow any relative movement between the two bodies, however at the moment of locking, the second body "glitches" into a perpendicular orientation with respect to the first body, instead of maintaining its natural orientation.
On the other hand, the unlocking behaviour (happening at t=800s) is smooth and expected, as we can see that the orientation between the two bodies is gradually changing.
One other option that i considered is actuating the joint so that it keeps a specific angle, but I am not sure how to determine that angle at any moment in time, and I am worried that this actuation may interfere with the natural dynamics happening when the joint should not be locked.
I may have to replace the revolute joint with a spherical one in the future for more freedom in rotation, ideally the solution for locking the joint should work for both types.
Thank you,
Irina

Steve Miller on 3 Jun 2021
Edited: Steve Miller on 8 Jun 2021
Hi Irina,
It seems the effect you want could be created by rapidly increasing friction at the moment of lock. There are many friction laws out there, each with their pros and cons. The simplest one would be to measure the relative speed of the bodies in the Revolute Joint, multiply this by (0 for unlocked / 1 for locked), and then multiply that result by a very high damping coefficient. This will not be a "perfect" lock, for some relative velocity will be necessary to apply the friction, but it is very simple.
Enabling/disabling a joint will return the two frames to their original relative orientation, which does not seem to be a good fit for your use case.
--Steve
PS. Based on the comments below, I have added an example model based on sm_double_pendulum.slx.
Irina-Stefana Bulgaru on 9 Jun 2021
Thank you so much for the model, now I understand!

### Categories

Find more on Assembly in Help Center and File Exchange

R2020b

### Community Treasure Hunt

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

Start Hunting!