From fc26ec03f1fae4e81f1664b2448cbeca3e82335e Mon Sep 17 00:00:00 2001 From: Jakub Delicat Date: Fri, 20 Jan 2023 14:53:06 +0100 Subject: [PATCH] Added decawave --- 99-decawave.rules | 1 + Legacy/entrypoint.sh | 5 +-- install.sh | 9 +++++ radio-lap/Dockerfile | 15 ++++++++ radio-lap/entrypoint.sh | 6 ++++ radio-lap/src/CMakeLists.txt | 69 ++++++++++++++++++++++++++++++++++++ radio-lap/src/ros_decawave | 1 + run.sh | 7 +++- 8 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 99-decawave.rules create mode 100644 radio-lap/Dockerfile create mode 100755 radio-lap/entrypoint.sh create mode 100644 radio-lap/src/CMakeLists.txt create mode 160000 radio-lap/src/ros_decawave diff --git a/99-decawave.rules b/99-decawave.rules new file mode 100644 index 0000000..1fd7a65 --- /dev/null +++ b/99-decawave.rules @@ -0,0 +1 @@ +SUBSYSTEM=="tty", ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0105", SYMLINK+="decawave" diff --git a/Legacy/entrypoint.sh b/Legacy/entrypoint.sh index e07590b..774dfb8 100755 --- a/Legacy/entrypoint.sh +++ b/Legacy/entrypoint.sh @@ -21,6 +21,7 @@ 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 -rosrun rosaria RosAria _port:=$ARIA_PORT _tf_prefix:=PIONIER${PIONIER_ID} & -rosrun hokuyo_node hokuyo_node _frame_id:="laser${PIONIER_ID}" diff --git a/install.sh b/install.sh index 599dfbb..f50f68a 100755 --- a/install.sh +++ b/install.sh @@ -5,6 +5,15 @@ if [ "$EUID" -ne 0 ] exit fi +cd radio-lap +docker build . -t decawave +cd .. + +cd Legacy +docker build . -t irth7/rosaria-legacy +cd .. + +cp 99-decawave.rules /etc/udev/rules.d/ cp rosaria-docker.service /etc/systemd/system/ chmod g+w /etc/systemd/system/rosaria-docker.service systemctl daemon-reload diff --git a/radio-lap/Dockerfile b/radio-lap/Dockerfile new file mode 100644 index 0000000..ce72a58 --- /dev/null +++ b/radio-lap/Dockerfile @@ -0,0 +1,15 @@ +FROM ros:noetic-ros-core + +RUN apt-get update -y && apt-get install ros-noetic-tf python3-serial python3-catkin-tools build-essential -y \ + && rm -rf /var/lib/apt/lists/* + +SHELL ["/bin/bash", "--login", "-c"] +WORKDIR /ws + +COPY ./src /ws/src +RUN source /opt/ros/noetic/setup.bash && catkin_make && \ + echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc && \ + echo "source /ws/devel/setup.bash" >> ~/.bashrc +ENV ROS_MASTER_URI=http://10.104.16.29:11311/ +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/radio-lap/entrypoint.sh b/radio-lap/entrypoint.sh new file mode 100755 index 0000000..412e0f7 --- /dev/null +++ b/radio-lap/entrypoint.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +source /opt/ros/noetic/setup.bash +source /ws/devel/setup.bash +set -x +roslaunch ros_decawave decawave_driver.launch pionier_id:=${PIONIER_ID} diff --git a/radio-lap/src/CMakeLists.txt b/radio-lap/src/CMakeLists.txt new file mode 100644 index 0000000..cd58121 --- /dev/null +++ b/radio-lap/src/CMakeLists.txt @@ -0,0 +1,69 @@ +# toplevel CMakeLists.txt for a catkin workspace +# catkin/cmake/toplevel.cmake + +cmake_minimum_required(VERSION 3.0.2) + +project(Project) + +set(CATKIN_TOPLEVEL TRUE) + +# search for catkin within the workspace +set(_cmd "catkin_find_pkg" "catkin" "${CMAKE_SOURCE_DIR}") +execute_process(COMMAND ${_cmd} + RESULT_VARIABLE _res + OUTPUT_VARIABLE _out + ERROR_VARIABLE _err + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE +) +if(NOT _res EQUAL 0 AND NOT _res EQUAL 2) + # searching fot catkin resulted in an error + string(REPLACE ";" " " _cmd_str "${_cmd}") + message(FATAL_ERROR "Search for 'catkin' in workspace failed (${_cmd_str}): ${_err}") +endif() + +# include catkin from workspace or via find_package() +if(_res EQUAL 0) + set(catkin_EXTRAS_DIR "${CMAKE_SOURCE_DIR}/${_out}/cmake") + # include all.cmake without add_subdirectory to let it operate in same scope + include(${catkin_EXTRAS_DIR}/all.cmake NO_POLICY_SCOPE) + add_subdirectory("${_out}") + +else() + # use either CMAKE_PREFIX_PATH explicitly passed to CMake as a command line argument + # or CMAKE_PREFIX_PATH from the environment + if(NOT DEFINED CMAKE_PREFIX_PATH) + if(NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "") + if(NOT WIN32) + string(REPLACE ":" ";" CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) + else() + set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) + endif() + endif() + endif() + + # list of catkin workspaces + set(catkin_search_path "") + foreach(path ${CMAKE_PREFIX_PATH}) + if(EXISTS "${path}/.catkin") + list(FIND catkin_search_path ${path} _index) + if(_index EQUAL -1) + list(APPEND catkin_search_path ${path}) + endif() + endif() + endforeach() + + # search for catkin in all workspaces + set(CATKIN_TOPLEVEL_FIND_PACKAGE TRUE) + find_package(catkin QUIET + NO_POLICY_SCOPE + PATHS ${catkin_search_path} + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + unset(CATKIN_TOPLEVEL_FIND_PACKAGE) + + if(NOT catkin_FOUND) + message(FATAL_ERROR "find_package(catkin) failed. catkin was neither found in the workspace nor in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was sourced before.") + endif() +endif() + +catkin_workspace() diff --git a/radio-lap/src/ros_decawave b/radio-lap/src/ros_decawave new file mode 160000 index 0000000..cee43c8 --- /dev/null +++ b/radio-lap/src/ros_decawave @@ -0,0 +1 @@ +Subproject commit cee43c8ea4496df46ec00bc851082186b86ad169 diff --git a/run.sh b/run.sh index 0d02c4b..7bbb7db 100755 --- a/run.sh +++ b/run.sh @@ -2,5 +2,10 @@ # Script running rosaria inside docker container echo "ID: $PIONIER_ID" -docker run --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 -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' ) 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 +fi