Skip to content

Commit 4bc6d5e

Browse files
authored
Merge pull request #180 from NeLy-EPFL/dev-v1.0.0-pre.2
Release: v1.0.0-pre.2
2 parents 404df67 + 166b766 commit 4bc6d5e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+11379
-258
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
### Description
22
[describe your changes here]
33

4-
### Types of changes
5-
6-
- [ ] Bugfix
7-
- [ ] New feature
8-
- [ ] Refactor / Code style update (no logical changes)
9-
- [ ] Build / CI changes
10-
- [ ] Documentation Update
11-
- [ ] Other (explain)
12-
134
### Does this address any currently open issues?
145
[list open issues here]

.github/workflows/documentation.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ jobs:
3434
if-no-files-found: error
3535
retention-days: 1
3636
compression-level: 6
37-
overwrite: false
37+
overwrite: false

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[**Documentation**](https://neuromechfly.org/) | [**Preprint**](https://www.biorxiv.org/content/10.1101/2023.09.18.556649) | [**Discussion Board**](https://github.com/NeLy-EPFL/flygym/discussions)
66

7-
![Python: 3.7–3.12](https://img.shields.io/badge/python-3.7%E2%80%933.12-blue)
7+
![Python: 3.9–3.12](https://img.shields.io/badge/python-3.9%E2%80%933.12-blue)
88
[![License: MPL 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/NeLy-EPFL/flygym/blob/main/LICENSE)
99
[![PyPI version](https://badge.fury.io/py/flygym.svg)](https://badge.fury.io/py/flygym)
1010
![Repo Size](https://img.shields.io/github/repo-size/NeLy-EPFL/flygym)
@@ -31,7 +31,7 @@ In brief:
3131
pip install "flygym"
3232
```
3333

34-
See [our website](https://neuromechfly.org/installation.html) for details, especially if you plan to install FlyGym in the developer mode (i.e. if you plan to make changes to the code). Dependencies are specified in [`setup.py`](https://github.com/NeLy-EPFL/flygym/blob/main/setup.py) and will be installed automatically upon installation using pip. Installation should take no more than a few minutes. NeuroMechFly has been tested on Linux (Ubuntu 22.04.3) and macOS (13.5.2). All commits are tested automatically using the latest Ubuntu version on Python versions 3.7 through 3.12 (see [CI workflow](https://github.com/NeLy-EPFL/flygym/blob/main/.github/workflows/tests.yaml) for exact test specification). The PyPI version of the current release of FlyGym is indicated on the shield at the top of this page. No special or paid software is required to use FlyGym.
34+
See [our website](https://neuromechfly.org/installation.html) for details, especially if you plan to install FlyGym in the developer mode (i.e. if you plan to make changes to the code). Dependencies are specified in [`setup.py`](https://github.com/NeLy-EPFL/flygym/blob/main/setup.py) and will be installed automatically upon installation using pip. Installation should take no more than a few minutes. NeuroMechFly has been tested on Linux (Ubuntu 22.04.3) and macOS (13.5.2). All commits are tested automatically using the latest Ubuntu version on Python versions 3.9 through 3.12 (see [CI workflow](https://github.com/NeLy-EPFL/flygym/blob/main/.github/workflows/tests.yaml) for exact test specification). The PyPI version of the current release of FlyGym is indicated on the shield at the top of this page. No special or paid software is required to use FlyGym.
3535

3636
## Demos
3737
See [our website](https://neuromechfly.org/tutorials/index.html) for tutorials, including expected outputs. For code blocks that take more than a few seconds to run, the running time (on a 2020 MacBook Pro with M1 processor running macOS 13.5.2) is indicated, typically in the form of a progress bar.

doc/source/api_ref/camera.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Camera
2+
======
3+
4+
The ``Camera`` class defines how images should be rendered from a camera in the world model. Note that the ``Camera`` class does not by itself add a camera to the MuJoCo model — the camera must have already existed and can be referenced by its name. The camera can be added in two ways:
5+
6+
1. By adding a camera to the MuJoCo model file. Refer to the `section on camera <https://mujoco.readthedocs.io/en/stable/XMLreference.html#body-camera>`_ in the MuJoCo XML reference for more information. As an example, the following XML code adds a tracking camera to the MuJoCo model:
7+
8+
.. code-block:: xml
9+
10+
<worldbody>
11+
<!-- ... other things ... -->
12+
<camera name="camera_top" class="nmf" mode="track" ipd="0.068" pos="0 0 8" euler="0 0 0"/>
13+
</worldbody>
14+
15+
2. By calling ``.worldbody.add()`` on the root element of the MuJoCo model programmatically in Python. Practically, this can be done by extending an existing FlyGym Arena class and adding the camera in the ``__init__`` method. For example, the following code adds a stationary bird's eye camera to the MuJoCo model:
16+
17+
.. code-block:: python3
18+
19+
from flygym.arena import BaseArena
20+
21+
class MyArena(BaseArena):
22+
def __init__(self):
23+
super().__init__()
24+
self.birdeye_cam = self.root_element.worldbody.add(
25+
"camera",
26+
name="birdseye_cam",
27+
mode="fixed",
28+
pos=(20, 0, 20),
29+
euler=(0, 0, 0),
30+
fovy=60,
31+
)
32+
# ... other things ...
33+
34+
Once the camera is added to the MuJoCo model, it can be referenced by its name to initialize the ``Camera`` object with additional parameters assigned to it. These can include: rendering rate in frames-per-second (FPS), window size, play speed, etc. Furthermore, the ``Camera`` class has useful methods such as ``.save_video``, ``.reset``, etc. Logics such as rotating the camera in tilted terrain are also implemented in the ``Camera`` class. The ``.render`` method is the main point of entry for fetching images from the camera.
35+
36+
The full API reference of the ``Camera`` class is as follows:
37+
38+
.. autoclass:: flygym.camera.Camera
39+
:members:
40+
:undoc-members:
41+
:show-inheritance:

doc/source/api_ref/examples/locomotion.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Locomotion
22
==========
33

4+
Preprogrammed steps
5+
-------------------
6+
7+
.. autoclass:: flygym.examples.locomotion.PreprogrammedSteps
8+
:members:
9+
:undoc-members:
10+
:show-inheritance:
11+
:inherited-members:
12+
413
CPG controller
514
--------------
615

doc/source/api_ref/examples/olfaction.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Olfaction
2-
=========
1+
Advanced Olfaction
2+
==================
33

44
Arenas
55
------

doc/source/api_ref/examples/vision.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Vision
2-
======
1+
Advanced Vision
2+
===============
33

44
Arenas
55
------

doc/source/api_ref/fly.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Fly
2+
===
3+
4+
An object of the ``Fly`` class is an instance of a simulated fly. There can be multiple flies in a `Simulation <simulation.html>`_. The ``Fly`` object contains parameters related to the fly but not the whole simulation: for example, the set of actuated joints, spawn position, joint actuator parameters (stiffness, damping, etc.), and initial pose.
5+
6+
.. autoclass:: flygym.Fly
7+
:members:

doc/source/api_ref/index.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ This section of the documentation provides the complete API reference for the Fl
77
.. toctree::
88
:maxdepth: 2
99

10-
parameters
11-
simulation
10+
fly
1211
arena
12+
camera
13+
simulation
1314
state
1415
vision
1516
olfaction
1617
utils
1718
preprogrammed
18-
examples/index
19+
examples/index
20+
legacy

doc/source/api_ref/legacy.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Legacy API
2+
==========
3+
4+
.. warning::
5+
6+
This API, inherited from the 0.x.x versions, is deprecated and will be removed in a future release. Please use the new API (the rest of the documentation) instead.
7+
8+
.. automodule:: flygym.core
9+
:members:
10+
:undoc-members:
11+
:show-inheritance:

0 commit comments

Comments
 (0)