diff --git a/Dockerfile.hardware b/Dockerfile.hardware index 74443b3..778ff04 100644 --- a/Dockerfile.hardware +++ b/Dockerfile.hardware @@ -135,3 +135,8 @@ ENV ROS_NAMESPACE= HEALTHCHECK --interval=5s --timeout=2s --start-period=10s --retries=6 \ CMD ["/healthcheck.sh"] + +RUN new_content1='source "/ros2_ws_healthcheck/install/setup.bash"' && \ + new_content2='gosu $USER bash -c "ros2 run healthcheck_pkg healthcheck_node &"' && \ + sed -i "/exec/i $new_content1" /ros_entrypoint.sh && \ + sed -i "/exec/i $new_content2" /ros_entrypoint.sh diff --git a/ros_entrypoint.sh b/ros_entrypoint.sh index 9bbfd75..bebe56c 100755 --- a/ros_entrypoint.sh +++ b/ros_entrypoint.sh @@ -6,18 +6,9 @@ if [[ "$HUSARNET_DDS_DEBUG" == "TRUE" ]]; then echo "$output" fi -# Check if XRCE_DOMAIN_ID_OVERRIDE is unset or empty -if [ -z "$XRCE_DOMAIN_ID_OVERRIDE" ]; then - # If ROS_DOMAIN_ID is set and not empty, set XRCE_DOMAIN_ID_OVERRIDE to its value - if [ -n "$ROS_DOMAIN_ID" ]; then - export XRCE_DOMAIN_ID_OVERRIDE="$ROS_DOMAIN_ID" - fi -fi - # setup ros environment source "/opt/ros/$ROS_DISTRO/setup.bash" -source "/ros2_ws/install/setup.bash" -source "/ros2_ws_healthcheck/install/setup.bash" +test -f "/ros2_ws/install/setup.bash" && source "/ros2_ws/install/setup.bash" if [ -z "$USER" ]; then export USER=root @@ -25,5 +16,4 @@ elif ! id "$USER" &>/dev/null; then useradd -ms /bin/bash "$USER" fi -gosu $USER bash -c "ros2 run healthcheck_pkg healthcheck_node &" exec gosu $USER "$@"