Skip to content
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

Spawn vehicles via RPC #2390

Merged
merged 30 commits into from
Mar 9, 2021
Merged

Spawn vehicles via RPC #2390

merged 30 commits into from
Mar 9, 2021

Conversation

rajat2004
Copy link
Contributor

@rajat2004 rajat2004 commented Jan 19, 2020

Closes #2922

Rebased version of #1937
airsim-spawn-rpc-2020-01-19

airsim_spawn_drones.mp4

Future improvement possible - pass JSON object as string for the vehicle settings

The example script is very minimal one right now, will need to improve it

Fun fact: I did test with 50 drones, AirSim was able to create them :) but my laptop was definitely struggling to keep up, also had a crash when closing the editor due to RPC error.

@rajat2004 rajat2004 force-pushed the pr/1937 branch 2 times, most recently from 9cde560 to c911a6f Compare January 20, 2020 02:18
@rajat2004
Copy link
Contributor Author

Need to rebase and test again. One thing I'm not sure about is how the Airsim.sln file is updated, it seems to indicate it's for Version 15, but we're now using 16 (2019), so doesn't it need to be updated? Or that it doesn't affect the build, etc?

@rajat2004 rajat2004 force-pushed the pr/1937 branch 2 times, most recently from cd9538a to 4de892e Compare April 7, 2020 02:32
@rajat2004
Copy link
Contributor Author

Working on Linux, Pending Windows .vcxproj update, testing

Copy link
Contributor

@zimmy87 zimmy87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for creating this PR @rajat2004! Once you're ready to submit this PR, I can take another look at this PR in case you've already addressed some of these comments in your next update.

HelloSpawnedDrones/HelloSpawnedDrones.cpp Outdated Show resolved Hide resolved
AirLib/include/api/RpcLibClientBase.hpp Outdated Show resolved Hide resolved
AirLib/include/common/AirSimSettings.hpp Outdated Show resolved Hide resolved
AirLib/src/api/RpcLibServerBase.cpp Outdated Show resolved Hide resolved
HelloSpawnedDrones/HelloSpawnedDrones.cpp Outdated Show resolved Hide resolved
HelloSpawnedDrones/HelloSpawnedDrones.cpp Outdated Show resolved Hide resolved
HelloSpawnedDrones/HelloSpawnedDrones.cpp Outdated Show resolved Hide resolved
@rajat2004 rajat2004 force-pushed the pr/1937 branch 2 times, most recently from b7d8b19 to a38ce42 Compare February 6, 2021 12:14
@rajat2004
Copy link
Contributor Author

@zimmy87 and others also, If possible, could you test this on Windows as well, I'll also try to do so on my end. The changes in AirSim.sln & .vcxproj files are something which I have no idea about, these were already present in the old PR and have been carried forward here.

@rajat2004 rajat2004 force-pushed the pr/1937 branch 6 times, most recently from c971ae2 to 137f867 Compare February 8, 2021 04:10
@rajat2004 rajat2004 marked this pull request as ready for review February 8, 2021 04:11
@rajat2004
Copy link
Contributor Author

rajat2004 commented Feb 8, 2021

I'm marking this PR as Ready for review since the first review comments as well as Unity non-implemented method has been tested, plus the HelloSpawnedDrones and the Python script (See video in PR description for the behaviour of HelloSpawnedDrones). The Python script could be enhanced a bit though
Additionally, I've tested this PR on top of #2936 which adds an APi to get the list of current vehicle names. Somewhat useful in normal cases, and more so when combined with this PR. After running ./HelloSpawnedDrones 5, the API -

>>> cl.listVehicles()
['SimpleFlight', 'UAV_0', 'UAV_1', 'UAV_2', 'UAV_3', 'UAV_4']

@rajat2004 rajat2004 requested a review from zimmy87 February 8, 2021 04:17
@zimmy87
Copy link
Contributor

zimmy87 commented Mar 5, 2021

Hi @rajat2004, as per updating HelloSpawnedDrones.vcxproj and HelloSpawnedDrones.vcxproj, I've made a update to both these files in a commit here in my own AirSim fork that you can feel free to copy into this PR. With this commit, I'm able to build HelloSpawnedDrones from the AirSim solution locally, however this is breaking the Windows build check for me, so I'm still missing some dependencies in this commit. I will try and spend more time fixing the Windows build, and keep you updated once I've reached some resolution.

@rajat2004
Copy link
Contributor Author

@zimmy87 Sure, will bring that commit in later. I think it might be best to do that after all the problems have been figured out so can be done in one swoop. Once it's fixed, let me know and I can cherry-pick the commits onto my branch, or you could push to mine as well since maintainers can do that

zimmy87 added 3 commits March 9, 2021 06:29
add project dependencies
remove duplicate declaration of registerPhysicsBody()
@zimmy87
Copy link
Contributor

zimmy87 commented Mar 9, 2021

Thank you for the contribution @rajat2004! Tested latest version locally on Windows & Ubuntu and it's working & building just fine for me, so I am moving ahead with merging.

@zimmy87 zimmy87 merged commit 950a559 into microsoft:master Mar 9, 2021
@rajat2004 rajat2004 deleted the pr/1937 branch March 10, 2021 02:55
@rajat2004
Copy link
Contributor Author

rajat2004 commented Mar 10, 2021

@zimmy87 Thanks for the Windows fixes and merging! I think the Python script can be improved further, and probably should add a bit of info in the docs as well, will do so in another PR

Also, could you have a look at #2936, it becomes more useful now that this is merged

@rajat2004
Copy link
Contributor Author

@Roopesh-Bharatwaj-K-R Are you using the latest master rather than some other branch that isn't up to date and doesn't include this PR? Also, did you use import setup_path before doing import airsim? This is required to use the airsim module from local repo, rather than the pip installed one.

@Roopesh-Bharatwaj-K-R
Copy link

@rajat2004 I Used import setup_path before import airsim. I'm not sure about the master.please give more details on this.

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

Successfully merging this pull request may close these issues.

Allocate the number of drones after pressing "Play" instead of the setting in advance?
5 participants