utiasDSL / gym-pybullet-drones

PyBullet Gymnasium environments for single and multi-agent reinforcement learning of quadcopter control
https://utiasDSL.github.io/gym-pybullet-drones/
MIT License
1.21k stars 351 forks source link

A Drag function mistake #189

Closed ana-lys closed 7 months ago

ana-lys commented 8 months ago

If you are converting linear velocity from global coordinates to base coordinates, then the rotation should be inverse. I suggest changing it to

        drag = np.dot(base_rot.T, drag_factors*np.array(self.vel[nth_drone, :]))

instead of

        drag = np.dot(base_rot, drag_factors*np.array(self.vel[nth_drone, :]))

The effect is neglectable when the rotation is small ( yaw = 0 ) so it makes this harder to notice.

JacopoPan commented 8 months ago

Hi @ana-lys: could you please open a PR with the recommended changes? Small contributions and bug fixes are always welcome and should be attributed properly