Skip to content

Commit 9d493bf

Browse files
committed
working healthcheck
1 parent 7b3cb6c commit 9d493bf

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

Dockerfile.hardware

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
ARG ROS_DISTRO=humble
22
ARG PREFIX=
3-
ARG ROS_PKG_RELEASE=0.11.1
43

54
## =========================== Healthcheck builder ===============================
65

@@ -37,7 +36,6 @@ FROM husarnet/ros:${PREFIX}${ROS_DISTRO}-ros-base AS ros_builder
3736

3837
ARG ROS_DISTRO
3938
ARG PREFIX
40-
ARG ROS_PKG_RELEASE
4139

4240
SHELL ["/bin/bash", "-c"]
4341

@@ -49,7 +47,7 @@ COPY ./healthcheck.cpp /
4947
RUN apt-get update && apt-get install -y \
5048
python3-pip
5149

52-
RUN git clone --depth 1 -b ${ROS_PKG_RELEASE} https://github.com/husarion/rosbot_ros.git src && \
50+
RUN git clone --depth 1 -b humble https://github.com/husarion/rosbot_ros.git src && \
5351
vcs import src < src/rosbot/rosbot_hardware.repos && \
5452
cp -r src/ros2_controllers/diff_drive_controller src/ && \
5553
cp -r src/ros2_controllers/imu_sensor_broadcaster src/ && \
@@ -106,6 +104,7 @@ RUN apt-get update && apt-get install -y \
106104
rm -rf /var/lib/apt/lists/*
107105

108106
COPY healthcheck.sh /
107+
COPY run_healthcheck_node.sh /
109108

110109
COPY print-serial-number.py /usr/bin/
111110

@@ -114,8 +113,5 @@ ENV ROS_NAMESPACE=
114113
HEALTHCHECK --interval=5s --timeout=2s --start-period=10s --retries=6 \
115114
CMD ["/healthcheck.sh"]
116115

117-
RUN new_content1='source "/ros2_ws_healthcheck/install/setup.bash"' && \
118-
new_content2='gosu $USER bash -c "ros2 run healthcheck_pkg healthcheck_node &"' && \
119-
file=$(ls /*_entrypoint.sh | head -n 1) && \
120-
sed -i "/exec/i $new_content1" $file && \
121-
sed -i "/exec/i $new_content2" $file
116+
RUN sed -i "/# <additional-user-commands>/r /run_healthcheck_node.sh" /ros_entrypoint.sh && \
117+
sed -i "/# <additional-user-commands>/d" /ros_entrypoint.sh

demo/compose.build.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,16 @@ services:
1919
context: ..
2020
dockerfile: Dockerfile.hardware
2121
<<: *common-config
22+
privileged: true
2223
devices:
2324
- ${SERIAL_PORT:?err}
25+
environment:
26+
- ROS_NAMESPACE=rosbot
27+
# command: tail -f /dev/null
28+
# command: ros2 run rosbot_utils flash_firmware --usb
2429
command: >
2530
ros2 launch rosbot_bringup combined.launch.py
2631
mecanum:=${MECANUM:-False}
2732
serial_port:=$SERIAL_PORT
2833
serial_baudrate:=576000
34+
namespace:=rosbot

healthcheck.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
HEALTHCHECK_FILE="/var/tmp/health_status.txt"
44

5-
65
# Now check the health status
76
if [ -f "$HEALTHCHECK_FILE" ]; then
87
status=$(cat "$HEALTHCHECK_FILE")

run_healthcheck_node.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
source "/ros2_ws_healthcheck/install/setup.bash"
2+
gosu $USER bash -c "ros2 run healthcheck_pkg healthcheck_node &"

0 commit comments

Comments
 (0)