fixed errors
This commit is contained in:
parent
401080d78e
commit
193e884e40
6 changed files with 35 additions and 20 deletions
|
@ -13,10 +13,10 @@ export enum ToolTypes {
|
||||||
|
|
||||||
interface RobotJoint {
|
interface RobotJoint {
|
||||||
limit: {
|
limit: {
|
||||||
lower: Number;
|
lower: number;
|
||||||
upper: Number;
|
upper: number;
|
||||||
};
|
};
|
||||||
angle: Number;
|
angle: number;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -199,10 +199,10 @@ export class CoreThreeRepository extends TypedEvent<any> {
|
||||||
Object.entries(robot.joints).forEach(([name, uRDFJoint]) => {
|
Object.entries(robot.joints).forEach(([name, uRDFJoint]) => {
|
||||||
if (uRDFJoint.jointType !== "fixed") {
|
if (uRDFJoint.jointType !== "fixed") {
|
||||||
robotModel.jointPosition.push({
|
robotModel.jointPosition.push({
|
||||||
angle: uRDFJoint.angle,
|
angle: Number(uRDFJoint.angle),
|
||||||
limit: {
|
limit: {
|
||||||
lower: uRDFJoint.limit.lower,
|
lower: Number(uRDFJoint.limit.lower),
|
||||||
upper: uRDFJoint.limit.upper,
|
upper: Number(uRDFJoint.limit.upper),
|
||||||
},
|
},
|
||||||
name: name,
|
name: name,
|
||||||
});
|
});
|
||||||
|
|
|
@ -43,20 +43,32 @@ export class BehaviorTreeBuilderModel {
|
||||||
this.toXML(sortedSequence as Map<string, number>, editor, area, firstNodeId, skills);
|
this.toXML(sortedSequence as Map<string, number>, editor, area, firstNodeId, skills);
|
||||||
this.result += `</${this.getNodeLabelAtId(editor, firstNodeId, skills)}>`;
|
this.result += `</${this.getNodeLabelAtId(editor, firstNodeId, skills)}>`;
|
||||||
});
|
});
|
||||||
return Result.ok(xmlFormat(this.btRootTag.replace("${bt}", this.result)));
|
|
||||||
|
return this.xmlFormat(this.btRootTag, this.result);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
return Result.error("BtBuilderModel fromReteScene error");
|
return Result.error("BtBuilderModel fromReteScene error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static xmlFormat = (result: string, btRootTag: string): Result<string, string> => {
|
||||||
public static getNodeLabelAtId(editor: NodeEditor<Schemes>, id: string, skills?: Skills) {
|
|
||||||
try {
|
try {
|
||||||
if (skills?.getSkillsNames().find((el) => el.name.isEqual(editor.getNode(id).label))) {
|
return Result.ok(xmlFormat(btRootTag.replace("${bt}", result)));
|
||||||
return `Action ID="RbsAction" do="${skills.getSkillDo(editor.getNode(id).label)}" command="${
|
} catch (error) {
|
||||||
editor.getNode(id).label
|
console.log(result);
|
||||||
|
console.log(btRootTag);
|
||||||
|
console.log(error);
|
||||||
|
console.log(btRootTag.replace("${bt}", result))
|
||||||
|
return Result.error(error as string);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
public static getNodeLabelAtId(editor: NodeEditor<Schemes>, id: string, skills?: Skills,) {
|
||||||
|
try {
|
||||||
|
if (skills?.getSkillsNames().find((el) => el.name.isEqual(editor.getNode(id)!.label))) {
|
||||||
|
return `Action ID="RbsAction" do="${skills.getSkillDo(editor.getNode(id)!.label)}" command="${
|
||||||
|
editor.getNode(id)?.label
|
||||||
}" sid=${id}"`;
|
}" sid=${id}"`;
|
||||||
}
|
}
|
||||||
return editor.getNode(id).label;
|
return editor.getNode(id)?.label;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,8 @@ export class NodeBehaviorTree {
|
||||||
|
|
||||||
static fromReteScene(editor: NodeEditor<Schemes>, area: AreaPlugin<Schemes, AreaExtra>): NodeBehaviorTree[] {
|
static fromReteScene(editor: NodeEditor<Schemes>, area: AreaPlugin<Schemes, AreaExtra>): NodeBehaviorTree[] {
|
||||||
const nodes = new Map<string, NodeBehaviorTree>();
|
const nodes = new Map<string, NodeBehaviorTree>();
|
||||||
editor
|
editor.getNodes().forEach((el) => {
|
||||||
.getNodes()
|
if (area.nodeViews.get(el.id)?.position)
|
||||||
.forEach((el) =>
|
|
||||||
nodes.set(
|
nodes.set(
|
||||||
el.id,
|
el.id,
|
||||||
new NodeBehaviorTree(
|
new NodeBehaviorTree(
|
||||||
|
@ -38,8 +37,8 @@ export class NodeBehaviorTree {
|
||||||
Object.keys(el.inputs),
|
Object.keys(el.inputs),
|
||||||
area.nodeViews.get(el.id)!.position
|
area.nodeViews.get(el.id)!.position
|
||||||
)
|
)
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
});
|
||||||
editor.getConnections().forEach((el) => nodes.overrideValue(el.target, { connectTo: el.source }));
|
editor.getConnections().forEach((el) => nodes.overrideValue(el.target, { connectTo: el.source }));
|
||||||
|
|
||||||
return nodes.toArray();
|
return nodes.toArray();
|
||||||
|
|
|
@ -211,6 +211,7 @@ export class BehaviorTreeBuilderStore extends UiDrawerFormState<BehaviorTreeView
|
||||||
)
|
)
|
||||||
).fold(
|
).fold(
|
||||||
(xml) => {
|
(xml) => {
|
||||||
|
console.log(xml)
|
||||||
this.behaviorTreeModel.skills = this.filledOutTemplates;
|
this.behaviorTreeModel.skills = this.filledOutTemplates;
|
||||||
this.behaviorTreeModel.scene = NodeBehaviorTree.fromReteScene(
|
this.behaviorTreeModel.scene = NodeBehaviorTree.fromReteScene(
|
||||||
this.editor as NodeEditor<Schemes>,
|
this.editor as NodeEditor<Schemes>,
|
||||||
|
@ -222,7 +223,10 @@ export class BehaviorTreeBuilderStore extends UiDrawerFormState<BehaviorTreeView
|
||||||
successMessage: "Дерево поведения сохранено",
|
successMessage: "Дерево поведения сохранено",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
(_) => message.error(`Дерево поведения ошибка: ${_}`)
|
(error) => {
|
||||||
|
message.error(`Дерево поведения ошибка: ${error}`);
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
async () => message.error(`Дерево поведения не заполнено`)
|
async () => message.error(`Дерево поведения не заполнено`)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es6",
|
"target": "es2018",
|
||||||
"lib": ["dom", "dom.iterable", "esnext"],
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue