everything but light
This commit is contained in:
parent
139f012803
commit
1cc489fc72
17 changed files with 206 additions and 132 deletions
|
@ -4,6 +4,7 @@ export enum StaticFilesProject {
|
|||
parts = "/assets/parts.json",
|
||||
scenes = "/scenes/",
|
||||
behaviorTrees = "behavior_trees",
|
||||
robots = 'robots'
|
||||
}
|
||||
|
||||
export enum StaticFilesServer {
|
||||
|
|
|
@ -1,25 +1,45 @@
|
|||
import { CallbackStrategyWithValidationModel, ResponseBase } from "../../../core/controllers/http_controller";
|
||||
import { Result } from "../../../core/helpers/result";
|
||||
import { RobotModel } from "../model/robot_model";
|
||||
import { StaticFilesProject } from "../../../core/models/static_files";
|
||||
import { GetServerAddressUseCase } from "../../../core/usecases/get_server_address_usecase";
|
||||
import { SearchManyDataBaseModelUseCase } from "../../../core/usecases/search_many_database_model_usecase";
|
||||
import { IProjectModel, ProjectDBModel } from "../../projects/models/project_model_database_model";
|
||||
import { ExecProcessUseCase } from "../../../core/usecases/exec_process_usecase";
|
||||
import { StaticFilesProject } from "../../../core/models/static_files";
|
||||
|
||||
export class CreateRobotScenario extends CallbackStrategyWithValidationModel<RobotModel> {
|
||||
validationModel: RobotModel = new RobotModel();
|
||||
call = async (model: RobotModel): ResponseBase => (
|
||||
await new SearchManyDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call(
|
||||
{ isActive: true },
|
||||
"is dont active projects"
|
||||
)
|
||||
).map(async (projectModel) => {
|
||||
const { rootDir } = projectModel[0];
|
||||
rootDir + '/robots/'
|
||||
|
||||
return Result.ok([])
|
||||
});
|
||||
|
||||
|
||||
call = async (model: RobotModel): ResponseBase =>
|
||||
(
|
||||
await new SearchManyDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call(
|
||||
{ isActive: true },
|
||||
"is dont active projects"
|
||||
)
|
||||
).map((projectModel) => {
|
||||
const { rootDir } = projectModel[0];
|
||||
console.log(
|
||||
`python3 $PYTHON_ROBOT_BUILDER --path ${
|
||||
projectModel[0].rootDir + "/" + StaticFilesProject.robots + "/"
|
||||
} --name ${model.name} --nDOF ${model.nDof} --toolType ${model.toolType}`
|
||||
);
|
||||
return new GetServerAddressUseCase().call().map(async (serverAddress) =>
|
||||
(
|
||||
await new ExecProcessUseCase().call(
|
||||
rootDir,
|
||||
`python3 $PYTHON_ROBOT_BUILDER --path ${
|
||||
projectModel[0].rootDir + "/" + StaticFilesProject.robots + "/"
|
||||
} --name ${model.name} --nDOF ${model.nDof} --toolType ${model.toolType}`,
|
||||
""
|
||||
)
|
||||
).map((log) =>
|
||||
Result.ok({
|
||||
robotUrl: `${serverAddress}/${
|
||||
rootDir.match(new RegExp(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gm))[0]
|
||||
}/${StaticFilesProject.robots}/${model.name}/robot.xml`,
|
||||
})
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// PYTHON_ROBOT_BUILDER
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue