progress
This commit is contained in:
parent
7e25cc216a
commit
c628cdb9af
20 changed files with 654 additions and 124 deletions
183
ui/src/core/model/skill_model.ts
Normal file
183
ui/src/core/model/skill_model.ts
Normal file
|
@ -0,0 +1,183 @@
|
|||
import { IsArray, IsString, ValidateNested } from "class-validator";
|
||||
import { Type } from "class-transformer";
|
||||
import { ISkillView } from "../../features/behavior_tree_builder/presentation/ui/skill_tree/skill_tree";
|
||||
import { v4 } from "uuid";
|
||||
|
||||
export interface ISkillPoseEstimation {
|
||||
SkillPackage: ISkillPackage;
|
||||
Module: IModule;
|
||||
Launch: ILaunch;
|
||||
ROS2: IRos2;
|
||||
BTAction: IBTAction[];
|
||||
Interface: IInterface;
|
||||
Settings: ISetting[];
|
||||
xxx: IXxx;
|
||||
}
|
||||
|
||||
export interface IBTAction {
|
||||
name: string;
|
||||
format: string;
|
||||
type: string;
|
||||
param: string[];
|
||||
result: string[];
|
||||
}
|
||||
|
||||
export interface IInterface {
|
||||
Input: IPut[];
|
||||
Output: IPut[];
|
||||
}
|
||||
|
||||
export interface IPut {
|
||||
name: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface ILaunch {
|
||||
executable: string;
|
||||
}
|
||||
|
||||
export interface IModule {
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export interface IRos2 {
|
||||
node_name: string;
|
||||
}
|
||||
|
||||
export interface ISetting {
|
||||
name: string;
|
||||
value: number | string;
|
||||
}
|
||||
|
||||
export interface ISkillPackage {
|
||||
name: string;
|
||||
version: string;
|
||||
format: string;
|
||||
}
|
||||
|
||||
export interface IXxx {
|
||||
cameraLink: string;
|
||||
topicImage: string;
|
||||
topicCameraInfo: string;
|
||||
}
|
||||
|
||||
export class SkillPackage implements ISkillPackage {
|
||||
@IsString()
|
||||
name: string;
|
||||
@IsString()
|
||||
version: string;
|
||||
@IsString()
|
||||
format: string;
|
||||
}
|
||||
export class Module implements IModule {
|
||||
@IsString()
|
||||
name: string;
|
||||
@IsString()
|
||||
description: string;
|
||||
}
|
||||
export class BTAction implements IBTAction {
|
||||
@IsString()
|
||||
name: string;
|
||||
@IsString()
|
||||
format: string;
|
||||
@IsString()
|
||||
type: string;
|
||||
@IsArray()
|
||||
param: string[];
|
||||
@IsArray()
|
||||
result: string[];
|
||||
}
|
||||
export class Launch implements ILaunch {
|
||||
@IsString()
|
||||
executable: string;
|
||||
}
|
||||
export class Ros2 implements IRos2 {
|
||||
@IsString()
|
||||
node_name: string;
|
||||
}
|
||||
export class Put implements IPut {
|
||||
@IsString()
|
||||
name: string;
|
||||
@IsString()
|
||||
type: string;
|
||||
}
|
||||
export class Interface implements IInterface {
|
||||
@ValidateNested()
|
||||
@Type(() => Put)
|
||||
Input: IPut[];
|
||||
@ValidateNested()
|
||||
@Type(() => Put)
|
||||
Output: IPut[];
|
||||
}
|
||||
export class Setting implements ISetting {
|
||||
name: string;
|
||||
value: string | number;
|
||||
}
|
||||
export class Xxx implements IXxx {
|
||||
cameraLink: string;
|
||||
topicImage: string;
|
||||
topicCameraInfo: string;
|
||||
}
|
||||
export class SkillModelPoseEstimation implements ISkillPoseEstimation {
|
||||
@ValidateNested()
|
||||
@Type(() => SkillPackage)
|
||||
SkillPackage: ISkillPackage;
|
||||
@ValidateNested()
|
||||
@Type(() => Module)
|
||||
Module: IModule;
|
||||
@ValidateNested()
|
||||
@Type(() => Launch)
|
||||
Launch: ILaunch;
|
||||
@ValidateNested()
|
||||
@Type(() => Ros2)
|
||||
ROS2: IRos2;
|
||||
@ValidateNested()
|
||||
@IsArray()
|
||||
@Type(() => BTAction)
|
||||
BTAction: IBTAction[];
|
||||
@ValidateNested()
|
||||
@Type(() => Interface)
|
||||
Interface: IInterface;
|
||||
@ValidateNested()
|
||||
@IsArray()
|
||||
@Type(() => Setting)
|
||||
Settings: ISetting[];
|
||||
@ValidateNested()
|
||||
@Type(() => Xxx)
|
||||
xxx: IXxx;
|
||||
}
|
||||
|
||||
export class Skills {
|
||||
@IsArray()
|
||||
@Type(() => SkillModelPoseEstimation)
|
||||
skills: SkillModelPoseEstimation[];
|
||||
toSkillView(): ISkillView[] {
|
||||
return 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) => {
|
||||
if (el.BTAction.find((el) => el.name.isEqual(name))) {
|
||||
acc = el.Module.name;
|
||||
}
|
||||
return acc;
|
||||
}, "error");
|
||||
}
|
||||
getSkillsNames() {
|
||||
return this.skills
|
||||
.map((el) => {
|
||||
return el.BTAction.map((act) => {
|
||||
return { name: act.name };
|
||||
});
|
||||
})
|
||||
.flat(1);
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@ import DetailsScreen, { DetailsScreenPath } from "../../features/details/details
|
|||
import { AssemblesScreen, AssemblesScreenPath } from "../../features/assembles/assembles_screen";
|
||||
import SimulationScreen, { SimulationScreenPath } from "../../features/simulations/simulations_screen";
|
||||
import { EstimateScreen, EstimateScreenPath } from "../../features/estimate/estimate_screen";
|
||||
import { SkillPath, SkillScreen } from "../../features/skils/skills_screen";
|
||||
|
||||
const idURL = ":id";
|
||||
|
||||
|
@ -67,9 +68,12 @@ export const router = createBrowserRouter([
|
|||
path: SimulationScreenPath,
|
||||
element: <SimulationScreen />,
|
||||
},
|
||||
|
||||
{
|
||||
path: EstimateScreenPath,
|
||||
element: <EstimateScreen />,
|
||||
},
|
||||
{
|
||||
path: SkillPath,
|
||||
element: <SkillScreen />,
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -31,3 +31,6 @@ export function CoreButton(props: IButtonProps) {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -10,6 +10,7 @@ import { DetailsScreenPath } from "../../../features/details/details_screen";
|
|||
import { SimulationScreenPath } from "../../../features/simulations/simulations_screen";
|
||||
import { EstimateScreenPath } from "../../../features/estimate/estimate_screen";
|
||||
import { BehaviorTreeBuilderPath } from "../../../features/behavior_tree_builder/presentation/behavior_tree_builder_screen";
|
||||
import { SkillPath as SkillScreenPath } from "../../../features/skils/skills_screen";
|
||||
export interface IBlockProps {
|
||||
name: string;
|
||||
isActive: boolean;
|
||||
|
@ -45,6 +46,7 @@ const Block = (props: IBlockProps) => {
|
|||
export interface IMainPageProps {
|
||||
page: string;
|
||||
bodyChildren?: JSX.Element;
|
||||
panelChildren?: JSX.Element;
|
||||
isLoading?: boolean;
|
||||
}
|
||||
export const MainPage = (props: IMainPageProps) => {
|
||||
|
@ -53,7 +55,8 @@ export const MainPage = (props: IMainPageProps) => {
|
|||
{ name: "Сборки", path: AssemblesScreenPath, icon: "Assembly" },
|
||||
{ name: "Датасеты", path: DatasetsScreenPath, icon: "Datasets" },
|
||||
{ name: "Сцена", path: SceneManagerPath, icon: "Layers" },
|
||||
{ name: "Навыки", path: BehaviorTreeBuilderPath, icon: "Rocket" },
|
||||
{ name: "Навыки", path: SkillScreenPath, icon: "Layers" },
|
||||
{ name: "Поведение", path: BehaviorTreeBuilderPath, icon: "Rocket" },
|
||||
{ name: "Симуляция", path: SimulationScreenPath, icon: "Simulation" },
|
||||
{ name: "Оценка", path: EstimateScreenPath, icon: "Grade" },
|
||||
];
|
||||
|
@ -118,7 +121,9 @@ export const MainPage = (props: IMainPageProps) => {
|
|||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div style={{ width: 241, height: window.innerHeight, backgroundColor: "#F7F2FA", borderRadius: 16 }}> </div>
|
||||
<div style={{ width: 241, height: window.innerHeight, backgroundColor: "#F7F2FA", borderRadius: 16 }}>
|
||||
{props.panelChildren}{" "}
|
||||
</div>
|
||||
{props.bodyChildren}
|
||||
</>
|
||||
)}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue