Skip to content

Commit 6b56437

Browse files
author
shakuevda
committed
wip. Update: docker, add new launch for stingray communication,
1 parent fc7a110 commit 6b56437

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+265
-2430
lines changed

docker/Dockerfile

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,20 @@
11
FROM ros:humble-ros-base
22

3+
# Установим нужные пакеты
34
RUN apt-get update && apt-get install -y \
4-
python3-pip \
5-
python3-smbus \
6-
python3-smbus2 \
7-
libi2c-dev \
8-
i2c-tools \
9-
ros-humble-rclcpp \
10-
ros-humble-std-msgs \
11-
ros-humble-sensor-msgs \
12-
ros-humble-udp-msgs \
13-
libasio-dev \
14-
netcat \
15-
socat \
5+
python3-pip python3-colcon-common-extensions \
6+
python3-smbus python3-smbus2 libi2c-dev i2c-tools \
7+
libasio-dev netcat socat \
8+
ros-humble-rclcpp ros-humble-std-msgs ros-humble-sensor-msgs ros-humble-udp-msgs \
169
&& rm -rf /var/lib/apt/lists/*
1710

11+
# Рабочая директория
1812
WORKDIR /stingray_core
19-
COPY . /stingray_core
20-
RUN /bin/bash -c "source /opt/ros/humble/setup.bash && colcon build"
2113

22-
RUN usermod -aG i2c root
14+
RUN groupadd -f i2c && usermod -aG i2c root
2315

24-
COPY /docker/entrypoint.sh /entrypoint.sh
25-
RUN chmod +x /entrypoint.sh
26-
ENTRYPOINT ["/entrypoint.sh"]
27-
28-
RUN echo 'source /stingray_core/install/setup.bash' >> /root/.bashrc
16+
COPY docker/entrypoint.sh /entrypoint.sh
17+
RUN chmod +x /entrypoint.sh
2918

30-
CMD ["bash"]
19+
ENTRYPOINT ["/entrypoint.sh"]
20+
CMD ["bash"]

docker/build.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
set -e
3+
4+
IMAGE_NAME=stingray_core
5+
6+
echo "[INFO] Сборка Docker-образа: $IMAGE_NAME"
7+
docker build -t $IMAGE_NAME -f docker/Dockerfile .
8+
9+
echo "[INFO] Образ успешно собран."

docker/entrypoint.sh

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
#!/bin/bash
22
set -e
33

4-
# Проверяем, существует ли файл setup.bash
5-
if [ -f /stingray_core/install/setup.bash ]; then
6-
echo "[INFO] Код уже сбилжен"
4+
source /opt/ros/humble/setup.bash
5+
6+
# Если проект уже собран
7+
if [ -f /stingray_core/install/setup.bash ]; then
8+
echo "[INFO] Используем существующую сборку."
79
source /stingray_core/install/setup.bash
810
else
9-
echo "[INFO] Файл install/setup.bash не найден. Запускаем сборку..."
10-
# Выполняем сборку, при ошибке удаляем build, install, log и выходим
11-
source "/opt/ros/humble/setup.bash"
12-
source "/additional_packages/install/setup.bash"
13-
if ! colcon build --packages-select stingray_core_launch stingray_core_interfaces stingray_core_communication; then
14-
echo "[ERROR] Сборка завершилась с ошибкой. Удаляем build, install, log..."
15-
rm -rf build install log
16-
exit 1
17-
fi
18-
echo "[INFO] Сборка завершена успешно. Выполняем source install/setup.bash..."
19-
source /stingray_core/install/setup.bash
11+
echo "[INFO] Локальная сборка не найдена (install/setup.bash отсутствует)"
2012
fi
2113

2214
exec "$@"

docker/run.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
set -e
3+
4+
IMAGE_NAME=stingray_core
5+
CONTAINER_NAME=stingray_core
6+
7+
echo "[INFO] Запуск контейнера $CONTAINER_NAME..."
8+
9+
docker run -it --rm \
10+
--user $(id -u):$(id -g) \
11+
--name $CONTAINER_NAME \
12+
--network host \
13+
-v $(pwd):/stingray_core \
14+
-v /tmp/.X11-unix:/tmp/.X11-unix \
15+
-e DISPLAY=$DISPLAY \
16+
--device /dev/i2c-0 \
17+
--device /dev/i2c-1 \
18+
$IMAGE_NAME

src/stingray_core_communication/serial_driver/CMakeLists.txt renamed to src/serial_driver/CMakeLists.txt

File renamed without changes.

src/stingray_core_communication/serial_driver/README.md renamed to src/serial_driver/README.md

File renamed without changes.

src/stingray_core_communication/serial_driver/include/serial_driver/serial_bridge_node.hpp renamed to src/serial_driver/include/serial_driver/serial_bridge_node.hpp

File renamed without changes.

src/stingray_core_communication/serial_driver/include/serial_driver/serial_driver.hpp renamed to src/serial_driver/include/serial_driver/serial_driver.hpp

File renamed without changes.

src/stingray_core_communication/serial_driver/include/serial_driver/serial_port.hpp renamed to src/serial_driver/include/serial_driver/serial_port.hpp

File renamed without changes.

src/stingray_core_communication/serial_driver/include/serial_driver/visibility_control.hpp renamed to src/serial_driver/include/serial_driver/visibility_control.hpp

File renamed without changes.

0 commit comments

Comments
 (0)