progress
This commit is contained in:
parent
4585d079f6
commit
5162612a77
49 changed files with 1108 additions and 732 deletions
|
@ -13,12 +13,20 @@ export interface ISkillPoseEstimation {
|
|||
Settings: ISetting[];
|
||||
xxx: IXxx;
|
||||
}
|
||||
export interface IWeightsDependency {
|
||||
objectName: string;
|
||||
weightsPath: string;
|
||||
}
|
||||
|
||||
export interface IParam {
|
||||
type: string;
|
||||
dependency: IWeightsDependency;
|
||||
}
|
||||
export interface IBTAction {
|
||||
name: string;
|
||||
format: string;
|
||||
type: string;
|
||||
param: string[];
|
||||
param: IParam[];
|
||||
result: string[];
|
||||
}
|
||||
|
||||
|
@ -84,7 +92,7 @@ export class BTAction implements IBTAction {
|
|||
@IsString()
|
||||
type: string;
|
||||
@IsArray()
|
||||
param: string[];
|
||||
param: IParam[];
|
||||
@IsArray()
|
||||
result: string[];
|
||||
}
|
||||
|
@ -152,32 +160,74 @@ export class Skills {
|
|||
@IsArray()
|
||||
@Type(() => SkillModelPoseEstimation)
|
||||
skills: SkillModelPoseEstimation[];
|
||||
toSkillView(): ISkillView[] {
|
||||
return this.skills.map((el) => {
|
||||
toSkillView = (): ISkillView[] =>
|
||||
this.skills.map((el) => {
|
||||
return {
|
||||
name: el.Module.name,
|
||||
children: el.BTAction.map((act) => {
|
||||
// return { name: `${el.Module.name} - ${act.name}` };
|
||||
return { name: act.name, uuid: v4() };
|
||||
}),
|
||||
};
|
||||
});
|
||||
}
|
||||
getSkillDo(name: string) {
|
||||
return this.skills.reduce((acc, el) => {
|
||||
|
||||
getSkilsOut = (name: string) =>
|
||||
this.skills
|
||||
.reduce<string[][]>((acc, el) => {
|
||||
if (el.BTAction.find((el) => el.name.isEqual(name))) {
|
||||
acc = el.BTAction.filter((f) => f.name.isEqual(name)).map((z) => z.result);
|
||||
}
|
||||
return acc;
|
||||
}, [])
|
||||
.flat(1);
|
||||
getSkillParams = (name: string) =>
|
||||
this.skills
|
||||
.reduce<IParam[][]>((acc, el) => {
|
||||
if (el.BTAction.find((el) => el.name.isEqual(name))) {
|
||||
acc = el.BTAction.filter((f) => f.name.isEqual(name)).map((z) => z.param);
|
||||
}
|
||||
return acc;
|
||||
}, [])
|
||||
.flat(1);
|
||||
getSkillDo = (name: string) =>
|
||||
this.skills.reduce((acc, el) => {
|
||||
if (el.BTAction.find((el) => el.name.isEqual(name))) {
|
||||
acc = el.Module.name;
|
||||
}
|
||||
return acc;
|
||||
}, "error");
|
||||
}
|
||||
getSkillsNames() {
|
||||
return this.skills
|
||||
|
||||
getSkillsNames = () =>
|
||||
this.skills
|
||||
.map((el) => {
|
||||
return el.BTAction.map((act) => {
|
||||
return { name: act.name };
|
||||
});
|
||||
})
|
||||
.flat(1);
|
||||
}
|
||||
|
||||
getForms = (skillLabel: string) =>
|
||||
this.skills
|
||||
.reduce<SkillModelPoseEstimation[]>((acc, el) => {
|
||||
if (el.BTAction.find((el) => el.name.isEqual(skillLabel))) {
|
||||
acc.push(el);
|
||||
}
|
||||
return acc;
|
||||
}, [])
|
||||
.map((el) => el.BTAction.map((act) => act.param.map((el) => el.type).flat(1)))
|
||||
.flat(1)
|
||||
.flat(1)
|
||||
.filter((el) => el !== "");
|
||||
getDependencyBySkillLabelAndType = <T>(skillLabel: string, skillType: string) =>
|
||||
this.skills
|
||||
.reduce<SkillModelPoseEstimation[]>((acc, el) => {
|
||||
if (el.BTAction.find((el) => el.name.isEqual(skillLabel))) {
|
||||
acc.push(el);
|
||||
}
|
||||
return acc;
|
||||
}, [])
|
||||
.map((el) => el.BTAction.map((act) => act.param.filter((el) => el.type.isEqual(skillType))))
|
||||
.flat(1)
|
||||
.flat(1)
|
||||
.map((el) => el.dependency)
|
||||
.at(0) as T;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue