-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·212 lines (178 loc) · 10 KB
/
setup.sh
File metadata and controls
executable file
·212 lines (178 loc) · 10 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#!/usr/bin/env bash
# ####################################################################################
# (c) 2025 Copyright, Real-Time Innovations, Inc. (RTI) All rights reserved. #
# #
# RTI grants Licensee a license to use, modify, compile, and create derivative #
# works of the Software. Licensee has the right to distribute object form only #
# for use with RTI products. The Software is provided "as is", with no warranty #
# of any type, including any warranty for fitness for any purpose. RTI is under no #
# obligation to maintain or support the Software. RTI shall not be liable for any #
# incidental or consequential damages arising out of the use or inability to use #
# the software. #
# ####################################################################################
set -euo pipefail
# ═══════════════════════════════════════════════════════════════════════════════
# GENESIS Setup Script
# ═══════════════════════════════════════════════════════════════════════════════
# This script sets up the GENESIS Python environment.
# Run ./rti_setup.sh first if you haven't installed RTI Connext DDS.
# ═══════════════════════════════════════════════════════════════════════════════
PROJECT_ROOT="$(cd "$(dirname "$0")" && pwd)"
cd "$PROJECT_ROOT"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
BOLD='\033[1m'
NC='\033[0m'
echo ""
echo -e "${BLUE}╔═══════════════════════════════════════════════════════════════╗${NC}"
echo -e "${BLUE}║${NC}${BOLD} GENESIS Setup ${NC}${BLUE}║${NC}"
echo -e "${BLUE}╚═══════════════════════════════════════════════════════════════╝${NC}"
echo ""
# ─────────────────────────────────────────────────────────────────────────────
# Check for RTI Connext DDS
# ─────────────────────────────────────────────────────────────────────────────
check_rti() {
# Check NDDSHOME
if [[ -n "${NDDSHOME:-}" ]] && [[ -d "$NDDSHOME" ]]; then
return 0
fi
# Check common paths
local paths=(
"/Applications/rti_connext_dds-7.5.0"
"/Applications/rti_connext_dds-7.4.0"
"/Applications/rti_connext_dds-7.3.0"
"$HOME/rti_connext_dds-7.5.0"
"$HOME/rti_connext_dds-7.4.0"
"$HOME/rti_connext_dds-7.3.0"
"/opt/rti_connext_dds-7.5.0"
"/opt/rti_connext_dds-7.4.0"
"/opt/rti_connext_dds-7.3.0"
)
for path in "${paths[@]}"; do
if [[ -d "$path" ]]; then
return 0
fi
done
return 1
}
echo -e "${CYAN}Step 1: Checking for RTI Connext DDS${NC}"
echo ""
if ! check_rti; then
echo -e " ${YELLOW}⚠ RTI Connext DDS not found${NC}"
echo ""
echo -e " GENESIS requires RTI Connext DDS to run."
echo -e " Don't worry - we have a wizard to help you set it up!"
echo ""
echo -e " ${BOLD}Run this command first:${NC}"
echo ""
echo -e " ${CYAN}./rti_setup.sh${NC}"
echo ""
echo -e " The wizard will guide you through getting a free 60-day license"
echo -e " and installing RTI Connext DDS."
echo ""
echo -e " After that completes, run ${CYAN}./setup.sh${NC} again."
echo ""
exit 1
fi
if [[ -n "${NDDSHOME:-}" ]]; then
echo -e " ${GREEN}✓${NC} RTI Connext DDS found: ${NDDSHOME}"
else
echo -e " ${GREEN}✓${NC} RTI Connext DDS installation detected"
echo -e " ${YELLOW}⚠${NC} NDDSHOME not set - you may need to open a new terminal"
fi
echo ""
# ─────────────────────────────────────────────────────────────────────────────
# Check Python Version
# ─────────────────────────────────────────────────────────────────────────────
echo -e "${CYAN}Step 2: Checking Python version${NC}"
echo ""
PYV=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")' 2>/dev/null || echo "")
if [[ "$PYV" == "3.10" ]]; then
echo -e " ${GREEN}✓${NC} Python 3.10 detected"
elif [[ -n "$PYV" ]]; then
echo -e " ${YELLOW}⚠${NC} Python $PYV detected (3.10 recommended)"
else
echo -e " ${RED}✗${NC} Python 3 not found"
echo ""
echo -e " Please install Python 3.10 and try again."
exit 1
fi
echo ""
# ─────────────────────────────────────────────────────────────────────────────
# Create Virtual Environment
# ─────────────────────────────────────────────────────────────────────────────
echo -e "${CYAN}Step 3: Setting up Python environment${NC}"
echo ""
if [[ ! -d .venv ]]; then
echo -e " Creating virtual environment (.venv)..."
if command -v python3.10 &> /dev/null; then
python3.10 -m venv .venv
else
python3 -m venv .venv
fi
echo -e " ${GREEN}✓${NC} Virtual environment created"
else
echo -e " ${GREEN}✓${NC} Virtual environment exists"
fi
# shellcheck disable=SC1091
source .venv/bin/activate
echo -e " ${GREEN}✓${NC} Virtual environment activated"
echo ""
# ─────────────────────────────────────────────────────────────────────────────
# Install Dependencies
# ─────────────────────────────────────────────────────────────────────────────
echo -e "${CYAN}Step 4: Installing GENESIS${NC}"
echo ""
echo -e " Upgrading pip..."
pip install --upgrade pip >/dev/null 2>&1 || true
echo -e " Installing genesis-lib..."
pip install . >/dev/null 2>&1
echo -e " ${GREEN}✓${NC} GENESIS installed"
echo ""
# ─────────────────────────────────────────────────────────────────────────────
# Verify Installation
# ─────────────────────────────────────────────────────────────────────────────
echo -e "${CYAN}Step 5: Verifying installation${NC}"
echo ""
if python -c "import genesis_lib" 2>/dev/null; then
echo -e " ${GREEN}✓${NC} genesis_lib imports successfully"
else
echo -e " ${RED}✗${NC} Failed to import genesis_lib"
exit 1
fi
if command -v genesis-monitor &>/dev/null; then
echo -e " ${GREEN}✓${NC} genesis-monitor CLI available"
else
echo -e " ${YELLOW}⚠${NC} genesis-monitor CLI not in PATH"
fi
# Check DDS connectivity
if [[ -n "${NDDSHOME:-}" ]] && [[ -x "$NDDSHOME/bin/rtiddsspy" ]]; then
echo -e " ${GREEN}✓${NC} rtiddsspy available"
else
echo -e " ${YELLOW}⚠${NC} rtiddsspy not accessible (DDS features may be limited)"
fi
echo ""
# ─────────────────────────────────────────────────────────────────────────────
# Done
# ─────────────────────────────────────────────────────────────────────────────
echo -e "${GREEN}═══════════════════════════════════════════════════════════════════${NC}"
echo -e "${GREEN} SETUP COMPLETE! ${NC}"
echo -e "${GREEN}═══════════════════════════════════════════════════════════════════${NC}"
echo ""
echo -e " ${BOLD}To activate the environment later:${NC}"
echo -e " ${CYAN}source $PROJECT_ROOT/.venv/bin/activate${NC}"
echo ""
echo -e " ${BOLD}To run the demo:${NC}"
echo -e " ${CYAN}cd examples/MultiAgent && ./run_interactive_demo.sh${NC}"
echo ""
echo -e " ${BOLD}To run tests:${NC}"
echo -e " ${CYAN}cd tests && ./run_all_tests.sh${NC}"
echo ""
echo -e " ${BOLD}Documentation:${NC}"
echo -e " • ${CYAN}QUICKSTART.md${NC} - Get started quickly"
echo -e " • ${CYAN}docs/${NC} - Full documentation"
echo ""