uzh-rpg / agile_flight

Developing and Comparing Vision-based Algorithms for Vision-based Agile Flight
MIT License
137 stars 52 forks source link

The terminate rule about boundary #67

Closed tongtybj closed 2 years ago

tongtybj commented 2 years ago

@yun-long

https://github.com/uzh-rpg/flightmare/blob/092ff357139b2e98fc92bcdee50f38f85b55246d/flightlib/src/envs/vision_env/vision_env.cpp#L345-L348

I wonder that quad_state_.p(QS::POSX) is not correct... This should be quad_state_.x(QS::POSX) or quad_state_.p(0).

tongtybj commented 2 years ago

acoording to https://github.com/uzh-rpg/flightmare/blob/092ff357139b2e98fc92bcdee50f38f85b55246d/flightlib/include/flightlib/common/quad_state.hpp#L15-L17 QS::POSX = 0. So there would be no any trobule in the original coding. Sorry for my misunderstanding.

P.S. for other state such as velocity, we need to use quad_state_.v(0) instead of quad_state_.v(QS::VELX)

Glanfaloth commented 1 year ago

Hi I have the same question. I still don't understand what x represents here and why we use both x and p for position state. Could you explain? Thank you! @tongtybj

tongtybj commented 1 year ago

x should denote the all states as defined in following line:

https://github.com/uzh-rpg/flightmare/blob/092ff357139b2e98fc92bcdee50f38f85b55246d/flightlib/include/flightlib/common/quad_state.hpp#L80

Glanfaloth commented 1 year ago

Yes, but why did they use x at some places and p at other places? Are they interchangeable?

  bool x_valid = quad_state_.p(QS::POSX) >= world_box_[0] + safty_threshold &&
                 quad_state_.p(QS::POSX) <= world_box_[1] - safty_threshold;
  bool y_valid = quad_state_.p(QS::POSY) >= world_box_[2] + safty_threshold &&
                 quad_state_.p(QS::POSY) <= world_box_[3] - safty_threshold;
  bool z_valid = quad_state_.x(QS::POSZ) >= world_box_[4] + safty_threshold &&
                 quad_state_.x(QS::POSZ) <= world_box_[5] - safty_threshold;