-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlaunch_realsense.sh
executable file
·41 lines (35 loc) · 1.04 KB
/
launch_realsense.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
IMAGE_NAME=ghcr.io/matsuolab/realsense_ros
CONTAINER_NAME=realsense_ros
TAG_NAME=latest
if [ "$(uname -m)" == "aarch64" ]; then
TAG_NAME=jetson
fi
ROS_MASTER_URI="http://`hostname -I | cut -d' ' -f1`:11311"
ROS_IP=`hostname -I | cut -d' ' -f1`
LAUNCH=rs_camera.launch
if [ ! $# -eq 0 ]; then
IP_CHECK=$(echo $1 | egrep "^(([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")
if [ "${IP_CHECK}" ]; then
ROS_MASTER_URI="http://$1:11311"
if [ $# -ge 2 ]; then
LAUNCH=${@:2}
fi
else
LAUNCH=$@
fi
fi
echo "IMAGE_NAME=${IMAGE_NAME}:${TAG_NAME}"
echo "CONTAINER_NAME=${CONTAINER_NAME}"
echo "ROS_MASTER_URI=${ROS_MASTER_URI}"
echo "ROS_IP=${ROS_IP}"
echo "LAUNCH=${LAUNCH}"
docker run -it --rm \
--privileged \
--volume="/dev:/dev" \
--env ROS_MASTER_URI=${ROS_MASTER_URI} \
--env ROS_IP=${ROS_IP} \
--net="host" \
--name ${CONTAINER_NAME} \
${IMAGE_NAME}:${TAG_NAME} \
bash -c "roslaunch realsense2_camera ${LAUNCH}"