Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PORT_ROSBRIDGE=9090
PORT_CONTROL_PANEL=5000
1 change: 1 addition & 0 deletions Dockerfile.humble
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ros-humble-xacro \
ros-humble-rosbridge-server \
ros-humble-realsense2-camera \
ros-humble-compressed-image-transport \
python3-colcon-common-extensions \
python3-rosdep2 \
python3-pytest-cov \
Expand Down
5 changes: 3 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,9 @@ check_cmd git
check_cmd python3
if [ "${CI:-}" = "true" ] || [ "${CI:-}" = "1" ] || [ "${LUCY_INSTALL_SKIP_XHOST:-}" = "1" ]; then
echo "install.sh: skipping xhost check (set CI=1 for headless CI or export LUCY_INSTALL_SKIP_XHOST=1 locally)."
else
check_cmd xhost
elif ! command -v xhost &>/dev/null; then
echo "Missing required command: xhost. Install it or skip this check by re-running with LUCY_INSTALL_SKIP_XHOST=1 (headless setups)." >&2
exit 1
fi
echo "Requirements OK (docker, git, python3)."

Expand Down
19 changes: 15 additions & 4 deletions windows/Lucy.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
WORKSPACE_DIR_HOST = PROJECT_ROOT
WORKSPACE_DIR_CONTAINER = install_ops.WORKSPACE_CONTAINER

ROSBRIDGE_PORT = 9090
LCP_DEFAULT_PORT = 5000

_CLI_MODES = frozenset(('install', 'update', 'repair', 'build-only', 'check-prereqs'))
Expand All @@ -58,22 +57,31 @@ def run_command(command, check=True, interactive=False):
return e.returncode


def _read_lcp_env_value(key):
env_path = os.path.join(PROJECT_ROOT, 'src', 'lucy_control_panel', '.env')
def _read_env_value(env_path, key):
if not os.path.exists(env_path):
return None
value = None
try:
with open(env_path, 'r') as f:
for line in f:
stripped = line.strip()
if stripped.startswith('#') or '=' not in stripped:
continue
if stripped.startswith(f"{key}="):
value = stripped.split('=', 1)[1].strip().strip('"').strip("'")
except OSError:
return None
return value


def _read_lcp_env_value(key):
return _read_env_value(os.path.join(PROJECT_ROOT, 'src', 'lucy_control_panel', '.env'), key)


def _read_root_env_value(key):
return _read_env_value(os.path.join(PROJECT_ROOT, '.env'), key)


def _lcp_container_port():
val = _read_lcp_env_value('VITE_PORT')
if val and val.isdigit():
Expand Down Expand Up @@ -185,11 +193,14 @@ def launch_workspace():
lcp_host_port = lcp_container_port
lcp_scheme = _lcp_scheme()

val = _read_root_env_value('PORT_ROSBRIDGE')
rosbridge_host_port = int(val) if val and val.isdigit() else 9090

docker_cmd = [
'docker', 'run', '-it', '--rm',
*install_ops.docker_run_platform_args(PROJECT_ROOT),
'--name', 'lucy_dev_win',
'-p', f'{ROSBRIDGE_PORT}:9090',
'-p', f'{rosbridge_host_port}:9090',
'-p', f'{lcp_host_port}:{lcp_container_port}',
'-v', volume_mapping,
'-e', f'LUCY_LCP_PUBLISHED_HOST_PORT={lcp_host_port}',
Expand Down
Loading