How nely-epfl/flygym works
FlyGym is a Python digital-twin and simulation library for embodied fly sensorimotor control. Users compose a fly model and world, run CPU or GPU simulations, and obtain sensory and mechanosensory observations; controllers or learning environments can use those observations to drive actions. The graph includes model composition, simulation and sensing, optional Warp acceleration, and the documented demo workflows. Some subsystem implementations were not sampled, so uncertain connections are omitted; README-described capabilities without a clearly supported source path are represented at the package level.
Main entry points: simulation.py Simulation runtime · base_fly.py Base fly model · base_world.py World composition · hybrid_controller.py Hybrid controller
Components 24
Fly and world models
- Fly anatomy
src/flygym/anatomy.py - Kinematic poses
src/flygym/compose/pose.py - Base fly model
src/flygym/compose/fly/base_fly.py - NeuroMechFly
src/flygym/compose/fly/neuromechfly.py - FlyBody model
src/flygym/compose/fly/flybody.py - Musculoskeletal fly
src/flygym/compose/fly/musculoskeletal.py - World composition
src/flygym/compose/world/base_world.py - Terrain worlds
src/flygym/compose/world/complex_terrain.py - Contact physics
src/flygym/compose/physics.py
Simulation and sensing
- Simulation runtime
src/flygym/simulation.py - Rendering and viewer
src/flygym/rendering.py - Retina vision
src/flygym/vision/retina.py - Olfactory inputs
src/flygym - Mechanosensory feedback
src/flygym/simulation.py
Warp backend
- Warp simulation
src/flygym/warp/simulation.py - Warp rendering
src/flygym/warp/rendering.py
Locomotion demos
- Locomotion setup
src/flygym_demo/complex_terrain/common.py - Step patterns
src/flygym_demo/complex_terrain/preprogrammed.py - CPG controller
src/flygym_demo/complex_terrain/cpg_controller.py - Hybrid controller
src/flygym_demo/complex_terrain/hybrid_controller.py
Imitation learning
- Motion capture data
src/flygym_demo/muscle_imitation/data.py - Imitation environment
src/flygym_demo/muscle_imitation/env.py - Imitation training
src/flygym_demo/muscle_imitation/train.py
Other components
- Library user
Connections 27
- Library user → Simulation runtime: runs
- Library user → World composition: composes scene
- Base fly model → Fly anatomy: uses anatomy
src/flygym/compose/fly/base_fly.py - Base fly model → Kinematic poses: uses poses
src/flygym/compose/fly/base_fly.py - Base fly model → Contact physics: configures contacts
- NeuroMechFly → Base fly model: specializes
- FlyBody model → Base fly model: extends model
src/flygym/compose/fly/flybody.py - Musculoskeletal fly → Base fly model: specializes
- World composition → NeuroMechFly: accepts fly
src/flygym/compose/world/base_world.py - Terrain worlds → World composition: specializes
- Simulation runtime → World composition: compiles world
src/flygym/simulation.py - Simulation runtime → Rendering and viewer: renders frames
src/flygym/simulation.py - Simulation runtime → Retina vision: gets vision
src/flygym/simulation.py - Simulation runtime → Mechanosensory feedback: reads contacts
src/flygym/simulation.py - Simulation runtime → Olfactory inputs: provides inputs
src/flygym/simulation.py - Library user → Warp simulation: runs GPU mode
- Warp rendering → Rendering and viewer: reuses rendering
src/flygym/warp/rendering.py - Locomotion setup → Fly anatomy: uses joint types
src/flygym_demo/complex_terrain/common.py - Locomotion setup → Simulation runtime: sets actions
src/flygym_demo/complex_terrain/common.py - CPG controller → Step patterns: maps oscillator state
src/flygym_demo/complex_terrain/cpg_controller.py - Hybrid controller → CPG controller: advances network
src/flygym_demo/complex_terrain/hybrid_controller.py - Hybrid controller → Step patterns: uses step patterns
src/flygym_demo/complex_terrain/hybrid_controller.py - Hybrid controller → Simulation runtime: reads observations
src/flygym_demo/complex_terrain/hybrid_controller.py - Imitation environment → Simulation runtime: steps simulation
src/flygym_demo/muscle_imitation/env.py - Imitation environment → Motion capture data: loads reference data
src/flygym_demo/muscle_imitation/env.py - Imitation training → Imitation environment: trains policy
src/flygym_demo/muscle_imitation/train.py - Imitation training → Motion capture data: uses dataset
src/flygym_demo/muscle_imitation/train.py