Step 1, get WSL2.
Turn Windows Features on or off
and open, tick Windows subsystem for Linux
.4.1. winkey+R, type in %USERPROFILE% 4.2. create a new file named
.wslconfig
with content [wsl2] guiApplications=false 4.3. restart wsl by opening a cmd.exe with admin privilege running commandwsl --shutdown
seehttps://x410.dev/cookbook/wsl/disabling-wslg-or-using-it-together-with-x410/
Step 2, get VS Code.
In VS Code, install the extension named “WSL”. It allows you to work with a terminal as if you are on an Ubuntu machine.
Step 3, install pydrake.
https://drake.mit.edu/pydrake/pydrake.tutorials.html https://drake.mit.edu/python_bindings.html#using-the-python-bindings
The official steps are:
ON WSL2 Ubuntu 20.04
sudo apt-get update
sudo apt install python3-pip
sudo apt install python3.8-venv
# this will create a folder named "./main2" in the current directory "."
python3 -m venv main2
main2/bin/pip install drake
main2/bin/pip install notebook
main2/python3 -m pydrake.tutorials
http://localhost:7000/
# open authoring_multibody_simulation.ipynb
BUT somehow I cannot enable my python3 venv encironment in wsl2. Instead, I run pydrake without setting an virtual environment.
Step 4, model simple system in drake.
Step 5, https://github.com/RussTedrake/underactuated
git clone https://github.com/RussTedrake/underactuated.git
to run, e.g., ipynb in folder ./dp, you need to fix the dependency issue by adding following snippets
import sys; sys.path.insert(0, '/home/hory/codes/underactuated')
import sys; sys.path.append('../')
import sys, os; sys.path.append(os.path.dirname(os.path.abspath(__file__)))
pip3 install mpld3 packaging
Related Links:
https://github.com/robotics-laboratory/cart-pole https://cartpole.robotics-lab.ru/3.0.0/dynamics/ https://www.youtube.com/@robotics_lab/videos