This commit is contained in:
IDONTSUDO 2024-04-23 15:56:52 +03:00
parent 7e25cc216a
commit c628cdb9af
20 changed files with 654 additions and 124 deletions

View file

@ -1,3 +1,4 @@
import { BehaviorTreesPresentation } from "../../features/behavior_trees/behavior_trees";
import { DatasetsPresentation } from "../../features/datasets/datasets_presentation";
import { ProjectsPresentation } from "../../features/projects/projects_presentation";
// import { ProjectsPresentation } from "../../features/_projects/projects_presentation";
@ -6,4 +7,4 @@ import { Routes } from "../interfaces/router";
extensions();
export const httpRoutes: Routes[] = [new ProjectsPresentation(), new DatasetsPresentation()].map((el) => el.call());
export const httpRoutes: Routes[] = [new ProjectsPresentation(), new DatasetsPresentation(), new BehaviorTreesPresentation()].map((el) => el.call());

View file

@ -0,0 +1,147 @@
import { IsArray, IsString, ValidateNested } from "class-validator";
import { Type } from "class-transformer";
export interface SkillPoseEstimation {
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 SkillPoseEstimation {
@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;
}

View file

@ -0,0 +1,12 @@
import { CoreHttpController } from "../../core/controllers/http_controller";
import { DatasetValidationModel } from "../datasets/models/dataset_validation_model";
import { GetBehaviorTreeSkillsUseCase } from "./get_bt_usecase";
export class BehaviorTreesPresentation extends CoreHttpController<DatasetValidationModel> {
constructor() {
super({
url: "behavior/trees",
validationModel: DatasetValidationModel,
});
super.get(new GetBehaviorTreeSkillsUseCase().call);
}
}

View file

@ -0,0 +1,154 @@
import { Result } from "../../core/helpers/result";
export class GetBehaviorTreeSkillsUseCase {
call = () => {
return Result.ok({
skills: [
{
SkillPackage: {
name: "Robossembler",
version: "1.0",
format: "1",
},
Module: {
name: "PoseEstimation",
description: "Pose Estimation skill with DOPE",
},
Launch: {
executable: "pe_dope_lc.py",
},
ROS2: {
node_name: "lc_dope",
},
BTAction: [
{
name: "peConfigure",
format: "yaml",
type: "run",
param: ["object_name", "weights_file"],
result: ["Pose"],
},
{
name: "peStop",
format: "yaml",
type: "stop",
param: [],
result: [],
},
],
Interface: {
Input: [
{
name: "cameraLink",
type: "CAMERA",
},
{
name: "object_name",
type: "MODEL",
},
],
Output: [
{
name: "pose_estimation_topic",
type: "POSE",
},
],
},
Settings: [
{
name: "cameraLink",
value: "inner_rgbd_camera",
},
{
name: "pose",
value: "",
},
{
name: "publishDelay",
value: 0.5,
},
{
name: "tf2_send_pose",
value: 1,
},
{
name: "mesh_scale",
value: 0.001,
},
],
xxx: {
cameraLink: "inner_rgbd_camera",
topicImage: "/inner_rgbd_camera/image",
topicCameraInfo: "/inner_rgbd_camera/camera_info",
},
},
{
SkillPackage: {
name: "Robossembler",
version: "1.0",
format: "1",
},
Module: {
name: "ObjectDetection",
description: "Object detection skill with YOLOv8",
},
Launch: {
executable: "detection_lifecycle.py",
},
ROS2: {
node_name: "lc_detection",
},
BTAction: [
{
name: "odConfigure",
format: "yaml",
args: ["SettingPath", "server_name", "server_timeout"],
result: ["boundBox"],
},
{
name: "odStop",
format: "yaml",
args: ["server_name", "server_timeout"],
result: [],
},
],
Interface: {
Input: [
{
name: "cameraLink",
type: "string",
group: "STD_USER",
},
{
name: "topicImage",
type: "Image",
group: "sensor_msgs.msg",
},
],
Output: [
{
name: "boundBox",
type: "BoundBox",
group: ".msg",
},
],
},
Settings: [
{
name: "publishDelay",
value: 0.5,
},
{
name: "server_timeout",
value: 1000,
},
{
name: "server_name",
value: "/object_detection/change_state",
},
],
},
],
});
};
}