Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
```julia using MeshCat using ModelingToolkit using TORA using RigidBodyDynamics using Symbolics import SymPy function setup(vis, n_dof, sympy=false) robot = create_robot_kuka_iiwa_14(vis) x = MechanismState{sympy ? SymPy.Sym : Num}(robot.mechanism) q = configuration(x) if sympy for i in 1:n_dof q[i] = SymPy.symbols("q_$i", real = true) end else for i in 1:n_dof q[i] = Num(Sym{Real}(Symbol("q$i"))) end end return x end vis = Visualizer() ``` Symbolics: ```julia julia> x = setup(vis, 3); @time M = mass_matrix(x); 3.721925 seconds (7.73 M allocations: 462.482 MiB, 2.41% gc time, 99.20% compilation time) julia> for n in 3:7; x = setup(vis, n); @time M = mass_matrix(x); end 0.006976 seconds (79.61 k allocations: 3.028 MiB) 0.007024 seconds (80.71 k allocations: 3.072 MiB) 0.007367 seconds (81.56 k allocations: 3.106 MiB) 0.007341 seconds (82.07 k allocations: 3.131 MiB) 0.007315 seconds (82.66 k allocations: 3.157 MiB) ``` SymPy: ```julia julia> x = setup(vis, 3, true); @time M = mass_matrix(x); 16.333147 seconds (31.71 M allocations: 1.870 GiB, 2.18% gc time) julia> for n in 3:7; x = setup(vis, n, true); @time M = mass_matrix(x); end 2.899745 seconds (78.61 k allocations: 2.414 MiB) 4.737822 seconds (78.61 k allocations: 2.414 MiB) 9.462235 seconds (78.61 k allocations: 2.414 MiB) 16.858959 seconds (78.61 k allocations: 2.414 MiB) 17.311054 seconds (78.61 k allocations: 2.414 MiB) ```
- Loading branch information