utiasDSL / safe-control-gym

PyBullet CartPole and Quadrotor environments—with CasADi symbolic a priori dynamics—for learning-based control and RL
https://www.dynsyslab.org/safe-robot-learning/
MIT License
585 stars 122 forks source link

Remove env.gravity #40

Closed JakobThumm closed 2 years ago

JakobThumm commented 2 years ago

Hi, I would highly recommend replacing https://github.com/utiasDSL/safe-control-gym/blob/19ec4f9a6bf7a5c2691aee7c281b0ee255d2e7cc/safe_control_gym/envs/gym_pybullet_drones/quadrotor_utils.py#L107 with just the acceleration that the earth's gravitational force induces on an object g=9.8 m/s^2, and calculate F_g = g * m, where it's needed. The word gravity has a formal definition and it is very confusing if env.gravity = 0.2646 instead of =9.8! Thanks, Jakob

JacopoPan commented 2 years ago

The one you link is not an attribute of the environment (but in the PIDController class). BaseAviary contains both GRAVITY_ACC (the acceleration in m/s**2) and GRAVITY (the weight/force in N on any robot given its mass and g). If you want to re-name the second to WEIGHT, that's a simple replacement PR I'm happy to merge (just make sure you you apply it across the whole repo).

JacopoPan commented 2 years ago

Do you still want/plan this change (GRAVITY -> WEIGHT), @JakobThumm ?

(I'll re-open this if you do.)