Skip to content

Commit 9da620d

Browse files
authored
Update README.md
1 parent 50588d3 commit 9da620d

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

README.md

+16-4
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,25 @@ We envision our model as a platform for fruit fly biophysics simulations and for
1919

2020
The fruit fly body model lives in [this directory][fly-home]. To visualize it, you can drag-and-drop `fruitfly.xml` or `floor.xml` to MuJoCo's `simulate` viewer.
2121

22-
Beginning interacting with the model via Python is as simple as:
22+
Interacting with the fly via Python is as simple as:
2323

2424
```python
25-
from dm_control import mujoco
25+
import numpy as np
26+
import mediapy
2627

27-
physics = mujoco.Physics.from_xml_path('flybody/fruitfly/assets/fruitfly.xml') # Load model.
28-
physics.step() # Step simulation.
28+
from flybody.fly_envs import walk_imitation
29+
30+
# Create walking imitation environment.
31+
env = walk_imitation()
32+
33+
# Run environment loop with random actions for a bit.
34+
for _ in range(100):
35+
action = np.random.normal(size=59) # 59 is the walking action dimension.
36+
timestep = env.step(action)
37+
38+
# Generate a pretty image.
39+
pixels = env.physics.render(camera_id=1)
40+
mediapy.show_image(pixels)
2941
```
3042

3143
The quickest way to get started with `flybody` is to take a look at a [tutorial notebook][tutorial] or [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)][tutorial-colab].

0 commit comments

Comments
 (0)