Skip to content

Commit

Permalink
Build Release & Helthcheck decrease interval
Browse files Browse the repository at this point in the history
  • Loading branch information
rafal-gorecki committed Dec 6, 2023
1 parent f51dd87 commit 19a1b77
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
8 changes: 5 additions & 3 deletions Dockerfile.gazebo
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ RUN cd src/ && \
mv /healthcheck.cpp /ros2_ws/src/healthcheck_pkg/src/ && \
cd .. && \
# Build
colcon build && \
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release && \
rm -rf build log

## =========================== Final Stage ===============================
Expand All @@ -71,14 +71,16 @@ RUN apt-get update && apt-get install -y \
rosdep init && \
rosdep update --rosdistro $ROS_DISTRO && \
rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y && \
apt-get clean && \
# Save version
echo $(cat /ros2_ws/src/rosbot_gazebo/package.xml | grep '<version>' | sed -r 's/.*<version>([0-9]+.[0-9]+.[0-9]+)<\/version>/\1/g') > /version.txt && \
# Size optimalization
apt-get clean && \
rm -rf src && \
rm -rf /var/lib/apt/lists/*

COPY ros_entrypoint.sh /
COPY vulcanexus_entrypoint.sh /
COPY healthcheck.sh /

HEALTHCHECK --interval=7s --timeout=2s --start-period=5s --retries=5 \
HEALTHCHECK --interval=5s --timeout=2s --start-period=5s --retries=4 \
CMD ["/healthcheck.sh"]
8 changes: 5 additions & 3 deletions Dockerfile.hardware
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ COPY healthcheck.cpp src/healthcheck_pkg/src/

RUN MYDISTRO=${PREFIX:-ros}; MYDISTRO=${MYDISTRO//-/} && \
source /opt/$MYDISTRO/$ROS_DISTRO/setup.bash && \
colcon build && \
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release && \
rm -rf build log src

## =========================== ROS builder ===============================
Expand Down Expand Up @@ -135,8 +135,10 @@ RUN apt-get update && apt-get install -y \
rosdep init && \
rosdep update --rosdistro $ROS_DISTRO && \
rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y && \
apt-get clean && \
# Save version
echo $(cat /ros2_ws/src/rosbot/package.xml | grep '<version>' | sed -r 's/.*<version>([0-9]+.[0-9]+.[0-9]+)<\/version>/\1/g') >> /version.txt && \
# Size optimalization
apt-get clean && \
rm -rf src && \
rm -rf /var/lib/apt/lists/*

Expand All @@ -151,7 +153,7 @@ COPY ros_entrypoint.sh /
COPY vulcanexus_entrypoint.sh /
COPY healthcheck.sh /

HEALTHCHECK --interval=7s --timeout=2s --start-period=5s --retries=5 \
HEALTHCHECK --interval=5s --timeout=2s --start-period=5s --retries=4 \
CMD ["/healthcheck.sh"]

COPY microros_localhost_only.xml /
Expand Down
2 changes: 1 addition & 1 deletion healthcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int main(int argc, char *argv[]) {
rclcpp::init(argc, argv);
auto node = rclcpp::Node::make_shared("healthcheck_node");
auto sub = node->create_subscription<nav_msgs::msg::Odometry>(
"odometry/filtered", rclcpp::SensorDataQoS(), msg_callback);
"odometry/filtered", rclcpp::SensorDataQoS().keep_last(1), msg_callback);

while (rclcpp::ok()) {
rclcpp::spin_some(node);
Expand Down

0 comments on commit 19a1b77

Please sign in to comment.