This repository contains a short example of setting up a Julia project for robotics research using MuJoCo.jl. Note that MuJoCo.jl is still under development and usage may change in the future!
An easy way to install Julia is via juliaup. For Mac or Linux, install with
curl -fsSL https://install.julialang.org | sh
and follow the prompts in your terminal. For Windows, use
winget install julia -s msstore
To play around with Julia, do the following:
-
Open a terminal and navigate to the directory in which you cloned the repository. Start up a Julia session by typing
juliain your terminal. -
You are now in the REPL. Write any Julia code in this interactive terminal to test it out. Eg:
print("Hello World! Welcome to the PRESS HDR Conference!")-
To add packages, enter the package manager and add packages as follows:
- Type
]to enter the package manager - Type
activate .to activate/create a project - Type
add Randomto add theRandom.jlpackage - Press
Backspaceto exit the package manager
- Type
-
You can now load in packages and play around with them. For example:
using Random
for k in 1:100
print(rand())
end- Type
exit()to quit Julia.
To install and play around with this package, you will need to:
-
Clone this repository with (for example):
git clone https://github.com/nic-barbara/PRESS-HDR-Conference2023.git -
Open a terminal and navigate to the directory in which you cloned the repository. Start up a Julia session by typing
juliain your terminal. -
Enter the package manager by typing
]into the Julia REPL. You can now install all the dependencies for this project with:pkg> activate . pkg> instantiate[NOTE:] If you encounter any issues with git credentials at this step, you may need to include define the following environment variable in your
.bashrc(or equivalent for Windows/Mac):export JULIA_PKG_USE_CLI_GIT=true. This is just becauseMuJoCo.jlis currently an unregistered package and is still in development. -
You are now ready to run the program, which will simulate a cart-pole system balancing its pendulum upright. Hit
Backspacein the terminal to exit the package manager, and run the code withjulia> include("src/cartpole_lqr.jl")after it compiles everything, you should now see a cart-pole system balancing on your screen.
-
Have fun with it! Press
F1to see the menu of available options. Some useful button/mouse combos are:- Press
CTRL+RightArrow(orCMDfor Mac) to turn on the controller - Press
SPACEto pause/un-pause - Double-click on an object select it
CTRL+RightClickand drag to apply a force- Press
ESCto exit the simulation
- Press
-
If you're keen on exploring MuJoCo.jl, try running a more complex experiment with the MuJoCo humanoid model using
julia> include("src/humanoid_lqr.jl")and play around with it in exactly the same way as the cart-pole model.
-
To close Julia, navigate back to the terminal and type
exit().
For any questions, please contact Nic Barbara at nicholas.barbara@sydney.edu.au