Skip to content
Snippets Groups Projects
Commit 513afff2 authored by Johannes Mey's avatar Johannes Mey
Browse files

work on tracing

parent 771a3a8f
No related branches found
No related tags found
No related merge requests found
Pipeline #13951 passed
Showing
with 158 additions and 23 deletions
relast_version = 0.3.0-137 relast_version = 0.3.0-137
relast2uml_version = 1.0.0 relast2uml_version = 1.0.2-68
jupyter_version = 5.8.2 jupyter_version = 5.8.2
assertj_version = 3.22.0 assertj_version = 3.22.0
grammar2uml_version = 0.2.1 grammar2uml_version = 0.2.1
......
No preview for this file type
<mxfile host="Electron" modified="2022-05-30T15:22:45.891Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/18.1.3 Chrome/100.0.4896.143 Electron/18.2.3 Safari/537.36" etag="In4-8qNJInGg5Ttx52PO" version="18.1.3" type="device"><diagram id="xllGRi-CdCWfJc1u12WW" name="Page-1">7Vpdb6M4FP01fSzyF8Z+bDvT3dmdSiN1pdE+VQ44gBZwFpxJZn79XggQwHTazoZ2qk6ktsm1+eg591yfa3JGr/L9b6XaJDcm0tkZQdH+jL47I0QKDL/rwNdDwBf8EIjLNDqE8DFwm37TbRC10W0a6Wo00RqT2XQzDoamKHRoRzFVlmY3nrY22fiqGxVrJ3AbqqyNkmP0cxrZpJ2LEToO/K7TOGkvLfx2IFfd5DZQJSoyu0GIvj+jV6Ux9vAu31/prMauw+Vw3PU9o/3tlrqwjzngm/n75g8/+ZNEHxVOgg/nH9TqnASH03xR2bb9j9u7tV87CEqzLSJdnwWd0ctdklp9u1FhPboDziGW2DyDTxjerk1hWxYxh8/t6XVp9f7eG8c9HJBG2uTall9hSnuAaAFsM4h00O+OfAQdyMmACtZNVG0OxP2pjzDBmxapJ6BGHdAudaK+pGZbfgc9/DB6NU4pJN9FlsYFxKzZjDElNQXrNMuuTGbK5go0UlqsQ4hXtjT/6MEID4VerU/Dgs8mNDCXhj42pIGSpWjADg1XgJTe25cgwdciYnMkCLKi/ERSwJI+TMKcFpYjwb+fh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bHbI37AMixIyExGIrk+vr71VQZLarH34MNY/pIP2bxX+qKSpASoJDFiMWSOaWQAzFJYBiFDDBuGTiRAUPE9mbu34HCs/5PVhKPT6nm8CTeCnSXIcPrluXRZ30U0Ov12t93w5VmKgi1m9oh2oiQCqlJ4cvNsPvs24yPsJ/vJZdDI4n1S7A/YOPAcDdU+MhvlL0D1OeADF8PH6rsBkbfDWTvv8P</diagram></mxfile> <mxfile host="Electron" modified="2022-06-10T07:40:44.173Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/18.1.3 Chrome/100.0.4896.143 Electron/18.2.3 Safari/537.36" etag="r6BY6nRAQaejeYnjVoee" version="18.1.3" type="device"><diagram id="xllGRi-CdCWfJc1u12WW" name="Page-1">7Zptc6M2EMc/jV+G0RNCepnHa9qkdzNpJ9NXGRlkYA6QC3Ls3KevwIAB4YvTM24zOc9kglcC7P39d7UrPMOX6eZTLpbRvQpkMkMg2Mzw1QwhBCgy/0rLy9YCEYZbS5jHQW3bGR7ib7I2gtq6igNZ9CZqpRIdL/tGX2WZ9HXPJvJcrfvTFirp33UpQmkZHnyR1Fa0sz7GgY7quRCA3cAvMg6j+tbMrQdS0UyuDUUkArXumPD1DF/mSuntUbq5lEnpvcYv2/Nu9oy2HzeXmT7khG/qr/tf3eg3FNwJGHm3Z7difoa87WWeRbKqv3H9afVL44JcrbJAllcBM3yxjmItH5bCL0fXhrqxRTpNzDtoDhcq0zVFSM37Qufqq7xUicqNKVOZGbmwP3r9bZ5lruWmY6q/yiepUqnzFzOlHmW1V18apdXv1ztIXuP5qMOHNBNFLYywvfTOd+agdt8bXIktT17ISDzHapV/x6XwdZeWTomNIs+TOMyMTatl39Go5LKIk6Rx8wzhQEi28C0AZoT6TM4Xx6HgkgEGYmNobV0MGE2FAVoYLo2n5Eb/FxBcyQIyBoGhOab0OBAgx69DGIuFo0B4/D1ZffVf7m/v0Aaff76G38jnEQh/ZjrWifE2AnfiReZvzV6jt0F2z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9JPWIAc8kn7XNQiFg2Tpwbav7nidu7bTOWt79eP7/V9vkRx9P4RMWQHyQQXID3xaOt3DUnuf40DHH/85GKKDlwUHwf4Eb7BZhadcqCizG2Z39NnCGMHJdoqRvf/xs2eeKn6b9aHdMCFjhcpJ22Zk75m84wiGZMoQRoNfq+CRPY/TBu8Bex7vCB6fNP96pjEZ/JjE4w5GByGEcDKGdrP3sEvA5xWk91L3n+zJDwGDSORj/d5x8qh5u/ulazXW+cEwvv4H</diagram></mxfile>
\ No newline at end of file \ No newline at end of file
material/overview.drawio-full.png

250 KiB

material/overview.drawio.png

248 KiB

...@@ -42,4 +42,5 @@ aspect CleanupAttributes { ...@@ -42,4 +42,5 @@ aspect CleanupAttributes {
syn Tidy Tidy.containingTidy() = this; syn Tidy Tidy.containingTidy() = this;
inh Tidy ASTNode.containingTidy(); inh Tidy ASTNode.containingTidy();
eq Tidy.getChild().containingTidy() = this; eq Tidy.getChild().containingTidy() = this;
eq World.getChild().containingTidy() = null; // fallback
} }
aspect Tracing {
refine
public void Pose.setX(double x) {
World.printContextOf("Pose.setX()-BEFORE", this, de.tudresden.inf.st.mg.common.MotionGrammarConfig.REMOVE_COLOR);
refined(x);
World.printContextOf("Pose.setX()-AFTER", this, de.tudresden.inf.st.mg.common.MotionGrammarConfig.ADD_COLOR);
World.printContextOf("Pose.setX()-DONE", this, de.tudresden.inf.st.mg.common.MotionGrammarConfig.DEFAULT_COLOR);
}
refine
public void Pose.setY(double y) {
World.printContextOf("Pose.setY()-BEFORE", this, de.tudresden.inf.st.mg.common.MotionGrammarConfig.REMOVE_COLOR);
refined(y);
World.printContextOf("Pose.setY()-AFTER", this, de.tudresden.inf.st.mg.common.MotionGrammarConfig.ADD_COLOR);
World.printContextOf("Pose.setY()-DONE", this, de.tudresden.inf.st.mg.common.MotionGrammarConfig.DEFAULT_COLOR);
}
refine
public void Pose.setZ(double z) {
World.printContextOf("Pose.setZ()-BEFORE", this, de.tudresden.inf.st.mg.common.MotionGrammarConfig.REMOVE_COLOR);
refined(z);
World.printContextOf("Pose.setZ()-AFTER", this, de.tudresden.inf.st.mg.common.MotionGrammarConfig.ADD_COLOR);
World.printContextOf("Pose.setZ()-DONE", this, de.tudresden.inf.st.mg.common.MotionGrammarConfig.DEFAULT_COLOR);
}
// this is probably never called because each child overrides the setter method
refine
public void PhysicalObject.setPose(Pose p) {
World.printContextOf("PhysicalObject.setPose()-BEFORE", getPose(), de.tudresden.inf.st.mg.common.MotionGrammarConfig.REMOVE_COLOR);
refined(p);
World.printContextOf("PhysicalObject.setPose()-AFTER", getPose(), de.tudresden.inf.st.mg.common.MotionGrammarConfig.ADD_COLOR);
World.printContextOf("PhysicalObject.setPose()-DONE", getPose(), de.tudresden.inf.st.mg.common.MotionGrammarConfig.DEFAULT_COLOR);
}
refine
public void MovableObject.setPose(Pose p) {
World.printContextOf("MovableObject.setPose()-BEFORE", getPose(), de.tudresden.inf.st.mg.common.MotionGrammarConfig.REMOVE_COLOR);
refined(p);
World.printContextOf("MovableObject.setPose()-AFTER", getPose(), de.tudresden.inf.st.mg.common.MotionGrammarConfig.ADD_COLOR);
World.printContextOf("MovableObject.setPose()-DONE", getPose(), de.tudresden.inf.st.mg.common.MotionGrammarConfig.DEFAULT_COLOR);
}
refine
public void Robot.setIsIdle(boolean b) {
World.printContextOf("Robot.setIsIdle()-BEFORE", this, de.tudresden.inf.st.mg.common.MotionGrammarConfig.REMOVE_COLOR);
refined(b);
World.printContextOf("Robot.setIsIdle()-AFTER", this, de.tudresden.inf.st.mg.common.MotionGrammarConfig.ADD_COLOR);
World.printContextOf("Robot.setIsIdle()-DONE", this, de.tudresden.inf.st.mg.common.MotionGrammarConfig.DEFAULT_COLOR);
}
refine RelAstAPI
public Robot Robot.setAttachedItem(MovableObject o) {
World.printContextOf("Robot.setAttachedItem()-BEFORE", this, de.tudresden.inf.st.mg.common.MotionGrammarConfig.REMOVE_COLOR);
var result = refined(o);
World.printContextOf("Robot.setAttachedItem()-AFTER", this, de.tudresden.inf.st.mg.common.MotionGrammarConfig.ADD_COLOR);
World.printContextOf("Robot.setAttachedItem()-DONE", this, de.tudresden.inf.st.mg.common.MotionGrammarConfig.DEFAULT_COLOR);
return result;
}
refine RelAstAPI
public MovableObject MovableObject.setAttachedRobot(Robot r) {
World.printContextOf("MovableObject.setAttachedRobot()-BEFORE", this, de.tudresden.inf.st.mg.common.MotionGrammarConfig.REMOVE_COLOR);
var result = refined(r);
World.printContextOf("MovableObject.setAttachedRobot()-AFTER", this, de.tudresden.inf.st.mg.common.MotionGrammarConfig.ADD_COLOR);
World.printContextOf("MovableObject.setAttachedRobot()-DONE", this, de.tudresden.inf.st.mg.common.MotionGrammarConfig.DEFAULT_COLOR);
return result;
}
}
aspect Parser {
public de.tudresden.inf.st.mg.common.MotionGrammarParser ASTNode.parser;
public de.tudresden.inf.st.mg.common.MotionGrammarParser ASTNode.getParser() {
if (parser == null) {
return (getParent() != null) ? getParent().getParser() : null;
} else {
return parser;
}
}
}
aspect Navigation {
inh World ASTNode.containingWorld();
eq World.getChild().containingWorld() = this;
eq MotionGrammarElement.getChild().containingWorld() = null;
}
aspect Tracing {
public static void World.printContextOf(String step, ASTNode<?> highlightNode, String highlightColor) {
final String DEFAULT_COLOR = de.tudresden.inf.st.mg.common.MotionGrammarConfig.DEFAULT_COLOR;
World world;
try {
world = highlightNode.containingWorld();
} catch (NullPointerException e) {
// the element is not in a full AST (yet?), so we don't print it
return;
}
String worldName = world.getClass().getSimpleName();
try {
de.tudresden.inf.st.jastadd.dumpAst.ast.Dumper.read(world)
.setNameMethod(o -> o == null ? "null" : o.getClass().getSimpleName())
.includeRelationsFor(".*", ".*")
.setBackgroundColorMethod(n -> (n == highlightNode ? highlightColor : DEFAULT_COLOR))
.excludeTokens("Q.") // FIXME remove domain-specific code
.dumpAsPNG(de.tudresden.inf.st.mg.common.MotionGrammarConfig.astDiagramDir.resolve("Context-" + worldName + "-" + new java.text.SimpleDateFormat("yyyy.MM.dd.HH.mm.ss.SSS").format(new java.util.Date()) + "-" + step + ".png"));
} catch (java.io.IOException e) {
e.printStackTrace();
}
}
}
...@@ -28,10 +28,12 @@ public final class LoadWorldParser extends MotionGrammarParser<T> { ...@@ -28,10 +28,12 @@ public final class LoadWorldParser extends MotionGrammarParser<T> {
// try to parse a T // try to parse a T
if (peekFull()) { if (peekFull()) {
result = new T2(); result = new T2();
result.parser = this;
parent.setChild(result, index); parent.setChild(result, index);
parseT2(parent, index); parseT2(parent, index);
} else if (peekLoad()) { } else if (peekLoad()) {
result = new T1(); result = new T1();
result.parser = this;
parent.setChild(result, index); parent.setChild(result, index);
parseT1(parent, index); parseT1(parent, index);
} else { } else {
......
...@@ -33,6 +33,7 @@ public final class RobotParser extends MotionGrammarParser<Tidy> { ...@@ -33,6 +33,7 @@ public final class RobotParser extends MotionGrammarParser<Tidy> {
@Override @Override
protected void parse(ASTNode<?> parent, int index) throws ParseException { protected void parse(ASTNode<?> parent, int index) throws ParseException {
Tidy result = new Tidy(); Tidy result = new Tidy();
result.parser = this;
parent.setChild(result, index); parent.setChild(result, index);
while (true) { while (true) {
...@@ -66,6 +67,7 @@ public final class RobotParser extends MotionGrammarParser<Tidy> { ...@@ -66,6 +67,7 @@ public final class RobotParser extends MotionGrammarParser<Tidy> {
private void parseMoveObjectToCorrectPlace(ASTNode<?> parent, int index) throws ParseException { private void parseMoveObjectToCorrectPlace(ASTNode<?> parent, int index) throws ParseException {
MoveObjectToCorrectPlace result = new MoveObjectToCorrectPlace(); MoveObjectToCorrectPlace result = new MoveObjectToCorrectPlace();
result.parser = this;
parent.setChild(result, index); parent.setChild(result, index);
parseObjectAtWrongPlace(result, 0, parent.containingTidy()); parseObjectAtWrongPlace(result, 0, parent.containingTidy());
...@@ -79,6 +81,7 @@ public final class RobotParser extends MotionGrammarParser<Tidy> { ...@@ -79,6 +81,7 @@ public final class RobotParser extends MotionGrammarParser<Tidy> {
private void parseWaitForEmptyTable(ASTNode<?> parent, int index) throws ParseException { private void parseWaitForEmptyTable(ASTNode<?> parent, int index) throws ParseException {
WaitForEmptyTable result = new WaitForEmptyTable(); WaitForEmptyTable result = new WaitForEmptyTable();
result.parser = this;
parent.setChild(result, index); parent.setChild(result, index);
parseNotEmptyTable(result, 0); parseNotEmptyTable(result, 0);
...@@ -91,6 +94,7 @@ public final class RobotParser extends MotionGrammarParser<Tidy> { ...@@ -91,6 +94,7 @@ public final class RobotParser extends MotionGrammarParser<Tidy> {
private void parseDropObjectAtRightPlace(ASTNode<?> parent, int index) throws ParseException { private void parseDropObjectAtRightPlace(ASTNode<?> parent, int index) throws ParseException {
DropObjectAtRightPlace result = new DropObjectAtRightPlace(); DropObjectAtRightPlace result = new DropObjectAtRightPlace();
result.parser = this;
parent.setChild(result, index); parent.setChild(result, index);
parseRobotIsReadyToDrop(result, 0); parseRobotIsReadyToDrop(result, 0);
...@@ -123,6 +127,7 @@ public final class RobotParser extends MotionGrammarParser<Tidy> { ...@@ -123,6 +127,7 @@ public final class RobotParser extends MotionGrammarParser<Tidy> {
private void parsePickUpObject(ASTNode<?> parent, int index) throws ParseException { private void parsePickUpObject(ASTNode<?> parent, int index) throws ParseException {
PickUpObject result = new PickUpObject(); PickUpObject result = new PickUpObject();
result.parser = this;
parent.setChild(result, index); parent.setChild(result, index);
parseRobotIsReadyToPick(result, 0); parseRobotIsReadyToPick(result, 0);
...@@ -138,10 +143,12 @@ public final class RobotParser extends MotionGrammarParser<Tidy> { ...@@ -138,10 +143,12 @@ public final class RobotParser extends MotionGrammarParser<Tidy> {
// try to parse a RobotIsReadyToPickToken // try to parse a RobotIsReadyToPickToken
if (peekRobotIsReadyToPickToken()) { if (peekRobotIsReadyToPickToken()) {
result = new RobotIsReallyReadyToPick(); result = new RobotIsReallyReadyToPick();
result.parser = this;
parent.setChild(result, index); parent.setChild(result, index);
parseRobotIsReallyReadyToPick(parent, index); parseRobotIsReallyReadyToPick(parent, index);
} else if (peekRobotIsNotReadyToPickToken()) { } else if (peekRobotIsNotReadyToPickToken()) {
result = new RobotIsNotReadyToPick(); result = new RobotIsNotReadyToPick();
result.parser = this;
parent.setChild(result, index); parent.setChild(result, index);
parseRobotIsNotReadyToPick(parent, index); parseRobotIsNotReadyToPick(parent, index);
} else { } else {
...@@ -233,10 +240,12 @@ public final class RobotParser extends MotionGrammarParser<Tidy> { ...@@ -233,10 +240,12 @@ public final class RobotParser extends MotionGrammarParser<Tidy> {
// try to parse a RobotIsReadyToDropToken // try to parse a RobotIsReadyToDropToken
if (peekRobotIsReadyToDropToken()) { if (peekRobotIsReadyToDropToken()) {
result = new RobotIsReallyReadyToDrop(); result = new RobotIsReallyReadyToDrop();
result.parser = this;
parent.setChild(result, index); parent.setChild(result, index);
parseRobotIsReallyReadyToDrop(parent, index); parseRobotIsReallyReadyToDrop(parent, index);
} else if (peekRobotIsNotReadyToDropToken()) { } else if (peekRobotIsNotReadyToDropToken()) {
result = new RobotIsNotReadyToDrop(); result = new RobotIsNotReadyToDrop();
result.parser = this;
parent.setChild(result, index); parent.setChild(result, index);
parseRobotIsNotReadyToDrop(parent, index); parseRobotIsNotReadyToDrop(parent, index);
} else { } else {
......
package de.tudresden.inf.st.mg.common;
import java.nio.file.Path;
public class MotionGrammarConfig {
private MotionGrammarConfig() {
// hide the constructor
}
public static Path astDiagramDir;
public static final String DEFAULT_COLOR = "cccccc";
public static final String ADD_COLOR = "47ba4c";
public static final String REMOVE_COLOR = "de4a2c";
}
...@@ -7,6 +7,7 @@ import de.tudresden.inf.st.mg.jastadd.model.*; ...@@ -7,6 +7,7 @@ import de.tudresden.inf.st.mg.jastadd.model.*;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path; import java.nio.file.Path;
import java.text.SimpleDateFormat;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -17,10 +18,9 @@ public abstract class MotionGrammarParser<T extends MotionGrammarElement> { ...@@ -17,10 +18,9 @@ public abstract class MotionGrammarParser<T extends MotionGrammarElement> {
protected final Map<String, ASTNode<?>> contexts_ = new HashMap<>(); protected final Map<String, ASTNode<?>> contexts_ = new HashMap<>();
protected ASTNode<T> rootContainer_; protected ASTNode<T> rootContainer_;
private int timeStep_; private int timeStep_;
protected Path astDiagramDir_;
public void setDebugDiagramDir(Path p) { public void setDebugDiagramDir(Path p) {
astDiagramDir_ = p; MotionGrammarConfig.astDiagramDir = p;
} }
/** /**
...@@ -31,7 +31,7 @@ public abstract class MotionGrammarParser<T extends MotionGrammarElement> { ...@@ -31,7 +31,7 @@ public abstract class MotionGrammarParser<T extends MotionGrammarElement> {
*/ */
protected void printAST(String step, ASTNode<?> highlightNode) { protected void printAST(String step, ASTNode<?> highlightNode) {
if (astDiagramDir_ == null) { if (MotionGrammarConfig.astDiagramDir == null) {
return; return;
} }
...@@ -42,13 +42,6 @@ public abstract class MotionGrammarParser<T extends MotionGrammarElement> { ...@@ -42,13 +42,6 @@ public abstract class MotionGrammarParser<T extends MotionGrammarElement> {
try { try {
for (var contextEntry : contexts_.entrySet()) {
// System.out.println("REL: " + ((RobotScene) (contextEntry.getValue())).getRobot().getAttachedItem());
Dumper.read(contextEntry.getValue())
.setNameMethod(o -> o == null ? "null" : o.getClass().getSimpleName())
.includeRelationsFor(".*", ".*")
.dumpAsPNG(astDiagramDir_.resolve("Context-" + contextEntry.getKey() + "-" + String.format("%03d", timeStep_) + "-" + step + ".png"));
}
// TODO remove this once the issue in relast2uml has been resolved // TODO remove this once the issue in relast2uml has been resolved
if (rootContainer_.getChild(0) != null) { if (rootContainer_.getChild(0) != null) {
Dumper.read(rootContainer_.getChild(0)) Dumper.read(rootContainer_.getChild(0))
...@@ -62,11 +55,10 @@ public abstract class MotionGrammarParser<T extends MotionGrammarElement> { ...@@ -62,11 +55,10 @@ public abstract class MotionGrammarParser<T extends MotionGrammarElement> {
} }
return result + o.getClass().getSimpleName(); return result + o.getClass().getSimpleName();
}) })
.customPreamble("title " + step)
.skinParam(SkinParamBooleanSetting.Shadowing, false) .skinParam(SkinParamBooleanSetting.Shadowing, false)
.skinParam(SkinParamStringSetting.backgroundColor, "white") .skinParam(SkinParamStringSetting.backgroundColor, "white")
// .dumpAsSource(astDiagramDir_.resolve("AST-" + String.format("%03d", timeStep_) + "-" + step + ".puml")) .dumpAsPNG(MotionGrammarConfig.astDiagramDir.resolve("AST-" + String.format("%03d", timeStep_) + "-" + new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss.SSS").format(new java.util.Date()) + "-" + step + ".png"));
// .dumpAsSVG(astDiagramDir_.resolve("AST-" + String.format("%03d", timeStep_) + "-" + step + ".svg"));
.dumpAsPNG(astDiagramDir_.resolve("AST-" + String.format("%03d", timeStep_) + "-" + step + ".png"));
} }
timeStep_++; timeStep_++;
} catch (IOException e) { } catch (IOException e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment