Skip to content

Commit

Permalink
Feature/auto logger (#331)
Browse files Browse the repository at this point in the history
* add docker build action

Signed-off-by: Masaya Kataoka <[email protected]>

* rename docker

Signed-off-by: Masaya Kataoka <[email protected]>

* enable logging all topics

Signed-off-by: Masaya Kataoka <[email protected]>

* add rosbag directory

Signed-off-by: Masaya Kataoka <[email protected]>

* update entrypoint

Signed-off-by: Masaya Kataoka <[email protected]>

---------

Signed-off-by: Masaya Kataoka <[email protected]>
  • Loading branch information
hakuturu583 authored Feb 22, 2024
1 parent 6174abd commit 8476d44
Show file tree
Hide file tree
Showing 11 changed files with 155 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker/auto_logger/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages.repos
34 changes: 34 additions & 0 deletions .github/workflows/docker/auto_logger/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ARG ROS_DISTRO=humble
FROM ros:${ROS_DISTRO}-ros-core
SHELL ["/bin/bash", "-c"]

RUN apt update && \
apt install -y ros-$ROS_DISTRO-rosbag2-storage-mcap ros-$ROS_DISTRO-rosbag2 python3-vcstool python3-rosdep git python3-colcon-common-extensions && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN mkdir -p messages_ws/src

WORKDIR messages_ws
COPY packages.repos packages.repos
RUN vcs import src < packages.repos

RUN rosdep init && \
rosdep update && \
apt update && \
source /opt/ros/$ROS_DISTRO/setup.bash && \
rosdep install -iry --from-paths $(colcon list -p | xargs -I{} bash -c 'if [ "`cat {}/package.xml | grep "rosidl_interface_packages"`" ]; then echo {}; fi') && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN source /opt/ros/$ROS_DISTRO/setup.bash && \
colcon build --packages-select $(colcon list -n | xargs -I{} bash -c 'if [ "`cat {}/package.xml | grep "rosidl_interface_packages"`" ]; then echo {}; fi' | xargs)

ENV ROS_LOCALHOST_ONLY 0

RUN mkdir /rosbag

ADD entrypoint.sh /
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
70 changes: 70 additions & 0 deletions .github/workflows/docker/auto_logger/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: "Build auto logger image action"
description: "Build Virtual RobotX docker images"

inputs:
docker_username:
description: "Username for Dockerhub"
required: true
docker_password:
description: "Password for Dockerhub"
required: true

runs:
using: "composite"
steps:
- uses: actions/checkout@v2
- name: basic install
run: |
sudo apt install make ansible
- uses: actions/checkout@v2-beta
- name: run ansible
run: |
ansible-playbook -i ansible/hosts/localhost.ini ansible/export_repos_full.yml --connection local --become -e ansible_user=ubuntu
- name: copy repos file
run: |
cp ansible/mv ansible/packages.repos .github/workflows/docker/auto_logger/
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ inputs.docker_username }}
password: ${{ inputs.docker_password }}
- name: Build and Push Docker Image
if: ${{ github.event_name != 'pull_request'}}
uses: docker/build-push-action@v2
env:
DOCKER_BUILDKIT: 1
with:
username: ${{ inputs.docker_username }}
password: ${{ inputs.docker_password }}
context: ./.github/workflows/docker/auto_logger
file: ./.github/workflows/docker/auto_logger/Dockerfile
tags: wamvtan/auto_logger:latest
no-cache: false
cache-from: type=registry,ref=wamvtan/auto_logger:buildcache
cache-to: type=registry,ref=wamvtan/auto_logger:buildcache,mode=max
push: true
- name: Build Docker Image
if: ${{ github.event_name == 'pull_request'}}
uses: docker/build-push-action@v2
env:
DOCKER_BUILDKIT: 1
with:
username: ${{ inputs.docker_username }}
password: ${{ inputs.docker_password }}
context: ./.github/workflows/docker/auto_logger
file: ./.github/workflows/docker/auto_logger/Dockerfile
tags: wamvtan/auto_logger:latest
no-cache: false
cache-from: type=registry,ref=wamvtan/auto_logger:buildcache
push: false
- uses: peter-evans/dockerhub-description@v3
if: ${{ github.event_name == 'pull_request'}}
with:
username: ${{ inputs.docker_username }}
password: ${{ inputs.docker_password }}
repository: wamvtan/auto_logger
short-description: "Docker Image for Virtual RobotX Challenge"
readme-filepath: ./.github/workflows/docker/auto_logger/README.md
enable-url-completion: true
10 changes: 10 additions & 0 deletions .github/workflows/docker/auto_logger/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -e

# setup ros environment.
source "/opt/ros/$ROS_DISTRO/setup.bash"

# exec "$@"

# record all topics
ros2 bag record -a -d 10 -s mcap -o /rosbag/$(date '+%Y-%m-%d-%H-%M-%S')
2 changes: 1 addition & 1 deletion .github/workflows/docker/dev_container/action.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Build dev-container image Action"
name: "Build dev-container image action"
description: "Build dev-container docker images"

inputs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker/l4t_opencv/action.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Build L4T OpenCV image Action"
name: "Build L4T OpenCV image action"
description: "Build L4T OpenCV docker images"

inputs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker/vrx/action.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Build VRX image Action"
name: "Build VRX image action"
description: "Build Virtual RobotX docker images"

inputs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker/yolox/action.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Build YOLOX image Action"
name: "Build YOLOX image action"
description: "Build YOLOX docker images"

inputs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker/yolox_trainer/action.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Build YOLOX tainer image Action"
name: "Build YOLOX tainer image action"
description: "Build YOLOX trainer docker images"

inputs:
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/docker_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,14 @@ jobs:
with:
docker_username: ${{ secrets.DOCKER_USERNAME }}
docker_password: ${{ secrets.DOCKER_PASSWORD }}
auto_logger:
name: build and push wamvtan/auto_logger
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: ./.github/workflows/actions/cleanup_runner
- uses: ./.github/workflows/docker/vrx
with:
docker_username: ${{ secrets.DOCKER_USERNAME }}
docker_password: ${{ secrets.DOCKER_PASSWORD }}
24 changes: 24 additions & 0 deletions docs/docs/tools/tools.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Tools

## Automated logger

Plug & play automated rosbag logging tools for robots.

### Supported platform

- [ASUSTOR FLASHSTOR 6 (FS6706T)](https://www.asustor.com/en/product?p_id=79)

### How it works

This tools is works on docker container, only you have to do is pull wamvtan/auto_logger image.

### Setup

#### Setup ASUSTOR FLASHSTOR 6 (FS6706T)

Setup ASUSTOR FLASHSTOR 6 (FS6706T) using [asustor control center](https://www.asustor.com/en/service/download_acc/) or [AiMaster.](https://www.asustor.com/admv2?type=4&subject=19&sub=69&lan=en)

#### Setup Portainer in ASUSTOR FLASHSTOR 6 (FS6706T)

Please check these documentation.
- [Introducing Portainer(EN)](https://www.asustor.com/en/online/College_topic?topic=145)
- [Introducing Portainer(JP)](https://www.asustor.com/ja/online/College_topic?topic=145)

## Train yolox model
### Requirement
- [docker](https://docs.docker.com/desktop/install/ubuntu/#install-docker-desktop)
Expand Down

0 comments on commit 8476d44

Please sign in to comment.