-
Install necessary system packages on our Ubuntu machine using the command:
sudo apt install git python3-pip python3-venv python-is-python3
python3-pip
is the package manager for Python 3, which allows you to install and manage Python packages.python3-venv
is the module for creating isolated Python environments, which are useful for keeping the dependencies for different projects separate.python-is-python3
is a utility package to ensure that we use Python 3 when we typepython
.
Note that the
sudo
command is used to run the command as a superuser, which is necessary when installing packages globally on the system. Theapt
command stands for Advanced Packaging Tool and is used to manage packages on Debian-based systems like Ubuntu. -
Setup an isolated Python environment for CMPE434 labs using
venv
(virtual environment) module.python -m venv ~/venv/labs434
python -m venv
is the command to run thevenv
, which is used to create isolated Python environments using our currentpython
interpreter. You can check the version of your interprete by typingpython --version
.- The
~/venv/labs434
argument specifies the location and name of the virtual environment. In this case, it creates a virtual environment calledlabs434
in the.venv
directory located in the home directory of the user (indicated by the tilde~
symbol). - Check the content inside the newly created directory
labs434
created under~/venv
by typingls ~/venv/labs434
. This is a standalone Python environment to store the installed packages and scripts. And you can create multiple environments as needed.
We do this step because the robotics software development greatly suffers from the problem of managing dependencies to other software components (in this case other Python packages). Often we work on multiple projects with clashing dependency requ'rements hence isolated environments are very helpful in these situations.
-
Activate the
labs434
Python environment using the command for the current shell:source ~/venv/labs434/bin/activate
When you activate a virtual environment, you are essentially changing your shell's environment so that it uses the packages and dependencies contained within that virtual environment, instead of the system-wide packages. This allows you to work with different versions of packages, without affecting other projects that may be using different versions.
The
source
command is used to run the activate script within the current shell, allowing it to modify the shell's environment. The modified environment lasts as long as the shell session is active or until you run thedeactivate
command to exit the virtual environment.You need to repeat the command every time you open the terminal or add it into your
.bashrc
script. -
Install Python packages we will use once you have activated the virtual environment
python -m pip install mujoco
Feel free to install other packages when you need them.
-
Now explore some high-quality MuJoCo models, which can be found DeepMind's
mujoco_menagerie
repository. For that, clone the repo into a directory named~/labs434/mujoco_menagerie
as follows:git clone https://github.com/deepmind/mujoco_menagerie.git ~/labs434/mujoco_menagerie
-
Start the viewer for the Robotiq 2F-85 model:
python -m mujoco.viewer --mjcf ~/labs434/mujoco_menagerie/robotiq_2f85/scene.xml
This is the MuJoCo model of a robotic gripper together with a hanging box. Find the control tab and control the robot's position from the lever.
-
Go and try out other models in the repository.
-
Check out the MuJoCo documentation (https://mujoco.readthedocs.io).
-
Notifications
You must be signed in to change notification settings - Fork 1
License
bouncmpe/labs434
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
License
Code of conduct
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published