From ff74624bf593b89eeaa4bb8dc85bb9facde13b5b Mon Sep 17 00:00:00 2001 From: Filippo Luca Ferretti Date: Mon, 8 Jan 2024 10:38:57 +0100 Subject: [PATCH] Add examples' README and rename `pixi run` command --- examples/README.md | 39 +++++++++++++++++++++++++++++++++++++++ examples/pixi.toml | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 examples/README.md diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 000000000..0915eb84d --- /dev/null +++ b/examples/README.md @@ -0,0 +1,39 @@ +# JAXsim Notebook Examples + +This folder includes a Jupyter Notebook demonstrating practical usage of JAXsim for system simulations. + +### Examples + +- [PD_controller](./PD_controller.ipynb) - A simple example demonstrating the use of JAXsim to simulate a PD controller with gravity compensation for a 2-DOF cartpole. + +> [!TIP] +> Stay tuned for more examples! + +## Running the Examples + +To execute these examples utilizing JAXsim with hardware acceleration, there are a couple of options available: + +### Option 1: Google Colab (Recommended) + +The simplest way to run the examples is by accessing the provided Google Colab notebook link mentioned above. This will enable you to execute the examples in a hosted environment. +### Option 2: Local Execution with `pixi` + +For local execution, follow these steps: + +1. **Install `pixi`:** + +As per the [official documentation](https://pixi.sh/#installation): + +```bash +curl -fsSL https://pixi.sh/install.sh | bash +``` + +2. **Run the Example Notebook:** + +Use `pixi run ` to execute the example notebook locally, e.g.: + +```bash +pixi run PD_controller +``` + +This command will automatically handle the installation of necessary dependencies and execute the examples within a self-contained environment \ No newline at end of file diff --git a/examples/pixi.toml b/examples/pixi.toml index df7af2bea..4229fe34c 100644 --- a/examples/pixi.toml +++ b/examples/pixi.toml @@ -11,8 +11,8 @@ cuda = "12" unix = true [tasks] +PD_controller = {cmd = "jupyter notebook PD_controller.ipynb", depends_on = ["install"]} install = "python -m pip install git+https://github.com/ami-iit/jaxsim.git" -notebook = {cmd = "jupyter notebook PD_controller.ipynb", depends_on = ["install"]} [dependencies] cuda-nvcc = {channel = "nvidia", version = ">=12.3,<12.4"}