diff --git a/package.json b/package.json index 10659af..dfcdbf4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lms", - "version": "1.1.27", + "version": "1.1.28", "description": "Autonomy Studio LMS Electron app", "main": "./out/main/index.js", "author": { diff --git a/src/main/index.ts b/src/main/index.ts index b8ada58..cdcf4ef 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -260,6 +260,7 @@ type RemoteWorkspaceTarget = { type RosNetworkConfig = { enabled?: boolean | null + allowExternal?: boolean peer?: RemoteWorkspaceTarget | null } @@ -3791,7 +3792,7 @@ async function startVisualizationBridge( const requestedRosDomainId = String(rosDomainId ?? process.env.ROS_DOMAIN_ID ?? '0').trim() || '0' const requestedRosNetworkKey = rosNetworkEnabled(rosNetwork) ? `peer:${rosNetwork?.peer?.host?.trim() ?? ''}` - : 'local' + : rosNetwork?.allowExternal === true ? 'lan' : 'local' const otherContainerNames = (['autoware', 'nav2', 'slam'] as VisualizationStack[]) .filter((item) => item !== stack) .map(visualizationBridgeContainerName) @@ -3869,7 +3870,7 @@ async function startVisualizationBridge( '-e', `ROS_DOMAIN_ID=${requestedRosDomainId}`, '-e', - `ROS_LOCALHOST_ONLY=${rosNetworkEnabled(rosNetwork) ? '0' : '1'}`, + `ROS_LOCALHOST_ONLY=${rosNetworkEnabled(rosNetwork) || rosNetwork?.allowExternal === true ? '0' : '1'}`, '-e', `AUTONOMY_STUDIO_ROS_NETWORK=${requestedRosNetworkKey}`, '-e', @@ -5062,7 +5063,7 @@ async function startWorkspaceModule( ], undefined, { - ROS_LOCALHOST_ONLY: rosNetworkEnabled(rosNetwork) ? '0' : '1', + ROS_LOCALHOST_ONLY: rosNetworkEnabled(rosNetwork) || rosNetwork?.allowExternal === true ? '0' : '1', ...(fastDdsConfigPath ? { FASTDDS_CONFIG_PATH: fastDdsConfigPath } : {}), }, 30000 diff --git a/src/preload/index.ts b/src/preload/index.ts index 8cf7289..b3ee838 100644 --- a/src/preload/index.ts +++ b/src/preload/index.ts @@ -54,6 +54,7 @@ type ModuleInstallOptions = { type RosNetworkConfig = { enabled?: boolean | null + allowExternal?: boolean peer?: RemoteWorkspaceTarget | null } diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index 5738d9e..9ed48e6 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -1000,9 +1000,10 @@ function LocalPcWorkspaceMockup({ workspaceRoot: remoteRuntimeRoot, } : null const rosNetworkConfig = useMemo(() => { - if (!rosWorkspaceLinked) return null + const localNetwork = !remoteWorkspace ? { enabled: false, allowExternal: sourceSettings.allowExternalRos === true } : null + if (!rosWorkspaceLinked) return localNetwork if (remoteWorkspace) return { enabled: true } - if (!linkedPlatform) return null + if (!linkedPlatform) return localNetwork const linkedDefaults = normalizeStudioSourceSettings({ ...(linkedPlatform.sourceSettings ?? {}), @@ -1013,7 +1014,7 @@ function LocalPcWorkspaceMockup({ const peerHost = parseHostFromUrl(readNestedString(linkedProfile?.config, ['agent', 'url'])) ?? parseHostFromUrl(readNestedString(linkedProfile?.config, ['bridge', 'env', 'BRIDGE_HTTP_URL'])) ?? parseHostFromUrl(linkedDefaults.agentUrl ?? null) - if (!peerHost) return null + if (!peerHost) return localNetwork const peerPort = Number(linkedDefaults.sshPort ?? 22) return { @@ -1024,7 +1025,7 @@ function LocalPcWorkspaceMockup({ port: Number.isFinite(peerPort) && peerPort > 0 ? peerPort : 22, }, } - }, [linkedPlatform, remoteWorkspace, rosWorkspaceLinked, weekNumber]) + }, [linkedPlatform, remoteWorkspace, rosWorkspaceLinked, weekNumber, sourceSettings.allowExternalRos]) const visualizationBridgeLocation = ( remoteWorkspace ? localWorkspaceSettings.visualizationBridgeLocation : sourceSettings.visualizationBridgeLocation ) === 'platform' && rosWorkspaceLinked @@ -2449,6 +2450,7 @@ function LocalPcWorkspaceMockup({ giteaBaseUrl: sourceSettings.giteaBaseUrl, giteaOwner: sourceSettings.giteaOwner, gpuEnabled: sourceSettingsDraft.gpuEnabled, + allowExternalRos: !remoteWorkspace && sourceSettingsDraft.allowExternalRos === true, editorWordWrap: sourceSettingsDraft.editorWordWrap, editorFontSize: sourceSettingsDraft.editorFontSize, editorTabSize: sourceSettingsDraft.editorTabSize, @@ -2475,6 +2477,7 @@ function LocalPcWorkspaceMockup({ giteaBaseUrl: sourceSettings.giteaBaseUrl, giteaOwner: sourceSettings.giteaOwner, gpuEnabled: settings.gpuEnabled, + allowExternalRos: !remoteWorkspace && settings.allowExternalRos === true, editorWordWrap: settings.editorWordWrap, editorFontSize: settings.editorFontSize, editorTabSize: settings.editorTabSize, diff --git a/src/renderer/src/env.d.ts b/src/renderer/src/env.d.ts index 0f2e1f9..fc38f01 100644 --- a/src/renderer/src/env.d.ts +++ b/src/renderer/src/env.d.ts @@ -34,6 +34,7 @@ type ModuleInstallOptions = { type RosNetworkConfig = { enabled?: boolean | null + allowExternal?: boolean peer?: RemoteWorkspaceTarget | null } diff --git a/src/renderer/src/features/platforms/types.ts b/src/renderer/src/features/platforms/types.ts index 0bde18b..ee81d79 100644 --- a/src/renderer/src/features/platforms/types.ts +++ b/src/renderer/src/features/platforms/types.ts @@ -8,6 +8,7 @@ export type StudioSourceSettings = { editorTabSize: number editorMinimap: boolean rosDomainId: string + allowExternalRos?: boolean rosLinkedPlatformId?: string | null visualizationBridgeLocation?: 'local' | 'platform' agentUrl?: string | null diff --git a/src/renderer/src/features/workspace/WorkspaceSettingsView.tsx b/src/renderer/src/features/workspace/WorkspaceSettingsView.tsx index 180d11c..8181a32 100644 --- a/src/renderer/src/features/workspace/WorkspaceSettingsView.tsx +++ b/src/renderer/src/features/workspace/WorkspaceSettingsView.tsx @@ -97,6 +97,13 @@ function WorkspaceSettingsView({ dark={dark} /> + onUpdateSourceSetting('allowExternalRos', checked)} + dark={dark} + />