You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
```julia
using Test
using Multibody
using ModelingToolkit
import ModelingToolkitStandardLibrary.Mechanical.Rotational
using OrdinaryDiffEq
using LinearAlgebra
using JuliaSimCompiler
t = Multibody.t
D = Differential(t)
world = Multibody.world
W(args...; kwargs...) = Multibody.world
@mtkmodel TestUSR begin
@components begin
world = W()
j1 = JointUSR(positive_branch=true, use_arrays=false)
fixed = FixedTranslation(r=[1,0,0])
b1 = Body(isroot=false, neg_w=true)
p1 = Prismatic(state_priority=100)
end
@equations begin
connect(world.frame_b, j1.frame_a, fixed.frame_a)
connect(fixed.frame_b, p1.frame_a)
connect(p1.frame_b, j1.frame_b)
connect(j1.frame_im, b1.frame_a)
end
end
@nAmed model = TestUSR()
model = complete(model)
ss = structural_simplify(IRSystem(model))
prob = ODEProblem(ss, [model.b1.a_0[1]=>0.0, D(D(model.p1.s))=>0.0], (0.0, 1.0))
sol = solve(prob, FBDF(autodiff=true))
```
works
angle ~compute_angle2(length_constraint, e, r_a, r_b, positive_branch)[1]
451
-
end
446
+
angle ~_compute_angle2(length_constraint, e, r_a, r_b, positive_branch)
452
447
]
453
448
454
449
sys =ODESystem(eqs, t; name=:nothing, systems)#, parameter_dependencies = [positive_branch => select_branch(length_constraint, e, phi_offset + phi_guess, r_a, r_b)]) # JuliaSimCompiler ignores parameter dependencies, the user has to provide it instead
@@ -739,27 +734,33 @@ function compute_angle(L::Real, e::AbstractVector, r_a::AbstractVector, r_b::Abs
k1a >1e-10||error("Singular position of loop (either no or two analytic solutions; the mechanism has lost one-degree-of freedom in this position). Try to use another joint-assembly component. In most cases it is best to let joints outside of the JointXXX component be revolute and _not_ prismatic joints. If this also leads to singular positions, it could be that this kinematic loop cannot be solved analytically. In this case you have to build up the loop with basic joints (_no_ aggregation JointXXX components) and rely on dynamic state selection, i.e., during simulation the states will be dynamically selected in such a way that in no position a degree of freedom is lost.")
746
+
#k1a > 1e-10 || error("Singular position of loop (either no or two analytic solutions; the mechanism has lost one-degree-of freedom in this position). Try to use another joint-assembly component. In most cases it is best to let joints outside of the JointXXX component be revolute and _not_ prismatic joints. If this also leads to singular positions, it could be that this kinematic loop cannot be solved analytically. In this case you have to build up the loop with basic joints (_no_ aggregation JointXXX components) and rely on dynamic state selection, i.e., during simulation the states will be dynamically selected in such a way that in no position a degree of freedom is lost.")
0 commit comments