Skip to content

Commit 40d5d44

Browse files
committed
Dockerized
1 parent e717e86 commit 40d5d44

File tree

4 files changed

+173
-61
lines changed

4 files changed

+173
-61
lines changed

docker/bash_aliases.txt

100755100644
File mode changed.

docker/docker-compose.yml

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: '3.3'
22
services:
3-
eclss_base: &eclss_base
3+
nova_sanctum: &nova_sanctum
44
image: nova_sanctum # Use the built image name
55
ipc: host
66
network_mode: host
@@ -15,77 +15,77 @@ services:
1515
- /dev:/dev
1616
command: ["/bin/bash", "-c", "source /opt/ros/humble/setup.bash && source /root/ros2_ws/install/setup.bash && tail -f /dev/null"] # Keeps container running
1717

18-
collector:
19-
<<: *eclss_base
20-
container_name: collector
21-
command: ["ros2", "run", "demo_nova_sanctum", "collector"]
18+
# collector:
19+
# <<: *eclss_base
20+
# container_name: collector
21+
# command: ["ros2", "run", "demo_nova_sanctum", "collector"]
2222

23-
desiccant:
24-
<<: *eclss_base
25-
container_name: desiccant
26-
command: ["ros2", "run", "demo_nova_sanctum", "desiccant"]
23+
# desiccant:
24+
# <<: *eclss_base
25+
# container_name: desiccant
26+
# command: ["ros2", "run", "demo_nova_sanctum", "desiccant"]
2727

28-
adsorbent:
29-
<<: *eclss_base
30-
container_name: adsorbent
31-
command: ["ros2", "run", "demo_nova_sanctum", "adsorbent"]
28+
# adsorbent:
29+
# <<: *eclss_base
30+
# container_name: adsorbent
31+
# command: ["ros2", "run", "demo_nova_sanctum", "adsorbent"]
3232

33-
sabatier:
34-
<<: *eclss_base
35-
container_name: sabatier
36-
command: ["ros2", "run", "demo_nova_sanctum", "sabatier"]
33+
# sabatier:
34+
# <<: *eclss_base
35+
# container_name: sabatier
36+
# command: ["ros2", "run", "demo_nova_sanctum", "sabatier"]
3737

38-
water_pub:
39-
<<: *eclss_base
40-
container_name: water_pub
41-
command: ["ros2", "run", "demo_nova_sanctum", "water_pub"]
38+
# water_pub:
39+
# <<: *eclss_base
40+
# container_name: water_pub
41+
# command: ["ros2", "run", "demo_nova_sanctum", "water_pub"]
4242

43-
deionization_bed:
44-
<<: *eclss_base
45-
container_name: deionization_bed
46-
command: ["ros2", "run", "demo_nova_sanctum", "deionization_bed"]
43+
# deionization_bed:
44+
# <<: *eclss_base
45+
# container_name: deionization_bed
46+
# command: ["ros2", "run", "demo_nova_sanctum", "deionization_bed"]
4747

48-
electrolysis:
49-
<<: *eclss_base
50-
container_name: electrolysis
51-
command: ["ros2", "run", "demo_nova_sanctum", "electrolysis"]
48+
# electrolysis:
49+
# <<: *eclss_base
50+
# container_name: electrolysis
51+
# command: ["ros2", "run", "demo_nova_sanctum", "electrolysis"]
5252

53-
whc:
54-
<<: *eclss_base
55-
container_name: whc
56-
command: ["ros2", "run", "demo_nova_sanctum", "whc"]
53+
# whc:
54+
# <<: *eclss_base
55+
# container_name: whc
56+
# command: ["ros2", "run", "demo_nova_sanctum", "whc"]
5757

58-
waste_collector:
59-
<<: *eclss_base
60-
container_name: waste_collector
61-
command: ["ros2", "run", "demo_nova_sanctum", "waste_collector"]
58+
# waste_collector:
59+
# <<: *eclss_base
60+
# container_name: waste_collector
61+
# command: ["ros2", "run", "demo_nova_sanctum", "waste_collector"]
6262

63-
upa:
64-
<<: *eclss_base
65-
container_name: upa
66-
command: ["ros2", "run", "demo_nova_sanctum", "upa"]
63+
# upa:
64+
# <<: *eclss_base
65+
# container_name: upa
66+
# command: ["ros2", "run", "demo_nova_sanctum", "upa"]
6767

68-
filter:
69-
<<: *eclss_base
70-
container_name: filter
71-
command: ["ros2", "run", "demo_nova_sanctum", "filter"]
68+
# filter:
69+
# <<: *eclss_base
70+
# container_name: filter
71+
# command: ["ros2", "run", "demo_nova_sanctum", "filter"]
7272

73-
catalytic_chamber:
74-
<<: *eclss_base
75-
container_name: catalytic_chamber
76-
command: ["ros2", "run", "demo_nova_sanctum", "catalytic_chamber"]
73+
# catalytic_chamber:
74+
# <<: *eclss_base
75+
# container_name: catalytic_chamber
76+
# command: ["ros2", "run", "demo_nova_sanctum", "catalytic_chamber"]
7777

78-
ionization:
79-
<<: *eclss_base
80-
container_name: ionization
81-
command: ["ros2", "run", "demo_nova_sanctum", "ionization"]
78+
# ionization:
79+
# <<: *eclss_base
80+
# container_name: ionization
81+
# command: ["ros2", "run", "demo_nova_sanctum", "ionization"]
8282

83-
clean_water_tank:
84-
<<: *eclss_base
85-
container_name: clean_water_tank
86-
command: ["ros2", "run", "demo_nova_sanctum", "clean_water_tank"]
83+
# clean_water_tank:
84+
# <<: *eclss_base
85+
# container_name: clean_water_tank
86+
# command: ["ros2", "run", "demo_nova_sanctum", "clean_water_tank"]
8787

88-
ultrasound:
89-
<<: *eclss_base
90-
container_name: ultrasound
91-
command: ["ros2", "run", "demo_nova_sanctum", "ultrasound"]
88+
# ultrasound:
89+
# <<: *eclss_base
90+
# container_name: ultrasound
91+
# command: ["ros2", "run", "demo_nova_sanctum", "ultrasound"]

docker/entrypoint.sh

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/bash
2+
3+
# Set ROS distribution
4+
# This variable defines the ROS 2 distribution being used (e.g., "jazzy", "rolling", etc.)
5+
ROS_DISTRO="humble"
6+
7+
# Creates required temp directory for GUI applications - needed by Linux desktop standards
8+
# Set up XDG runtime directory
9+
export XDG_RUNTIME_DIR=/tmp/runtime-$USER
10+
mkdir -p $XDG_RUNTIME_DIR
11+
chmod 700 $XDG_RUNTIME_DIR
12+
13+
# Set base paths for convenience
14+
# ROS_WS is the path to the ROS 2 workspace
15+
ROS_WS="/root/ros2_ws"
16+
17+
# SHARED_ROS2 is the path to shared ROS 2 files
18+
SHARED_ROS2="/root/shared/ros2"
19+
20+
# Create ros_domain_id.txt file with default value 0 if it doesn't exist
21+
# This file stores the ROS_DOMAIN_ID, which is used for multi-robot communication
22+
ROS_DOMAIN_ID_FILE="$SHARED_ROS2/ros_domain_id.txt"
23+
24+
if [ ! -f "$ROS_DOMAIN_ID_FILE" ]; then
25+
# If the file doesn't exist, create it with a default value of 0
26+
echo "0" > "$ROS_DOMAIN_ID_FILE"
27+
echo "Created $ROS_DOMAIN_ID_FILE with default value 0"
28+
fi
29+
30+
# The ROS_DOMAIN_ID will need to be the same for computers that you want to communicate with each other.
31+
# This value can take any number between [0,232]. It is useful if you have multiple robots in the same environment.
32+
# Update .bashrc with ROS_DOMAIN_ID if it does not already exist
33+
if ! grep -q "export ROS_DOMAIN_ID" /root/.bashrc; then
34+
# Read the ROS_DOMAIN_ID from the file
35+
ros_domain_id=$(cat "$ROS_DOMAIN_ID_FILE")
36+
# Add the export command to .bashrc if it's not already there
37+
echo "export ROS_DOMAIN_ID=$ros_domain_id" >> /root/.bashrc
38+
fi
39+
40+
# Make the ROS Domain ID available to the current script
41+
# This allows the current script to use the ROS_DOMAIN_ID
42+
export ROS_DOMAIN_ID=$(cat "$ROS_DOMAIN_ID_FILE")
43+
44+
# Source ROS setup file
45+
# This sets up the ROS 2 environment for the current shell session
46+
source /opt/ros/$ROS_DISTRO/setup.bash
47+
48+
# Source the local workspace setup
49+
source $ROS_WS/install/setup.bash
50+
51+
# Source the .bashrc file to ensure all environment variables are up to date
52+
source /root/.bashrc
53+
54+
# Change to the ROS 2 workspace directory
55+
cd $ROS_WS
56+
57+
# Build the ROS 2 workspace using colcon
58+
colcon build
59+
60+
# Change back to the root directory
61+
cd
62+
63+
# Source .bashrc again to ensure any changes made during the build are applied
64+
source /root/.bashrc
65+
66+
# Any command you run after this script runs in the environment set up by the script.
67+
exec "$@"

docker/workspace.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Set ROS 2 distribution as a variable
5+
ROS_DISTRO="humble"
6+
7+
# Source ROS 2 setup
8+
source /opt/ros/$ROS_DISTRO/setup.bash
9+
10+
# Install system dependencies for MongoDB and PCL
11+
apt-get update && apt-get install -y \
12+
gnupg \
13+
curl \
14+
libpcap-dev
15+
16+
17+
# Navigate to the workspace
18+
cd /root/ros2_ws/src
19+
20+
# Navigate back to the workspace root
21+
cd /root/ros2_ws
22+
23+
# Install ROS2 dependencies for all packages
24+
echo "Installing ROS 2 dependencies..."
25+
rosdep update
26+
rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y
27+
28+
# Now apply all the fixes after dependencies are installed
29+
30+
31+
# Build the packages
32+
echo "Building packages..."
33+
# # First build without the problematic package
34+
# colcon build --packages-skip demo_nova_sanctum
35+
# source install/setup.bash
36+
37+
# # Then build the problematic package with warning suppression
38+
# colcon build --packages-select demo_nova_sanctum--cmake-args -Wno-dev
39+
# source install/setup.bash
40+
41+
# # Final build of everything
42+
colcon build
43+
source install/setup.bash
44+
45+
echo "Workspace setup completed!"

0 commit comments

Comments
 (0)