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

Updated with working Docker containers and CLI application #2

Merged
merged 101 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
4dfaed6
Removed DigitalFilters dependency
Arief-AK May 8, 2024
f831928
added build workflow
Arief-AK May 8, 2024
1b5e9a8
updated workflow
Arief-AK May 8, 2024
164d2f2
updated workflow
Arief-AK May 8, 2024
9a4bd25
Update build.yaml
Arief-AK May 8, 2024
53a6b4a
Update build.yaml
Arief-AK May 8, 2024
477b7d0
Update build.yaml
Arief-AK May 8, 2024
124fddd
Update build.yaml
Arief-AK May 8, 2024
3e02492
testing rosdep
Arief-AK May 9, 2024
23a59b7
testing rosdep
Arief-AK May 9, 2024
76ce786
testing rosdep
Arief-AK May 9, 2024
64afd9e
testing checkout action with specified path
Arief-AK May 9, 2024
bdd678c
testing checkout action with specified path
Arief-AK May 9, 2024
1f72dd3
testing checkout action with specified path
Arief-AK May 9, 2024
9d43ed3
testing checkout action with specified path
Arief-AK May 9, 2024
5768c4c
checking the repo structure on container
Arief-AK May 9, 2024
4032d44
checking the repo structure on container
Arief-AK May 9, 2024
615f9ff
checking the repo structure on container
Arief-AK May 9, 2024
035fd92
test success of cloning repo
Arief-AK May 9, 2024
216ce68
test success of cloning repo
Arief-AK May 9, 2024
14d8f14
workflow test for complete build
Arief-AK May 9, 2024
62f8d6d
workflow test for complete build
Arief-AK May 9, 2024
1ebb95c
added workflow status badge in README
Arief-AK May 9, 2024
bcba0ca
created sitl_build workflow
Arief-AK May 9, 2024
eee9c47
updated sitl_build to run on all branches
Arief-AK May 9, 2024
86892a4
updated sitl_build to run on all branches
Arief-AK May 9, 2024
2787eaf
added sitl_build status badge
Arief-AK May 9, 2024
25aaacc
used workflow run for sitl_build
Arief-AK May 9, 2024
77e5813
Merge pull request #1 from Arief-AK/formatting
Arief-AK May 9, 2024
457b895
updated workflow to trigger when pull request issued
Arief-AK May 9, 2024
a86d9a7
created publishing of package in GHCR
Arief-AK May 9, 2024
f730f95
updated secrets and package publishing workflow
Arief-AK May 9, 2024
de0292b
added Dockerfile
Arief-AK May 9, 2024
56bdd12
created status badge for publishing docker image as package
Arief-AK May 9, 2024
89a4d48
updated docker publishing workflow to only run when previous wokrkflo…
Arief-AK May 9, 2024
f4f5d6f
added GAZEBO_PLUGIN_PATH
Arief-AK May 13, 2024
b86ea15
added ROS_PACKAGE_PATH
Arief-AK May 13, 2024
dc43660
added rosdep and pip commands to setup procedure
Arief-AK May 13, 2024
f45fa0e
added rosdep install dependencies command into setup procedure
Arief-AK May 13, 2024
42a49e8
added Sarax with Docker document and images
Arief-AK May 13, 2024
fd438ce
added Docker section
Arief-AK May 13, 2024
b69ad6b
added always perform command on build workspace step in build workflow
Arief-AK May 13, 2024
6253089
modified workflow trigger for publishing docker package
Arief-AK May 13, 2024
1a4141d
test to remove rosdep
Arief-AK May 13, 2024
cb258fb
updated workflow to use rosdep to install dependencies
Arief-AK May 13, 2024
1dfece3
testing with multiple containers via matrix
Arief-AK May 13, 2024
e57ed3c
code cleanup
Arief-AK May 13, 2024
d9b8b27
added Docker Container Installation manual
Arief-AK May 16, 2024
a2bdd6b
fixed formatting for Docker installation manual
Arief-AK May 16, 2024
2187497
fixed command for building docker container
Arief-AK May 16, 2024
6b0e935
updated Docker container installation
Arief-AK May 17, 2024
0670f5e
Update Docker container Installation.md for running on linux
Arief-AK May 17, 2024
0d11f2b
added supporting documents, updated workflows, and improved Dockerfile
Arief-AK May 18, 2024
f47bb70
Update build.yaml
Arief-AK May 18, 2024
86b5d4f
edited build workflow
Arief-AK May 18, 2024
182a098
edited build workflow
Arief-AK May 18, 2024
ad0db8a
edited build
Arief-AK May 18, 2024
88013be
edited build
Arief-AK May 18, 2024
b62512a
Update build.yaml
Arief-AK May 18, 2024
27ff880
Update build.yaml
Arief-AK May 18, 2024
4673e55
edited build
Arief-AK May 18, 2024
bab4aa9
removed installing the geographical datasets
Arief-AK May 18, 2024
d03881f
added continue flag to all apt-get install commands in workflow
Arief-AK May 18, 2024
1aadf17
removed continue flag from pip
Arief-AK May 18, 2024
ba0cec8
added rosdep update command
Arief-AK May 18, 2024
d6f1f98
edited workflows to run on workflow_dispatch
Arief-AK May 18, 2024
110d6df
edited Dockerfile to ensure installation of dependencies
Arief-AK May 18, 2024
9b4cfe8
edited sitl_build workflow to run on package container and success of…
Arief-AK May 18, 2024
a65dfab
testing sitl_build workflow
Arief-AK May 18, 2024
3a529fa
testing sitl_build workflow
Arief-AK May 18, 2024
40e2eff
testing sitl_build workflow
Arief-AK May 18, 2024
203a150
testing sitl_build workflow
Arief-AK May 18, 2024
97a5683
testing sitl_build workflow
Arief-AK May 18, 2024
2bdb745
testing sitl_build workflow
Arief-AK May 18, 2024
2da2e66
edited docs
Arief-AK May 18, 2024
27dcb4c
setup SITL build and package publishing workflow on workflow_run event
Arief-AK May 18, 2024
293ea4d
edited docs
Arief-AK May 19, 2024
ff89fbc
added environment variables for running on WSL2
Arief-AK May 23, 2024
69499fb
added running on WSL2 information to Sarax with Docker document
Arief-AK May 23, 2024
750fa72
set build workflow to run on push and PR event
Arief-AK May 23, 2024
04c6133
updated Dockerfile to install nano
Arief-AK May 23, 2024
a39a75f
modified environment variables
Arief-AK May 24, 2024
f27bf12
created CLI menu application using bash scripts and python
Arief-AK May 24, 2024
2ddd1ff
updated readme
Arief-AK May 24, 2024
d07d0d5
Install and run sarax tested on WSL2
Arief-AK May 27, 2024
a432bdb
updated readme with instructions to use CLI script
Arief-AK May 27, 2024
12840f9
updated instructions for docker
Arief-AK May 27, 2024
2678af5
used global variable to easily modify various variables
Arief-AK May 27, 2024
b381264
tested on Ubuntu Linux and updated readme
Arief-AK May 27, 2024
4f6e476
modified scripts to better CLI application
Arief-AK May 28, 2024
dce1131
updated Dokcerfile with entrypoint
Arief-AK May 28, 2024
8f1d85f
modified docker_menu to handle integers
Arief-AK May 28, 2024
13534fd
updated Dockerfile to source entrypoint
Arief-AK May 28, 2024
3fab8f6
tested docker entrypoint on container
Arief-AK May 28, 2024
c35c5a0
modified docker scripts to fix bug on WSL2
Arief-AK Jun 1, 2024
dbeb6dd
added comments for using act
Arief-AK Jun 3, 2024
6511775
modified container script to properly initialise for Linux and WSL2 m…
Arief-AK Jun 3, 2024
d3134f0
modified to build simulation beforehand
Arief-AK Jun 3, 2024
0371d1a
updated for running docker entrypoint on both WSL2 and Linux
Arief-AK Jun 4, 2024
dca903f
implemented re-sourcing of bash in docker container
Arief-AK Jun 4, 2024
fee97ca
update urls
ayhamalharbat Jun 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Setup and build packages

# To manually run the workflow on GH, use the workflow_dispatch event trigger
# on: workflow_dispatch

# To automatically run on every push to GH, use the push and pull_request event trigger
on:
push:
branches:
- main
pull_request:
branches:
- main

env:
USER: github.actor

jobs:
build:
runs-on: ubuntu-latest
container:
image: px4io/px4-dev-ros-noetic:latest
options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
steps:

- name: Check environment
run: |
export
ulimit -a

- name: Update ROS dependencies
run: |
. /opt/ros/$ROS_DISTRO/setup.sh
rosdep update

- name: Create dependency workspace
run: |
mkdir -p ~/dependencies
cd ~/dependencies

- name: Install PX4 Dependencies
run: |
mkdir -p ~/dependencies
cd ~/dependencies
wget https://raw.githubusercontent.com/PX4/PX4-Autopilot/main/Tools/setup/ubuntu.sh
wget https://raw.githubusercontent.com/PX4/PX4-Autopilot/main/Tools/setup/requirements.txt
chmod +x ~/dependencies/ubuntu.sh && . ~/dependencies/ubuntu.sh

- name: Install MAVROS using binaries
run: |
mkdir -p ~/dependencies
cd ~/dependencies
sudo apt-get install ros-$ROS_DISTRO-mavros ros-$ROS_DISTRO-mavros-extras

- name: Install ROS building dependencies
run: |
sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential -y
sudo apt install python3-catkin-tools python3-rosinstall-generator python3-osrf-pycommon -y
sudo apt-get install ros-$ROS_DISTRO-rqt ros-$ROS_DISTRO-rqt-common-plugins -y
pip install scipy

- name: Create new workspace
run: |
cd ~
mkdir -p sarax_ws/src

- name: Initialise catkin workspace
run: |
cd ~/sarax_ws/
. /opt/ros/$ROS_DISTRO/setup.sh
catkin init
wstool init src

- name: Clone Sarax project
run: |
cd ~/sarax_ws/src
git clone ${{ github.server_url }}/${{ github.repository }}.git
ls -l

- name: Get dependencies using rosdep
run: |
cd ~/sarax_ws/
. /opt/ros/$ROS_DISTRO/setup.sh
rosdep install --from-paths src --ignore-src -r -y --skip-keys="python-scipy"

- name: Build workspace
if: always()
run: |
cd ~/sarax_ws/
. /opt/ros/$ROS_DISTRO/setup.sh
catkin build
53 changes: 53 additions & 0 deletions .github/workflows/publish_docker_package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Publish docker image as package

# To manually run the workflow on GH, use the workflow_dispatch event trigger
# on: workflow_dispatch

# To test workflow using act, use the push event
# on:
# push:
# branches:
# - main

# To automatically run depending on the status of the build.yaml workflow, use workflow_run event trigger
on:
workflow_run:
workflows: [Setup and build packages]
types: [completed]

jobs:
on-success:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- run: echo 'The build workflows have passed'

on-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'The build workflows have failed'

publish_package:
needs: on-success # Uncomment when on default branch (main)
runs-on: ubuntu-latest
steps:

- name: Checkout repository
uses: actions/checkout@v4

- name: Login to GH container registry
run: |
docker login --username ${{ github.actor }} --password ${{ secrets.GH_PAT }} ghcr.io

- name: Cleanup system
run: |
docker image prune

- name: Build Docker image
run: |
docker build --no-cache . -t ghcr.io/SaxionMechatronics/sarax-framework:latest

- name: Publish image
run: |
docker push ghcr.io/SaxionMechatronics/sarax-framework:latest
44 changes: 44 additions & 0 deletions .github/workflows/sitl_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Sarax PX4 SITL

# To manually run the workflow on GH, use the workflow_dispatch event trigger
# on: workflow_dispatch

# To test workflow using act, use the push event
# on:
# push:
# branches:
# - main

# To automatically run depending on the status of the build.yaml workflow, use workflow_run event trigger
on:
workflow_run:
workflows: [Publish docker image as package]
types: [completed]

jobs:
on-success:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- run: echo 'The Setup and build packages workflow passed'

on-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'The Setup and build packages workflow failed'

build:
needs: on-success # Uncomment when on default branch (main)
runs-on: ubuntu-latest
container:
image: ghcr.io/SaxionMechatronics/sarax-framework:latest
options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
steps:

- name: Run sarax SITL
run: |
. /home/user/.bashrc
cd /home/user/sarax_ws && ls -l
cd /home/user/sarax_ws/PX4-Autopilot/
./sarax_plus_sitl.bash
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode/
84 changes: 84 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Pull px4-ros-noetic image
FROM px4io/px4-dev-ros-noetic

# Update the linux environment
RUN echo "Updating environment" \
&& sudo apt install nano -y \
&& sudo apt install figlet -y \
&& sudo apt update -y \
&& sudo apt upgrade -y

# Check environment
RUN echo "Checking environment" \
&& export \
&& ulimit -a

# Perform rosdep
RUN echo "Use rosdep to update dependencies" \
&& . /opt/ros/$ROS_DISTRO/setup.sh \
&& rosdep update

# Create a dependency workspace
RUN mkdir -p ~/dependencies \
&& cd ~/dependencies

# Install PX4 Dependencies
RUN cd ~/dependencies \
&& wget https://raw.githubusercontent.com/PX4/PX4-Autopilot/main/Tools/setup/ubuntu.sh \
&& wget https://raw.githubusercontent.com/PX4/PX4-Autopilot/main/Tools/setup/requirements.txt \
&& chmod +x ~/dependencies/ubuntu.sh && . ~/dependencies/ubuntu.sh

# Install MAVROS using binaries
RUN cd ~/dependencies \
&& sudo apt-get install ros-$ROS_DISTRO-mavros ros-$ROS_DISTRO-mavros-extras -y \
&& wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh \
&& chmod +x install_geographiclib_datasets.sh && ./install_geographiclib_datasets.sh

# Install ROS build dependencies
RUN sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential -y \
&& sudo apt install python3-catkin-tools python3-rosinstall-generator python3-osrf-pycommon -y \
&& sudo apt-get install ros-$ROS_DISTRO-rqt ros-$ROS_DISTRO-rqt-common-plugins -y \
&& pip install scipy

# Create a workspace
RUN echo "Creating sarax workspace" \
&& cd /home \
&& mkdir -p user/sarax_ws/src/sarax

# Clone the sarax branch from the PX4-Autopilot repository
RUN cd /home/user/sarax_ws/ \
&& git clone --recursive -b v1.13.2-sarax-sim https://github.com/SaxionMechatronics/PX4-Autopilot.git

# Initialise catkin workspace
RUN cd /home/user/sarax_ws/ \
&& . /opt/ros/$ROS_DISTRO/setup.sh \
&& catkin init \
&& wstool init src

# Copy the source into workspace source directory
COPY . /home/user/sarax_ws/src/sarax/

# Install dependencies using rosdep
RUN cd /home/user/sarax_ws/ \
&& . /opt/ros/$ROS_DISTRO/setup.sh \
&& rosdep install --from-paths src --ignore-src -r -y --skip-keys="python-scipy"

# Build the workspace
RUN cd /home/user/sarax_ws/ \
&& . /opt/ros/$ROS_DISTRO/setup.sh \
&& catkin build

# Export graphic libraries
RUN echo "# If running on WSL2, uncomment the following lines" >> ~/.bashrc \
&& echo "# export LD_LIBRARY_PATH=/usr/lib/wsl/lib" >> ~/.bashrc \
&& echo "# export LIBVA_DRIVER_NAME=d3d12" >> ~/.bashrc

# Export worskpace and update sourcing
RUN cd /home/user/sarax_ws/ \
&& echo "export SARAX_WS=$PWD" >> ~/.bashrc \
&& echo "source \$SARAX_WS/devel/setup.bash" >> ~/.bashrc \
&& echo "source \$SARAX_WS/src/sarax/scripts/container/docker_entrypoint.sh" >> ~/.bashrc

# Build the simulator to speed up running within the container
RUN cd /home/user/sarax_ws/PX4-Autopilot \
&& ./sarax_plus_sitl.bash
Loading