moved hokuyo to another container

This commit is contained in:
Jakub Delicat 2023-01-24 11:55:50 +01:00
parent c26ea1b9dc
commit 18ee097492
9 changed files with 42 additions and 9 deletions

1
99-hokuyo.rules Normal file
View File

@ -0,0 +1 @@
SUBSYSTEM=="tty", ATTRS{idVendor}=="15d1", ATTRS{idProduct}=="0000", SYMLINK+="hokuyo"

View File

@ -21,6 +21,4 @@ echo
echo echo
set -x set -x
rosrun rosaria RosAria _port:=$ARIA_PORT _tf_prefix:=${ROS_NAMESPACE} & rosrun rosaria RosAria _port:=$ARIA_PORT _tf_prefix:=${ROS_NAMESPACE}
rosrun hokuyo_node hokuyo_node _frame_id:="PIONIER${PIONIER_ID}/laser" &
rosrun tf static_transform_publisher 0.16 0 0 0 0 0 ${ROS_NAMESPACE}/base_link "${ROS_NAMESPACE}/laser" 100

12
hokuyo/Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM ros:noetic-ros-core
RUN apt-get update -y && apt-get install -y ros-noetic-urg-node \
&& rm -rf /var/lib/apt/lists/*
SHELL ["/bin/bash", "--login", "-c"]
RUN source /opt/ros/noetic/setup.bash && \
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
ENV ROS_MASTER_URI=http://10.104.16.29:11311/
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

6
hokuyo/entrypoint.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
source /opt/ros/noetic/setup.bash
set -x
rosrun urg_node urg_node _frame_id:="PIONIER${PIONIER_ID}/laser" _serial_port:="/dev/hokuyo" scan:=PIONIER${PIONIER_ID}/scan &
rosrun tf static_transform_publisher 0.149 0 0.269 0 0 0 PIONIER${PIONIER_ID}/base_link PIONIER${PIONIER_ID}/laser 100

View File

@ -9,16 +9,20 @@ cd radio-lap
docker build . -t decawave docker build . -t decawave
cd .. cd ..
cd hokuyo
docker build . -t hokuyo
cd ..
cd Legacy cd Legacy
docker build . -t irth7/rosaria-legacy docker build . -t irth7/rosaria-legacy
cd .. cd ..
cp 99-decawave.rules /etc/udev/rules.d/ cp 99-decawave.rules /etc/udev/rules.d/
cp 99-hokuyo.rules /etc/udev/rules.d/
cp rosaria-docker.service /etc/systemd/system/ cp rosaria-docker.service /etc/systemd/system/
chmod g+w /etc/systemd/system/rosaria-docker.service chmod g+w /etc/systemd/system/rosaria-docker.service
git submodule init
git submodule update
systemctl daemon-reload systemctl daemon-reload
systemctl enable rosaria-docker.service systemctl enable rosaria-docker.service
systemctl start rosaria-docker.service systemctl start rosaria-docker.service

View File

@ -3,4 +3,5 @@
source /opt/ros/noetic/setup.bash source /opt/ros/noetic/setup.bash
source /ws/devel/setup.bash source /ws/devel/setup.bash
set -x set -x
roslaunch ros_decawave decawave_driver.launch pionier_id:=${PIONIER_ID} roslaunch ros_decawave decawave_driver.launch pionier_id:=${PIONIER_ID} &
rosrun tf static_transform_publisher 0 0 0.2 0 0 0 /PIONIER${PIONIER_ID}/base_link /PIONIER${PIONIER_ID}/tag 100

View File

@ -2,7 +2,9 @@
After=network.service After=network.service
[Service] [Service]
RemainAfterExit=true
ExecStart=/home/lab1_5/rosaria/run.sh ExecStart=/home/lab1_5/rosaria/run.sh
ExecStop=/home/lab1_5/rosaria/stop.sh
[Install] [Install]
WantedBy=default.target WantedBy=default.target

11
run.sh
View File

@ -2,10 +2,15 @@
# Script running rosaria inside docker container # Script running rosaria inside docker container
echo "ID: $PIONIER_ID" echo "ID: $PIONIER_ID"
docker run -d --privileged --network=host --device=/dev/ttyS0 -i -e ROS_IP=$(hostname -I | awk '{print $1}') -e PIONIER_ID=$(hostname | sed 's/[^0-9]//g' docker run --network=host --device=/dev/ttyS0 -i -e ROS_IP=$(hostname -I | awk '{print $1}') -e PIONIER_ID=$(hostname | sed 's/[^0-9]//g'
) --mount type=bind,source=/home/lab1_5/rosaria/Legacy/ws_linux,target=/home/lab1_5/ws/ws_linux irth7/rosaria-legacy ) --mount type=bind,source=/home/lab1_5/rosaria/Legacy/ws_linux,target=/home/lab1_5/ws/ws_linux irth7/rosaria-legacy &
if [ -e "/dev/decawave" ]; then if [ -e "/dev/decawave" ]; then
echo "found tag" echo "found tag"
docker run --network=host --device=/dev/decawave -e PIONIER_ID=$(hostname | sed 's/[^0-9]//g') decawave docker run --network=host --device=/dev/decawave -e PIONIER_ID=$(hostname | sed 's/[^0-9]//g') decawave &
fi
if [ -e "/dev/hokuyo" ]; then
echo "found lidar"
docker run --network=host --device=/dev/hokuyo -e PIONIER_ID=$(hostname | sed 's/[^0-9]//g') hokuyo &
fi fi

4
stop.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
echo "Stopping old containers..."
docker stop $(docker ps -q) > /dev/null
echo "Done!"