Skip to content

Commit

Permalink
Merge pull request #3914 from jonyMarino/pr/changing_gazebodrone_build
Browse files Browse the repository at this point in the history
Pr/changing gazebodrone build
  • Loading branch information
Jonathan authored Aug 2, 2021
2 parents 880c554 + e68600f commit e1d95f2
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 73 deletions.
4 changes: 1 addition & 3 deletions GazeboDrone/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ include_directories(
${AIRSIM_ROOT}/AirLib/deps/eigen3
${AIRSIM_ROOT}/AirLib/deps/rpclib/include
${AIRSIM_ROOT}/AirLib/include
${AIRSIM_ROOT}/AirLib/deps/MavLinkCom/include
)

link_directories(
${GAZEBO_LIBRARY_DIRS}
../../AirLib/lib/x64
../../build_release/output/lib
)

list(APPEND CMAKE_CXX_FLAGS "${GAZEBO_CXX_FLAGS}")
Expand All @@ -34,6 +33,5 @@ target_link_libraries(
pthread
AirLib
rpc
MavLinkCom
)

48 changes: 2 additions & 46 deletions GazeboDrone/README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,3 @@
# General

Derived from http://gazebosim.org/tutorials?tut=topics_subscribed

Make sure you have installed gazebo dependencies

```
sudo apt-get install libgazebo9-dev
```

# AirLib build

This project is built with g++, so AirLib needs to be built with g++ too. Change lines 56 and 57 of AirSim/build.sh with:
```
export CC="gcc-8"
export CXX="g++-8"
```
then run ./setup.sh and ./build.sh

# AirSim plugin

The AirSim UE plugin needs to be built with clang, so you can't use the one compiled in the previous step. You can use [our binaries](https://github.com/microsoft/AirSim/releases) or you can clone AirSim again in another folder without the above change, and with that one, [run Blocks](https://microsoft.github.io/AirSim/build_linux/#how-to-use-airsim) or your environment.


# AirSim settings

Inside your `settings.json` file add this line:
`"PhysicsEngineName":"ExternalPhysicsEngine"`
# Build

```
mkdir build && cd build
cmake ..
make
```

# Run

Run AirSim and Gazebo

then run:

```
cd build
./GazeboDrone
```
# Welcome to GazeboDrone

This page has moved [here](https://github.com/microsoft/AirSim/blob/master/docs/gazebo_drone.md).
57 changes: 33 additions & 24 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,22 @@ set -e
set -x

debug=false

gcc=false
# Parse command line arguments
while [[ $# -gt 0 ]]
do
key="$1"

case $key in
--debug)
debug=true
shift # past argument
;;
esac
key="$1"

case $key in
--debug)
debug=true
shift # past argument
;;
--gcc)
gcc=true
shift # past argument
;;
esac

done

Expand Down Expand Up @@ -54,8 +58,13 @@ if [ "$(uname)" == "Darwin" ]; then
export CC=/usr/local/opt/llvm@8/bin/clang
export CXX=/usr/local/opt/llvm@8/bin/clang++
else
export CC="clang-8"
export CXX="clang++-8"
if $gcc; then
export CC="gcc-8"
export CXX="g++-8"
else
export CC="clang-8"
export CXX="clang++-8"
fi
fi

#install EIGEN library
Expand All @@ -74,24 +83,24 @@ if [[ -d "./cmake/CMakeFiles" ]]; then
rm -rf "./cmake/CMakeFiles"
fi

folder_name=""


if [[ ! -d $build_dir ]]; then
mkdir -p $build_dir
pushd $build_dir >/dev/null
fi

if $debug; then
folder_name="Debug"
"$CMAKE" ../cmake -DCMAKE_BUILD_TYPE=Debug \
|| (popd && rm -r $build_dir && exit 1)
popd >/dev/null
else
folder_name="Release"
"$CMAKE" ../cmake -DCMAKE_BUILD_TYPE=Release \
|| (popd && rm -r $build_dir && exit 1)
popd >/dev/null
fi
pushd $build_dir >/dev/null
if $debug; then
folder_name="Debug"
"$CMAKE" ../cmake -DCMAKE_BUILD_TYPE=Debug \
|| (popd && rm -r $build_dir && exit 1)
else
folder_name="Release"
"$CMAKE" ../cmake -DCMAKE_BUILD_TYPE=Release \
|| (popd && rm -r $build_dir && exit 1)
fi
popd >/dev/null


pushd $build_dir >/dev/null
# final linking of the binaries can fail due to a missing libc++abi library
Expand Down
56 changes: 56 additions & 0 deletions docs/gazebo_drone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Welcome to GazeboDrone

GazeboDrone allows connecting a gazebo drone to the AirSim drone, using the gazebo drone as a flight dynamic model (FDM) and AirSim to generate environmental sensor data. It can be used for **Multicopters**, **Fixed-wings** or any other vehicle.


## Dependencies

### Gazebo

Make sure you have installed gazebo dependencies:

```
sudo apt-get install libgazebo9-dev
```

### AirLib

This project is built with GCC 8, so AirLib needs to be built with GCC 8 too.
Run from your AirSim root folder:
```
./clean.sh
./setup.sh
./build.sh --gcc
```

## AirSim simulator

The AirSim UE plugin needs to be built with clang, so you can't use the one compiled in the previous step. You can use [our binaries](https://github.com/microsoft/AirSim/releases) or you can clone AirSim again in another folder and buid it without the above option, then you can [run Blocks](build_linux.md#how-to-use-airsim) or your own environment.


### AirSim settings

Inside your `settings.json` file you need to add this line:
`"PhysicsEngineName":"ExternalPhysicsEngine"`.
You may want to change the visual model of the AirSim drone, for that you can follow [this tutorial.](https://youtu.be/Bp86WiLUC80)


## Build

Execute this from your AirSim root folder:
```
cd GazeboDrone
mkdir build && cd build
cmake ..
make
```

## Run

First run the AirSim simulator and your Gazebo model and then execute this from your AirSim root folder:

```
cd GazeboDrone/build
./GazeboDrone
```

1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ nav:
- "Infrared Camera": "InfraredCamera.md"
- "ROS: AirSim ROS Wrapper": "airsim_ros_pkgs.md"
- "ROS: AirSim Tutorial Packages": "airsim_tutorial_pkgs.md"
- "Import Gazebo models": "gazebo_drone.md"
- "Domain Randomization": "retexturing.md"
- "Mesh Vertex Buffers": "meshes.md"
- "Playing Logs": 'playback.md'
Expand Down

0 comments on commit e1d95f2

Please sign in to comment.