microsoft / AirSim

Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research
https://microsoft.github.io/AirSim/
Other
16.04k stars 4.48k forks source link

Support for betaflight firmware #4351

Open nikhil-sethi opened 2 years ago

nikhil-sethi commented 2 years ago

What feature are you suggesting?

Overview:

This issue requests firmware support in AirSim for a betaflight: a widely use flight control software used for drones.

Smaller Details:

I have a working implementation ready at my forks (airsim, betaflight). I didn't open a pull request because I wanted to discuss this first (Should I have opened one?). The implementation is very similar to @rajat2004's work for ardupilot. There are finer details that I would like to discuss but I'm not sure if I should do it here or in a pull request. Please let me know! I will also open a similar issue on the betaflight side to gauge their requirements. Video of the implementation: https://www.youtube.com/watch?v=sVEfow3y6rU (Most of it is just bad flying though)

Nature of Request:

Why would this feature be useful?

  1. Most drones catering to the FPV and drone racing demographic use firmware based on cleanflight/betaflight.

  2. Some testing labs for indoor aerial robotics (especially with nano drones) use betaflight because GPS oriented firmware like Ardupilot/INAV aren't as robust for indoor flight (ref). With increasing support for multiple vehicles in airsim, this might also help in testing for indoor swarm robotics.

  3. Current support for betaflight SITL needs to go through arducopter for simulating with gazebo. While this works okay, it has a lot of unnecessary layers and repetitive code. Moreover, configuring gazebo for even basic flying tasks like FPV is somewhat drawn out. There have also been recent discussions over at betaflight to improve the SITL target.

This feature might help the above people test and fly drones with better physics and graphics in SITL mode. It might also pave the way for HITL similar to px4. Thank you for reading!

rajat2004 commented 2 years ago

Video is great (and much better than my flying :laughing:, I just stick to what the firmware does itself through waypoints). If there's anything I can help with or you would like to discuss, would love to do so. PR would be useful if you think having code specifics will help

nikhil-sethi commented 2 years ago

Hey Rajat! Thanks for responding (and bearing with the video :p). There are some code specifics and conceptual doubts as well. I'll still open a PR to consolidate discussions there and hopefully make the implementation better by collaborating. Should I close the issue or keep it active for others to raise doubts?

rajat2004 commented 2 years ago

IMO shouldn't be any issues by keeping this open, will be better visibility as well.

jonyMarino commented 2 years ago

@nikhil-sethi It's okay to ask if a pull request is appropriate. Maintaining the code in the repository is a compromise. This issue leads me to think that the flight controllers should be in other repositories outside AirSim. Also, the flight controllers could use the AirSim API and not have to run inside the simulator; I don't know how much that adds. But I think we can merge it, and keeping it will depend on the support you and the rest of the community give. I'm going to discuss it with the rest of the team. Good work!