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

PX4 integration #181

Open petergerten opened 10 months ago

petergerten commented 10 months ago

Did anybody integrate PX4 SITL with this framework to utilize it for higher level objectives?

JacopoPan commented 10 months ago

Hi @petergerten , no, so far no one has worked on PX4 integration yet.

dmvinson commented 2 months ago

What would be involved in integrating with PX4? Is that covered under the Use SITL services with steppable simulation roadmap item? I'd be interested in this for my work, happy to contribute if there is an initial set of pointers to being development

JacopoPan commented 2 months ago

Hi @dmvinson

if you want to try and implement a lockstep version of PX4 SITL paired with one of the environments in this repo, it would be great and I'm happy to advise/guide/PR review the process.

I would start from the example in beta.py for which the execution instructions are here.

In this case the SITL is NOT in lockstep (the PyBullet simulation and the SITL of Betaflight run in parallel in separate processes https://github.com/utiasDSL/gym-pybullet-drones/blob/3d7b12edd4915a27e6cec9f2c0eb4b5479f7735e/gym_pybullet_drones/envs/BetaAviary.py#L85-L89 and communication happens over UDP https://github.com/utiasDSL/gym-pybullet-drones/blob/3d7b12edd4915a27e6cec9f2c0eb4b5479f7735e/gym_pybullet_drones/envs/BetaAviary.py#L158-L163

I believe that something similar using the default UDP/TCP port of SITL PX4 (see this diagram) and WITH THE ADDITION of lockstep execution (see this paragraph could be implemented by creating a new example gym_pybullet_drones/examples/px4.py and a new environment (spawning and talking to PX4 SITL) gym_pybullet_drones/envs/PX4Aviary.py

dmvinson commented 2 months ago

Thanks for the guidance, I'll take a look at this over the next few days. I appreciate your help!