How to connect to SICK TIM LiDAR through docker?
I am able to connect to my SICK TIM LiDAR fine when running it from my machine. Here's the basic launch file:
<launch>
<node name="sick_tim310_1" pkg="sick_tim" type="sick_tim310" respawn="false" output="screen">
</node>
</launch>
However, when I try to containerise this with Docker it does not connect to the LiDAR via USB and I get the message:
process[sick_tim310_1-2]: started with pid [64]
/opt/ros/noetic/lib/sick_tim/sick_tim310: error while loading shared libraries: libdiagnostic_updater.so: cannot open shared object file: No such file or directory
[sick_tim310_1-2] process has died [pid 64, exit code 127, cmd /opt/ros/noetic/lib/sick_tim/sick_tim310 __name:=sick_tim310_1 __log:=/root/.ros/log/bc9ceac0-3e11-11eb-a6cb-50eb712545a4/sick_tim310_1-2.log].
log file: /root/.ros/log/bc9ceac0-3e11-11eb-a6cb-50eb712545a4/sick_tim310_1-2*.log
Here's the minimal Docker file:
FROM osrf/ros:noetic-desktop-full
RUN apt-get update && apt-get install -q -y nano && \
apt-get update && apt-get install -q -y sudo git && \
apt-get update && apt-get install -q -y usbutils && \
apt-get update && apt-get install -q -y python3-wstool python3-rosdep ninja-build stow && \
apt-get update && apt-get install -q -y ros-noetic-position-controllers && \
apt-get update && apt-get install -q -y ros-noetic-effort-controllers && \
apt-get update && apt-get install -q -y ros-noetic-joint-state-controller && \
apt-get update && apt-get install -q -y ros-noetic-rosbridge-server && \
apt-get update && apt-get install -q -y ros-noetic-sick-tim && \
apt-get update && apt-get install -q -y python3-pip
RUN bash -c "source /opt/ros/noetic/setup.bash && \
cd ~ && \
mkdir -p /catkin_ws/src && \
cd /catkin_ws/src && \
catkin_init_workspace && \
mkdir my_package"
COPY . /catkin_ws/src/my_package
WORKDIR ~
RUN bash -c "source /opt/ros/noetic/setup.bash && \
cd /catkin_ws/ && \
catkin_make"
RUN bash -c "chmod +x /catkin_ws/src/my_package/container_entrypoint.sh"
RUN bash -c "source /opt/ros/noetic/setup.bash && \
source /catkin_ws/devel/setup.bash && \
cd && \
sudo rm /etc/ros/rosdep/sources.list.d/20-default.list && \
cd /catkin_ws && \
rosdep init && \
rosdep update && \
rosdep install --from-paths src --ignore-src --rosdistro=noetic -y"
ENTRYPOINT ["/catkin_ws/src/my_package/container_entrypoint.sh"]
CMD ["bash"]
The container_entrypoint.sh script referenced is:
#!/bin/bash
set -e
source /opt/ros/noetic/setup.bash
source /catkin_ws/devel/setup.bash
exec "$@"
The container is run with this script:
#!/bin/bash
docker run -it \
--rm \
--privileged \
--net=host \
my_package:latest \
/bin/bash -c \
"
roslaunch my_package my_package.launch
"
export containerId=$(docker ps -l -q)
Could anyone point out what I might be doing wrong please?
Is this library installed?
http://wiki.ros.org/diagnostic_updater
I thought this was but it turned out it was missing! This solved the problem. Thank you so much!!!!