diff --git a/99-hokuyo.rules b/99-hokuyo.rules new file mode 100644 index 0000000..2dd6617 --- /dev/null +++ b/99-hokuyo.rules @@ -0,0 +1 @@ +SUBSYSTEM=="tty", ATTRS{idVendor}=="15d1", ATTRS{idProduct}=="0000", SYMLINK+="hokuyo" diff --git a/Legacy/entrypoint.sh b/Legacy/entrypoint.sh index 23a0828..553f274 100755 --- a/Legacy/entrypoint.sh +++ b/Legacy/entrypoint.sh @@ -21,6 +21,4 @@ echo echo set -x -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 \ No newline at end of file +rosrun rosaria RosAria _port:=$ARIA_PORT _tf_prefix:=${ROS_NAMESPACE} \ No newline at end of file diff --git a/hokuyo/Dockerfile b/hokuyo/Dockerfile new file mode 100644 index 0000000..ad65f46 --- /dev/null +++ b/hokuyo/Dockerfile @@ -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"] diff --git a/hokuyo/entrypoint.sh b/hokuyo/entrypoint.sh new file mode 100755 index 0000000..4d305eb --- /dev/null +++ b/hokuyo/entrypoint.sh @@ -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 \ No newline at end of file diff --git a/install.sh b/install.sh index d3d7344..032571f 100755 --- a/install.sh +++ b/install.sh @@ -9,16 +9,20 @@ cd radio-lap docker build . -t decawave cd .. +cd hokuyo +docker build . -t hokuyo +cd .. + cd Legacy docker build . -t irth7/rosaria-legacy cd .. cp 99-decawave.rules /etc/udev/rules.d/ +cp 99-hokuyo.rules /etc/udev/rules.d/ + cp rosaria-docker.service /etc/systemd/system/ chmod g+w /etc/systemd/system/rosaria-docker.service -git submodule init -git submodule update systemctl daemon-reload systemctl enable rosaria-docker.service systemctl start rosaria-docker.service diff --git a/radio-lap/entrypoint.sh b/radio-lap/entrypoint.sh index 412e0f7..85510e4 100755 --- a/radio-lap/entrypoint.sh +++ b/radio-lap/entrypoint.sh @@ -3,4 +3,5 @@ source /opt/ros/noetic/setup.bash source /ws/devel/setup.bash 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 \ No newline at end of file diff --git a/rosaria-docker.service b/rosaria-docker.service index 63c278c..311a540 100644 --- a/rosaria-docker.service +++ b/rosaria-docker.service @@ -2,7 +2,9 @@ After=network.service [Service] +RemainAfterExit=true ExecStart=/home/lab1_5/rosaria/run.sh +ExecStop=/home/lab1_5/rosaria/stop.sh [Install] WantedBy=default.target diff --git a/run.sh b/run.sh index 3ac38f3..74f1f36 100755 --- a/run.sh +++ b/run.sh @@ -2,10 +2,15 @@ # Script running rosaria inside docker container 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' -) --mount type=bind,source=/home/lab1_5/rosaria/Legacy/ws_linux,target=/home/lab1_5/ws/ws_linux irth7/rosaria-legacy +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 & if [ -e "/dev/decawave" ]; then 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 diff --git a/stop.sh b/stop.sh new file mode 100755 index 0000000..25b64cf --- /dev/null +++ b/stop.sh @@ -0,0 +1,4 @@ +#!/bin/sh +echo "Stopping old containers..." +docker stop $(docker ps -q) > /dev/null +echo "Done!" \ No newline at end of file