3939# end
4040
4141# We compile the mechanism, and setup an ODE problem to simulate the dynamics of the rail robot.
42- m = compiled_mechanisms[end ]
42+ # m = compiled_mechanisms[5]
43+ m = compile (parseRSON (" ./RSONs/rsons/trivial2link.rson" ))
4344cache = Observable (new_inverse_dynamics_cache (m))
4445# @testset test_inverse_dynamics(m)
4546
5051
5152t = 0.0
5253q = [0.0 , π/ 2 ]
53- q = zero_q (m) + randn (7 )
54- q̇ = zero_q̇ (m) + randn (7 )
55- g = SVector {3, Float64} (0.0 , 0.0 , - 10 ) # + rand(SVector{3, Float64})
54+ q̇ = zero_q̇ (m)
55+ g = SVector {3, Float64} (0.0 , 0.0 , 0.0 )
5656
5757# rng = MersenneTwister(1234)
5858# t = 0.0
@@ -62,21 +62,30 @@ g = SVector{3, Float64}(0.0, 0.0, -10) #+ rand(SVector{3, Float64})
6262
6363u = zero_u (m)
6464
65- dcache = new_dynamics_cache (m)
66- dynamics! (dcache, t, q, q̇, g, u)
67- q̈ = get_q̈ (dcache)
65+ # dcache = new_dynamics_cache(m)
66+ # dynamics!(dcache, t, q, q̇, g, u)
67+ # q̈ = get_q̈(dcache)
68+ onehot_q̈ = [1.0 , 0.0 ]
69+ q̈ = onehot_q̈
70+
6871
6972VMRobotControl. _inverse_dynamics_set_inputs! (bundle, t, q, q̇, q̈, g)
7073VMRobotControl. _inverse_dynamics_forward_pass! (bundle)
7174VMRobotControl. _inverse_dynamics_zero! (bundle)
7275VMRobotControl. _inverse_dynamics_backward_pass_a! (bundle)
7376VMRobotControl. _inverse_dynamics_backward_pass_b! (bundle)
74- VMRobotControl. _inverse_dynamics_backward_pass_c! (bundle)
75- VMRobotControl. _inverse_dynamics_backward_pass_d! (bundle)
77+ # VMRobotControl._inverse_dynamics_backward_pass_c!(bundle)
78+ # VMRobotControl._inverse_dynamics_backward_pass_d!(bundle)
79+
80+ # @show get_u(bundle)
81+
82+ # @show inverse_dynamics!(bundle, t, q, zero_q̇(m), onehot_q̈, 0*g)
83+
84+ # _test_RNE_inertance_matrix(bundle, dcache, t, q)
7685
7786# q̈_out = dynamics!(dcache, t, q, q̇, g, get_u(bundle))
7887
79- @test get_u (cache[]) ≈ u atol= 1e-7 rtol= 1e-7
88+ # @test get_u(cache[]) ≈ u atol=1e-7 rtol=1e-7
8089# @test q̈ ≈ q̈_out atol=1e-7 rtol=1e-7
8190end
8291
@@ -86,6 +95,7 @@ fig = Figure()
8695display (fig)
8796ls = LScene (fig[1 , 1 ]; show_axis= false )
8897robotsketch! (ls, cache; linewidth= 3 , scale= 0.05 )
98+ robotvisualize! (ls, cache)
8999
90100frameIDs = get_compiled_frameID .((cache[],), frames (cache[]))
91101tfs = map (cache) do cache
@@ -114,8 +124,8 @@ arrows!(ls, positions, τs; lengthscale=τ_scale, arrowsize=0.04, color=:blue, )
114124
115125end
116126
117- using Test, Random
118- Revise. includet (" ../test/inverse_dynamics_test.jl" )
127+ # using Test, Random
128+ # Revise.includet("../test/inverse_dynamics_test.jl")
119129@testset test_inverse_dynamics (m)
120130
121131# function create_rotated_cylinder_mesh(N1, N2, r1, r2, ϕ)
0 commit comments