Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/gtri/scrimmage
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/gtri/scrimmage: (227 commits)
  allowing an external force in the fixed wing model
  added a loop to call close() for all metrics plugins in simcontrol's shutdown() method (gtri#515)
  added more randomness to the entityPlugin shape hash (gtri#514)
  allow setting initial scale of aircraft in a mission file (gtri#511)
  fixed nullptr in draw_sphere (gtri#507)
  added optional argument of enable_gui with ardupilot SITL (gtri#513)
  Update GPS.proto
  Fix could not find plugin ROSAirSim bug (gtri#500)
  updated terrain generation docs
  Update docs to reflect Internal GTRI Mailing List and Fix Link (gtri#485)
  exposed the flush() function so that partial log files can be written in the case of scrimmage crashing
  Added a printer utility in the log directory. Usage comments are in src/log/Print.cpp. This utility is shared among plugins in the simulation and can be invoked to print to both the console and to a file in the log directory called console.log. * PrintDev() * PrintInfo() * PrintWarning() * PrintError()
  fix build issues
  Updated shape docs per issue gtri#438
  Update README.md
  Create BatchExample.py
  Update multiple-local-runs.rst
  Fixing multi-agent bugs in scrimmage/openai
  travis.yml: Push docs to server from Ubuntu 20.04 docker image
  create docker tags for xenial, focal, latest
  ...
  • Loading branch information
kemen209 committed Jun 10, 2021
2 parents 4e447e8 + fffeb46 commit 8e8a9be
Show file tree
Hide file tree
Showing 399 changed files with 16,172 additions and 3,196 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ tags*
**.DS_Store
**.ccls*
.vscode
env
.idea*
python/scrimmage/bindings
python/dist
51 changes: 17 additions & 34 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ env:
global:
- ENCRYPTION_LABEL: dcc9512392ad

before_install:
- sudo apt-get install tar

install:
- echo '|1|hwoha+oiyHsKVrC9MhVGWVS26Pk=|GjfQxx3fU/0NzJb8DvMLSs9fXTc= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA363sO9FUaRFrYc3JGHLRfVCe49YBXVJYHt4HUhv8qaId/gFmL9tuL4SHuB5POc6zn+QGFrCQXfOSDBPcFI/lveDLMFWBx3k942tvtU4UUsdI0+8yvddGoILu5Rrw78HLmfXUUpjC9Qo27EO7OEkDbg6ybdQr82sBCjtTT9s7p9PWwXs6QISxsEek0ECNuQGBbICM6gm91zXFnwLa3COicvUpLGpFd0/jncObi2MjFrnyDPgDJ922DKkriwFQ0lFLBriHl10RLH3/KZjmivwmiSV+1J+Kvatf767hkEydEESTwe9++RLDh9/ab4KoKYbQ65da16Ai8Z6XwoOKIm/FYw==' >> $HOME/.ssh/known_hosts

Expand All @@ -20,55 +17,41 @@ services:
jobs:
include:
- stage: "Build Docker Images"
env: CACHE_NAME=ubuntu1604
name: "Build on Ubuntu 16.04"
script:
- export REPO=$DOCKER_USERNAME/scrimmage
- export DEPENDENCIES=$DOCKER_USERNAME/scrimmage-dependencies:latest
- export IMG_CACHE=$HOME/docker/scrimmage-dependencies-16.04.tar.gz
- export USE_CACHE=""
- if [ -f ${IMG_CACHE} ]; then
zcat ${IMG_CACHE} | docker load;
USE_CACHE="--cache-from ${DEPENDENCIES}";
fi
- docker build ${USE_CACHE} --target dependencies -t ${DEPENDENCIES} -f ./ci/dockerfiles/ubuntu-16.04 .
- docker build ${USE_CACHE} -t $REPO:${TRAVIS_BUILD_NUMBER} -f ./ci/dockerfiles/ubuntu-16.04 .
- docker build -t $REPO:xenial-${TRAVIS_BUILD_NUMBER} -f ./ci/dockerfiles/ubuntu-16.04 .
- export TAG=`if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`
- |
if [[ "$TAG" == "latest" ]]; then
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
docker tag $REPO:$TRAVIS_BUILD_NUMBER $REPO:$TAG;
docker create --name mycontainer $REPO:$TAG;
docker cp mycontainer:/root/scrimmage/scrimmage/build/docs ./doc_output;
bash ./ci/scripts/deploy-docs.sh;
docker tag $REPO:xenial-$TRAVIS_BUILD_NUMBER $REPO:xenial;
docker push $REPO;
docker save ${DEPENDENCIES} | gzip -2 > ${IMG_CACHE};
fi
- name: "Build on Ubuntu 18.04"
env: CACHE_NAME=ubuntu1804
script:
- export REPO=$DOCKER_USERNAME/scrimmage
- export DEPENDENCIES=$DOCKER_USERNAME/scrimmage-dependencies:18.04
- export IMG_CACHE=$HOME/docker/scrimmage-dependencies-18.04.tar.gz
- export USE_CACHE=""
- if [ -f ${IMG_CACHE} ]; then
zcat ${IMG_CACHE} | docker load;
USE_CACHE="--cache-from ${DEPENDENCIES}";
fi
- docker build ${USE_CACHE} --target dependencies -t ${DEPENDENCIES} -f ./ci/dockerfiles/ubuntu-18.04 .
- docker build ${USE_CACHE} -t $REPO:${TRAVIS_BUILD_NUMBER} -f ./ci/dockerfiles/ubuntu-18.04 .
- docker build -t $REPO:bionic-${TRAVIS_BUILD_NUMBER} -f ./ci/dockerfiles/ubuntu-18.04 .
- export TAG=`if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`

- name: "Build on Ubuntu 20.04"
script:
- export REPO=$DOCKER_USERNAME/scrimmage
- docker build -t $REPO:focal-${TRAVIS_BUILD_NUMBER} -f ./ci/dockerfiles/ubuntu-20.04 .
- export TAG=`if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`
- |
if [[ "$TAG" == "latest" ]]; then
docker save ${DEPENDENCIES} | gzip -2 > ${IMG_CACHE};
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
docker tag $REPO:focal-$TRAVIS_BUILD_NUMBER $REPO:focal;
docker tag $REPO:focal-$TRAVIS_BUILD_NUMBER $REPO:$TAG;
docker create --name mycontainer $REPO:$TAG;
docker cp mycontainer:/root/scrimmage/scrimmage/build/docs ./doc_output;
bash ./ci/scripts/deploy-docs.sh;
docker push $REPO;
fi
notifications:
email:
on_success: change
on_failure: always

# Setup the docker cache directories
cache:
directories:
- $HOME/docker
54 changes: 35 additions & 19 deletions 3rd-party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ set(SETUP_DIR "${CMAKE_SOURCE_DIR}/setup")
set(PATCH_SCRIPT "${SETUP_DIR}/apply-patch.sh")

option(BUILD_BINARY_PACKAGES "Build deb packages for dependencies." OFF)
option(BUILD_SOURCE_PACKAGES "Build sources packages for dependencies." OFF)
option(BUILD_SOURCE_PACKAGES "Build sources packages for dependencies." ON)

include(ProcessorCount)
ProcessorCount(N)
if(NOT N EQUAL 0)
set(CTEST_BUILD_FLAGS -j${N})
set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N})
endif()

if (BUILD_BINARY_PACKAGES AND BUILD_SOURCE_PACKAGES)
message(FATAL_ERROR "You can only build source or binary packages, not both at one time.")
Expand Down Expand Up @@ -68,8 +75,8 @@ execute_process(COMMAND bash "-c" "${SETUP_DIR}/edit-config.sh ${SCRIMMAGE_LOCAL

include(ExternalProject)

set(JSBSIM_GIT_REPOSITORY git://git.code.sf.net/p/jsbsim/code)
set(JSBSIM_GIT_TAG 36de9ac63c959cef5d7b2c56fb49c1a57fd46369)
set(JSBSIM_GIT_REPOSITORY https://github.com/JSBSim-Team/jsbsim.git)
set(JSBSIM_GIT_TAG 4840a621dafe1ce64970990ddaec3e86a1c7e082)
ExternalProject_Add (
jsbsim
PREFIX ${CMAKE_CURRENT_BINARY_DIR}
Expand Down Expand Up @@ -104,27 +111,36 @@ ExternalProject_Add (
########################################################
# Download and build grpc
########################################################
configure_file(${PATCH_DIR}/grpc.patch.in ${PATCH_DIR}/grpc.patch)
set(GRPC_VERSION_NUM 1.2.1)
set(GRPC_VERSION v${GRPC_VERSION_NUM})
set(GRPC_GIT_REPOSITORY https://github.com/grpc/grpc)


ExternalProject_Add (
grpc
PREFIX ${CMAKE_CURRENT_BINARY_DIR}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND make HAS_SYSTEM_PROTOBUF=true PROTOC=${PROTOBUF_DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/protoc
BUILD_COMMAND
${CMAKE_COMMAND} -E env
LD_LIBRARY_PATH=${PROTOBUF_DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/
PKG_CONFIG_PATH=${PROTOBUF_DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/
make
HAS_SYSTEM_PROTOBUF=true
PROTOC=${PROTOBUF_DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/protoc
CFLAGS=-Wno-error
${CTEST_BUILD_FLAGS}
DEPENDS protobuf
GIT_REPOSITORY ${GRPC_GIT_REPOSITORY}
GIT_TAG ${GRPC_VERSION}
UPDATE_COMMAND ""
PATCH_COMMAND ${PATCH_SCRIPT} ${PATCH_DIR}/grpc.patch
PATCH_COMMAND
${PATCH_SCRIPT} ${PATCH_DIR}/grpc-0001-Include-lib-dir-in-link-flags.patch
COMMAND
${PATCH_SCRIPT} ${PATCH_DIR}/grpc-0002-Fix-build-with-more-recent-openssl.patch
COMMAND
${PATCH_SCRIPT} ${PATCH_DIR}/grpc-0003-Fix-incorrect-linker-commands-in-grpc.patch
INSTALL_COMMAND make install prefix=${GRPC_INSTALL_PREFIX}
# CMAKE_ARGS
# -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
# -DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX}
# -DgRPC_PROTOBUF_PROVIDER="package"
# -DgRPC_SSL_PROVIDER="package"
)

########################################################
Expand Down Expand Up @@ -186,7 +202,7 @@ if (BUILD_SOURCE_PACKAGES)
find_package(CMakeDebSrc)
SET(PPA "ppa:kevin-demarco/scrimmage" CACHE STRING "Launchpad PPA for dput.")
SET(GPG_KEY_ID "3951DA01" CACHE STRING "GPG Key ID on local system.")
SET(DISTRIBUTIONS "xenial jessie" CACHE STRING "Target Linux distributions.")
SET(DISTRIBUTIONS "xenial bionic focal jessie" CACHE STRING "Target Linux distributions.")
SET(ARCHITECTURES "amd64 i386 armhf arm64" CACHE STRING "Possible build architectures.")

BuildDebSrcFromRepo(
Expand All @@ -197,7 +213,7 @@ if (BUILD_SOURCE_PACKAGES)
GIT_REPOSITORY ${PYBIND11_GIT_REPOSITORY}
GIT_TAG ${PYBIND11_GIT_TAG}
SOURCE_VERSION 2.2.3
PPA_VERSION_NUMBER 6
PPA_VERSION_NUMBER 7
PPA ${PPA}
GPG_KEY_ID ${GPG_KEY_ID}
UPDATE_COMMAND ""
Expand Down Expand Up @@ -244,12 +260,12 @@ if (BUILD_SOURCE_PACKAGES)
PACKAGES_DIR ${CMAKE_SOURCE_DIR}/packages
GIT_REPOSITORY ${JSBSIM_GIT_REPOSITORY}
GIT_TAG ${JSBSIM_GIT_TAG}
SOURCE_VERSION 0.1
PPA_VERSION_NUMBER 6
SOURCE_VERSION 0.2
PPA_VERSION_NUMBER 1
PPA ${PPA}
GPG_KEY_ID ${GPG_KEY_ID}
UPDATE_COMMAND ""
PATCH_COMMAND ${PATCH_SCRIPT} ${PATCH_DIR}/jsbsim.patch && ${SETUP_DIR}/install-aircraft.sh -c "${CMAKE_CURRENT_BINARY_DIR}/src/scrimmage-jsbsim-xenial-deb-src"
PATCH_COMMAND ${PATCH_SCRIPT} ${PATCH_DIR}/jsbsim.patch && ${SETUP_DIR}/install-aircraft.sh -c "${CMAKE_CURRENT_BINARY_DIR}/src/scrimmage-jsbsim-*-deb-src"
CONFIGURE_COMMAND ""
)

Expand Down Expand Up @@ -307,9 +323,9 @@ if (BUILD_SOURCE_PACKAGES)
ARCHITECTURES ${ARCHITECTURES}
PACKAGES_DIR ${CMAKE_SOURCE_DIR}/packages
PROJECT_DIRECTORY ${CMAKE_SOURCE_DIR}/packages/scrimmage-dependencies/scrimmage-dependencies
SOURCE_VERSION 0.2.1
SOURCE_VERSION 0.2.2
PPA ${PPA}
PPA_VERSION_NUMBER 6
PPA_VERSION_NUMBER 8
GPG_KEY_ID ${GPG_KEY_ID}
)

Expand All @@ -321,7 +337,7 @@ if (BUILD_SOURCE_PACKAGES)
GIT_REPOSITORY https://github.com/SyllogismRXS/scrimmage-extra-data.git
GIT_TAG master
SOURCE_VERSION 0.1
PPA_VERSION_NUMBER 6
PPA_VERSION_NUMBER 7
PPA ${PPA}
GPG_KEY_ID ${GPG_KEY_ID}
UPDATE_COMMAND ""
Expand Down
78 changes: 49 additions & 29 deletions 3rd-party/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,36 @@

SCRIMMAGE currently targets Ubuntu Xenial. This means that if a package exists
in Ubuntu Xenial that SCRIMMAGE depends on, apt-get will be used to install the
package. However, in some cases, we need much newer versions of the software
than are provided by Canonical. This subproject is for building the few
dependencies that have to be built from source because we require custom or
newer versions of the software. This project can build deb, rpm, source
binaries (for PPA), and local builds for the required dependencies.
package.

However, in some cases, we need much newer versions of the software than are
provided by Canonical. This subproject is for building the few dependencies
that have to be built from source because we require custom or newer versions
of the software.

This project can build deb, rpm, source binaries (for PPA), and local builds
for the required dependencies.

## Build Local Versions of dependencies

This is the old process for installing SCRIMMAGE's dependencies, but it will be
maintained for system flexibility. After running the following commands, the
dependencies will be installed under ~/.local :
dependencies will be installed under `~/.local`:

$ cd /path/to/3rd-party
$ mkdir -p build && cd build
$ cmake ..
$ source ~/.scrimmage/setup.bash
$ make

After building these libraries, you can make use of them by adding them to the
`LD_LIBRARY_PATH` and then following the standard build process:

$ export LD_LIBRARY_PATH="$HOME/.local/lib/"
$ cd build
$ cmake .. -DCMAKE_PREFIX_PATH="$HOME/.local"
$ make

## Build deb packages

deb packages for the dependencies can be built by running the following
Expand All @@ -38,29 +50,35 @@ Similarly, rpm packages can be built:
$ cmake .. -DBUILD_BINARY_PACKAGES=ON -DPACKAGE_OUTPUT_TYPE=rpm
$ make

## Build debian source packages
## Build Debian source packages

In order for Launchpad to provide debian binary packages, debian source
packages have to be uploaded to Launchpad via dput. This project provides cmake
build targets for the building of these source packages. It is recommended that
you use a different build directory for building PPA source packages since some
of the CMake variables may conflict with your locally built binary
packages. You have to manually specify PPA targets to build since they are not
built by default to discourage uploading to Launchpad accidently. By default,
Launchpad requires Debian source packages in order to provide compiled
packages. These source packages are built with the CMake build targets in this
directory and uploaded to Launchpad with
[dput](http://manpages.ubuntu.com/manpages/xenial/man1/dput.1.html).

It is recommended that you use a different build directory for building PPA
source packages since some of the CMake variables may conflict with your
locally built binary packages.

You have to manually specify PPA targets to build since they are not
built by default to discourage uploading to Launchpad accidentally. By default,
the packages are uploaded to Kevin DeMarco's PPA
(ppa:kevin-demarco/scrimmage). Thus, if you don't have his GPG keys (which you
(`ppa:kevin-demarco/scrimmage`). Thus, if you don't have his GPG keys (which you
don't), but you still want to upload to Launchpad, you will need to create a
Launchpad account, a PPA, and setup your GPG keys with the Ubuntu
keyserver. You can change the PPA and GPG key ID with the "PPA" and
"GPG\_KEY\_ID" CMake cache variables.
keyserver. You can change the PPA and GPG key ID with the `PPA` and
`GPG_KEY_ID` CMake cache variables.

The CMakeDebSrc cmake project is used to build the debian source
packages. CMakeDebSrc is a collection of cmake scripts that wrap around
pbuilder commands to build packages for various Linux distributions and
architectures. First, clone and install the CMakeDebSrc project from GitHub:
https://github.com/SyllogismRXS/CMakeDebSrc. You will also need to use pbuilder
to initialize a base tarball and setup a pbuilderrc file (see CMakeDebSrc's
installation instructions).
architectures.

First, clone and install the [CMakeDebSrc project from
GitHub](https://github.com/SyllogismRXS/CMakeDebSrc). You will also need to use
pbuilder to initialize a base tarball and setup a `/.pbuilderrc` file (see
CMakeDebSrc's installation instructions).

$ cd /path/to/3rd-party
$ mkdir -p build-ppa && cd build-ppa
Expand All @@ -71,17 +89,18 @@ installation instructions).

As changes are made to the dependencies source code and the debian packaging
configuration files, the package maintainer needs to bump the versions for the
SOURCE\_VERSION and PPA\_NUMBER in the root CMakeLists.txt file. Note: Allow
protobuf3 to build successfully on the Launchpad server before building
grpc. Then, allow grpc to build successfully before building the
`SOURCE_VERSION` and `PPA_NUMBER` in the root `CMakeLists.txt` file.

Note: Allow protobuf3 to build successfully on the Launchpad server before
building grpc. Then, allow grpc to build successfully before building the
dependencies-ppa.

## Build GRPC and Protobuf Python Packages from Source

### Install protobuf Python package
### Install Protobuf Python package

Protobuf should be installed using the source files that are compiled during
build. Using protobuf from PyPI (i.e. what you get with `pip install protobuf`
build. Using Protobuf from PyPI (i.e. what you get with `pip install protobuf`
) is known to cause crashes.

$ cd /path/to/scrimmage/3rd-party/build/src/protobuf/python
Expand Down Expand Up @@ -119,6 +138,7 @@ Allow pbuilder to have access to the network during build-time:
$ make scrimmage-pybind11-local-test

## Manual

Change directories to the location of the *.dsc file that was created and run
pbuilder:

Expand All @@ -127,9 +147,9 @@ pbuilder:

## Test Resulting Binary Debian Packages

The result of the package-name-local-test target is a debian binary package,
which is usually output to ~/pbuilder/xenial_result. To see the contents of the
output binary package, run the following command:
The result of the package-name-local-test target is a Debian binary package,
which is usually output to `~/pbuilder/xenial_result`. To see the contents of
the output binary package, run the following command:

$ dpkg -c ~/pbuilder/xenial_result/scrimmage-pybind11_0.1.1-0ppa1_amd64.deb

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scrimmage-dependencies (@ARG_SOURCE_VERSION@.@ARG_PPA_VERSION_NUMBER@-@ARG_PPA_VERSION_NUMBER@-@ARG_DISTRIBUTION@ppa@ARG_PPA_VERSION_NUMBER_SUFFIX@) @ARG_DISTRIBUTION@; urgency=medium

* Initial upload!

-- Kevin DeMarco <[email protected]> @DATE_STRING@
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
16 changes: 16 additions & 0 deletions 3rd-party/packages/scrimmage-dependencies/bionic/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Source: scrimmage-dependencies
Section: devel
Priority: optional
Maintainer: Kevin DeMarco <[email protected]>
Build-Depends: debhelper (>= 9), cmake, build-essential
Homepage: https://www.scrimmagesim.org

Package: scrimmage-dependencies
Depends: scrimmage-pybind11,
scrimmage-jsbsim,
scrimmage-protobuf3,
scrimmage-grpc
Architecture: any
Multi-Arch: same
Description: dependencies used by SCRIMMAGE
This is the version of dependencies used by SCRIMMAGE
Loading

0 comments on commit 8e8a9be

Please sign in to comment.