Skip to content

Commit

Permalink
Add examples' README and rename pixi run command
Browse files Browse the repository at this point in the history
  • Loading branch information
flferretti committed Jan 8, 2024
1 parent cc8f4f1 commit ff74624
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
39 changes: 39 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -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 <notebook_name>` 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
2 changes: 1 addition & 1 deletion examples/pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down

0 comments on commit ff74624

Please sign in to comment.