Commit dc2a3c71 authored by Larkin Heintzman's avatar Larkin Heintzman

first custom working ros cluster!

parent 42538d7d
FROM python:3.7
RUN mkdir /app
WORKDIR /app
ADD . /app/
RUN pip install -r requirements.txt
EXPOSE 5000
CMD ["python", "/app/main.py"]
......@@ -30,13 +30,13 @@ RUN catkin config \
catkin build \
roscpp_tutorials
COPY check_roscore.py /usr/local/bin/check_roscore.py
COPY bashCheckRoscore.sh /usr/local/bin/bashCheckRoscore.sh
COPY ros_entrypoint.sh /usr/local/bin/ros_entrypoint.sh
RUN chmod 755 /usr/local/bin/check_roscore.py &&\
chmod 755 /usr/local/bin/ros_entrypoint.sh
RUN chmod 755 /usr/local/bin/bashCheckRoscore.sh && chmod 755 /usr/local/bin/ros_entrypoint.sh
ENTRYPOINT ["/usr/local/bin/ros_entrypoint.sh"]
# CMD [""]
CMD ["bash"]
# run ros package launch file
......
#!/bin/bash
# set -e
# make sure to source ros work space so we can use the rostopic command
FILE="./resp.txt"
OUT="confirm"
until [[ $OUT != "confirm" ]]
do
rostopic list &> $FILE
echo $OUT
OUT=$(awk '/ERR/ { print "confirm" }' $FILE)
sleep 1
done
echo "found roscore!"
rm $FILE
# exit 1
#!/usr/bin/env python3
import sys
import rosgraph
import rospy
if not rosgraph.is_master_online():
if rospy.is_shutdown():
print("Waiting roscore ...")
sys.exit(1)
# if not rosgraph.is_master_online():
# print("Waiting roscore ...")
# sys.exit(1)
print("roscore found!")
......@@ -24,24 +24,22 @@ spec:
# and tries to connect to the rocore which is running in
# a container in the master pod deployment.
# https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
initContainers:
- name: init-service-listener
image: llhcluster/node:v0
args:
- check_roscore.py
env:
- name: ROS_MASTER_URI
value: http://service-master:11311
- name: ROS_HOSTNAME
value: service-listener
# initContainers:
# - name: init-service-listener
# image: llh/node:v0
# args:
# - bashCheckRoscore.sh
# env:
# - name: ROS_MASTER_URI
# value: http://service-master:11311
# - name: ROS_HOSTNAME
# value: service-listener
containers:
# The real node container
- name: llhclusterpublisher
image: llhcluster/node:v0
args:
- rostopic
- echo
- chatter
image: llh/node:v0
command: ["/bin/bash"]
args: ["-c", "source /opt/ros_ws/devel/setup.bash && /usr/local/bin/bashCheckRoscore.sh && rostopic echo /chatter"]
env:
- name: ROS_MASTER_URI
value: http://service-master:11311
......@@ -55,15 +53,12 @@ spec:
# This is required because the node doesn't fail automatically
# when roscore stops / restarts.
# https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/
livenessProbe:
exec:
command:
- entrypoint.sh
- /opt/ros/melodic/bin/rostopic
- info
- chatter
initialDelaySeconds: 5
periodSeconds: 1
# livenessProbe:
# exec:
# command: ["/bin/bash -c 'ros_entrypoint.sh && rostopic info /chatter'"]
# # args: ["-c", "ros_entrypoint.sh && rostopic info /chatter"]
# initialDelaySeconds: 3
# periodSeconds: 3
---
......
......@@ -20,8 +20,8 @@ spec:
node: roscore
spec:
containers:
- name: llhclustermaster
image: llhcluster/master:v0
- name: roscore
image: llh/master:v0
args:
- roscore
ports:
......
......@@ -24,27 +24,22 @@ spec:
# and tries to connect to the rocore which is running in
# a container in the master pod deployment.
# https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
initContainers:
- name: init-service-talker
image: llhcluster/node:v0
args:
- check_roscore.py
env:
- name: ROS_MASTER_URI
value: http://service-master:11311
- name: ROS_HOSTNAME
value: service-talker
# initContainers:
# - name: init-service-talker
# image: llh/node:v0
# args:
# - bashCheckRoscore.sh
# env:
# - name: ROS_MASTER_URI
# value: http://service-master:11311
# - name: ROS_HOSTNAME
# value: service-talker
containers:
# The real node container
- name: llhclusterpublisher
image: llhcluster/node:v0
args:
- "rostopic"
- "pub"
- "-r 1"
- "chatter"
- "std_msgs/String"
- "Hello, world"
image: llh/node:v0
command: ["/bin/bash"]
args: ["-c", "source /opt/ros_ws/devel/setup.bash && /usr/local/bin/bashCheckRoscore.sh && rostopic pub -r 1 chatter std_msgs/String 'hello worl'"]
env:
- name: ROS_MASTER_URI
value: http://service-master:11311
......@@ -58,15 +53,16 @@ spec:
# This is required because the node doesn't fail automatically
# when roscore stops / restarts.
# https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/
livenessProbe:
exec:
command:
- entrypoint.sh
- /opt/ros/melodic/bin/rostopic
- info
- chatter
initialDelaySeconds: 5
periodSeconds: 1
# livenessProbe:
# exec:
# command: ["/bin/bash -c 'ros_entrypoint.sh && rostopic info /chatter'"]
# # command:
# # - ros_entrypoint.sh
# # - /opt/ros/melodic/bin/rostopic
# # - info
# # - chatter
# initialDelaySeconds: 3
# periodSeconds: 3
---
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment