Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification of Coordinate Systems in Documentation #63

Open
defrag-bambino opened this issue Oct 1, 2024 · 9 comments
Open

Clarification of Coordinate Systems in Documentation #63

defrag-bambino opened this issue Oct 1, 2024 · 9 comments
Assignees

Comments

@defrag-bambino
Copy link

Hi,

I am trying to deploy a learned controller from PyFlyt onto a real quadcopter running Ardupilot. As far as I can tell these two use different coordinate system conventions. Namely: PyFlyt uses ENU (which means on the body of the drone its forward is X, to the left is Y and up is Z; Ardupilot uses NED (i.e. forward X, right Y and Z down). Is this correct thus far?
Also, I am unsure about the direction of rotation for yaw pitch roll in PyFlyt. Looking at the illustration provided in the paper, which way is a positive roll for example?
image
Ideally, the image containing this information should provided in the documentation.

Thanks!

@jet-sony
Copy link
Contributor

jet-sony commented Oct 1, 2024

Hi, admitttedly, even I had an issue with different axis convention when trying to deploy agents onto real quadcopters (PX4, Crazyflie, and Ardupilot all use different conventions).

PyFlyt used ENU / FLU:

  • Front X
  • Left Y
  • Up Z

Ardupilot uses NED / FRD:

  • Front X
  • Right Y
  • Down Z

Rotation conventions always follow right hand thumb rule, this is the standard regardless of NED/ENU:
image

Therefore, for PyFlyt (Front X) and Ardupilot (Front X), roll positive would be facing-forwards-clockwise.
However, in PyFlyt (Left Y), pitching positive would be pitching downwards; in Ardupilot (Right Y), pitching positive would be pitching upwards.

Hope this clarifies things!

@jjshoots jjshoots self-assigned this Oct 1, 2024
@defrag-bambino
Copy link
Author

Thanks!
What is the range for the rotations? Are they in [0, pi] or [-pi/2, pi/2] or [0,1] ...?

@jjshoots
Copy link
Owner

jjshoots commented Oct 4, 2024

[-pi, pi].

@defrag-bambino
Copy link
Author

And for angular velocities? Rad/s?

@jet-sony
Copy link
Contributor

jet-sony commented Oct 7, 2024

Yep!

@defrag-bambino
Copy link
Author

I think I've found my issue. It is related to the network outputs, rather than inputs.
The flight mode documentation says "0: vp, vq, vr, T" (angular velocities). Therefore I expected the four outputs of the network to be in the order "pitch, yaw, roll, throttle". However, it seems that it is actually "yaw, pitch, roll, throttle"?

@jet-sony
Copy link
Contributor

Are you intending to output to a crazyflie IRL? If the policy was trained in one of the gym envs within PyFlyt, the outputs should be "roll, pitch, yaw, theust" (v-pqr, T). The rotational outputs always follow the axes of the linear frames. If your intended goal is to output to a crazyflie, then it is likely in the form of "pitch, roll, yaw, thrust". I would try isolating outputs (by setting everything else to 0), and then activating only one output.

@zcase
Copy link

zcase commented Oct 28, 2024

@jet-sony just to clarify what you said above, are you saying that if we trained a model within the environment the model should output int the order of "roll, pitch, yaw, thrust" and so if i take this model and try to control an actual crazyflie drone i should change the order from "roll, pitch, yaw, thrust" to "pitch, roll, yaw, thrust"?

@jjshoots
Copy link
Owner

@zcase it's been awhile since I've messed with crazyflies. What I will say is that the output space in PyFlyt is permuted in Crazyflies. I would refer to the official documentation for the most up to date material. CrazyFlyt is simply a simple wrapper around both these libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants