We have pre programmed a number of handy constants for the user:


# All actively actuatable DoFs in the legs
>>> flygym.mujoco.preprogrammed.all_leg_dofs
['joint_LFCoxa', 'joint_LFCoxa_roll', 'joint_LFCoxa_yaw', 'joint_LFFemur', 'joint_LFFemur_roll', 'joint_LFTibia', 'joint_LFTarsus1', 'joint_LMCoxa', 'joint_LMCoxa_roll', 'joint_LMCoxa_yaw', 'joint_LMFemur', 'joint_LMFemur_roll', 'joint_LMTibia', 'joint_LMTarsus1', 'joint_LHCoxa', 'joint_LHCoxa_roll', 'joint_LHCoxa_yaw', 'joint_LHFemur', 'joint_LHFemur_roll', 'joint_LHTibia', 'joint_LHTarsus1', 'joint_RFCoxa', 'joint_RFCoxa_roll', 'joint_RFCoxa_yaw', 'joint_RFFemur', 'joint_RFFemur_roll', 'joint_RFTibia', 'joint_RFTarsus1', 'joint_RMCoxa', 'joint_RMCoxa_roll', 'joint_RMCoxa_yaw', 'joint_RMFemur', 'joint_RMFemur_roll', 'joint_RMTibia', 'joint_RMTarsus1', 'joint_RHCoxa', 'joint_RHCoxa_roll', 'joint_RHCoxa_yaw', 'joint_RHFemur', 'joint_RHFemur_roll', 'joint_RHTibia', 'joint_RHTarsus1']

# 3 DoFs per leg used in the CPG optimization task performed in Lobato-Rios et al., 2022.
# These are the most variable DoFs during tethered locomotion
>>> flygym.mujoco.preprogrammed.leg_dofs_3_per_leg
['joint_LFCoxa', 'joint_LFFemur', 'joint_LFTibia', 'joint_LMCoxa_roll', 'joint_LMFemur', 'joint_LMTibia', 'joint_LHCoxa_roll', 'joint_LHFemur', 'joint_LHTibia', 'joint_RFCoxa', 'joint_RFFemur', 'joint_RFTibia', 'joint_RMCoxa_roll', 'joint_RMFemur', 'joint_RMTibia', 'joint_RHCoxa_roll', 'joint_RHFemur', 'joint_RHTibia']

Body segments#

# All tarsal segments, useful for defining leg-ground contacts
>>> flygym.mujoco.preprogrammed.all_tarsi_links
['LFTarsus1', 'LFTarsus2', 'LFTarsus3', 'LFTarsus4', 'LFTarsus5', 'LMTarsus1', 'LMTarsus2', 'LMTarsus3', 'LMTarsus4', 'LMTarsus5', 'LHTarsus1', 'LHTarsus2', 'LHTarsus3', 'LHTarsus4', 'LHTarsus5', 'RFTarsus1', 'RFTarsus2', 'RFTarsus3', 'RFTarsus4', 'RFTarsus5', 'RMTarsus1', 'RMTarsus2', 'RMTarsus3', 'RMTarsus4', 'RMTarsus5', 'RHTarsus1', 'RHTarsus2', 'RHTarsus3', 'RHTarsus4', 'RHTarsus5']
flygym.mujoco.preprogrammed.get_collision_geometries(config: str = 'all') List[str]#

Get the list of collision geometries given the key: “all” (all body segments), “legs-no-coxa” (all leg segments excluding the coxa segments), “tarsi” (all tarsus segments), and “none” (nothing).


flygym.mujoco.preprogrammed.get_preprogrammed_pose(pose: str) KinematicPose#

Load the preprogrammed pose given the key. Available poses are found in the data directory: flygym/data/pose/pose_{key}.yaml. Included poses are:

  • “stretch”: all legs are fully extended sideways to ensure that the legs are not embeded into the ground upon initialization, which breaks the physics. This is the suggested initial pose.

  • “tripod”: a snapshot of a tethered fly walking in a tripod gait.

  • “zero”: the zero pose of the NeuroMechFly model. Not that the fly should be spawn significantly above the ground to insure that the legs are not extended into the ground upon initialization.