Skip to content

Randomly Spawn Drone #331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rl-2 opened this issue Jul 11, 2017 · 5 comments
Closed

Randomly Spawn Drone #331

rl-2 opened this issue Jul 11, 2017 · 5 comments

Comments

@rl-2
Copy link

rl-2 commented Jul 11, 2017

What is the best pipeline to have the drone spawn in the air while the simulation is running? For example, I wonder if I can write a function in Python that once the function is called, the drone will be reset in a random location in the air, armed and hovering. I'm aware that it may involve modifications on Blueprints in Unreal or even PX4 firmware, but it would be great if I can have some instructions. This method would be very helpful for reinforcement learning that the drone can spawn at different locations after episodes end.

@sytelus
Copy link
Contributor

sytelus commented Jul 11, 2017

Are you using PX4? Is so then things are tricky. PX4 takeoff is bit unpredictable and you need to do that before you can hover. Also PX4 doesn't have reset function :(. I'd tried to hack it and its implemented when you press backspace key (which resets to beginning position) but as you can see sometime you have to press Backspace twice.

I'm writing new flight controller called simple_flight that would run from inside of AirSim without any external HITL/SITL. This is precisely for the purpose of reinforcement learning. The code for this flight controller would be very simple and easily hackable to whatever functionality one needs. So far I've got rate and level controllers sort of working and I wouldn't call it read for use yet. But if you are willing to hack then dive in to that code!

Finally, one other option is to use new "Computer Vision" mode that I just implemented yesterday :). In this mode, you can control it new simSetPose API and then use simGetImage to get image. In this mode drone acts as "ideal drone". You tell it where to go and it goes there perfectly (unless collision happens). You reinforcement learning algorithm can take image as input and give velocity vector as output. You then compute next position as p += v * dt and set that position in vehicle usin simSetPose. For more on these APIs, please see this doc.

@rl-2
Copy link
Author

rl-2 commented Jul 11, 2017

Thank you very much for the answer. We were trying to use PX4 for our spawn feature, but it seems very complicated to achieve.

The Simple Flight controller sounds great. So if we train our models of reinforcement learning in Simple Flight, then test and refine the models in SITL and HITL, and then eventually on the real drone, do you think it's a workable pipeline? What would be the physical simulations like in Simple Flight? Ultimately, we'd like to have our policies work on the real drone, so we are afraid that Computer Vision scenario may not work for us.

@sytelus
Copy link
Contributor

sytelus commented Jul 12, 2017

Yes, that's exactly the plan. Due to instability and various issues with PX4 its very hard to work with it for reinforcement learning. My plan is to make simple_flight real firmware and actually installable on boards such as Naze32. Unlike PX4, simple_flight will have only basic attitude controller which is what we need for reinforcement learning. It will also be pure C++ cross platform code that is available as header-only library so one can easily debug and edit.

@sytelus sytelus closed this as completed Jul 12, 2017
@flyingsilverfin
Copy link

flyingsilverfin commented Jul 14, 2017

Just came across this - simple_flight sounds great! I'm trying to use multiple drones in AirSim at once - would adding such functionality using simple_flight would be easier than attempting to use HITL? If this isn't the right place to ask I could open a new issue :)

@sytelus
Copy link
Contributor

sytelus commented Jul 17, 2017

Yes, simple_flight would work much better for multiple drone scenarios. MavLInk requires opening up port or serial I/O and its not efficient for multiple drone scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants