diff --git a/angular_ui_app/src/app/components/camera/camera-box/camera-box.component.ts b/angular_ui_app/src/app/components/camera/camera-box/camera-box.component.ts index 99e19a0f..bc8dd45c 100644 --- a/angular_ui_app/src/app/components/camera/camera-box/camera-box.component.ts +++ b/angular_ui_app/src/app/components/camera/camera-box/camera-box.component.ts @@ -1,5 +1,6 @@ import { Component } from '@angular/core'; import { ViewChild, ElementRef } from '@angular/core'; +import { AppConstants } from 'src/app/constants'; @Component({ selector: 'app-camera-box', @@ -10,7 +11,7 @@ export class CameraBoxComponent { isHovered: boolean = true; pc: RTCPeerConnection | null = null; - host_ip: string = "127.0.0.1"; + host_ip: string = AppConstants.HOST_IP; device_id: number = 0; error: unknown; diff --git a/angular_ui_app/src/app/constants.ts b/angular_ui_app/src/app/constants.ts new file mode 100644 index 00000000..39ffff72 --- /dev/null +++ b/angular_ui_app/src/app/constants.ts @@ -0,0 +1,5 @@ +export class AppConstants { + // public static get HOST_IP(): string { return '192.168.1.69'; } + // public static get HOST_IP(): string { return '10.122.8.160'; } + public static get HOST_IP(): string { return 'localhost'; } +} \ No newline at end of file diff --git a/angular_ui_app/src/app/ros.service.ts b/angular_ui_app/src/app/ros.service.ts index 73a6102e..8ec0068d 100644 --- a/angular_ui_app/src/app/ros.service.ts +++ b/angular_ui_app/src/app/ros.service.ts @@ -1,4 +1,5 @@ import { Injectable } from '@angular/core'; +import { AppConstants } from './constants'; import * as ROSLIB from 'roslib'; @Injectable({ @@ -9,10 +10,7 @@ export class RosService { constructor() { this.ros = new ROSLIB.Ros({ - url: 'ws://localhost:9090' //replace with your ip for port forwarding - // user ng serve --host 0.0.0.0 - // works over LAN, must later be tested with an access point without wifi - // url: 'ws://10.122.8.160:9090' + url: 'ws://' + AppConstants.HOST_IP + ':9090' }); this.ros.on('connection', () => {