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

Add in Unreal support to GAMS #68

Merged
merged 40 commits into from Feb 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
033c807
Added initial unreal setup install
TheDash Jan 24, 2019
77b1ad7
Update
TheDash Jan 26, 2019
001e47f
Added in using_airlib and base of airlib into platforms
TheDash Jan 26, 2019
0cbc13d
Added more base build commands
TheDash Jan 26, 2019
0883b25
Added airlib
TheDash Jan 26, 2019
dd963ea
Fix missing comma bug
TheDash Jan 26, 2019
22c9309
AirLibBase compiles now
TheDash Jan 26, 2019
501555b
Added in code which uses the header file, but library is not properly…
TheDash Jan 26, 2019
0375b15
Updating
TheDash Jan 26, 2019
13dcd5e
Fixed compiler issues, airlib AirLibBase.h now builds
TheDash Jan 28, 2019
ac5b6cb
Change name to AirLibMultirotorBase
TheDash Jan 28, 2019
ae98502
Move to quadcopter naming
TheDash Jan 28, 2019
43cfbf7
Update the platform code
TheDash Jan 29, 2019
ad2e3f2
It's not compiling, complaining about vtable undefined reference.. ye…
TheDash Jan 30, 2019
d3e4ec6
Update
TheDash Jan 30, 2019
489f969
Compiles now
TheDash Jan 30, 2019
8752b68
Remove uncommented code
TheDash Jan 30, 2019
9f7caf7
Added some fixes
TheDash Jan 31, 2019
4dc36c4
Fix rpc error inclusion
TheDash Jan 31, 2019
3527247
Sigh, linker errors with rpc. RPC library building proving problemati…
TheDash Feb 1, 2019
ae26d7e
Remove
TheDash Feb 1, 2019
3de647b
Stash
TheDash Feb 1, 2019
a546baa
Update, fixes build
TheDash Feb 1, 2019
2489c46
change base_build for simbotic
auerj Feb 1, 2019
43c563d
fixed waypoints for unreal
auerj Feb 1, 2019
cc2611b
Updated
TheDash Feb 1, 2019
3a2780a
Fix airlib conflict
TheDash Feb 1, 2019
c594824
Update
TheDash Feb 4, 2019
504f42c
Fix unreal version
TheDash Feb 5, 2019
fe21a60
Added default args for gpc.pl for waypoints
TheDash Feb 5, 2019
d78a08c
Add change to gpc.pl regarding unreal
TheDash Feb 5, 2019
81707ed
Moved json configurator to new dir
TheDash Feb 5, 2019
c2a4305
Remove old code
TheDash Feb 5, 2019
e450cb8
Change mode on airsim_json_generator.py
TheDash Feb 5, 2019
6e9e138
Added json config to gpc.pl
TheDash Feb 5, 2019
68585c4
Added complete settings.json integration
TheDash Feb 5, 2019
ab93beb
Remove documentation files
TheDash Feb 5, 2019
a6e4da5
Add gitignore files for UnrealEngine and AirSim
TheDash Feb 5, 2019
64578df
Remove submodules
TheDash Feb 5, 2019
35d504b
Remove unnecessary file
TheDash Feb 5, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -72,3 +72,6 @@ capnproto/
MPC/
!src/gams/plugins/ros2gams

UnrealEngine
AirSim

15 changes: 15 additions & 0 deletions airlib_lib.mpb
@@ -0,0 +1,15 @@
feature (airlib) {
requires += airlib

Header_Files {
Platforms {
src/gams/platforms/airlib
}
}

Source_Files {
Platforms {
src/gams/platforms/airlib
}
}
}
5 changes: 5 additions & 0 deletions default.features
Expand Up @@ -71,3 +71,8 @@ nortti = 0
/// Because simtime feature is now a core part the project settings,
/// we need to set this to 0
simtime = 0


/// @feature airlib
/// This is required to build GAMS with AirLib. AirLib is a requirement to interface the GAMS algorithms with the Unreal engine and to see things working in an Unreal simulation. 'prereqs unreal' is used to actually pull in and download Unreal. The airlib command is used to build the GAMS library with an airlib integration, which is actually separate.
airlib = 0
7 changes: 3 additions & 4 deletions gams.mpc
@@ -1,4 +1,4 @@
project (gams) : build_files, using_madara, using_utm, using_ros, using_simtime, using_vrep, vrep_lib, ros_lib, port/java/using_android, port/java/using_java, port/java/using_openjdk, using_boost, using_nortti, using_nothreadlocal {
project (gams) : build_files, using_airlib, airlib_lib, using_madara, using_utm, using_ros, using_simtime, using_vrep, vrep_lib, ros_lib, port/java/using_android, port/java/using_java, port/java/using_openjdk, using_boost, using_nortti, using_nothreadlocal {
libout = lib
libout = $(GAMS_ROOT)/lib
sharedname = GAMS
Expand Down Expand Up @@ -197,7 +197,7 @@ project (gams) : build_files, using_madara, using_utm, using_ros, using_simtime,

}

project (gams_controller) : using_gams, using_madara, using_vrep {
project (gams_controller) : using_gams, using_madara {
exeout = $(GAMS_ROOT)/bin
exename = gams_controller

Expand Down Expand Up @@ -262,7 +262,6 @@ project (types) : using_madara, using_capnp {
}
}


project (ros2gams_pcl_plugin) : using_madara, using_ros, using_gams, using_capnp, using_simtime, using_boost, using_filesystem, using_types {
requires = types

Expand Down Expand Up @@ -294,4 +293,4 @@ project (ros2gams_pcl_plugin) : using_madara, using_ros, using_gams, using_capnp
Source_Files {
src/gams/plugins/ros2gams/pcl_plugin.cpp
}
}
}
94 changes: 87 additions & 7 deletions scripts/linux/base_build.sh
Expand Up @@ -73,6 +73,11 @@
# For java
# $JAVA_HOME

#COLORS
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
NOCOLOR='\033[0m'

DEBUG=0
TESTS=0
TUTORIALS=0
Expand Down Expand Up @@ -104,6 +109,8 @@ BUILD_ERRORS=0
TYPES=0
ANDROID_TESTS=0
CAPNP_JAVA=0
UNREAL=0
AIRLIB=0

MPC_DEPENDENCY_ENABLED=0
MADARA_DEPENDENCY_ENABLED=0
Expand All @@ -113,6 +120,7 @@ VREP_AS_A_PREREQ=0
GAMS_AS_A_PREREQ=0
EIGEN_AS_A_PREREQ=0
CAPNP_AS_A_PREREQ=0
UNREAL_AS_A_PREREQ=0

MPC_REPO_RESULT=0
DART_REPO_RESULT=0
Expand All @@ -128,6 +136,8 @@ ZMQ_BUILD_RESULT=0
LZ4_REPO_RESULT=0
CAPNP_REPO_RESULT=0
CAPNP_BUILD_RESULT=0
UNREAL_BUILD_RESULT=0
AIRSIM_BUILD_RESULT=0

STRIP_EXE=strip
VREP_INSTALLER="V-REP_PRO_EDU_V3_4_0_Linux.tar.gz"
Expand All @@ -138,7 +148,7 @@ if [ -z $CORES ] ; then
echo "CORES unset, so setting it to default of 1"
echo " If you have more than one CPU core, try export CORES=<num cores>"
echo " CORES=1 (the default) will be much slower than CORES=<num cores>"
export CORES=1
export CORES=1
fi

# if $@ is empty, the user wants to repeat last build with noclean
Expand Down Expand Up @@ -226,9 +236,14 @@ do
JAVA=1
elif [ "$var" = "strip" ]; then
STRIP=1
elif [ "$var" = "unreal" ]; then
UNREAL=1
elif [ "$var" = "airlib" ]; then
AIRLIB=1
else
echo "Invalid argument: $var"
echo " args can be zero or more of the following, space delimited"
echo " airlib builds gams with the airlib dependency allowing gams controllers to interface with the Microsoft AirSim plugin"
echo " debug create a debug build, with minimal optimizations"
echo " mpc download MPC if prereqs is enabled"
echo " android build android libs, turns on java"
Expand Down Expand Up @@ -259,6 +274,7 @@ do
echo " tests build test executables"
echo " tutorials build MADARA tutorials"
echo " types builds libTYPES.so"
echo " unreal downloads, builds, and configures Unreal and AirSim if preqreqs is also enabled"
echo " vrep build with vrep support"
echo " vrep-config configure vrep to support up to 20 agents"
echo " zmq build with ZeroMQ support"
Expand All @@ -279,10 +295,20 @@ do
echo " SSL_ROOT - location of OpenSSL"
echo " ROS_ROOT - location of ROS (usually set by ROS installer)"
echo " DMPL_ROOT - location of DART DMPL directory"
echo " UNREAL_ROOT - location of UnrealEngine repository"
echo " AIRSIM_ROOT - location of AirSim repository"
exit
fi
done

if [ $CORES -eq 1 ] ; then
echo -e "${ORANGE} Warning! The CORES environment variable is set to 1. With only one core installation will take longer than it could be. By increasing the number of cores to compile with you will be reducing compilation time substantially. ${NOCOLOR}"
CORE_COUNT=$(grep -c ^processor /proc/cpuinfo)
echo "The system has ${CORE_COUNT} cores. How many should be used for installation?"
read CORES
echo -e "${ORANGE} Now using $CORES CPU cores for installation. To permanently set this, add the line 'export CORES=$CORES to your ~/.bashrc file and open a new terminal. ${NOCOLOR}"
fi

if [ -z $MPC_ROOT ] ; then
export MPC_ROOT=$INSTALL_DIR/MPC
fi
Expand All @@ -299,6 +325,14 @@ if [ -z $LZ4_ROOT ] ; then
export LZ4_ROOT=$INSTALL_DIR/lz4
fi

if [ -z $UNREAL_ROOT ] ; then
export UNREAL_ROOT=$INSTALL_DIR/UnrealEngine
fi

if [ -z $AIRSIM_ROOT ] ; then
export AIRSIM_ROOT=$INSTALL_DIR/AirSim
fi


# echo build information
echo "INSTALL_DIR will be $INSTALL_DIR"
Expand All @@ -314,6 +348,8 @@ echo "MPC_ROOT is set to $MPC_ROOT"

echo "EIGEN_ROOT is set to $EIGEN_ROOT"
echo "CAPNP_ROOT is set to $CAPNP_ROOT"
echo "UNREAL_ROOT is set to $UNREAL_ROOT"
echo "AIRSIM_ROOT is set to $AIRSIM_ROOT"
echo "LZ4_ROOT is set to $LZ4_ROOT"
echo "MADARA will be built from $MADARA_ROOT"
if [ $MADARA -eq 0 ]; then
Expand All @@ -331,6 +367,7 @@ echo "STRIP has been set to $STRIP"
if [ $STRIP -eq 1 ]; then
echo "strip will use $STRIP_EXE"
fi
echo "AIRLIB has been set to $AIRLIB"

echo "JAVA has been set to $JAVA"
if [ $JAVA -eq 1 ]; then
Expand Down Expand Up @@ -567,6 +604,49 @@ if [ $PREREQS -eq 1 ] && [ $MAC -eq 0 ]; then
sudo apt-get install -y perl git build-essential subversion libboost-all-dev bison flex realpath cbmc tk xvfb libyaml-cpp-dev ant
fi

if [ $UNREAL -eq 1 ]; then
if [ -d "$UNREAL_ROOT" ]; then
echo -e "${ORANGE} UnrealEngine directory already exists. Would you like to delete this directory and re-install anyway? [y/n]. This will call 'rm -rf' on whatever your UNREAL_ROOT env var is set to. [$UNREAL_ROOT]. ${NOCOLOR}"
read YES
fi

if [ $YES = 'y' ] ; then
echo "rm -rf $UNREAL_ROOT"
rm -rf $UNREAL_ROOT
echo "Installing UnrealEngine"
echo "git clone -b 4.21 git@github.com:EpicGames/UnrealEngine.git $UNREAL_ROOT"
git clone -b 4.18 git@github.com:EpicGames/UnrealEngine.git $UNREAL_ROOT
cd $UNREAL_ROOT
echo "./Setup.sh"
./Setup.sh
echo "./GenerateProjectFiles.sh"
./GenerateProjectFiles.sh
echo "Making unreal"
make
else
echo -e "${BLUE}Skipping unreal re-installation...UnrealEngine already installed at $UNREAL_ROOT${NOCOLOR}"
fi

if [ -d "$AIRSIM_ROOT" ] ; then
echo -e "${ORANGE} AirSim directory already exists. Would you like to delete this directory and re-install anyway? [y/n]. This will call 'rm -rf' on whatever your AIRSIM_ROOT env var is set to. [$AIRSIM_ROOT]. ${NOCOLOR}"
read YES
fi

if [ $YES = 'y' ] ; then
echo "rm -rf $AIRSIM_ROOT"
rm -rf $AIRSIM_ROOT
echo "Installing AirSim"
cd $INSTALL_DIR
echo "git clone https://github.com/Microsoft/AirSim.git"
git clone https://github.com/Microsoft/AirSim.git
echo "Building AirSim"
./setup.sh
./build.sh
echo "Installation complete. Open UnrealEngine/Engine/Binaries/Linux/UE4Editor and then When Unreal Engine prompts for opening or creating project, select Browse and choose AirSim/Unreal/Environments/Blocks. For more information see \" How to Use AirSim\" at https://microsoft.github.io/AirSim/docs/build_linux/"
else
echo -e "${BLUE}Skipping AirSim re-installation...AirSim already installed at $AIRSIM_ROOT ${NOCOLOR}"
fi
fi
fi
if [ $MAC -eq 1 ]; then
# Install boost for mac
Expand Down Expand Up @@ -998,8 +1078,8 @@ if [ $GAMS -eq 1 ] || [ $GAMS_AS_A_PREREQ -eq 1 ]; then
cd $GAMS_ROOT

echo "GENERATING GAMS PROJECT"
echo "perl $MPC_ROOT/mwc.pl -type make -features java=$JAVA,ros=$ROS,types=$TYPES,vrep=$VREP,tests=$TESTS,android=$ANDROID,docs=$DOCS,clang=$CLANG,simtime=$SIMTIME,debug=$DEBUG gams.mwc"
perl $MPC_ROOT/mwc.pl -type make -features java=$JAVA,ros=$ROS,python=$PYTHON,types=$TYPES,vrep=$VREP,tests=$TESTS,android=$ANDROID,docs=$DOCS,clang=$CLANG,simtime=$SIMTIME,debug=$DEBUG gams.mwc
echo "perl $MPC_ROOT/mwc.pl -type make -features airlib=$AIRLIB,java=$JAVA,ros=$ROS,types=$TYPES,vrep=$VREP,tests=$TESTS,android=$ANDROID,docs=$DOCS,clang=$CLANG,simtime=$SIMTIME,debug=$DEBUG gams.mwc"
perl $MPC_ROOT/mwc.pl -type make -features airlib=$AIRLIB,java=$JAVA,ros=$ROS,python=$PYTHON,types=$TYPES,vrep=$VREP,tests=$TESTS,android=$ANDROID,docs=$DOCS,clang=$CLANG,simtime=$SIMTIME,debug=$DEBUG gams.mwc

if [ $TYPES -eq 1 ]; then
# Strip the unnecessary NOTPARALLEL: directives
Expand All @@ -1013,10 +1093,10 @@ if [ $GAMS -eq 1 ] || [ $GAMS_AS_A_PREREQ -eq 1 ]; then
fi

echo "BUILDING GAMS"
echo "make depend java=$JAVA ros=$ROS types=$TYPES vrep=$VREP tests=$TESTS android=$ANDROID simtime=$SIMTIME docs=$DOCS -j $CORES"
make depend java=$JAVA ros=$ROS types=$TYPES vrep=$VREP tests=$TESTS android=$ANDROID simtime=$SIMTIME docs=$DOCS -j $CORES
echo "make java=$JAVA ros=$ROS types=$TYPES vrep=$VREP tests=$TESTS android=$ANDROID simtime=$SIMTIME docs=$DOCS -j $CORES"
make java=$JAVA ros=$ROS types=$TYPES vrep=$VREP python=$PYTHON tests=$TESTS android=$ANDROID simtime=$SIMTIME docs=$DOCS -j $CORES
echo "make depend airlib=$AIRLIB java=$JAVA ros=$ROS types=$TYPES vrep=$VREP tests=$TESTS android=$ANDROID simtime=$SIMTIME docs=$DOCS -j $CORES"
make depend airlib=$AIRLIB java=$JAVA ros=$ROS types=$TYPES vrep=$VREP tests=$TESTS android=$ANDROID simtime=$SIMTIME docs=$DOCS -j $CORES
echo "make airlib=$AIRLIB java=$JAVA ros=$ROS types=$TYPES vrep=$VREP tests=$TESTS android=$ANDROID simtime=$SIMTIME docs=$DOCS -j $CORES"
make airlib=$AIRLIB java=$JAVA ros=$ROS types=$TYPES vrep=$VREP python=$PYTHON tests=$TESTS android=$ANDROID simtime=$SIMTIME docs=$DOCS -j $CORES
GAMS_BUILD_RESULT=$?

if [ ! -f $GAMS_ROOT/lib/libGAMS.so ]; then
Expand Down
37 changes: 37 additions & 0 deletions scripts/projects/airsim_json_generator.py
@@ -0,0 +1,37 @@
#!/usr/bin/env python
import sys

def print_json(x):
print """ {
"SettingsVersion": 1.2,
"SimMode": "Multirotor",
"Vehicles": { """
for i in range(0, int(x)):
# Handle all cases up to and before i == x - 1 (e.g everything before the last)
if (i < (int(x) - 1)):
template = """ "agent.%d": {
"VehicleType": "SimpleFlight",
"X": %d,
"Y": 0,
"Z": -2,
"Yaw": -180
}, """ % (i, i)
# Handle the ending comma. Can be done easier, this is just simpler code to read.
# In the case of agent == 1 passed in, it will default to this, and so no comma.
elif (i == (int(x) - 1)):
template = """ "agent.%d": {
"VehicleType": "SimpleFlight",
"X": %d,
"Y": 0,
"Z": -2,
"Yaw": -180
} """ % (i, i)
print template
print """ } \n } """
return

if __name__ == "__main__":
if len(sys.argv) != 3:
print "Usage: python settings_json.py madara|json num_agents"
elif sys.argv[1] == "json":
print_json(sys.argv[2])