neuromechfly
Fly
¶
Bases: NeuroMechFly
Deprecated alias for NeuroMechFly. Will be removed in a future release.
Source code in src/flygym/compose/fly/neuromechfly.py
NeuroMechFly
¶
Bases: BaseFly
The NeuroMechFly body model for Drosophila melanogaster.
NeuroMechFly is derived from a micro-CT scan of a real fly. It is the
default body model in FlyGym and supports all locomotion, sensorimotor,
and vision experiments. For an alternative anatomically detailed model
with wing and abdomen degrees of freedom, see FlyBody.
Both NeuroMechFly and FlyBody inherit from BaseFly and expose the
same composition API, so they can be used interchangeably.
See NeuroMechFlyWithSeparateTrochanterFemur for a variant of this model
where the trochanter and femur are separate body segments (instead of fused
into a single segment). The user can still effectively fuse the two by not
adding any joint between them (which is the case by default). When MuJoCo
compiler parameter fusestatic is set to true, the two segment will
actually be fused at compile time. Tentatively,
NeuroMechFlyWithSeparateTrochanterFemur will fully replace NeuroMechFly
in FlyGym 3.0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Identifier for this fly instance. Defaults to |
'nmf'
|
rigging_config_path
|
PathLike
|
Path to YAML file defining body segment positions, orientations, and masses. |
DEFAULT_RIGGING_CONFIG_PATH
|
mesh_basedir
|
PathLike
|
Directory containing STL mesh files for body segments. |
DEFAULT_MESH_DIR
|
mujoco_globals_path
|
PathLike
|
Path to YAML file with global MuJoCo parameters. |
DEFAULT_MUJOCO_GLOBALS_PATH
|
root_segment
|
BodySegment | str
|
Root body segment for the kinematic tree. |
'c_thorax'
|
mirror_left2right
|
bool
|
If True, mirror left-side meshes for the right side. |
True
|
mesh_type
|
MeshType
|
Mesh resolution to use. |
SIMPLIFIED_MAX2000FACES
|
geom_fitting_option
|
GeomFittingOption
|
How to fit collision geometries. |
UNMODIFIED
|
vision_config_path
|
PathLike
|
Path to YAML file with vision sensor configuration. |
DEFAULT_VISION_CONFIG_PATH
|
Source code in src/flygym/compose/fly/neuromechfly.py
colorize(visuals_config_path=DEFAULT_VISUALS_CONFIG_PATH)
¶
Apply colors and textures to the NeuroMechFly model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
visuals_config_path
|
PathLike
|
Path to the YAML file defining per-segment material and texture assignments. Defaults to the bundled NeuroMechFly visuals. |
DEFAULT_VISUALS_CONFIG_PATH
|
Source code in src/flygym/compose/fly/neuromechfly.py
NeuroMechFlyWithSeparateTrochanterFemur
¶
Bases: BaseFly
NeuroMechFly with the trochanter and the femur as separate body segments.
In NeuroMechFly, the trochanter and the femur form a single trochanterfemur
segment. Here, they are separate segments (e.g. lf_trochanter and lf_femur),
so that each has its own body and geom (e.g. for segmentation maps). Use
SeparateTrochanterFemurJointPreset and
SeparateTrochanterFemurContactBodiesPreset instead of JointPreset and
ContactBodiesPreset with this model.
The two are often considered to be fused in real flies (at least in Lobato-Rios et
al., 2022), so biological joint presets add no DoF between them and the kinematics
are the same as in NeuroMechFly. The physics is close but not bit-for-bit
identical, because the mass distribution of the two segments is derived from
separate meshes. Joint DoFs of the fused anatomy are renamed: the
coxa-trochanterfemur joint becomes the coxa-trochanter joint, and the
trochanterfemur-tibia joint becomes the femur-tibia joint (see
flygym.anatomy.separate_trochanterfemur_in_dof_name). Poses defined for the fused
anatomy, such as KinematicPosePreset.NEUTRAL, are renamed automatically.
The user can still effectively fuse the two segments by not adding any joint between
them (which is the case by default). When MuJoCo compiler parameter fusestatic
is set to true, the two segment will actually be fused at compile time.
This model will tentatively replace NeuroMechFly in FlyGym 3.0.
Source code in src/flygym/compose/fly/neuromechfly.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | |
colorize(visuals_config_path=DEFAULT_VISUALS_CONFIG_PATH)
¶
get_pose_lookup(neutral_pose)
¶
Same as BaseFly.get_pose_lookup, but DoF names of the fused
trochanterfemur are renamed to their equivalents in this model.