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

mac code fixes, needed for compile on mac #1914

Merged
merged 2 commits into from
Apr 29, 2019
Merged

mac code fixes, needed for compile on mac #1914

merged 2 commits into from
Apr 29, 2019

Conversation

klintan
Copy link
Contributor

@klintan klintan commented Apr 25, 2019

Some smaller code changes, if these are not present, it won't compile because these won't be defined on Mac.

However I'm uncertain that the change in PInvokeWrapper.h is correct, because even though it compiles, haven't yet gotten Unity to recognize thelibAirLibWrapper.a file.

If you have any additional ideas on what it might be feel free to comment and I'll update.
Everything else seems fine.

Edit: Got it to work now, added some changes. Needed to change some files in the build.sh and cmakelists for the airsimwrapper custom for Mac, building a .bundle file instead of .so.

In general I also updated to the latest LLVM (not the old 5.0, since that one wouldn't build as described in some other issues) let me know if those changes are of interest.

@msftclas
Copy link

msftclas commented Apr 25, 2019

CLA assistant check
All CLA requirements met.

@klintan klintan mentioned this pull request Apr 26, 2019
@sytelus sytelus merged commit c25597e into microsoft:master Apr 29, 2019
@damilolah
Copy link

damilolah commented Jun 22, 2019

Thanks klintan for all your work on getting AirSim to run on OSX.
I was able to follow all your modifications. However, when I run Unity/build.sh on my MAC, I get this error:

make[1]: *** [CMakeFiles/AirsimWrapper.dir/all] Error 2
make: *** [all] Error 2
cp: AirsimWrapper.bundle: No such file or directory

Do you have an idea on how to fix this?

Thanks.

@klintan
Copy link
Contributor Author

klintan commented Jun 23, 2019

Thanks klintan for all your work on getting AirSim to run on OSX.
I was able to follow all your modifications. However, when I run Unity/build.sh on my MAC, I get this error:

make[1]: *** [CMakeFiles/AirsimWrapper.dir/all] Error 2
make: *** [all] Error 2
cp: AirsimWrapper.bundle: No such file or directory

Do you have an idea on how to fix this?

Thanks.

Hm is the file created at all ? AirsimWrapper.bundle

@damilolah
Copy link

damilolah commented Jun 23, 2019 via email

@damilolah
Copy link

Just to follow up. I have a fundamental question. I'm trying to run the TestModel.ipynb as described in this tutorial: https://github.com/microsoft/AutonomousDrivingCookbook/tree/master/AirSimE2EDeepLearning
This tutorial states that I need the AirSim simulation environment to be running. However, I'm using a MAC.

This command to run AirSim standalone environment doesn't work for me: .\AD_Cookbook_Start_AirSim.ps1 landscape

So, I'm trying to run Airsim on Unity. I have successfully run the setup.sh and build.sh commands for Airsim but Unity/build.sh doesn't create AirsimWrapper.bundle at all.

Please let me know if I'm on the right track.

@klintan
Copy link
Contributor Author

klintan commented Jun 23, 2019

Yeah you are right, the Powershell script files will only work on Windows.

I tried compiling it again from source and I noticed some issues as well;
To get the build of AirSim itself to work I had to replace llvm-5.0 (which is rather old) with gcc and g++, I put my files in the gist here:
https://gist.github.com/klintan/be30a38aa14fc54706472f5b54beae0e
I replaced llvm-5.0 in the Unity folder build.sh file as well, which is also in the gist.

Further I found a bug in the CMakeLists.txt which I added in this PR actually, maybe it changed, because I'm pretty sure it worked at that time. I will create a new PR with the fix, however it is an easy one if you don't want to wait:
in the AirSimWrapper folder and CMakeLists.txt file, on line 36 replace ${MACOSX} with ${APPLE}
Try that and let me know.

@damilolah
Copy link

damilolah commented Jun 24, 2019

Thanks Klintan,

I changed ${MACOSX} to ${APPLE} in CMakeLists.txt.
I also changed
cp AirsimWrapper.bundle ../UnityDemo/Assets/Plugins;

to

cp -r AirsimWrapper.bundle ../UnityDemo/Assets/Plugins;

because it complained that AirsimWrapper.bundle is not a file but a directory.
I ran Unity/build.sh and I got one last error having to do with Boost so I installed Boost
"brew install Boost"

Then I ran Unity/build.sh and it was successful. I got the message:
[100%] Built target AirsimWrapper

I proceeded to follow the tutorial here and control the car as stated in the instruction below:
https://github.com/microsoft/AirSim/tree/master/Unity
"
Start Unity and click Open project.
Select the folder AirSim\Unity\UnityDemo, and then hit the button Select Folder.
In the bottom pane, Click on Projects->Assets->Scenes. Then, Double-click on SimModeSelector. This will load the SimModeSelector scene into the scene hierarchy pane. DO NOT add CarDemo or DroneDemo scene into the scene hierarchy pane.
Hit the play button to start the simulation (and hit play again to stop the simulation. .
Alternatively, you can change the SimMode in your Settings.json file. (You can read more about Settings.json here)
Controlling the car:
Use WASD or the Arrow keys or the AirSim client.
Controlling the drone:
Keyboard control is not currently available for drone flight.
Changing camera views:

"

Question 1: Since I can control the car in Unity using the arrow keys as described above, does this mean, Airsim is now running on Unity?

Question 2: While running Airsim on Unity, I tried the TestModel.ipynb but I'm still getting this error:

----> 4 client.confirmConnection()
5 client.enableApiControl(True)
6 car_controls = CarControls()

~/Documents/AutonomousDrivingCookbook/AirSimE2EDeepLearning/AirSimClient.py in confirmConnection(self)
158 def confirmConnection(self):
159 print('Waiting for connection: ', end='')
--> 160 home = self.getHomeGeoPoint()
161 while ((home.latitude == 0 and home.longitude == 0 and home.altitude == 0) or
162 math.isnan(home.latitude) or math.isnan(home.longitude) or math.isnan(home.altitude)):

~/Documents/AutonomousDrivingCookbook/AirSimE2EDeepLearning/AirSimClient.py in getHomeGeoPoint(self)
167
168 def getHomeGeoPoint(self):
--> 169 return GeoPoint.from_msgpack(self.client.call('getHomeGeoPoint'))
170
171 # basic flight control

~/anaconda3/lib/python3.6/site-packages/msgpackrpc/session.py in call(self, method, *args)
39
40 def call(self, method, *args):
---> 41 return self.send_request(method, args).get()
42
43 def call_async(self, method, *args):

~/anaconda3/lib/python3.6/site-packages/msgpackrpc/future.py in get(self)
41 else:
42 if isinstance(self._error, error.RPCError):
---> 43 raise self._error
44 else:
45 raise error.RPCError(self._error)

TransportError: Retry connection over the limit

@klintan
Copy link
Contributor Author

klintan commented Jun 24, 2019

Question 1: Since I can control the car in Unity using the arrow keys as described above, does this mean, Airsim is now running on Unity?

I would say yes :P However I'm def no expert, I only wanted to make sure I could build it and run it (and run it as in basically what you did, run the car in Unity and the default environment)

Question 2: While running Airsim on Unity, I tried the TestModel.ipynb but I'm still getting this error:

Hm so the RPC connections doesn't seem to work, and unfortunately I haven't tested that in Unity etc, so I think the best approach now would just to create a new issue, with that specific question.

cp -r AirsimWrapper.bundle ../UnityDemo/Assets/Plugins;

Good catch! You should put in a PR to change that :)

@damilolah
Copy link

How do I put in a PR? :|
Thanks.

@nfirbas
Copy link

nfirbas commented Mar 17, 2020

Thanks for help so far, I did all steps above. Then i get one error that repeats for all includes of boost. I have installed boost from brew.
fatal error: 'boost/filesystem.hpp' file not found #include <boost/filesystem.hpp>

@nfirbas
Copy link

nfirbas commented Mar 18, 2020

Now it's working. In CMakeList.txt i added one line and change one.

find_package(Boost REQUIRED COMPONENTS filesystem) target_link_libraries(${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT} -lstdc++ -lpthread Boost::filesystem)

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

Successfully merging this pull request may close these issues.

5 participants