NeLy-EPFL / flygym

Simulating embodied sensorimotor control with NeuroMechFly v2
https://neuromechfly.org/
Apache License 2.0
31 stars 7 forks source link

Cardinal vector sensing #214

Closed sibocw closed 2 months ago

sibocw commented 2 months ago

Description

Previously, we returned the "forward" heading of the fly (fly_orientation in the observation). Now, I'm adding the same thing but also for the side and up. The results are returned under the cardinal_vectors key in the observation dictionary, which is a (3, 3) vector. The 0th dimension specifies the three cardinal vectors; the 1st dimension specifies the x, y, z values of the vectors.

In the video below, the three cardinal vectors (cardinal_vectors[0, :], cardinal_vectors[1, :], cardinal_vectors[2, :]) are marked in red, green, blue. Two things are still unclear to me:

  1. Why is the forward vector tilted up by about 30 degrees?
  2. Why is the order left-up-front instead of front-left-up, as is the case in the mesh file?

My guess is that these have to do with how the model is configured in Blender, but I'm deferring it because it's still functional and changing it will break backward compatibility. This issue is documented in #215.

https://github.com/user-attachments/assets/2ede4c94-76bd-43bf-9604-c3cd26b6d375

https://github.com/user-attachments/assets/107835d4-f73b-417c-9793-b41bac3d6731

Related to this, I changed how spawn orientations are processed. In the previous versions, pi/2 is subtracted from the spawn orientation specified by the user upon init. I got rid of this confusing step and changed the default angle to make the default behavior equivalent. The spawn orientations in examples and tutorials are changed accordingly. This is a minor non-backward-compatible change.

Does this address any currently open issues?

No