From 763d7e32fcd794b20d21aa2fc6cd0bd087111af9 Mon Sep 17 00:00:00 2001 From: carlo Date: Mon, 4 Mar 2024 15:26:16 +0100 Subject: [PATCH 1/5] ripristinata applicazione helper. Seconda versione plugin services --- .../robot-speech/robot-speech.component.ts | 56 +++++++++++-------- .../services-manager.component.ts | 14 +++-- src/app/services/api/api.mock.service.ts | 8 +-- src/app/services/api/api.service.interface.ts | 8 +-- src/app/services/api/api.service.ts | 13 ++--- src/app/widget-base/widget-base.component.ts | 8 +-- 6 files changed, 58 insertions(+), 49 deletions(-) diff --git a/src/app/plugins/robot-speech/robot-speech.component.ts b/src/app/plugins/robot-speech/robot-speech.component.ts index 44430ad..e65652b 100644 --- a/src/app/plugins/robot-speech/robot-speech.component.ts +++ b/src/app/plugins/robot-speech/robot-speech.component.ts @@ -1,5 +1,5 @@ import {ChangeDetectorRef, Component, ElementRef, ViewChild} from '@angular/core'; -import { WidgetBaseComponent } from '../../widget-base/widget-base.component'; +import {WidgetBaseComponent} from '../../widget-base/widget-base.component'; import {MatInput} from "@angular/material/input"; @Component({ @@ -7,18 +7,18 @@ import {MatInput} from "@angular/material/input"; templateUrl: './robot-speech.component.html', styleUrl: './robot-speech.component.css' }) -export class RobotSpeechComponent extends WidgetBaseComponent{ +export class RobotSpeechComponent extends WidgetBaseComponent { @ViewChild('scrollContainer') private myScrollContainer: ElementRef; - @ViewChild('messageInput',{read:MatInput}) messageInput: MatInput; + @ViewChild('messageInput', {read: MatInput}) messageInput: MatInput; readonly messageColors = { - "CREATED":'lightgray', - "SENDING":'#FFF778FF', - "SENT":'lightgreen', - "FAILED":'indianred' + "CREATED": 'lightgray', + "SENDING": '#FFF778FF', + "SENT": 'lightgreen', + "FAILED": 'indianred' } - messages:{text:string,status:string}[] = []; + messages: { text: string, status: string }[] = []; newMessage = "" inputDisabled = false; @@ -30,38 +30,46 @@ export class RobotSpeechComponent extends WidgetBaseComponent{ this.sendMessage() } - sendMessage(){ + sendMessage() { if (this.newMessage.trim()) { this.inputDisabled = true; let messageObject = { - text:this.newMessage, - status:"CREATED" + text: this.newMessage, + status: "CREATED" }; this.newMessage = ""; this.messages.push(messageObject); this.cdr.detectChanges() this.scrollToBottom() - this.speechSayAsync(messageObject.text).subscribe(requestID => { - const onRunningCallback = () => { - messageObject.status = "SENDING"; - } - const onDoneCallback = () => { - messageObject.status = "SENT"; - this.inputDisabled = false; - } + this.speechSayAsync(messageObject.text).subscribe({ + next: requestID => { + const onRunningCallback = () => { + messageObject.status = "SENDING"; + } + const onDoneCallback = () => { + messageObject.status = "SENT"; + this.inputDisabled = false; + } + + const onFailedCallback = () => { + messageObject.status = "FAILED"; + this.inputDisabled = false; + } - const onFailedCallback = () => { + this.checkAsyncRequestStatus(requestID, () => { + }, onRunningCallback, onDoneCallback, onFailedCallback) + + }, + error: err => { messageObject.status = "FAILED"; this.inputDisabled = false; } - - this.checkAsyncRequestStatus(requestID,() =>{},onRunningCallback,onDoneCallback,onFailedCallback) - }) } } - scrollToBottom(){ + + scrollToBottom() { this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight; } diff --git a/src/app/plugins/services-manager/services-manager.component.ts b/src/app/plugins/services-manager/services-manager.component.ts index 8072542..5b76e9c 100644 --- a/src/app/plugins/services-manager/services-manager.component.ts +++ b/src/app/plugins/services-manager/services-manager.component.ts @@ -61,7 +61,7 @@ export class ServicesManagerComponent extends WidgetBaseComponent implements OnI } }) - this.runServiceAsync(selectedService.name,selectedService.args).subscribe(reqID => { + this.runServiceAsync(`${this.application.name}.${selectedService.name}`,selectedService.args).subscribe(reqID => { //console.log("RISPOSTA PLAYACTION: ",reqID) @@ -125,11 +125,13 @@ export class ServicesManagerComponent extends WidgetBaseComponent implements OnI ngOnInit() { this.getApplicationServices().subscribe({ next: services => { - //const filteredActions = actions.filter(action => action.startsWith(this.application.name + ".")).map(action => action.substring(this.application.name.length + 1)) - //const newActions: Action[] = filteredActions.map(action => { - //return {actionID: action, actionState: ActionState.ACTIVE} - //}) - this.services = services; + const filteredServices = services.filter(service => service.name.startsWith(this.application.name + ".")).map(service => { + return { + ...service, + name:service.name.substring(this.application.name.length + 1) + } + }) + this.services = filteredServices; this.isLoading = false; //console.log(this.actions) }, diff --git a/src/app/services/api/api.mock.service.ts b/src/app/services/api/api.mock.service.ts index 5b522d5..4f9755e 100644 --- a/src/app/services/api/api.mock.service.ts +++ b/src/app/services/api/api.mock.service.ts @@ -13,7 +13,7 @@ import * as defaultDashboardConfig from "../../defaultDashboardConfiguration.jso import {Plugin} from "../../types/Plugin"; import {ApplicationArgType} from "../../types/ApplicationArgType"; -///* +/* @Injectable({ providedIn: 'root' }) @@ -286,9 +286,9 @@ export class ApiMockService implements IApiService { } -//*/ +*/ -/* +///* @Injectable({ providedIn: 'root' }) @@ -556,4 +556,4 @@ export class ApiMockService implements IApiService { } } -*/ +//*/ diff --git a/src/app/services/api/api.service.interface.ts b/src/app/services/api/api.service.interface.ts index 2514d8c..dd0e1b5 100644 --- a/src/app/services/api/api.service.interface.ts +++ b/src/app/services/api/api.service.interface.ts @@ -8,7 +8,7 @@ import { ICubEmoEmotion } from '../../types/ICubEmoEmotion'; import { ICubEmoColor } from '../../types/ICubEmoColor'; import {Injectable, InjectionToken} from "@angular/core"; -///* +/* @Injectable({ providedIn: 'root' }) @@ -66,9 +66,9 @@ export abstract class IApiService { } } -//*/ +*/ -/* +///* @Injectable({ providedIn: 'root' }) @@ -125,4 +125,4 @@ export abstract class IApiService { } } -*/ +//*/ diff --git a/src/app/services/api/api.service.ts b/src/app/services/api/api.service.ts index d6c5bcc..404595d 100644 --- a/src/app/services/api/api.service.ts +++ b/src/app/services/api/api.service.ts @@ -25,7 +25,7 @@ import {getApplicationFSMResponse} from "./types/GetApplicationFSMResponse"; import {SessionStorageService} from "../session-storage.service"; import {Service, ServiceState} from "../../types/Service"; -///* +/* @Injectable({ providedIn: 'root' }) @@ -501,9 +501,9 @@ export class ApiService implements IApiService { } -//*/ +*/ -/* +///* @Injectable({ providedIn: 'root' @@ -616,7 +616,7 @@ export class ApiService implements IApiService { } getApplicationArgsTemplate(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "getArgsTemplate").pipe( + return this.runService(robotName, appName, appPort, "utils.getArgsTemplate").pipe( map(response => { //console.log("ARGSTEMPLATE: ",response) return this.getArgsTemplate(response) @@ -625,7 +625,7 @@ export class ApiService implements IApiService { } setApplicationArgs(robotName: string, appName: string, appPort: string, args) { - return this.runService(robotName, appName, appPort, "setArgs", {"input_args": args}) + return this.runService(robotName, appName, appPort, "utils.setArgs", {"input_args": args}) } applicatioConfigure(robotName: string, appName: string, appPort: string, args) { @@ -979,7 +979,6 @@ export class ApiService implements IApiService { } } - - */ +//*/ diff --git a/src/app/widget-base/widget-base.component.ts b/src/app/widget-base/widget-base.component.ts index 17a6ec0..c0e4f72 100644 --- a/src/app/widget-base/widget-base.component.ts +++ b/src/app/widget-base/widget-base.component.ts @@ -7,7 +7,7 @@ import {Application} from "../types/Application"; import {AppStateService} from "../services/app-state.service"; import {Plugin} from "../types/Plugin"; -///* +/* @Component({ selector: 'app-widget-base', templateUrl: './widget-base.component.html', @@ -209,9 +209,9 @@ export class WidgetBaseComponent{ } -//*/ +*/ -/* +///* @Component({ selector: 'app-widget-base', templateUrl: './widget-base.component.html', @@ -416,4 +416,4 @@ export class WidgetBaseComponent { } } -*/ +//*/ From bf6f7b9f933b05db866a01b7df2b36afb050e610 Mon Sep 17 00:00:00 2001 From: carlo Date: Mon, 4 Mar 2024 16:09:24 +0100 Subject: [PATCH 2/5] fixato errore nella gestione della sessione dell'app --- src/app/application-page/application-page.component.ts | 6 +++++- src/app/services/api/api.service.ts | 5 ++++- src/app/services/session-storage.service.ts | 9 +++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/app/application-page/application-page.component.ts b/src/app/application-page/application-page.component.ts index baae6a0..5e53faa 100644 --- a/src/app/application-page/application-page.component.ts +++ b/src/app/application-page/application-page.component.ts @@ -43,6 +43,7 @@ export class ApplicationPageComponent implements OnInit{ dialogRef.afterClosed().subscribe(args => { this.appState.configureApplication(this.application,args).subscribe(() => { this.application.isConfigured = true; + this.sessionStorage.saveIsApplicationConfigured(this.application.robotName,this.application.name,true) this.canShowApplication = true; }) }) @@ -69,6 +70,7 @@ export class ApplicationPageComponent implements OnInit{ } else { this.appState.configureApplication(this.application,{}).subscribe(() => { this.application.isConfigured = true; + this.sessionStorage.saveIsApplicationConfigured(this.application.robotName,this.application.name,true) this.canShowApplication = true; }) } @@ -136,15 +138,17 @@ export class ApplicationPageComponent implements OnInit{ const argsTemplateExists = Object.keys(this.application.argsTemplate).length !== 0 const areArgsSet = this.application.args && Object.keys(this.application.args).length !== 0 const isApplicationConfigured = this.application.isConfigured; - + console.log(this.application) //se l'applicazione è gia stata configurata mostro il dialog per scegliere se ripristinare la sessione if(isApplicationConfigured){ + this.openRestoreSessionDialog() //se l'applicazione non è gia stata configurata e non ci sono argomenti da configurare, invio la configure senza parametri } else if(!argsTemplateExists){ this.appState.configureApplication(this.application, {}).subscribe(() => { this.application.isConfigured = true; + this.sessionStorage.saveIsApplicationConfigured(this.application.robotName,this.application.name,true) this.canShowApplication = true; }) diff --git a/src/app/services/api/api.service.ts b/src/app/services/api/api.service.ts index 404595d..8808d98 100644 --- a/src/app/services/api/api.service.ts +++ b/src/app/services/api/api.service.ts @@ -517,7 +517,7 @@ export class ApiService implements IApiService { private asyncRequestsStatus: { [key: string]: ICubRequestStatus } = {} - constructor(private http: HttpClient,private localStorageService:LocalStorageService) { + constructor(private http: HttpClient,private localStorageService:LocalStorageService, private sessionStorageService:SessionStorageService) { } getRobots() { @@ -559,6 +559,8 @@ export class ApiService implements IApiService { }), map(argsTemplate => { application.argsTemplate = argsTemplate; + application.args = this.sessionStorageService.getApplicationArgs(robotName,application.name) || {} + application.isConfigured = this.sessionStorageService.getIsApplicationConfigured(robotName,application.name) const savedDashboard = this.localStorageService.getDashboardConfig(application) for (const [pluginName, componentName] of Object.entries(pluginIndex)) { const pluginDefaultData = (savedDashboard && savedDashboard[pluginName]) ? savedDashboard[pluginName] : defaultDashboardConfig[pluginName]; @@ -629,6 +631,7 @@ export class ApiService implements IApiService { } applicatioConfigure(robotName: string, appName: string, appPort: string, args) { + console.log("chiamata configure") return this.runService(robotName, appName, appPort, "utils.configure", {"input_args": args}) } diff --git a/src/app/services/session-storage.service.ts b/src/app/services/session-storage.service.ts index 30d98be..7277f40 100644 --- a/src/app/services/session-storage.service.ts +++ b/src/app/services/session-storage.service.ts @@ -42,6 +42,15 @@ public saveApplicationArgs(robotName:string,applicationName:string,args){ sessionStorage.setItem(`${robotName}_${applicationName}_ARGS`,argsString) } +public saveIsApplicationConfigured(robotName:string,applicationName:string,isConfigured:boolean){ + sessionStorage.setItem(`${robotName}_${applicationName}_ISCONFIGURED`, isConfigured ? "true" : "false") +} + +public getIsApplicationConfigured(robotName:string,applicationName:string):boolean{ + const isConfiguredString = sessionStorage.getItem(`${robotName}_${applicationName}_ISCONFIGURED`); + return isConfiguredString === "true" +} + public getApplicationArgs(robotName:string,applicationName:string):DashboardConfig{ const argsString = sessionStorage.getItem(`${robotName}_${applicationName}_ARGS`) From 3de63eb80f7aa37f237ed8244907b571cea56598 Mon Sep 17 00:00:00 2001 From: carlo Date: Mon, 4 Mar 2024 16:14:41 +0100 Subject: [PATCH 3/5] fixato errore nella gestione della sessione dell'app --- .../application-page.component.ts | 1 - src/app/services/api/api.mock.service.ts | 279 +--------- src/app/services/api/api.service.interface.ts | 64 +-- src/app/services/api/api.service.ts | 482 +----------------- src/app/widget-base/widget-base.component.ts | 206 -------- 5 files changed, 3 insertions(+), 1029 deletions(-) diff --git a/src/app/application-page/application-page.component.ts b/src/app/application-page/application-page.component.ts index 5e53faa..28d3ffc 100644 --- a/src/app/application-page/application-page.component.ts +++ b/src/app/application-page/application-page.component.ts @@ -138,7 +138,6 @@ export class ApplicationPageComponent implements OnInit{ const argsTemplateExists = Object.keys(this.application.argsTemplate).length !== 0 const areArgsSet = this.application.args && Object.keys(this.application.args).length !== 0 const isApplicationConfigured = this.application.isConfigured; - console.log(this.application) //se l'applicazione è gia stata configurata mostro il dialog per scegliere se ripristinare la sessione if(isApplicationConfigured){ diff --git a/src/app/services/api/api.mock.service.ts b/src/app/services/api/api.mock.service.ts index 4f9755e..d17782c 100644 --- a/src/app/services/api/api.mock.service.ts +++ b/src/app/services/api/api.mock.service.ts @@ -12,283 +12,6 @@ import {pluginIndex} from "../../plugins"; import * as defaultDashboardConfig from "../../defaultDashboardConfiguration.json"; import {Plugin} from "../../types/Plugin"; import {ApplicationArgType} from "../../types/ApplicationArgType"; - -/* -@Injectable({ - providedIn: 'root' -}) -export class ApiMockService implements IApiService { - camLeftGetImgRes(robotName: string, appName: string, appPort: string): Observable<{ width: number; height: number }> { - return undefined; - } - - camLeftGetURI(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - camRightGetImgRes(robotName: string, appName: string, appPort: string): Observable<{ - width: number; - height: number - }> { - return undefined; - } - - camRightGetURI(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - checkAsyncRequestStatus(requestID: string, initCallback: () => void, runningCallback: () => void, doneCallback: (retval: any) => void, failedCallback: () => void): void { - } - - emoAngry(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - emoClosingEyes(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - emoCun(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - emoEbSmile(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - emoEbSurprised(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - emoEvil(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - emoNeutral(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - emoOpeningEyes(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - emoSad(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - emoSendCmd(robotName: string, appName: string, appPort: string, part: ICubEmoPart, emotion: ICubEmoEmotion): Observable { - return undefined; - } - - emoSetBrightness(robotName: string, appName: string, appPort: string, brightness: 0 | 1 | 2 | 3 | 4 | 5): Observable { - return undefined; - } - - emoSetColor(robotName: string, appName: string, appPort: string, color: ICubEmoColor): Observable { - return undefined; - } - - emoSmile(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - emoSurprised(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - fsmGetCurrentState(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - gazeBlockEyes(robotName: string, appName: string, appPort: string, vergence: number): Observable { - return undefined; - } - - gazeBlockNeck(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - gazeClearEyes(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - gazeClearNeck(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - gazeInit(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - gazeLookAtAbsAngles(robotName: string, appName: string, appPort: string, azimuth: number, elevation: number, vergence: number, waitMotionDone?: boolean, timeout?: number): Observable { - return undefined; - } - - gazeLookAtFixationPoint(robotName: string, appName: string, appPort: string, x: number, y: number, z: number, waitMotionDone?: boolean, timeout?: number): Observable { - return undefined; - } - - gazeLookAtRelAngles(robotName: string, appName: string, appPort: string, azimuth: number, elevation: number, vergence: number, waitMotionDone?: boolean, timeout?: number): Observable { - return undefined; - } - - gazeReset(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - gazeSetParams(robotName: string, appName: string, appPort: string, neck_tt: number, eyes_tt: number): Observable { - return undefined; - } - - gazeSetTrackingMode(robotName: string, appName: string, appPort: string, mode: boolean): Observable { - return undefined; - } - - gazeWaitMotionDone(robotName: string, appName: string, appPort: string, period?: number, timeout?: number): Observable { - return undefined; - } - - gazeWaitMotionOnset(robotName: string, appName: string, appPort: string, speedRef?: number, period?: number, maxAttempts?: number): Observable { - return undefined; - } - - getApplicationArgsTemplate(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - getApplicationFSM(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - getApplications(robotName: string): Observable { - return undefined; - } - - getRobotActions(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - getRobots(): Observable { - - const robot1 = new Robot("iCub 1", new URL("http://localhost:8001/pyicub/iCub1")) - const robot2 = new Robot("iCub 2", new URL("http://localhost:8002/pyicub/iCub2")) - const robot3 = new Robot("iCub 3", new URL("http://localhost:8003/pyicub/iCub3")) - - const numAppRobot1 = 3 - const numAppRobot2 = 2; - const numAppRobot3 = 2; - - for(let i = 0; i { - return undefined; - } - - playActionAsync(robotName: string, appName: string, appPort: string, actionID: string): Observable { - return undefined; - } - - playActionSync(robotName: string, appName: string, appPort: string, actionID: string): Observable { - return undefined; - } - - runService(robotName: string, appName: string, appPort: string, serviceName: string, body?: any): Observable { - return undefined; - } - - runServiceAsync(robotName: string, appName: string, appPort: string, serviceName: string, body?: any): Observable { - return undefined; - } - - setApplicationArgs(robotName: string, appName: string, appPort: string, args: any): Observable { - return undefined; - } - - speechClose(robotName: string, appName: string, appPort: string): Observable { - return undefined; - } - - speechSay(robotName: string, appName: string, appPort: string, sentence: string, waitActionDone?: boolean): Observable { - return undefined; - } - - speechSayAsync(robotName: string, appName: string, appPort: string, sentence: string, waitActionDone?: boolean): Observable { - return undefined; - } - - -} - -*/ - -///* @Injectable({ providedIn: 'root' }) @@ -556,4 +279,4 @@ export class ApiMockService implements IApiService { } } -//*/ + diff --git a/src/app/services/api/api.service.interface.ts b/src/app/services/api/api.service.interface.ts index dd0e1b5..52aefb9 100644 --- a/src/app/services/api/api.service.interface.ts +++ b/src/app/services/api/api.service.interface.ts @@ -7,68 +7,6 @@ import { ICubEmoPart } from '../../types/ICubEmoPart'; import { ICubEmoEmotion } from '../../types/ICubEmoEmotion'; import { ICubEmoColor } from '../../types/ICubEmoColor'; import {Injectable, InjectionToken} from "@angular/core"; - -/* -@Injectable({ - providedIn: 'root' -}) -export abstract class IApiService { - abstract getRobots(): Observable; - abstract getApplications(robotName: string): Observable; - abstract getApplicationArgsTemplate(robotName: string, appName: string, appPort: string): Observable; - abstract setApplicationArgs(robotName: string, appName: string, appPort: string, args: any): Observable; - abstract getApplicationFSM(robotName: string, appName: string, appPort: string): Observable; - abstract getServices(robotName: string, appName: string): Observable; - abstract checkAsyncRequestStatus(requestID: string, initCallback: () => void, runningCallback: () => void, doneCallback: (retval: any) => void, failedCallback: () => void): void; - abstract runService(robotName: string, appName: string, appPort: string, serviceName: string, body?: any): Observable; - abstract runServiceAsync(robotName: string, appName: string, appPort: string, serviceName: string, body?: any): Observable; - abstract fsmGetCurrentState(robotName: string, appName: string, appPort: string): Observable; - abstract emoAngry(robotName: string, appName: string, appPort: string): Observable; - abstract emoClosingEyes(robotName: string, appName: string, appPort: string): Observable; - abstract emoCun(robotName: string, appName: string, appPort: string): Observable; - abstract emoEbSmile(robotName: string, appName: string, appPort: string): Observable; - abstract emoEbSurprised(robotName: string, appName: string, appPort: string): Observable; - abstract emoEvil(robotName: string, appName: string, appPort: string): Observable; - abstract emoNeutral(robotName: string, appName: string, appPort: string): Observable; - abstract emoOpeningEyes(robotName: string, appName: string, appPort: string): Observable; - abstract emoSad(robotName: string, appName: string, appPort: string): Observable; - abstract emoSendCmd(robotName: string, appName: string, appPort: string, part: ICubEmoPart, emotion: ICubEmoEmotion): Observable; - abstract emoSetBrightness(robotName: string, appName: string, appPort: string, brightness: 0 | 1 | 2 | 3 | 4 | 5): Observable; - abstract emoSetColor(robotName: string, appName: string, appPort: string, color: ICubEmoColor): Observable; - abstract emoSmile(robotName: string, appName: string, appPort: string): Observable; - abstract emoSurprised(robotName: string, appName: string, appPort: string): Observable; - abstract gazeBlockEyes(robotName: string, appName: string, appPort: string, vergence: number): Observable; - abstract gazeBlockNeck(robotName: string, appName: string, appPort: string): Observable; - abstract gazeClearEyes(robotName: string, appName: string, appPort: string): Observable; - abstract gazeClearNeck(robotName: string, appName: string, appPort: string): Observable; - abstract gazeInit(robotName: string, appName: string, appPort: string): Observable; - abstract gazeLookAtAbsAngles(robotName: string, appName: string, appPort: string, azimuth: number, elevation: number, vergence: number, waitMotionDone?: boolean, timeout?: number): Observable; - abstract gazeLookAtFixationPoint(robotName: string, appName: string, appPort: string, x: number, y: number, z: number, waitMotionDone?: boolean, timeout?: number): Observable; - abstract gazeLookAtRelAngles(robotName: string, appName: string, appPort: string, azimuth: number, elevation: number, vergence: number, waitMotionDone?: boolean, timeout?: number): Observable; - abstract gazeReset(robotName: string, appName: string, appPort: string): Observable; - abstract gazeSetParams(robotName: string, appName: string, appPort: string, neck_tt: number, eyes_tt: number): Observable; - abstract gazeSetTrackingMode(robotName: string, appName: string, appPort: string, mode: boolean): Observable; - abstract gazeWaitMotionDone(robotName: string, appName: string, appPort: string, period?: number, timeout?: number): Observable; - abstract gazeWaitMotionOnset(robotName: string, appName: string, appPort: string, speedRef?: number, period?: number, maxAttempts?: number): Observable; - abstract speechClose(robotName: string, appName: string, appPort: string): Observable; - abstract speechSay(robotName: string, appName: string, appPort: string, sentence: string, waitActionDone?: boolean): Observable; - abstract speechSayAsync(robotName: string, appName: string, appPort: string, sentence: string, waitActionDone?: boolean): Observable; - abstract camLeftGetURI(robotName: string, appName: string, appPort: string): Observable; - abstract camLeftGetImgRes(robotName: string, appName: string, appPort: string): Observable<{ width: number, height: number }>; - abstract camRightGetImgRes(robotName: string, appName: string, appPort: string): Observable<{ width: number, height: number }>; - abstract camRightGetURI(robotName: string, appName: string, appPort: string): Observable; - abstract getRobotActions(robotName: string, appName: string, appPort: string): Observable; - abstract playActionSync(robotName: string, appName: string, appPort: string, actionID: string): Observable; - abstract playActionAsync(robotName:string, appName: string, appPort: string, actionID: string): Observable; - - constructor(){ - - } -} - -*/ - -///* @Injectable({ providedIn: 'root' }) @@ -125,4 +63,4 @@ export abstract class IApiService { } } -//*/ + diff --git a/src/app/services/api/api.service.ts b/src/app/services/api/api.service.ts index 8808d98..4a0924a 100644 --- a/src/app/services/api/api.service.ts +++ b/src/app/services/api/api.service.ts @@ -25,486 +25,6 @@ import {getApplicationFSMResponse} from "./types/GetApplicationFSMResponse"; import {SessionStorageService} from "../session-storage.service"; import {Service, ServiceState} from "../../types/Service"; -/* -@Injectable({ - providedIn: 'root' -}) -export class ApiService implements IApiService { - private port = environment.apiPort - private hostname = environment.apiHost - private scheme = environment.apiScheme - - //I path simbolici utilizzati saranno sostituiti da quelli veri tramite la configurazione presente in proxy.conf.json - - private asyncRequestsStatus: { [key: string]: ICubRequestStatus } = {} - - constructor(private http: HttpClient,private localStorageService:LocalStorageService,private sessionStorageService:SessionStorageService) { - } - - getRobots() { - const path = `${this.scheme}://${this.hostname}:${this.port}/pyicub`; - return this.http.get(path).pipe( - //Per ogni robot, vado ad effettuare una chiamata per ottenere le relative applicazioni. Quando tutte le chiamate sono terminate, restituisco i robot. - mergeMap(robots => { - const robotsObservables = robots.map(robot => this.getApplications(robot.name).pipe( - map(applications => { - robot.applications = applications - //console.log(robot) - return robot - }) - )); - - return (forkJoin(robotsObservables)) - - }) - ) - - } - - - getApplications(robotName: string) { - const path = `${this.scheme}://${this.hostname}:${this.port}/pyicub/${robotName}`; - return this.http.get(path).pipe( - //inizio a creare le applicazioni - map(response => { - return response.map(applicationObject => new Application(robotName, applicationObject.name, applicationObject.url) - ) - }), - //Per ogni applicazione vado ad ottenere l'argsTemplate. - switchMap(applications => { - const applicationsObservables = applications.map(application => - - this.getApplicationArgsTemplate(robotName, application.name, application.url.port).pipe( - catchError(() => { - return of({}) - }), - map(argsTemplate => { - application.argsTemplate = argsTemplate; - application.args = this.sessionStorageService.getApplicationArgs(robotName,application.name) || {} - const savedDashboard = this.localStorageService.getDashboardConfig(application) - for (const [pluginName, componentName] of Object.entries(pluginIndex)) { - const pluginDefaultData = (savedDashboard && savedDashboard[pluginName]) ? savedDashboard[pluginName] : defaultDashboardConfig[pluginName]; - const x = pluginDefaultData?.x || 0; - const y = pluginDefaultData?.y || 0; - const cols = pluginDefaultData?.cols || 20; - const rows = pluginDefaultData?.rows || 20; - const enabled = pluginDefaultData?.enabled || false; - application.plugins.push(new Plugin(pluginName, componentName, enabled, cols, rows, x, y)) - } - //console.log(application.argsTemplate) - return application - }) - ) - ); - - return forkJoin(applicationsObservables); - }) - ); - } - - private getArgsTemplate(args): ApplicationArgsTemplate { - const templateTypes: ApplicationArgsTemplate = {} - for (const [key, value] of Object.entries(args)) { - templateTypes[key] = { - type: this.getArgType(value), - value: value - } - } - - return templateTypes; - } - - private getArgType(value: any): ApplicationArgType { - if (typeof (value) === "string") { - return ApplicationArgType.STRING - } else if (typeof (value) === "boolean") { - return ApplicationArgType.BOOLEAN - } else if (typeof (value) === "number") { - return ApplicationArgType.NUMBER - } else if (Array.isArray(value)) { - if (value.length === 0) { - return ApplicationArgType.ARRAY_STRING - } else { - let elem = value[0]; - if (typeof (elem) == "string") { - return ApplicationArgType.ARRAY_STRING - } else if (typeof (elem) == "number") { - return ApplicationArgType.ARRAY_NUMBER - } - } - } - - return ApplicationArgType.STRING; - } - - getApplicationArgsTemplate(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "utils.getArgsTemplate").pipe( - map(response => { - //console.log("ARGSTEMPLATE: ",response) - return this.getArgsTemplate(response) - }) - ) - } - - setApplicationArgs(robotName: string, appName: string, appPort: string, args) { - return this.runService(robotName, appName, appPort, "utils.setArgs", {"input_args": args}) - } - applicatioConfigure(robotName: string, appName: string, appPort: string, args) { - return this.runService(robotName, appName, appPort, "utils.configure", {"input_args": args}) - } - - getApplicationFSM(robotName: string, appName: string, appPort: string) { - return this.runService(robotName,appName,appPort,"fsm.toJSON").pipe( - map(response => { - - let nodes: FSMNode[] = response.states.map(state => { - let node:FSMNode = { - name:state.name, - id:state.name, - description:state.description - } - return node - }) - - let edges: FSMEdge[] = response.transitions.map(transition => { - let edge:FSMEdge = { - sourceID: transition.source, - targetID:transition.dest, - trigger:transition.trigger - } - return edge - }) - - let initState:FSMNode = { - name: response.initial_state, - id: response.initial_state, - description: "" - } - //inserisco lo stato iniziale come primo dell'array. è importante che sia il primo poichè cosi il motore grafico che renderizza l'FSM lo posiziona all'estrema sinistra. - nodes.unshift(initState) - - const fsmDefaultConfig = defaultDashboardConfig["fsm"]; - const x = fsmDefaultConfig.x || 0; - const y = fsmDefaultConfig.y || 0; - const cols = fsmDefaultConfig.cols || 50; - const rows = fsmDefaultConfig.rows || 70; - - return new FSM(nodes, edges, cols, rows, x, y) - - }) - ) - } - - getServices(robotName: string = "", appName: string = "") { - const path = `${this.scheme}://${this.hostname}:${this.port}/pyicub/${robotName}/${appName}`; - return this.http.get(path).pipe( - map(response => { - let services:Service[] = Object.entries(response).map(([name, service]) =>{ - const argsTemplate = this.getArgsTemplate(service.signature); - const newService:Service = { - name:name, - argsTemplate:argsTemplate, - args:{}, - state:ServiceState.ACTIVE - } - return newService - }) - - return services - }) - ) - } - - checkAsyncRequestStatus(requestID: string, initCallback: () => void = () => { - }, runningCallback: () => void = () => { - }, doneCallback: (retval: any) => void = () => { - }, failedCallback: () => void = () => { - }) { - const url = new URL(requestID); - const requestStatusPath = `${this.scheme}://${this.hostname}:${url.port}${url.pathname}`; - this.asyncRequestsStatus[requestID] = ICubRequestStatus.INIT - initCallback() - - interval(100).pipe( - switchMap(() => { - return this.http.get(requestStatusPath).pipe( - tap(response => { - switch (response.status) { - case ICubRequestStatus.RUNNING: - if (this.asyncRequestsStatus[requestID] !== ICubRequestStatus.RUNNING) { - this.asyncRequestsStatus[requestID] = ICubRequestStatus.RUNNING; - runningCallback(); - } - break; - case ICubRequestStatus.DONE: - if (this.asyncRequestsStatus[requestID] !== ICubRequestStatus.DONE) { - this.asyncRequestsStatus[requestID] = ICubRequestStatus.DONE; - doneCallback(response.retval); - } - break; - case ICubRequestStatus.FAILED: - this.asyncRequestsStatus[requestID] = ICubRequestStatus.FAILED; - failedCallback(); - break; - default: - console.log("unknown response status:") - console.log(response.status) - console.log(response) - } - }) - ) - }), - takeWhile(response => response.status !== ICubRequestStatus.DONE && response.status !== ICubRequestStatus.FAILED && response.status !== ICubRequestStatus.TIMEOUT, true) - ).subscribe() - - } - - runService(robotName: string, appName: string, appPort: string, serviceName: string, body: any = {}) { - let params = new HttpParams().set('sync', ''); - const path = `${this.scheme}://${this.hostname}:${appPort}/pyicub/${robotName}/${appName}/${serviceName}` - - return this.http.post(path, body, {params: params}) - } - - runServiceAsync(robotName: string, appName: string, appPort: string, serviceName: string, body: any = {}) { - const path = `${this.scheme}://${this.hostname}:${appPort}/pyicub/${robotName}/${appName}/${serviceName}`; - return this.http.post(path, body); - } - - fsmGetCurrentState(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "fsm.getCurrentState") - } - - emoAngry(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "helper.emo.angry") - } - - emoClosingEyes(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "helper.emo.closingEyes") - } - - emoCun(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "helper.emo.cun") - } - - emoEbSmile(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "helper.emo.eb_smile") - } - - emoEbSurprised(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "helper.emo.eb_surprised") - } - - emoEvil(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "helper.emo.evil") - } - - emoNeutral(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "helper.emo.neutral") - } - - emoOpeningEyes(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "helper.emo.openingEyes") - } - - emoSad(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "helper.emo.sad") - } - - emoSendCmd(robotName: string, appName: string, appPort: string, part: ICubEmoPart, emotion: ICubEmoEmotion) { - return this.runService(robotName, appName, appPort, "helper.emo.sendCmd", {part: part, emo: emotion}) - } - - emoSetBrightness(robotName: string, appName: string, appPort: string, brightness: 0 | 1 | 2 | 3 | 4 | 5) { - return this.runService(robotName, appName, appPort, "helper.emo.setBrightness", {brightness: brightness}) - } - - emoSetColor(robotName: string, appName: string, appPort: string, color: ICubEmoColor) { - return this.runService(robotName, appName, appPort, "helper.emo.setColor", {color: color}) - } - - emoSmile(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "helper.emo.smile") - } - - emoSurprised(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "helper.emo.surprised") - } - - gazeBlockEyes(robotName: string, appName: string, appPort: string, vergence: number) { - return this.runService(robotName, appName, appPort, "helper.gaze.blockEyes", {vergence: vergence}) - } - - gazeBlockNeck(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "helper.gaze.blockNeck") - } - - gazeClearEyes(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "helper.gaze.clearEyes") - } - - gazeClearNeck(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "helper.gaze.clearNeck") - } - - gazeInit(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "helper.gaze.init") - } - - gazeLookAtAbsAngles(robotName: string, appName: string, appPort: string, azimuth: number, elevation: number, vergence: number, waitMotionDone: boolean = true, timeout: number = 0.0) { - return this.runService(robotName, appName, appPort, "helper.gaze.lookAtAbsAngles", { - azi: azimuth, - ele: elevation, - ver: vergence, - waitMotionDone: waitMotionDone, - timeout: timeout - }) - } - - gazeLookAtFixationPoint(robotName: string, appName: string, appPort: string, x: number, y: number, z: number, waitMotionDone: boolean = true, timeout: number = 0.0) { - return this.runService(robotName, appName, appPort, "helper.gaze.lookAtFixationPoint", { - x: x, - y: y, - z: z, - waitMotionDone: waitMotionDone, - timeout: timeout - }) - } - - gazeLookAtRelAngles(robotName: string, appName: string, appPort: string, azimuth: number, elevation: number, vergence: number, waitMotionDone: boolean = true, timeout: number = 0.0) { - return this.runService(robotName, appName, this.port, "helper.gaze.lookAtRelAngles", { - azi: azimuth, - ele: elevation, - ver: vergence, - waitMotionDone: waitMotionDone, - timeout: timeout - }) - } - - gazeReset(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "helper.gaze.reset") - } - - gazeSetParams(robotName: string, appName: string, appPort: string, neck_tt: number, eyes_tt: number) { - return this.runService(robotName, appName, appPort, "helper.gaze.setParams", {neck_tt: neck_tt, eyes_tt: eyes_tt}) - } - - gazeSetTrackingMode(robotName: string, appName: string, appPort: string, mode: boolean) { - return this.runService(robotName, appName, appPort, "helper.gaze.setTrackingMode", {mode: mode}) - } - - gazeWaitMotionDone(robotName: string, appName: string, appPort: string, period: number = 0.1, timeout: number = 0) { - return this.runService(robotName, appName, appPort, "helper.gaze.waitMotionDone", {period: period, timeout: timeout}) - } - - gazeWaitMotionOnset(robotName: string, appName: string, appPort: string, speedRef: number = 0, period: number = 0.1, maxAttempts: number = 50) { - return this.runService(robotName, appName, appPort, "helper.gaze.waitMotionOnset", { - speed_ref: speedRef, - period: period, - max_attempts: maxAttempts - }) - } - - speechClose(robotName: string, appName: string, appPort: string) { - return this.runService(robotName, appName, appPort, "helper.speech.close") - } - - speechSay(robotName: string, appName: string, appPort: string, sentence: string, waitActionDone: boolean = true) { - return this.runService(robotName, appName, appPort, "helper.speech.say", { - something: sentence, - waitActionDone: waitActionDone - }) - } - - speechSayAsync(robotName: string, appName: string, appPort: string, sentence: string, waitActionDone: boolean = true) { - return this.runServiceAsync(robotName, appName, appPort, "helper.speech.say", { - something: sentence, - waitActionDone: waitActionDone - }) - } - - camLeftGetURI(robotName: string, appName: string, appPort: string,) { - return this.runService(robotName, appName, appPort, "helper.cam_left.getURI").pipe( - map(stringURL => new URL(stringURL)) - ) - } - - camLeftGetImgRes(robotName: string, appName: string, appPort: string,) { - return this.runService(robotName, appName, appPort, "helper.cam_left.getImgRes").pipe( - map(arrayRes => { - let imgFrameSize = { - width: 0, - height: 0 - } - - if (arrayRes) { - - if (arrayRes.length >= 1) { - imgFrameSize.width = arrayRes[0]; - } - - if (arrayRes.length >= 2) { - imgFrameSize.height = arrayRes[1]; - } - - } - - return imgFrameSize; - - }) - ) - } - - camRightGetImgRes(robotName: string, appName: string, appPort: string,) { - return this.runService(robotName, appName, appPort, "helper.cam_right.getImgRes").pipe( - map(arrayRes => { - let imgFrameSize = { - width: 0, - height: 0 - } - - if (arrayRes) { - - if (arrayRes.length >= 1) { - imgFrameSize.width = arrayRes[0]; - } - - if (arrayRes.length >= 2) { - imgFrameSize.height = arrayRes[1]; - } - - } - - return imgFrameSize; - - }) - ) - } - - camRightGetURI(robotName: string, appName: string, appPort: string,) { - return this.runService(robotName, appName, appPort, "helper.cam_right.getURI").pipe( - map(stringURL => new URL(stringURL)) - ) - } - - getRobotActions(robotName: string, appName: string, appPort: string,) { - return this.runService(robotName, appName, appPort, "helper.actions.getActions") - } - - playActionSync(robotName:string, appName: string, appPort: string,actionID:string){ - return this.runService(robotName,appName,appPort,"helper.actions.playAction",{action_id:actionID}) - } - - playActionAsync(robotName:string, appName: string, appPort: string, actionID:string){ - return this.runServiceAsync(robotName,appName,appPort,"helper.actions.playAction",{action_id:actionID}) - } - -} - -*/ - -///* - @Injectable({ providedIn: 'root' }) @@ -982,6 +502,6 @@ export class ApiService implements IApiService { } } -//*/ + diff --git a/src/app/widget-base/widget-base.component.ts b/src/app/widget-base/widget-base.component.ts index c0e4f72..e92a651 100644 --- a/src/app/widget-base/widget-base.component.ts +++ b/src/app/widget-base/widget-base.component.ts @@ -7,211 +7,6 @@ import {Application} from "../types/Application"; import {AppStateService} from "../services/app-state.service"; import {Plugin} from "../types/Plugin"; -/* -@Component({ - selector: 'app-widget-base', - templateUrl: './widget-base.component.html', - styleUrl: './widget-base.component.css' -}) -export class WidgetBaseComponent{ - - @Input() - application:Application; - - @Input() - plugin:Plugin; - - @Input() - width?:number - - @Input() - height?:number - - protected apiService = inject(ApiService); - protected appStateService = inject(AppStateService); - - getApplicationFSM(){ - return this.apiService.getApplicationFSM(this.application.robotName,this.application.name,this.application.url.port) - } - - getApplicationServices(){ - return this.apiService.getServices(this.application.robotName,this.application.name) - } - - checkAsyncRequestStatus(requestID:string,initCallback:() => void = () => {},runningCallback: () => void = () => {},doneCallback: (retval:any) => void = () => {},failedCallback: () => void = () => {}){ - return this.apiService.checkAsyncRequestStatus(requestID,initCallback,runningCallback,doneCallback,failedCallback) - } - - runService(serviceName:string,body:any){ - return this.apiService.runService(this.application.robotName,this.application.name,this.application.url.port,serviceName,body) - } - - runServiceAsync(serviceName:string,body:any = {}){ - return this.apiService.runServiceAsync(this.application.robotName,this.application.name,this.application.url.port,serviceName,body) - } - - fsmGetCurrentState(){ - return this.apiService.fsmGetCurrentState(this.application.robotName,this.application.name,this.application.url.port) - } - - fsmRunStep(trigger:string){ - return this.apiService.runServiceAsync(this.application.robotName,this.application.name,this.application.url.port,"fsm.runStep",{trigger:trigger}) - } - - getRobotActions(){ - return this.apiService.getRobotActions(this.application.robotName,this.application.name,this.application.url.port) - } - - playActionSync(actionID:string){ - return this.apiService.playActionSync(this.application.robotName,this.application.name,this.application.url.port,actionID) - } - - playActionAsync(actionID:string){ - return this.apiService.playActionAsync(this.application.robotName,this.application.name,this.application.url.port,actionID) - } - - emoAngry(){ - return this.apiService.emoAngry(this.application.robotName,this.application.name,this.application.url.port) - } - - emoClosingEyes(){ - return this.apiService.emoClosingEyes(this.application.robotName,this.application.name,this.application.url.port) - } - - emoCun(){ - return this.apiService.emoCun(this.application.robotName,this.application.name,this.application.url.port) - } - - emoEbSmile(){ - return this.apiService.emoEbSmile(this.application.robotName,this.application.name,this.application.url.port) - } - - emoEbSurprised(){ - return this.apiService.emoEbSurprised(this.application.robotName,this.application.name,this.application.url.port) - } - - emoEvil(){ - return this.apiService.emoEvil(this.application.robotName,this.application.name,this.application.url.port) - } - - emoNeutral(){ - return this.apiService.emoNeutral(this.application.robotName,this.application.name,this.application.url.port) - } - - emoOpeningEyes(){ - return this.apiService.emoOpeningEyes(this.application.robotName,this.application.name,this.application.url.port) - } - - emoSad() { - return this.apiService.emoSad(this.application.robotName,this.application.name,this.application.url.port) - } - - emoSendCmd(part:ICubEmoPart,emotion:ICubEmoEmotion){ - return this.apiService.emoSendCmd(this.application.robotName,this.application.name,this.application.url.port,part,emotion) - } - - emoSetBrightness(brightness: 0 | 1 | 2 | 3 | 4 | 5){ - return this.apiService.emoSetBrightness(this.application.robotName,this.application.name,this.application.url.port,brightness) - } - - emoSetColor(color:ICubEmoColor){ - return this.apiService.emoSetColor(this.application.robotName,this.application.name,this.application.url.port,color) - } - - emoSmile(){ - return this.apiService.emoSmile(this.application.robotName,this.application.name,this.application.url.port) - } - - emoSurprised(){ - return this.apiService.emoSurprised(this.application.robotName,this.application.name,this.application.url.port) - } - - gazeBlockEyes(vergence:number){ - return this.apiService.gazeBlockEyes(this.application.robotName,this.application.name,this.application.url.port,vergence) - } - - gazeBlockNeck(){ - return this.apiService.gazeBlockNeck(this.application.robotName,this.application.name,this.application.url.port) - } - - gazeClearEyes(){ - return this.apiService.gazeClearEyes(this.application.robotName,this.application.name,this.application.url.port) - } - - gazeClearNeck(){ - return this.apiService.gazeClearNeck(this.application.robotName,this.application.name,this.application.url.port) - } - - gazeInit(){ - return this.apiService.gazeInit(this.application.robotName,this.application.name,this.application.url.port) - } - - gazeLookAtAbsAngles(azimuth:number, elevation:number, vergence:number, waitMotionDone:boolean = true, timeout:number = 0.0){ - return this.apiService.gazeLookAtAbsAngles(this.application.robotName,this.application.name,this.application.url.port,azimuth,elevation,vergence,waitMotionDone,timeout) - } - - gazeLookAtFixationPoint(x:number, y:number, z:number, waitMotionDone:boolean = true, timeout:number = 0.0){ - return this.apiService.gazeLookAtFixationPoint(this.application.robotName,this.application.name,this.application.url.port,x,y,z,waitMotionDone,timeout) - } - - gazeLookAtRelAngles(azimuth:number, elevation:number, vergence:number, waitMotionDone:boolean = true, timeout:number = 0.0){ - return this.apiService.gazeLookAtRelAngles(this.application.robotName,this.application.name,this.application.url.port,azimuth,elevation,vergence,waitMotionDone,timeout) - } - - gazeReset(){ - return this.apiService.gazeReset(this.application.robotName,this.application.name,this.application.url.port) - } - - gazeSetParams(neck_tt:number, eyes_tt:number){ - return this.apiService.gazeSetParams(this.application.robotName,this.application.name,this.application.url.port,neck_tt,eyes_tt) - } - - gazeSetTrackingMode(mode:boolean){ - return this.apiService.gazeSetTrackingMode(this.application.robotName,this.application.name,this.application.url.port,mode) - } - - gazeWaitMotionDone(period:number = 0.1 ,timeout:number = 0){ - return this.apiService.gazeWaitMotionDone(this.application.robotName,this.application.name,this.application.url.port,period,timeout) - } - - gazeWaitMotionOnset(speedRef:number = 0 ,period:number = 0.1,maxAttempts:number=50){ - return this.apiService.gazeWaitMotionOnset(this.application.robotName,this.application.name,this.application.url.port,speedRef,period,maxAttempts) - } - - speechClose(){ - return this.apiService.speechClose(this.application.robotName,this.application.name,this.application.url.port) - } - - speechSay(sentence:string,waitActionDone:boolean = true){ - return this.apiService.speechSay(this.application.robotName,this.application.name,this.application.url.port,sentence,waitActionDone) - } - - speechSayAsync(sentence:string,waitActionDone:boolean = true){ - return this.apiService.speechSayAsync(this.application.robotName,this.application.name,this.application.url.port,sentence,waitActionDone) - } - - - camLeftGetURI(){ - return this.apiService.camLeftGetURI(this.application.robotName,this.application.name,this.application.url.port) - } - - camRightGetURI(){ - return this.apiService.camRightGetURI(this.application.robotName,this.application.name,this.application.url.port) - } - - camLeftGetImgRes(){ - return this.apiService.camLeftGetImgRes(this.application.robotName,this.application.name,this.application.url.port) - } - - camRightGetImgRes(){ - return this.apiService.camRightGetImgRes(this.application.robotName,this.application.name,this.application.url.port) - } - -} - -*/ - -///* @Component({ selector: 'app-widget-base', templateUrl: './widget-base.component.html', @@ -416,4 +211,3 @@ export class WidgetBaseComponent { } } -//*/ From ac5ce686065fb5e037122b123dc9432f19006d21 Mon Sep 17 00:00:00 2001 From: carlo Date: Mon, 4 Mar 2024 16:23:10 +0100 Subject: [PATCH 4/5] fixato errore nella gestione della sessione dell'app --- src/app/application-page/application-page.component.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/application-page/application-page.component.ts b/src/app/application-page/application-page.component.ts index 28d3ffc..ef6a80b 100644 --- a/src/app/application-page/application-page.component.ts +++ b/src/app/application-page/application-page.component.ts @@ -63,7 +63,9 @@ export class ApplicationPageComponent implements OnInit{ //ed esistono argomenti da selezionare, mostro il popup degli argomenti if(argsTemplateExists){ this.application.args = {}; + this.application.isConfigured = false; this.sessionStorage.saveApplicationArgs(this.application.robotName,this.application.name,{}) + this.sessionStorage.saveIsApplicationConfigured(this.application.robotName,this.application.name,false) this.openArgsDialog() //e non esistono argomenti da selezionare, invio la configure vuota From 985318e99f4e851dd325a3c8c51fc4c9ce465509 Mon Sep 17 00:00:00 2001 From: carlo Date: Mon, 4 Mar 2024 16:28:59 +0100 Subject: [PATCH 5/5] Modificato plugin services --- .../plugins/actions-manager/actions-manager.component.html | 2 +- .../plugins/services-manager/services-manager.component.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/plugins/actions-manager/actions-manager.component.html b/src/app/plugins/actions-manager/actions-manager.component.html index fe54700..7c0e054 100644 --- a/src/app/plugins/actions-manager/actions-manager.component.html +++ b/src/app/plugins/actions-manager/actions-manager.component.html @@ -25,7 +25,7 @@
- Non ci sono action associate a questa applicazione. + There are no action for this application.
diff --git a/src/app/plugins/services-manager/services-manager.component.html b/src/app/plugins/services-manager/services-manager.component.html index 68c2ba0..53b8a4f 100644 --- a/src/app/plugins/services-manager/services-manager.component.html +++ b/src/app/plugins/services-manager/services-manager.component.html @@ -1,7 +1,7 @@
- + search
@@ -81,7 +81,7 @@
- Non ci sono action associate a questa applicazione. + There are no services for this application.