-
Install necessary system packages on our Ubuntu machine using the command:
sudo apt install git python3-pip python3-venv python-is-python3python3-pipis the package manager for Python 3, which allows you to install and manage Python packages.python3-venvis the module for creating isolated Python environments, which are useful for keeping the dependencies for different projects separate.python-is-python3is a utility package to ensure that we use Python 3 when we typepython.
Note that the
sudocommand is used to run the command as a superuser, which is necessary when installing packages globally on the system. Theaptcommand 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/labs434python -m venvis the command to run thevenv, which is used to create isolated Python environments using our currentpythoninterpreter. You can check the version of your interprete by typingpython --version.- The
~/venv/labs434argument specifies the location and name of the virtual environment. In this case, it creates a virtual environment calledlabs434in the.venvdirectory located in the home directory of the user (indicated by the tilde~symbol). - Check the content inside the newly created directory
labs434created under~/venvby 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
labs434Python environment using the command for the current shell:source ~/venv/labs434/bin/activateWhen 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
sourcecommand 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 thedeactivatecommand to exit the virtual environment.You need to repeat the command every time you open the terminal or add it into your
.bashrcscript. -
Install Python packages we will use once you have activated the virtual environment
python -m pip install mujocoFeel free to install other packages when you need them.
-
Now explore some high-quality MuJoCo models, which can be found DeepMind's
mujoco_menagerierepository. For that, clone the repo into a directory named~/labs434/mujoco_menagerieas 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.xmlThis 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).
bouncmpe/labs434
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|