dojo-sim / dojo.jl Goto Github PK
View Code? Open in Web Editor NEWA differentiable physics engine for robotics
License: MIT License
A differentiable physics engine for robotics
License: MIT License
Is there a good way to breakout the environments from the primary simulator package while maintaining the integrity of tests across both packages?
@rejuvyesh
@janbruedigam
e.g.
size(reset(antenv), 1) == antenv.observation_space.n
returns false
.
I'll add those tests in a PR.
Reason is because although wedefine observation space as https://github.com/dojo-sim/Dojo.jl/blob/main/environments/ant/methods/env.jl#L44-L51 but then get_observation
concatenates the contact forces as well: https://github.com/dojo-sim/Dojo.jl/blob/main/environments/ant/methods/env.jl#L175. We need a way to reflect this in the observation space.
I was trying to run the examples in examples/trajectory_optimization/ but couldn't get the atlas example and the hopper example to converge.. (the hopper one at least was converging with the RL policy I was training but didn't have much luck with atlas there).. @thowell mentioned that the friction model was changed recently so the trajopt parameters might have to be tuned to get it working again.
Currently, it seems Dojo does not support elastic collisions. I'm wondering if there's any plan on adding elasticity support in Dojo. Thanks!
So far only removing fixed joints is only implemented for URDF parsing
As a new person to Julia these were some problems I encountered while working through the documentation.
When trying to create the Tippetop from the Documentation under "Defining a Mechanism" there are several functions that seem to be modified leading to errors and some information that could included for clarity:
Hi,
Impressive simulator.
Using API, is it possible to make a contact for the wheel object or the circle?
I saw a sphere(point), capsule, cube in examples.
Thanks in advance.
ERROR: LoadError: SingularException(5)
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/StaticArrays/58yy1/src/lu.jl:86 [inlined]
[2] _lu
@ ~/.julia/packages/StaticArrays/58yy1/src/lu.jl:75 [inlined]
[3] #lu#500
@ ~/.julia/packages/StaticArrays/58yy1/src/lu.jl:48 [inlined]
[4] #lu#507
@ ~/.julia/packages/StaticArrays/58yy1/src/lu.jl:52 [inlined]
[5] lu
@ ~/.julia/packages/StaticArrays/58yy1/src/lu.jl:52 [inlined]
[6] macro expansion
@ ~/.julia/packages/StaticArrays/58yy1/src/inv.jl:79 [inlined]
[7] _inv
@ ~/.julia/packages/StaticArrays/58yy1/src/inv.jl:74 [inlined]
[8] inv
@ ~/.julia/packages/StaticArrays/58yy1/src/inv.jl:5 [inlined]
[9] ldu_factorization_acyclic!(diagonal_v::Dojo.Entry{SMatrix{6, 6, Float64, 36}}, offdiagonal_l::Dojo.Entry{SMatrix{6, 5, Float64, 30}}, diagonal_c::Dojo.Entry{SMatrix{5, 5, Float64, 25}}, offdiagonal_u::Dojo.Entry{SMatrix{5, 6, Float64, 30}}, diagonal_inverse_c::Dojo.Entry{SMatrix{5, 5, Float64, 25}})
@ Dojo ~/.julia/packages/Dojo/D5fhl/src/graph/ldu_factorization.jl:6
[10] ldu_factorization!(system::Dojo.System{30})
@ Dojo ~/.julia/packages/Dojo/D5fhl/src/graph/ldu_factorization.jl:38
[11] mehrotra!(mechanism::Mechanism{Float64, 30, 13, 13, 4}; opts::SolverOptions{Float64})
@ Dojo ~/.julia/packages/Dojo/D5fhl/src/solver/mehrotra.jl:36
[12] simulate!(mechanism::Mechanism{Float64, 30, 13, 13, 4}, steps::Base.OneTo{Int64}, storage::Storage{Float64, 500}, control!::typeof(ctrl!); record::Bool, verbose::Bool, abort_upon_failure::Bool, opts::SolverOptions{Float64})
@ Dojo ~/.julia/packages/Dojo/D5fhl/src/simulation/simulate.jl:28
[13] simulate!(mechanism::Mechanism{Float64, 30, 13, 13, 4}, tend::Float64, args::Function; record::Bool, verbose::Bool, abort_upon_failure::Bool, opts::SolverOptions{Float64})
@ Dojo ~/.julia/packages/Dojo/D5fhl/src/simulation/simulate.jl:46
[14] top-level scope
@ /dojo/examples/trajectory_optimization/quadruped_standing_gait.jl:288
I cannot find the code of this function and REPL report an error when I run it.
It's unclear how to set joint limits for an orbital joint. Attempting to set limits in a few ways that seemed intuitive caused a dimension mismatch while the solver attempts to set the joint impulses.
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
This is the error I get:
atlas_min.ipynb attached:
atlas_min.zip
MethodError: no method matching setindex(::Vector{Float64}, ::Float64, ::Int64)
Closest candidates are:
setindex(::Tuple, ::Any, ::Integer) at tuple.jl:52
setindex(::CartesianIndex, ::Any, ::Any) at multidimensional.jl:100
setindex(::SHermitianCompact{N, T, L}, ::Any, ::Int64) where {N, T, L} at ~/.julia/packages/StaticArrays/B0HhH/src/SHermitianCompact.jl:114
Hi,
Thanks for your excellent code! I'm new to julia. When I run the training code in ags.jl
file (by changing the ars
function in ant_ars.jl
to ags
), I get the error ERROR: BoundsError: attempt to access 0-element UnitRange{Int64} at index [0]
, which traces back to this line. Could anyone help me with this?
Ian
Running the halfcheetah_ars.jl
example, I expected to see policy behavior similar to what is shown in the docs. Instead, I see that ARS gets a mean reward of around -23 and the resulting policy tends to move backward. Is this the expected behavior?
I'm using julia 1.8, Ubuntu 20.04, and the main branch of Dojo.jl
support for pick-and-place tasks
Running Julia 1.7.2 with Dojo v0.1.0, the first steps of the example from Defining a Simulation work so far:
using Dojo
timestep=0.01
gravity=0.0
mech = get_mechanism(:dzhanibekov, timestep=timestep, gravity=gravity);
initialize!(mech, :dzhanibekov, angular_velocity=[15.0; 0.01; 0.0])
But next the simulation fails with the following error:
julia> storage = simulate!(mech, 5.0, record=true, verbose=false)
ERROR: MethodError: lu(::StaticArrays.SMatrix{6, 6, Float64, 36}, ::Val{true}) is ambiguous. Candidates:
lu(A::AbstractMatrix, ::Val{true}; check) in LinearAlgebra at deprecated.jl:70
lu(A::StaticArrays.StaticMatrix{N, N}, pivot::Union{Val{false}, Val{true}}; check) where N in StaticArrays at ~/.julia/packages/StaticArrays/LJQEe/src/lu.jl:40
lu(A::StaticArrays.StaticMatrix, pivot::Union{Val{false}, Val{true}}; check) in StaticArrays at ~/.julia/packages/StaticArrays/LJQEe/src/lu.jl:33
Possible fix, define
lu(::StaticArrays.StaticMatrix{N, N}, ::Val{true}) where N
Stacktrace:
[1] lu(A::StaticArrays.SMatrix{6, 6, Float64, 36})
@ StaticArrays ~/.julia/packages/StaticArrays/LJQEe/src/lu.jl:42
[2] macro expansion
@ ~/.julia/packages/StaticArrays/LJQEe/src/inv.jl:77 [inlined]
[3] _inv
@ ~/.julia/packages/StaticArrays/LJQEe/src/inv.jl:72 [inlined]
[4] inv
@ ~/.julia/packages/StaticArrays/LJQEe/src/inv.jl:5 [inlined]
[5] ldu_factorization_acyclic!(diagonal_v::Dojo.Entry{StaticArrays.SMatrix{6, 6, Float64, 36}}, offdiagonal_l::Dojo.Entry{StaticArrays.SMatrix{6, 6, Float64, 36}}, diagonal_c::Dojo.Entry{StaticArrays.SMatrix{6, 6, Float64, 36}}, offdiagonal_u::Dojo.Entry{StaticArrays.SMatrix{6, 6, Float64, 36}}, diagonal_inverse_c::Dojo.Entry{StaticArrays.SMatrix{6, 6, Float64, 36}})
@ Dojo ~/.julia/packages/Dojo/wc2gJ/src/graph/ldu_factorization.jl:6
[6] ldu_factorization!(system::Dojo.System{4})
@ Dojo ~/.julia/packages/Dojo/wc2gJ/src/graph/ldu_factorization.jl:38
[7] mehrotra!(mechanism::Mechanism{Float64, 4, 2, 2, 0}; opts::SolverOptions{Float64})
@ Dojo ~/.julia/packages/Dojo/wc2gJ/src/solver/mehrotra.jl:36
[8] simulate!(mechanism::Mechanism{Float64, 4, 2, 2, 0}, steps::Base.OneTo{Int64}, storage::Dojo.Storage{Float64, 500}, control!::Dojo.var"#180#182"; record::Bool, verbose::Bool, abort_upon_failure::Bool, opts::SolverOptions{Float64})
@ Dojo ~/.julia/packages/Dojo/wc2gJ/src/simulation/simulate.jl:28
[9] simulate!(::Mechanism{Float64, 4, 2, 2, 0}, ::Float64; record::Bool, verbose::Bool, abort_upon_failure::Bool, opts::SolverOptions{Float64})
@ Dojo ~/.julia/packages/Dojo/wc2gJ/src/simulation/simulate.jl:46
[10] top-level scope
@ REPL[6]:1
This error looks similar to JuliaArrays/StaticArrays.jl#920. Perhaps the version of StaticArrays used by Dojo (0.12.5) is not up-to-date?
NB: this only happens when Dojo is installed by add Dojo
. The error does not appear when installing by add Dojo#main
. (In both cases the version number is 0.1.0.)
See for example CI#299 (attempt 1).
https://github.com/dojo-sim/Dojo.jl/actions/runs/1972726645/attempts/1
I was wondering what is the physical meaning of the inputs in set_input
? I was trying to balance the block in block2d
and block
example with a controller!
function. I need to set the input in the gravity direction to be timestep*actual_object_weight
in order to balance the object. If I want to exert certain forces/torques on the joints, should I always multiple the actual force/force by timestep to get the input?
Here is the control function I used to balance 'block2d'
function controller!(mechanism, t)
u = [0.0, -mechanism.bodies[1].mass*mech.gravity[3]*timestep, 0.0]
set_input!(mechanism, u)
end
change minimal state representation to:
state = (configurations, velocities)
Hi,
I am trying to figure out how to calculate the dynamics like torques and contact forces under the condition of reference trajectory.
Take quadruped_min for example, before the step of trajectory optimazation, the code gives a reference trajectory and it can be visualized with MeshCat. But all I know is the knematics, how can I get dynamics such as the energy when it's walking, the torques and contact forces?
Thanks for your help!
Hi,
I am trying some custom-built controller with Dojo simulator, but I could not find the full mechanism state I need.
I can get the mechanism state with "get_minimal_state(mechanism)", however it is just for one time step. The "Storage" variable stores full trajectories from simulation but it does not include the mechanism state (the closest one I guess is the Quaternion in "Storage.q").
Is there any built-in function in Dojo so that I can transfer those Quaternion to system states? If not, do you have any suggested approach for me to attempt?
Thanks for your help!
Next error up is:
julia> include("hopper_max.jl")
Activating project at `~/.julia/packages/Dojo/6iIp0/examples`
┌ Info: MeshCat server started. You can open the visualizer by visiting the following URL in your browser:
└ http://127.0.0.1:8718
ERROR: LoadError: MethodError: no method matching build_robot(::Visualizer, ::Mechanism{Float64, 6, 2, 2, 2}; name=:robot)
Stacktrace:
[1] visualize(env::Environment{Dojo.RaibertHopper, Float64, Mechanism{Float64, 6, 2, 2, 2}, BoxSpace{Float64, 3}, BoxSpace{Float64, 26}, Nothing}, traj::Vector{Vector{Float64}}; name::Symbol, axes::Bool, grid::Bool)
@ Dojo ~/.julia/packages/Dojo/tpwPK/environments/raiberthopper/methods/env.jl:121
[2] visualize(env::Environment{Dojo.RaibertHopper, Float64, Mechanism{Float64, 6, 2, 2, 2}, BoxSpace{Float64, 3}, BoxSpace{Float64, 26}, Nothing}, traj::Vector{Vector{Float64}})
@ Dojo ~/.julia/packages/Dojo/tpwPK/environments/raiberthopper/methods/env.jl:110
[3] top-level scope
@ ~/.julia/packages/Dojo/6iIp0/examples/trajectory_optimization/hopper_max.jl:46
[4] include(fname::String)
@ Base.MainInclude ./client.jl:451
[5] top-level scope
@ REPL[6]:1
in expression starting at /Users/glenhenshaw/.julia/packages/Dojo/6iIp0/examples/trajectory_optimization/hopper_max.jl:46
glenhenshaw@vpn202077 Dojo % julia cartpole_max.jl
Activating project at `~/Code/ahrm`
┌ Info: MeshCat server started. You can open the visualizer by visiting the following URL in your browser:
└ http://127.0.0.1:8701
ERROR: LoadError: MethodError: no method matching Options(; max_al_iter=10, verbose=true)
Closest candidates are:
Options(; line_search, max_iterations, max_dual_updates, min_step_size, objective_tolerance, lagrangian_gradient_tolerance, constraint_tolerance, constraint_norm, initial_constraint_penalty, scaling_penalty, max_penalty, reset_cache, verbose) at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/base/util.jl:489 got unsupported keyword argument "max_al_iter"
Options(::Symbol, ::Int64, ::Int64, ::T, ::T, ::T, ::T, ::T, ::T, ::T, ::T, ::Bool, ::Any) where T at ~/.julia/packages/IterativeLQR/uZ1DR/src/options.jl:2 got unsupported keyword arguments "max_al_iter", "verbose"
Stacktrace:
[1] kwerr(kw::NamedTuple{(:max_al_iter, :verbose), Tuple{Int64, Bool}}, args::Type)
@ Base ./error.jl:163
[2] top-level scope
@ ~/Code/ahrm/Dojo/cartpole_max.jl:66
in expression starting at /Users/glenhenshaw/Code/ahrm/Dojo/cartpole_max.jl:66
Oddly, I got it to run exactly once, the very first time I tried it, from a Jupyter notebook. It failed with this error the second time and every subsequent time, both from a notebook and from the terminal.
function Dojo.body_constraint_jacobian_contact_data(mechanism::Mechanism, body::Body{T}, contact::ContactConstraint{T,N,Nc,Cs,N½}) where {T,N,Nc,Cs<:NonlinearContact{T,N},N½}
Nd = Dojo.data_dim(contact)
model = contact.model
xp3, qp3 = Dojo.next_configuration(get_body(mechanism, contact.parent_id).state, mechanism.timestep)
xc3, qc3 = Dojo.next_configuration(get_body(mechanism, contact.child_id).state, mechanism.timestep)
γ = contact.impulses[2]
∇friction_coefficient = szeros(T,3,1)
X = Dojo.force_mapping(:parent, model, xp3, qp3, xc3, qc3)
∇p = - Dojo.∂skew∂p(Dojo.VRmat(qp3) * Dojo.LᵀVᵀmat(qp3) * X * γ)
cn = contact_normal(model.collision, xp3, qp3, xc3, qc3)
∇contact_radius = - Dojo.∂skew∂p(Dojo.VRmat(qp3) * Dojo.LᵀVᵀmat(qp3) * X * γ) * -Dojo.rotation_matrix(inv(qp3)) * cn'
∇X = szeros(T,3,Nd)
∇Q = -[∇friction_coefficient ∇contact_radius ∇p]
return [∇X; ∇Q]
end
function Dojo.contact_constraint_jacobian_contact_data(mechanism::Mechanism, contact::ContactConstraint{T,N,Nc,Cs,N½}, body::Body{T}) where {T,N,Nc,Cs<:NonlinearContact{T,N},N½}
Nd = Dojo.data_dim(contact)
model = contact.model
xp3, vp25, qp3, ωp25 = Dojo.next_configuration_velocity(get_body(mechanism, contact.parent_id).state, mechanism.timestep)
xc3, vc25, qc3, ωc25 = Dojo.next_configuration_velocity(get_body(mechanism, contact.child_id).state, mechanism.timestep)
cn = contact_normal(model.collision, xp3, qp3, xc3, qc3)
ct = contact_tangent(model.collision, xp3, qp3, xc3, qc3)
s = contact.impulses_dual[2]
γ = contact.impulses[2]
∇friction_coefficient = SA[0,γ[1],0,0]
∇contact_radius = [-cn; szeros(T,1,3); -ct * Dojo.skew(Dojo.vector_rotate(ωp25, qp3))] * cn'
∇p = [cn * Dojo.rotation_matrix(qp3); szeros(T,1,3); ct * Dojo.skew(Dojo.vector_rotate(ωp25, qp3)) * Dojo.rotation_matrix(qp3)]
∇compμ = szeros(T,N½,Nd)
∇g = -[∇friction_coefficient ∇contact_radius ∇p]
return [∇compμ; ∇g]
end
Hi, I want to simulate a bouncing ball using the sphere mechanism, but I can not get it bouncing. Is this due to the unspport of elastic collision? I have tried all three contact types. Thanks so much!
using Dojo
using DojoEnvironments
using StaticArrays
using Plots
timestep = 0.01
mechanism = get_mechanism(:sphere;contact_type = :nonlinear, timestep=timestep, springs = 20000.0,dampers = 10.0,mass = 10)
initialize!(mechanism, :sphere;position = [0;0;5.0],velocity = [3;2;-5.0],angular_velocity=[1.0;1.0;1.0])
storage = simulate!(mechanism, 5, record=true)
vis = visualize(mechanism, storage)
render(vis)
Hi,
Just wonder if it is possible to have multiple mechanisms in one simulation so that we can simulate multiple robots or some simple tasks like pick up and place items. A short example would be much appreciated, thanks for your help!
Cheers!
Add functionality for parsing values:
from URDF models, instead of adding post hoc in an environment.
Line 38 in c513e78
For Julia v1.7 and later, we need StaticArrays v1.4 and later for some of the lu
interface changes. But this conflicts with MeshCat
v0.13 and requires updating to MeshCat v0.14. Locally updating MeshCat to v0.14 didn't seem to effect anything, but to be fair, I didn't look too hard.
Dojo.jl/examples/simulation/tippetop.jl
Line 17 in 2727f5e
Functions related to contact handling are allocating a lot of memory.
Could be tracked down and reduced for improved speed.
The following code could be used for profiling (https://docs.julialang.org/en/v1/manual/profile/#Line-by-Line-Allocation-Tracking):
using Dojo
using DojoEnvironments
mechanism = get_mechanism(:block)
storage = simulate!(mechanism, 1, record=true)
julia> include("quadruped_min.jl")
Activating project at `~/.julia/packages/Dojo/tpwPK/examples`
┌ Info: MeshCat server started. You can open the visualizer by visiting the following URL in your browser:
└ http://127.0.0.1:8721
typeof(Z) = Vector{Float64}
ERROR: LoadError: UndefVarError: gravity_compensation not defined
Stacktrace:
[1] top-level scope
@ ~/.julia/packages/Dojo/tpwPK/examples/trajectory_optimization/quadruped_min.jl:64
[2] include(fname::String)
@ Base.MainInclude ./client.jl:451
[3] top-level scope
@ REPL[8]:1
in expression starting at /Users/glenhenshaw/.julia/packages/Dojo/tpwPK/examples/trajectory_optimization/quadruped_min.jl:64
Hey guys! Congratulations on this interesting package :) I'm just wondering how one can find the paper you're referring to in the readme, I'd be keen to read it!
Best regards,
Fredrik
Dojo.jl/examples/reinforcement_learning/algorithms/ars.jl
Lines 119 to 127 in c513e78
The distributed version updates a different normalizer
for each run. Not sure if that was intentional.
Julia 1.7.2 on macOS 12.3, Apple M1 architecture
julia> include("quadruped_min.jl")
Activating project at `~/.julia/packages/Dojo/frGnC/examples`
┌ Info: MeshCat server started. You can open the visualizer by visiting the following URL in your browser:
└ http://127.0.0.1:8719
typeof(Z) = Vector{Float64}
┌ Warning: need to treat the joint to origin
└ @ Main ~/.julia/packages/Dojo/frGnC/environments/quadruped/methods/template.jl:124
ERROR: LoadError: UndefVarError: spring_impulses not defined
Stacktrace:
[1] gravity_compensation(mechanism::Mechanism{Float64, 38, 13, 13, 12})
@ Main ~/.julia/packages/Dojo/frGnC/environments/quadruped/methods/template.jl:119
[2] top-level scope
@ ~/.julia/packages/Dojo/frGnC/examples/trajectory_optimization/quadruped_min.jl:64
[3] include(fname::String)
@ Base.MainInclude ./client.jl:451
[4] top-level scope
@ REPL[22]:1
in expression starting at /Users/glenhenshaw/.julia/packages/Dojo/frGnC/examples/trajectory_optimization/quadruped_min.jl:64
Dojo.jl/src/orientation/rotate.jl
Line 7 in 0d54f76
I wasn't sure what this function is supposed to do here, but p
is unused.
Is there a way to get access to gradients with respect to a mechanism's model parameters like inertia, mass, and center of mass?
Julia 1.7.2, macOS 12.3, Apple M1 architecture. Appears to happen only when Julia is called with more than one thread, eg "> Julia --threads 3"
julia> include("halfcheetah_ars.jl")
Activating project at `~/.julia/packages/Dojo/tpwPK/examples`
┌ Info: MeshCat server started. You can open the visualizer by visiting the following URL in your browser:
└ http://127.0.0.1:8714
┌ Warning: Assignment to `env` in soft scope is ambiguous because a global variable by the same name exists: `env` will be treated as a new local. Disambiguate by using `local env` to suppress this warning or `global env` to assign to the existing global variable.
└ @ ~/.julia/packages/Dojo/tpwPK/examples/reinforcement_learning/halfcheetah_ars.jl:27
┌ Warning: Assignment to `obs` in soft scope is ambiguous because a global variable by the same name exists: `obs` will be treated as a new local. Disambiguate by using `local obs` to suppress this warning or `global obs` to assign to the existing global variable.
└ @ ~/.julia/packages/Dojo/tpwPK/examples/reinforcement_learning/halfcheetah_ars.jl:29
┌ Info: MeshCat server started. You can open the visualizer by visiting the following URL in your browser:
└ http://127.0.0.1:8715
Training linear policy with Augmented Random Search (ARS)
4
signal (11): Segmentation fault: 11
in expression starting at /Users/glenhenshaw/.julia/packages/Dojo/tpwPK/examples/reinforcement_learning/halfcheetah_ars.jl:25
signal (11): Segmentation fault: 11
in expression starting at /Users/glenhenshaw/.julia/packages/Dojo/tpwPK/examples/reinforcement_learning/halfcheetah_ars.jl:25
signal (6): Abort trap: 6
in expression starting at /Users/glenhenshaw/.julia/packages/Dojo/tpwPK/examples/reinforcement_learning/halfcheetah_ars.jl:25
zsh: abort julia --threads 4
Here's another, different stack trace:
julia> include("halfcheetah_ars.jl")
Activating project at `~/.julia/packages/Dojo/tpwPK/examples`
┌ Info: MeshCat server started. You can open the visualizer by visiting the following URL in your browser:
└ http://127.0.0.1:8713
┌ Warning: Assignment to `env` in soft scope is ambiguous because a global variable by the same name exists: `env` will be treated as a new local. Disambiguate by using `local env` to suppress this warning or `global env` to assign to the existing global variable.
└ @ ~/.julia/packages/Dojo/tpwPK/examples/reinforcement_learning/halfcheetah_ars.jl:27
┌ Warning: Assignment to `obs` in soft scope is ambiguous because a global variable by the same name exists: `obs` will be treated as a new local. Disambiguate by using `local obs` to suppress this warning or `global obs` to assign to the existing global variable.
└ @ ~/.julia/packages/Dojo/tpwPK/examples/reinforcement_learning/halfcheetah_ars.jl:29
┌ Info: MeshCat server started. You can open the visualizer by visiting the following URL in your browser:
└ http://127.0.0.1:8714
Training linear policy with Augmented Random Search (ARS)
3
signal (11): Segmentation fault: 11
in expression starting at /Users/glenhenshaw/.julia/packages/Dojo/tpwPK/examples/reinforcement_learning/halfcheetah_ars.jl:25
loadtriplet! at /Users/sabae/src/julia/usr/share/julia/stdlib/v1.7/Base64/src/encode.jl:0
unsafe_write at /Users/sabae/src/julia/usr/share/julia/stdlib/v1.7/Base64/src/encode.jl:53
unsafe_write at ./io.jl:648 [inlined]
write at ./io.jl:671
unknown function (ip: 0x10c0a5837)
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
#base64encode#5 at /Users/sabae/src/julia/usr/share/julia/stdlib/v1.7/Base64/src/encode.jl:209
base64encode##kw at /Users/sabae/src/julia/usr/share/julia/stdlib/v1.7/Base64/src/encode.jl:206 [inlined]
#base64encode#6 at /Users/sabae/src/julia/usr/share/julia/stdlib/v1.7/Base64/src/encode.jl:216 [inlined]
base64encode at /Users/sabae/src/julia/usr/share/julia/stdlib/v1.7/Base64/src/encode.jl:216 [inlined]
generate_websocket_key at /Users/glenhenshaw/.julia/packages/WebSockets/QcswW/src/WebSockets.jl:548 [inlined]
upgrade at /Users/glenhenshaw/.julia/packages/WebSockets/QcswW/src/HTTP.jl:189
unknown function (ip: 0x10c0a338b)
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
_servercoroutine at /Users/glenhenshaw/.julia/packages/WebSockets/QcswW/src/HTTP.jl:370
macro expansion at /Users/glenhenshaw/.julia/packages/HTTP/aTjcj/src/Servers.jl:415 [inlined]
#13 at ./task.jl:423
unknown function (ip: 0x10bf86bd7)
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
start_task at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
Allocations: 524622903 (Pool: 523434761; Big: 1188142); GC: 176
signal (11): Segmentation fault: 11
in expression starting at /Users/glenhenshaw/.julia/packages/Dojo/tpwPK/examples/reinforcement_learning/halfcheetah_ars.jl:25
loadtriplet! at /Users/sabae/src/julia/usr/share/julia/stdlib/v1.7/Base64/src/encode.jl:0
close at /Users/sabae/src/julia/usr/share/julia/stdlib/v1.7/Base64/src/encode.jl:111
#3 at /Users/sabae/src/julia/usr/share/julia/stdlib/v1.7/Base64/src/encode.jl:42
unknown function (ip: 0x10c0aad5b)
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
run_finalizer at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_gc_run_finalizers_in_list at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_gc_run_all_finalizers at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_atexit_hook at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_exit at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_exit_thread0_cb at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
Allocations: 524622903 (Pool: 523434761; Big: 1188142); GC: 176
cartpole_max
works, encouragingly. But cartpole_min
gives:
julia> include("cartpole_min.jl")
Activating project at `~/.julia/packages/Dojo/6iIp0/examples`
┌ Info: MeshCat server started. You can open the visualizer by visiting the following URL in your browser:
└ http://127.0.0.1:8715
ERROR: LoadError: UndefVarError: cartpole_nominal_max not defined
Stacktrace:
[1] top-level scope
@ ~/.julia/packages/Dojo/6iIp0/examples/trajectory_optimization/cartpole_min.jl:29
[2] include(fname::String)
@ Base.MainInclude ./client.jl:451
[3] top-level scope
@ REPL[5]:1
in expression starting at /Users/glenhenshaw/.julia/packages/Dojo/6iIp0/examples/trajectory_optimization/cartpole_min.jl:29
Julia 1.7.2 on macOS 12.3, Apple M1 architecture.
julia> include("hopper_min.jl")
Activating project at `~/.julia/packages/Dojo/frGnC/examples`
┌ Info: MeshCat server started. You can open the visualizer by visiting the following URL in your browser:
└ http://127.0.0.1:8717
ERROR: LoadError: UndefVarError: raiberthopper_nominal_max not defined
Stacktrace:
[1] top-level scope
@ ~/.julia/packages/Dojo/frGnC/examples/trajectory_optimization/hopper_min.jl:26
[2] include(fname::String)
@ Base.MainInclude ./client.jl:451
[3] top-level scope
@ REPL[19]:1
in expression starting at /Users/glenhenshaw/.julia/packages/Dojo/frGnC/examples/trajectory_optimization/hopper_min.jl:26
I am just trying to run block.jl and get this:
Activating project at `~/Dojo.jl/examples`
ERROR: LoadError: UndefVarError: get_environment not defined
Stacktrace:
[1] top-level scope
@ ~/Dojo.jl/examples/trajectory_optimization/block.jl:13
in expression starting at /root/Dojo.jl/examples/trajectory_optimization/block.jl:13
* The terminal process "julia '--color=yes', '--project=/root/.julia/environments/v1.8', '/root/Dojo.jl/examples/trajectory_optimization/block.jl'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
* Executing task: julia --color=yes --project=/root/.julia/environments/v1.8 /root/Dojo.jl/examples/trajectory_optimization/block.jl
Activating project at `~/Dojo.jl/examples`
ERROR: LoadError: UndefVarError: get_environment not defined
Stacktrace:
[1] top-level scope
@ ~/Dojo.jl/examples/trajectory_optimization/block.jl:13
in expression starting at /root/Dojo.jl/examples/trajectory_optimization/block.jl:13
* The terminal process "julia '--color=yes', '--project=/root/.julia/environments/v1.8', '/root/Dojo.jl/examples/trajectory_optimization/block.jl'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
I installed Dojo, and also DojoEnvironments using the package manager. How can I fix this?
Julia 1.7.2 running on macOS 12.3, Apple M1 architecture. After the training is complete, the examples throw an identical error:
episode 98 reward_evaluation -0.7817167591651243. Took 36.599132333 seconds
episode 99 reward_evaluation -13.705568624874973. Took 36.127634708 seconds
episode 100 reward_evaluation -10.772545859258324. Took 38.790820875 seconds
rewards = [44.0188651955438, 84.07397185902886, 58.151621089522905, 74.00135312248605, 61.31391504999342]
mean(train_time_best) = 2776.0249286366666
std(train_time_best) = 178.33750793333417
mean(rewards) = 64.31194526331501
std(rewards) = 15.355529928613961
WARNING: both Dojo and Base export "close"; uses of it in module Main must be qualified
ERROR: LoadError: UndefVarError: close not defined
Stacktrace:
[1] display_policy(env::Environment{Dojo.Ant, Float64, Mechanism{Float64, 35, 13, 13, 9}, BoxSpace{Float64, 8}, BoxSpace{Float64, 37}, Nothing}, policy::Policy{Float64}, normalizer::Normalizer{Float64}, hp::HyperParameters{Float64}; rendering::Bool)
@ Main ~/.julia/packages/Dojo/frGnC/examples/reinforcement_learning/algorithms/ars.jl:189
[2] display_policy(env::Environment{Dojo.Ant, Float64, Mechanism{Float64, 35, 13, 13, 9}, BoxSpace{Float64, 8}, BoxSpace{Float64, 37}, Nothing}, policy::Policy{Float64}, normalizer::Normalizer{Float64}, hp::HyperParameters{Float64})
@ Main ~/.julia/packages/Dojo/frGnC/examples/reinforcement_learning/algorithms/ars.jl:173
[3] top-level scope
@ ~/.julia/packages/Dojo/frGnC/examples/reinforcement_learning/ant_ars.jl:124
[4] include(fname::String)
@ Base.MainInclude ./client.jl:451
[5] top-level scope
@ REPL[3]:1
in expression starting at /Users/glenhenshaw/.julia/packages/Dojo/frGnC/examples/reinforcement_learning/ant_ars.jl:124
Hi,
I am a bit new to Julia but I would like to use Dojo to build a Simulator for my robot. To start with, I was following this page.
From my understanding, I should specify the path/directory of the urdf files (and the corresponding mesh files). Then call Dojo.Mechanism to load it into the "mechanism" data type. I tried with the urdf file of my robot, as well as the urdf files of
rexhopper from this commit.
However it throws the following error when I try to reproduce it, which looks like the input arguments are not what should be expected.
Any hints on what shall I do to fix this? I much appreciate your help!
I got this permission denied error when I'm trying to build Dojo on both Mac and Linux. Not sure what I did wrong.
(@v1.6) pkg> build Dojo
Building WebIO → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/c9529be473e97fa0b3b2642cdafcd0896b4c9494/build.log`
Building Blink → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/08d0b679fd7caa49e2bca9214b131289e19808c0/build.log`
Building Dojo ─→ `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/97750ad693a1a2e43a9417aed731a15c7543c4ad/build.log`
ERROR: Error building `Dojo`:
Activating environment at `~/.julia/packages/Dojo/tpwPK/examples/Project.toml`
Updating registry at `~/.julia/registries/General`
Installed GR_jll ─────────── v0.64.2+0
Installed DualNumbers ────── v0.6.8
Installed NearestNeighbors ─ v0.4.10
Installed Latexify ───────── v0.15.14
Installed ArrayInterface ─── v5.0.6
Installed AxisArrays ─────── v0.4.5
Installed Distributions ──── v0.25.53
Installed JuMP ───────────── v1.0.0
Installed MathOptInterface ─ v1.1.2
Installed PooledArrays ───── v1.4.1
Installed Expat_jll ──────── v2.4.8+0
Installed StatsFuns ──────── v0.9.17
Installed EllipsisNotation ─ v1.5.0
Installed RecipesPipeline ── v0.5.2
Installed Polyhedra ──────── v0.7.3
Installed Parsers ────────── v2.2.4
Installed ProgressMeter ──── v1.7.2
Installed SciMLBase ──────── v1.29.0
Installed StaticArrays ───── v1.4.3
ERROR: LoadError: SystemError: opening file "/Users/xianyi/.julia/packages/Dojo/tpwPK/examples/Project.toml": Permission denied
Hi ! I'm using Dojo to build my simulation task. I need to create an environment with atlas robot and an object (.obj file). But in your documents, you just mention how to load a urdf file or some meshes, how can I simultaneously load atlas (.urdf) and an object(.obj) into Dojo?
Thanks for your reply !
Julia 1.7.2, macOS 12.3, Apple M1 architecture
julia> include("pendulum_max.jl")
Activating project at `~/.julia/packages/Dojo/frGnC/examples`
ERROR: LoadError: UndefVarError: pendulum_nominal_max not defined
Stacktrace:
[1] top-level scope
@ ~/.julia/packages/Dojo/frGnC/examples/trajectory_optimization/pendulum_max.jl:29
[2] include(fname::String)
@ Base.MainInclude ./client.jl:451
[3] top-level scope
@ REPL[26]:1
in expression starting at /Users/glenhenshaw/.julia/packages/Dojo/frGnC/examples/trajectory_optimization/pendulum_max.jl:29
The simulator prints "clipping .. " whenever it clips the simulator states while performing the simulation. I couldn't find a straighforward way to disable it. Would be great if we have an option to suppress those messages! Thank you!
When going over the API I found a section Defining a Controller, at this section there is an example of single pendulum swing-up.
This example gives the general idea of how to work with the controller but it’s too simple.
what I don’t understand is this:
If my mechanism has multi-body, how do I find and control a specific body/joint? the get_minimal_state
return a vector which holds all the mechanism state without any separation between the different joints.
In the pendulum example the controller out put is a vector of length 2, when the first input is referring to the angular coordinate and the second is for the angular velocity, I don't understand the meaning of applying impulse on this states? when applying the impulse on the angular coordinate state I apply a Torque and when applying impulse on the angular velocity state I apply ... what?
What if I want to apply an external spatial force on a body, as part of the controller, how do I implement it?
If you could provide clearer documentation and some additional example it'll be great.
Thank in ahead and great gob on this package.
There are currently three proper env tests missing as mentioned in #12
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.