# 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?