# Restrict spherical joint movements

Posted 1 year ago
2803 Views
|
|
3 Total Likes
|
 I would like to simulate a body with internal components connected to a spherical joint that should only freely move within a specific angle range, for example, in each degree of freedom, between +/- 45 degrees.This would be similar I suppose to a block standing on its corner or edge and falling to the floor:  I found this example for the bouncing ball in system modeler education examples equation impact = h <= 0.0; der(v) = if flying then -g else 0; der(h) = v; when {h <= 0.0 and v <= 0.0, impact} then v_new = if edge(impact) then -e * pre(v) else 0; flying = v_new > 0; reinit(v, v_new); n_bounce = pre(n_bounce) + 1; end when; Which I thought would be a good starting point...however it isn't directly connected to any specific joints that I could easily adapt the code for and the code for a spherical joint is simply beyond ability I think. though, as far as I could remember, this may be as 'simple' as adding in some algebraic equations, similar to der(phi) == 0 when phi < pi/4 and following through with each degree of freedom...though, I'm unsure if that assumption is correct.So the question would be how to program with blocks or code the restriction or maybe 'impact' with this box body with the ground plane? or how to restrict the angles of a spherical joint in all degrees of freedom to an arbitrary +/- angle?
 Hi, I did a quick test. The idea is to use revolute joints and set the constraints on them. In this case I used the elastobacklash to limit the movement.This is the model diagram: Note that I have the z-direction disabled in this version. If I set initial conditions for the rotational velocities the box will keep bouncing for ever (as I have no losses) and if I trace the path of one of the corners (after simulating or 1000 seconds)I get this: I have probably not arranged the directions the way you like, but that can be adjusted.I have attached the model. Attachments: