Skip to content

Commit

Permalink
feature(#183): Stochastic flocking
Browse files Browse the repository at this point in the history
- Initial implementation

- Requires injection of global swarm state each timestep, which is kind of
  icky, but the quickest/most computationally efficient way to do it.
  • Loading branch information
jharwell committed Mar 28, 2023
1 parent 10142a4 commit e1c31ae
Show file tree
Hide file tree
Showing 921 changed files with 9,932 additions and 4,825 deletions.
59 changes: 48 additions & 11 deletions .dir-locals.el
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,51 @@
(add-to-list 'flycheck-clang-args "-fPIC")
(add-to-list 'flycheck-clang-args "-std=c++17")
(add-to-list 'flycheck-clang-args "-Wno-pragma-once-outside-header")
(add-to-list 'flycheck-clang-definitions "COSM_ENABLE_PAL_TARGET_ROS")
(add-to-list 'flycheck-clang-definitions
"COSM_ENABLE_PAL_TARGET_ARGOS")
;; (add-to-list 'flycheck-clang-definitions
;; "COSM_HAL_TARGET=COSM_HAL_TARGET_ARGOS_FOOTBOT")
(add-to-list 'flycheck-clang-definitions
"COSM_HAL_TARGET=COSM_HAL_TARGET_ARGOS_DRONE")
(add-to-list 'flycheck-clang-definitions
"COSM_HAL_TARGET_HAS_QUADROTOR")
(add-to-list 'flycheck-clang-definitions
"COSM_HAL_TARGET_HAS_2D_BINDINGS")
(add-to-list 'flycheck-clang-definitions
"COSM_HAL_TARGET_HAS_3D_BINDINGS")

(add-to-list 'flycheck-clang-definitions "LIBRA_ER=LIBRA_ER_ALL")
(add-to-list 'flycheck-clang-definitions "RCPPSW_ER_SYSTEM_LOG4CXX")
(add-to-list 'flycheck-clang-args (concat "-isystem" (substitute-in-file-name
"$localroot/system/include")))
(add-to-list 'flycheck-clang-definitions
"LIBRA_ER=LIBRA_ER_ALL")
(add-to-list 'flycheck-clang-definitions
"RCPPSW_ER_SYSTEM_LOG4CXX")
(add-to-list 'flycheck-clang-args
(concat "-isystem" (substitute-in-file-name
"$localroot/system/include")))


(setq flycheck-gcc-include-path includes-list)
(add-to-list 'flycheck-gcc-args "-fPIC")
(add-to-list 'flycheck-gcc-args "-std=c++17")
(add-to-list 'flycheck-gcc-definitions "COSM_ENABLE_PAL_TARGET_ROS")
(add-to-list 'flycheck-gcc-definitions "RCPPSW_ER_SYSTEM_LOG4CXX")
(add-to-list 'flycheck-gcc-definitions "LIBRA_ER=LIBRA_ER_ALL")
(add-to-list 'flycheck-gcc-definitions
"COSM_ENABLE_PAL_TARGET_ARGOS")
(add-to-list 'flycheck-gcc-definitions
"COSM_HAL_TARGET=COSM_HAL_TARGET_ARGOS_DRONE")
(add-to-list 'flycheck-gcc-definitions
"COSM_HAL_TARGET_HAS_QUADROTOR")
(add-to-list 'flycheck-gcc-definitions
"COSM_HAL_TARGET_HAS_2D_BINDINGS")
(add-to-list 'flycheck-gcc-definitions
"COSM_HAL_TARGET_HAS_3D_BINDINGS")
;; (add-to-list 'flycheck-gcc-definitions
;; "COSM_HAL_TARGET=COSM_HAL_TARGET_ARGOS_FOOTBOT")
(add-to-list 'flycheck-gcc-definitions
"RCPPSW_ER_SYSTEM_LOG4CXX")
(add-to-list 'flycheck-gcc-definitions
"LIBRA_ER=LIBRA_ER_ALL")

(add-to-list 'flycheck-gcc-args (concat "-isystem" (substitute-in-file-name
"$localroot/system/include")))
(add-to-list 'flycheck-gcc-args
(concat "-isystem" (substitute-in-file-name
"$localroot/system/include")))

(let ((cc-search-dirs (list (concat (projectile-project-root) "include/cosm/*/*")
(concat (projectile-project-root) "src/*/*")
Expand All @@ -61,6 +89,15 @@
)
)
))
))
)
(nil . ((eval .
(progn
(add-to-list 'projectile-globally-ignored-directories
"docs/doxyoutput")
)
))
)

)

;;; end of .dir-locals.el
36 changes: 36 additions & 0 deletions .github/actions/rcppsw-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Setup RCPPSW'
description: 'Setup RCPPSW for CI and testing'
inputs:
cmake_extra_args: # id of input
description: 'Extra arguments to pass to cmake'
required: True
# outputs:
# time: # id of output
# description: 'The time we greeted you'
runs:
using: 'composite'
steps:
- name: Install RCPPSW
shell: bash
run: |
echo ${{ inputs.cmake_extra_args }}
mkdir -p build && cd build
git clone https://github.com/jharwell/rcppsw.git
cd rcppsw
git config --global --add safe.directory $PWD
git checkout devel
git submodule update --init --remote --recursive
mkdir build && cd build
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DLIBRA_DEPS_PREFIX=/usr/local \
-DCMAKE_BUILD_TYPE=DEV \
-DLIBRA_ER=ALL ${{ inputs.cmake_extra_args }} \
..
JOBS=$(grep -c ^processor /proc/cpuinfo)
make ticpp
make -j${JOBS} install
33 changes: 33 additions & 0 deletions .github/actions/rcsw-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 'Setup RCSW'
description: 'Setup RCSW for CI and testing'
# inputs:
# who-to-greet: # id of input
# description: 'Who to greet'
# required: true
# default: 'World'
# outputs:
# time: # id of output
# description: 'The time we greeted you'
runs:
using: 'composite'
steps:
- name: Install RCSW
shell: bash
run: |
mkdir -p build && cd build
git clone https://github.com/jharwell/rcsw.git
cd rcsw
git config --global --add safe.directory $PWD
git checkout devel
git submodule update --init --remote --recursive
mkdir build && cd build
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DLIBRA_DEPS_PREFIX=/usr/local \
-DCMAKE_BUILD_TYPE=DEV \
..
JOBS=$(grep -c ^processor /proc/cpuinfo)
make -j${JOBS} install
28 changes: 28 additions & 0 deletions .github/actions/rosbridge-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Setup a sensor for the ROS Extended Turtlebot3'
description: 'Setup a sensor for the ROS Extended Turtlebot3'
# inputs:
# repo: # id of input
# description: 'The github repo'
# required: true

# outputs:
# time: # id of output
# description: 'The time we greeted you'
runs:
using: 'composite'
steps:
- name: Install the ROSbridge
shell: bash
run: |
source /opt/ros/noetic/setup.bash
pip3 install catkin_tools
mkdir -p build && cd build
git clone https://github.com/jharwell/rosbridge.git
cd rosbridge
git checkout devel
ls -alh src/
catkin init
catkin config --extend /opt/ros/noetic
catkin config --install -DCMAKE_INSTALL_PREFIX=/usr/local
catkin build sr04us tsl2591
43 changes: 43 additions & 0 deletions .github/workflows/ci-argos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: ARGoS build and test

on:
workflow_call:
workflow_dispatch:

jobs:
build-and-test:
runs-on: ubuntu-latest
container:
image: jharwell/ubuntu22.04:2023-03-23
strategy:
matrix:
CMAKE_BUILD_TYPE:
- OPT
- DEV
COSM_BUILD_FOR:
- ARGOS_FOOTBOT
- ARGOS_DRONE

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/rcsw-setup
- uses: ./.github/actions/rcppsw-setup
with:
cmake_extra_args: ''
- name: Build=${{ matrix.CMAKE_BUILD_TYPE }} HAL_TARGET=${{ matrix.COSM_BUILD_FOR }}
shell: bash
run: |
git config --global --add safe.directory $PWD
git submodule update --init --remote --recursive
mkdir -p build && cd build
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DLIBRA_DEPS_PREFIX=/usr/local \
-DCMAKE_BUILD_TYPE=${{ matrix.CMAKE_BUILD_TYPE }} \
-DLIBRA_ER=ALL \
-DCOSM_BUILD_FOR=${{ matrix.COSM_BUILD_FOR }} \
..
make -j$(nproc)
45 changes: 45 additions & 0 deletions .github/workflows/ci-ros1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: ROS1 build and test

on:
workflow_dispatch:
workflow_call:

jobs:
build-and-test:
runs-on: ubuntu-latest
container:
image: jharwell/ubuntu20.04:2023-03-28
strategy:
matrix:
CMAKE_BUILD_TYPE:
- OPT
- DEV
COSM_BUILD_FOR:
- ROS_ETURTLEBOT3

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/rcsw-setup
- uses: ./.github/actions/rcppsw-setup
with:
cmake_extra_args: '-DRCPPSW_ER_OLD_LOG4CXX=YES'
- uses: ./.github/actions/rosbridge-setup
- name: Build=${{ matrix.CMAKE_BUILD_TYPE }} HAL_TARGET=${{ matrix.COSM_BUILD_FOR }}
shell: bash
run: |
git config --global --add safe.directory $PWD
git submodule update --init --remote --recursive
mkdir -p build && cd build
source /opt/ros/noetic/setup.bash
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DLIBRA_DEPS_PREFIX=/usr/local \
-DCMAKE_BUILD_TYPE=${{ matrix.CMAKE_BUILD_TYPE }} \
-DLIBRA_ER=ALL \
-DCOSM_BUILD_FOR=${{ matrix.COSM_BUILD_FOR }} \
..
make -j$(nproc)
61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build and test

on:
push:
branches:
- master
- devel

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
ci-argos:
uses: ./.github/workflows/ci-argos.yml
ci-ros1:
uses: ./.github/workflows/ci-ros1.yml

docs:
uses: ./.github/workflows/pages.yml
needs:
- ci-argos
- ci-ros1
secrets: inherit

tag-release:
runs-on: ubuntu-latest
needs:
- ci-argos
- ci-ros1

container:
image: jharwell/ubuntu22.04:2023-03-23
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3

- name: Push tag
shell: bash
run: |
git config --global --add safe.directory $PWD
git config --global user.email "${{ github.event.pusher.email }}"
git config --global user.name "${{ github.event.pusher.name }}"
git submodule update --init --remote --recursive
VERSION_MAJOR=$(sed -nE 's/.*PROJECT_VERSION_MAJOR ([0-9]+).*/\1/p' cmake/project-local.cmake)
VERSION_MINOR=$(sed -nE 's/.*PROJECT_VERSION_MINOR ([0-9]+).*/\1/p' cmake/project-local.cmake)
VERSION_PATCH=$(sed -nE 's/.*PROJECT_VERSION_PATCH ([0-9]+).*/\1/p' cmake/project-local.cmake)
PACKAGE_VERSION=$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH
if [ "${{ github.ref }}" = "refs/heads/devel" ]; then
TAG_VERSION=${PACKAGE_VERSION}.beta
TAG_MESSAGE="Development release ${TAG_VERSION}"
else
TAG_VERSION=${PACKAGE_VERSION}
TAG_MESSAGE="Release ${TAG_VERSION}"
fi
git tag ${TAG_VERSION} -m "${TAG_MESSAGE}"
git push -o ci.skip origin ${TAG_VERSION}
Loading

0 comments on commit e1c31ae

Please sign in to comment.