-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
52 lines (44 loc) · 1.37 KB
/
run.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
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# Use lsusb to list USB devices and filter for your camera information
camera_info=$(lsusb | grep "Basler")
# Extract the bus and device numbers from the lsusb output for each camera
camera_paths=()
while read -r line; do
bus=$(echo "$line" | awk '{print $2}')
device=$(echo "$line" | awk '{print $4}' | tr -d ':')
path="/dev/bus/usb/$bus/$device"
camera_paths+=("$path")
done <<< "$camera_info"
# Print the paths
for ((i=0; i<${#camera_paths[@]}; i++)); do
echo "Camera $((i+1)) path: ${camera_paths[i]}"
done
# Prompt user whether to run the docker container with --rm
read -p "Do you want to run the Docker container with --rm? (y/n): " run_rm
if [[ $run_rm == "y" ]]; then
rm_flag="--rm"
else
rm_flag=""
fi
# Prompt user whether to include the two --device
read -p "Do you want to include the two --device flags? (y/n): " include_device
if [[ $include_device == "y" ]]; then
device_flags="--device ${camera_paths[0]} --device ${camera_paths[1]}"
else
device_flags=""
fi
# Start X server
xhost +
# Run Docker container with GUI support
# May need to change --device paths depending on your system
sudo docker run -it \
$rm_flag \
--name frtab \
--gpus all \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
$device_flags \
--hostname I3DRWL004 \
foxy-rtabmap-pyphase
# Revoke access to X server
xhost -