Skip to content

Commit

Permalink
Update all.
Browse files Browse the repository at this point in the history
  • Loading branch information
maxpolzin committed May 9, 2024
1 parent a3a1cfc commit 4dba8d8
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 20 deletions.
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ RUN cd Livox-SDK2 && mkdir -p build && cd build && cmake .. && make -j4 && make
WORKDIR /colcon_ws
COPY livox_ros_driver2 src/livox_ros_driver2

RUN cp src/livox_ros_driver2/package_ROS2.xml src/livox_ros_driver2/package.xml && \
. /opt/ros/${ROS_DISTRO}/setup.sh && \
RUN . /opt/ros/${ROS_DISTRO}/setup.sh && \
colcon build --symlink-install --cmake-args -DROS_EDITION=${ROS_DISTRO} -DHUMBLE_ROS=${ROS_DISTRO} -DCMAKE_BUILD_TYPE=Release --event-handlers console_direct+

ENV LAUNCH_COMMAND='ros2 launch livox_ros_driver2 msg_MID360_launch.py'

# Create build and run aliases
RUN echo 'alias build="colcon build --symlink-install --event-handlers console_direct+"' >> /etc/bash.bashrc && \
echo 'alias run="su - ros /run.sh"' >> /etc/bash.bashrc && \
echo "source /colcon_ws/install/setup.bash; $LAUNCH_COMMAND" >> /run.sh && chmod +x /run.sh
RUN echo 'alias build="colcon build --symlink-install --cmake-args -DROS_EDITION=${ROS_DISTRO} -DHUMBLE_ROS=${ROS_DISTRO} -DCMAKE_BUILD_TYPE=Release --event-handlers console_direct+ "' >> /etc/bash.bashrc && \
echo 'alias run="su - ros --whitelist-environment=\"ROS_DOMAIN_ID\" /run.sh"' >> /etc/bash.bashrc && \
echo "source /colcon_ws/install/setup.bash; echo UID: $UID; echo ROS_DOMAIN_ID: $ROS_DOMAIN_ID; $LAUNCH_COMMAND" >> /run.sh && chmod +x /run.sh
6 changes: 4 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

REPOSITORY_NAME="$(basename "$(dirname -- "$( readlink -f -- "$0"; )")")"
export BUILDKIT_PROGRESS=plain

docker build --progress=plain -t ghcr.io/rosblox/${REPOSITORY_NAME}:humble .
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

docker compose -f $SCRIPT_DIR/docker-compose.yml build
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
ros-livox-ros-driver2:
image: ghcr.io/rosblox/ros-livox-ros-driver2:humble
build:
context: .
dockerfile: Dockerfile
restart: always
network_mode: "host"
privileged: true
ipc: host
pid: host
environment:
- UID=${HOST_UID}
- ROS_DOMAIN_ID
command: su - ros --whitelist-environment=ROS_DOMAIN_ID /run.sh
2 changes: 1 addition & 1 deletion livox_ros_driver2
Submodule livox_ros_driver2 updated 2 files
+1 −2 .gitignore
+35 −0 package.xml
8 changes: 4 additions & 4 deletions ros_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
set -e

id -u ros &>/dev/null || adduser --quiet --disabled-password --gecos '' --uid ${UID:=1000} --uid ${GID:=1000} ros
id -u ros &>/dev/null || adduser --quiet --disabled-password --gecos '' --uid ${UID:=1000} ros

source "/opt/ros/$ROS_DISTRO/setup.bash"
source /colcon_ws/install/setup.bash
source /opt/ros/${ROS_DISTRO}/setup.bash
source /colcon_ws/install/setup.bash || true

exec "$@"
exec "$@"
13 changes: 5 additions & 8 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#!/bin/bash

REPOSITORY_NAME="$(basename "$(dirname -- "$( readlink -f -- "$0"; )")")"
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

docker run -it --rm \
--network=host \
--ipc=host \
--pid=host \
--env UID=$(id -u) \
--env GID=$(id -g) \
export HOST_UID=$(id -u)

docker compose -f $SCRIPT_DIR/docker-compose.yml run \
--volume $(pwd)/livox_ros_driver2:/colcon_ws/src/livox_ros_driver2 \
--volume $(pwd)/Livox-SDK2:/Livox-SDK2 \
ghcr.io/rosblox/${REPOSITORY_NAME}:humble
ros-livox-ros-driver2 bash

0 comments on commit 4dba8d8

Please sign in to comment.