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.15k stars 337 forks source link

How can I change the collision set of the cf2p #64

Open sinsauzero opened 2 years ago

sinsauzero commented 2 years ago

I use your cf2p drone model to do the collision avoidance. However, I meet a problem that the model collide in vision only with the main body but ignore the prop links. So that all the links just get through the wall without any collision happens. So what can I do to solve this problem so that collision happens when prop links hit the wall rather than the base body? Wait for your response, thank you!

JacopoPan commented 2 years ago

Hi @sinsauzero

the collision shape is really just a cylinder around the entire drone set here: https://github.com/utiasDSL/gym-pybullet-drones/blob/a0534f8a28e9b47f1d9912223952075a032be455/gym_pybullet_drones/assets/cf2p.urdf#L31

In PyBullet's GUI visualizer you can press w to toggle the wireframe view.

This collision shape should already extend beyond the motors so there are 2 things I would try to avoid apparent object penetration: (i) use a smaller PyBullet integration step and (ii) design a collision shape closer to the visual mesh (you can use the mesh itself of compose cylinders and cuboids). However, note that both these approaches could slow down the simulation.