Airsim: Using Python and C++ APIS on Ubuntu

Created on 26 Jan 2018  Â·  11Comments  Â·  Source: microsoft/AirSim

Hi there,

I want to use the C++ API's to generate image data. I've looked at all the tutorials, but I'm a bit confused what directory I actually use to put my C++ (or python) files in that will get the images using the API. Would it be in our project directory? Or the Airsim directory?

If anyone could provide examples or help it would be appreciated! I've seen the demo from youtube, but since I do not have Visual Studio, I'm not sure for example how to run the Drone Shell, and if I do create another c++ file that uses the API must it be in the AirSim folder?

doc update

Most helpful comment

Solved it by adding
link_directories(${AIRSIM_ROOT}/build_debug/output/lib/)
before creating the executable and using the cmake version provided in the repository

All 11 comments

Generally the way I would do is:

  1. Copy sample project from repo to your own folder. For example, copy HelloDrone to C:\MyProjects.
  2. In .vcproj file, change path for AdditionalIncludeDirectories and AdditionalLibraryDirectories to repo directory everywhere.
  3. Run Unreal project (which is server). Compile and run above project (which is client).

Since I'm using Linux I wouldn't be using Visual Studio, so I don't have a .vproj file. Any advice for linux use that doesn't require VS?

You can either use cmake (see this example) or just command line switches to compiler to add include libraries and libs you want to link.

I have the same problem. Do you know already how to do it?

@Domi47 I ended up using the python api since I didn't have to worry about compiling issues.

Thank u @olivia-skydio. Related to your first question "what directory I actually use to put my C++ (or python) files in that will get the images using the API. Would it be in our project directory? Or the Airsim directory?...if I do create another c++ file that uses the API must it be in the AirSim folder?" How did you solve that? That's the main problem i have now since I'm new with all this. I'm also using Linux. If you give me an example it would be appreciated.

@Domi47 I am not sure about if you want to use the C++ api because I didn't end up using it, although I don't believe you should have to be in the AirSim Directory. I'm not totally sure because I used the python api and just had "import AirSimClient import *" at the top of my file and it worked fine even when it was placed in a completely separate directory.

Sorry I can't be more helpful!

To use C++ API, you can put your client code anywhere. Just make sure to add path for include and libs to AirSim folder. Here's a simple example of how HelloCar application uses cmake to add include and libs folder. If you are not familiar with what above means then I would suggest not to use C++.

I followed the instruction manual for linux. After compiling UnrealEngine and AirSim, running the HelloCar example on linux gives me
/usr/bin/ld: cannot find -lAirLib /usr/bin/ld: cannot find -lrpc collect2: error: ld returned 1 exit status
Can you maybe provide a full example that is linking properly? Or is something wrong on my system configuration?
Thank you already

Solved it by adding
link_directories(${AIRSIM_ROOT}/build_debug/output/lib/)
before creating the executable and using the cmake version provided in the repository

is there any way in github to mark a certain issue for myself?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

p3jawors picture p3jawors  Â·  3Comments

jingleFun picture jingleFun  Â·  3Comments

machenxiang picture machenxiang  Â·  3Comments

Mayankm96 picture Mayankm96  Â·  4Comments

Kim-BongSu picture Kim-BongSu  Â·  4Comments