micro-ROS / micro-ROS/micro-ROS-demos

Dockerfile can't be build if I add personal micro-ros subscriber to micro-ROS-demos

オープン
#74 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
C
スター
101
フォーク
35
平均マージ
4日 16時間
マージ済み PR(30日)
3

説明

## Issue template

- Hardware description: Ubuntu 22.04
- RTOS:
- Installation type: micro_ros_setup
- Version or commit hash: humble

#### Steps to reproduce the issue
Hey, my goal is to create a Docker container where everything is set up, and I can directly execute my own subscriber from a docker compose file and don't have to run commands in the terminal.
My plan was to copy my publisher after I ran `ros2 run micro_ros_setup create_firmware_ws.sh host` into the workspace but afterwords when I run `ros2 run micro_ros_setup build_firmware.sh` it throws an error because micro_ros_setup can no longer be found ( I think this is because they are in different layers of the image and not have access to each other).

Any ideas how I can solve my issues?

```
# Download base image ubuntu 22.04
FROM ubuntu:22.04

# LABEL about the custom image
LABEL maintainer="cornelius.welling@gmail.com"
LABEL version="1.0"
LABEL description="This is a ROS2_pub_sub Docker Image"

# Define build arguments
ARG TIME_ZONE
ARG DEBIAN_FRONTEND=noninteractive
ARG ROS_DISTRO=humble
#ARG DEBIAN_FRONTEND=noninteractive -> no user input needed when building

# Install dependencies
RUN apt-get update && \
apt-get install -y locales\
curl\
locales\
python3-pip\
&& rm -rf /var/lib/apt/lists/*

# Generate and set locales
RUN locale-gen en_US en_US.UTF-8 && \
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8

# Set environment variables
ENV TZ=Europe/Berlin
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
ENV ROS_VERSION=2
ENV ROS_DISTRO=humble
ENV ROS_PYTHON_VERSION=3
ENV RCUTILS_CONSOLE_OUTPUT_FORMAT="[{severity} {time}]: {message}"

# Add, install and source ROS2 humble
RUN apt-get update && apt-get install -y software-properties-common curl && \
add-apt-repository universe

RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null

# Install bootstrap tools
RUN apt-get update && apt-get install --no-install-recommends -y \
nano \
iputils-ping \
wget \
python3-colcon-common-extensions \
python3-colcon-mixin \
python3-rosdep \
python3-vcstool \
git \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get upgrade -y &&\
apt-get install -y ros-humble-desktop\
&& rm -rf /var/lib/apt/lists/*

# Install cyclonedds
RUN apt-get update && apt-get install -y ros-humble-rmw-cyclonedds-cpp && rm -rf /var/lib/apt/lists/*

# Set the RMW_IMPLEMENTATION environment variable
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

RUN bash -c "source /opt/ros/humble/setup.bash"

RUN mkdir /microros_ws
WORKDIR /microros_ws
RUN git clone -b $ROS_DISTRO https://github.com/micro-ROS/micro_ros_setup.git src/micro_ros_setup

# bootstrap rosdep
RUN rosdep init && \
rosdep update --rosdistro humble
RUN apt update && rosdep update
RUN rosdep install -i --from-path src --rosdistro humble -y

**# After setting up micro-ROS and running the first build:
RUN bash -c "source /opt/ros/humble/setup.bash && \
colcon build && \
source install/local_setup.bash && \
ros2 run micro_ros_setup create_firmware_ws.sh host"

# Add your new application
COPY ./MICROROS_SUBPUB/main.c /microros_ws/src/uros/micro-ROS-demos/rclc/MICROROS_SUBPUB/main.c
COPY ./MICROROS_SUBPUB/CMakeLists.txt /microros_ws/src/uros/micro-ROS-demos/rclc/MICROROS_SUBPUB/CMakeLists.txt

# Update the main CMakeLists.txt to add your new executable
RUN echo 'export_executable(MICROROS_SUBPUB)' >> /microros_ws/src/uros/micro-ROS-demos/rclc/CMakeLists.txt

# Continue with your build
RUN bash -c "source /opt/ros/humble/setup.bash && \
source install/local_setup.bash && \
ros2 run micro_ros_setup build_firmware.sh && \
source install/local_setup.bash && \
ros2 run micro_ros_setup create_agent_ws.sh && \
ros2 run micro_ros_setup build_agent.sh && \
source install/local_setup.bash"**

# Environment setup
#RUN echo 'source /opt/ros/humble/setup.bash' >> ~/.bashrc
RUN echo '#!/usr/bin/env bash' > /ros_entrypoint.sh
RUN echo 'source /opt/ros/humble/setup.bash' >> /ros_entrypoint.sh
RUN echo 'source /microros_ws/install/local_setup.bash' >> /ros_entrypoint.sh

# Finalize entrypoint script
RUN echo 'exec "$@"' >> /ros_entrypoint.sh
RUN chmod +x /ros_entrypoint.sh

ENTRYPOINT ["/ros_entrypoint.sh"]

# Run command
CMD ["bash"]
```
#### Expected behavior

#### Actual behavior

#### Additional information

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

提供されたDockerfileを再現することから始め、micro_ros_setupのcreate_firmware_ws.shとbuild_firmware.shのエントリポイント周辺にあるsourceされたワークスペースを追跡します。各Docker RUNステップの後も、イメージがビルド済みワークスペースを保持し、アクセスできるか確認します。完了条件は、カスタムsubscriberを含むイメージが正常にビルドされ、Docker Composeのセットアップからそれを実行できることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c, docker
領域
devops, embedded-iot
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。