Skip to content
Snippets Groups Projects
Commit e1d742e2 authored by René Schöne's avatar René Schöne
Browse files

towards impl used in paper

parent 0e2c0f00
No related branches found
No related tags found
No related merge requests found
Pipeline #13578 passed
Showing
with 96 additions and 153 deletions
...@@ -4,3 +4,5 @@ acs.txt ...@@ -4,3 +4,5 @@ acs.txt
cfcs.txt cfcs.txt
trainbenchmark.file trainbenchmark.file
trainbenchmark.lang trainbenchmark.lang
cats.txt
ignored.txt
Connect
filter call_regexp_common Java
extension connect
extension ragconnect
3rd_gen_scale 10
...@@ -20,14 +20,14 @@ done ...@@ -20,14 +20,14 @@ done
echo "Running cloc with new definitions" echo "Running cloc with new definitions"
# --ignored=bad-files.txt # --ignored=bad-files.txt
CLOC_CMD="cloc --exclude-lang=JSON --read-lang-def=my_definitions.txt --exclude-list-file=.clocignore --quiet" CLOC_CMD="cloc --exclude-lang=JSON --read-lang-def=my_definitions.txt --exclude-list-file=.clocignore --quiet"
$CLOC_CMD --report-file=common-result.txt ../ros3rag.common/src/main/resources/jastadd ../ros3rag.common/src/main/java 2>>cloc-errors.log $CLOC_CMD --report-file=common-01-input-result.txt ../ros3rag.common/src/main/resources/jastadd ../ros3rag.common/src/main/proto ../ros3rag.common/src/main/java 2>>cloc-errors.log
$CLOC_CMD --report-file=placeA-result.txt ../ros3rag.placeA/src/main/ja* 2>>cloc-errors.log $CLOC_CMD --report-file=placeA-01-input-result.txt ../ros3rag.placeA/src/main/ja* 2>>cloc-errors.log
$CLOC_CMD --report-file=placeB-result.txt ../ros3rag.placeB/src/main/ja* 2>>cloc-errors.log $CLOC_CMD --report-file=placeB-01-input-result.txt --categorized=cats.txt --ignored=ignored.txt ../ros3rag.placeB/src/main/ja* 2>>cloc-errors.log
# $CLOC_CMD --report-file=base-gen-result.txt ../ros3rag.base/src/gen 2>>cloc-errors.log # $CLOC_CMD --report-file=base-gen-result.txt ../ros3rag.base/src/gen 2>>cloc-errors.log
$CLOC_CMD --report-file=placeA-gen-result.txt ../ros3rag.placeA/src/gen 2>>cloc-errors.log $CLOC_CMD --report-file=placeA-02-gen-result.txt ../ros3rag.placeA/src/gen 2>>cloc-errors.log
$CLOC_CMD --report-file=placeB-gen-result.txt ../ros3rag.placeB/src/gen 2>>cloc-errors.log $CLOC_CMD --report-file=placeB-02-gen-result.txt ../ros3rag.placeB/src/gen 2>>cloc-errors.log
$CLOC_CMD --report-file=common-gen-result.txt ../ros3rag.common/build/generated/source/proto/main/java/de 2>>cloc-errors.log $CLOC_CMD --report-file=common-02-gen-result.txt ../ros3rag.common/build/generated/source/proto/main/java/de 2>>cloc-errors.log
# CFC_CMD='grep -o 'if'\|'for'\|'return'' # CFC_CMD='grep -o 'if'\|'for'\|'return''
......
...@@ -60,7 +60,10 @@ public abstract class SharedMainParts<MqttHandler extends SharedMainParts.MqttHa ...@@ -60,7 +60,10 @@ public abstract class SharedMainParts<MqttHandler extends SharedMainParts.MqttHa
/// Prepare main handler /// Prepare main handler
mainHandler = createMqttHandler().dontSendWelcomeMessage(); mainHandler = createMqttHandler().dontSendWelcomeMessage();
mainHandler.setHost(config.mqttHost); mainHandler.setHost(config.mqttHost);
mainHandler.waitUntilReady(2, TimeUnit.SECONDS); if (!mainHandler.waitUntilReady(2, TimeUnit.SECONDS)) {
logger.fatal("Could not connect to mqtt handler. Exiting");
return;
}
CountDownLatch exitCondition = new CountDownLatch(1); CountDownLatch exitCondition = new CountDownLatch(1);
mainHandler.newConnection(TOPIC_EXIT, bytes -> { mainHandler.newConnection(TOPIC_EXIT, bytes -> {
logger.info("Got exit command"); logger.info("Got exit command");
......
syntax = "proto3";
package config;
message RobotConfig {
double speed = 1;
}
\ No newline at end of file
syntax = "proto3";
package robot;
message RobotState {
message Position {
double x = 1;
double y = 2;
double z = 3;
}
message Orientation {
double x = 1;
double y = 2;
double z = 3;
double w = 4;
}
message LinearTwist {
double x = 1;
double y = 2;
double z = 3;
}
message AngularTwist {
double x = 1;
double y = 2;
double z = 3;
}
string name = 1;
Position position = 2;
Orientation orientation = 3;
LinearTwist linear_twist = 4;
AngularTwist angular_twist = 5;
}
\ No newline at end of file
syntax = "proto3";
package plan;
message Trajectory {
message Position {
double x = 1;
double y = 2;
double z = 3;
}
message Orientation {
double x = 1;
double y = 2;
double z = 3;
double w = 4;
}
enum PlanningMode {
FLUID = 0;
CARTESIAN = 1;
}
message Pose {
Position position = 1;
Orientation orientation = 2;
PlanningMode mode = 3;
}
repeated Pose pose = 1;
bool loop = 2;
}
...@@ -62,17 +62,3 @@ ConvertScene maps de.tudresden.inf.st.ceti.Scene pbScene to Scene {: ...@@ -62,17 +62,3 @@ ConvertScene maps de.tudresden.inf.st.ceti.Scene pbScene to Scene {:
} }
return result; return result;
:} :}
ParseReachability maps byte[] bytes to de.tudresden.inf.st.ceti.Reachability {:
return de.tudresden.inf.st.ceti.Reachability.parseFrom(bytes);
:}
ConvertReachability maps de.tudresden.inf.st.ceti.Reachability r to CanReachObjectOfInterestWrapper {:
var result = new CanReachObjectOfInterestWrapper();
for (var objReach : r.getObjectsList()) {
if (objReach.getReachable()) {
result.addCanReachObjectOfInterest(new CanReachObjectOfInterest().setObjectName(objReach.getIdObject()));
}
}
return result;
:}
...@@ -165,14 +165,6 @@ aspect Navigation { ...@@ -165,14 +165,6 @@ aspect Navigation {
syn LogicalMovableObject LogicalObjectOfInterest.asLogicalMovableObject() = null; syn LogicalMovableObject LogicalObjectOfInterest.asLogicalMovableObject() = null;
eq LogicalMovableObject.asLogicalMovableObject() = this; eq LogicalMovableObject.asLogicalMovableObject() = this;
// --- isCollaborationZone ---
syn boolean DropOffLocation.isCollaborationZone() = false;
eq CollaborationZone.isCollaborationZone() = true;
// --- asCollaborationZone ---
syn CollaborationZone DropOffLocation.asCollaborationZone() = null;
eq CollaborationZone.asCollaborationZone() = this;
inh Scene DropOffLocation.containingScene(); inh Scene DropOffLocation.containingScene();
inh Scene MovableObject.containingScene(); inh Scene MovableObject.containingScene();
inh Scene LogicalMovableObject.containingScene(); inh Scene LogicalMovableObject.containingScene();
......
...@@ -5,26 +5,23 @@ Orientation ::= <X:double> <Y:double> <Z:double> <W:double> ; ...@@ -5,26 +5,23 @@ Orientation ::= <X:double> <Y:double> <Z:double> <W:double> ;
// Regions cannot be contained in scene, but must be retrieved via attribute // Regions cannot be contained in scene, but must be retrieved via attribute
Scene ::= DropOffLocation* MovableObject* RobotObject* /LogicalScene/ ; Scene ::= DropOffLocation* MovableObject* RobotObject* /LogicalScene/ ;
CanReachObjectOfInterestWrapper ::= CanReachObjectOfInterest* ;
ObjectOfInterest ::= <Name:String> Position Size Orientation ; ObjectOfInterest ::= <Name:String> Position Size Orientation ;
DropOffLocation : ObjectOfInterest ; DropOffLocation : ObjectOfInterest ;
MovableObject : ObjectOfInterest ; MovableObject : ObjectOfInterest ;
RobotObject : ObjectOfInterest ::= <Active:boolean> ; RobotObject : ObjectOfInterest ::= <Active:boolean> ;
CanReachObjectOfInterest ::= <ObjectName:String> ;
LogicalScene ::= LogicalRegion* LogicalMovableObject* ; LogicalScene ::= LogicalRegion* LogicalMovableObject* ;
LogicalObjectOfInterest ::= <Name:String> ; LogicalObjectOfInterest ::= <Name:String> ;
LogicalRegion : LogicalObjectOfInterest ; LogicalRegion : LogicalObjectOfInterest ;
LogicalMovableObject : LogicalObjectOfInterest ::= <NameOfMyLocation> ; LogicalMovableObject : LogicalObjectOfInterest ::= <NameOfMyLocation> ;
rel LogicalRegion.ContainedObject* <-> LogicalMovableObject.LocatedAt* ; rel LogicalRegion.ContainedObject* <-> LogicalMovableObject.LocatedAt* ;
// TODO could lead to problems when including this information and sending it // could lead to problems when including this information and sending it
//rel LogicalMovableObject.MyLocation? -> DropOffLocation ; //rel LogicalMovableObject.MyLocation? -> DropOffLocation ;
Region ::= <Name:String> <LocationNames> ; Region ::= <Name:String> <LocationNames> ;
//rel Region.Location* <-> DropOffLocation.ContainedInRegion* ; //rel Region.Location* <-> DropOffLocation.ContainedInRegion* ;
// TODO should this be only in site-B?? // only used in site-B, but needed here for parsing the scene
CollaborationZone : DropOffLocation ; CollaborationZone : DropOffLocation ;
mqttHost: "192.168.0.122" #mqttHost: "192.168.0.122"
mqttHost: "localhost"
filenameRegions: "src/main/resources/regions-a-placeworld.json" filenameRegions: "src/main/resources/regions-a-placeworld.json"
forA: forA:
filenameInitialScene: "src/main/resources/config-scene-a-placeworld.json" filenameInitialScene: "src/main/resources/config-scene-a-placeworld.json"
......
...@@ -6,6 +6,20 @@ receive Robot.CanReachObjectOfInterestWrapper using ParseReachability, ConvertRe ...@@ -6,6 +6,20 @@ receive Robot.CanReachObjectOfInterestWrapper using ParseReachability, ConvertRe
receive Robot.OwnedCollaborationZoneNames using ConfigChangeCommandCheckForOwnedCollaborationZone ; receive Robot.OwnedCollaborationZoneNames using ConfigChangeCommandCheckForOwnedCollaborationZone ;
receive Robot.OccupiedCollaborationZoneNames using CommandCheckForOccupiedCollaborationZone ; receive Robot.OccupiedCollaborationZoneNames using CommandCheckForOccupiedCollaborationZone ;
ParseReachability maps byte[] bytes to de.tudresden.inf.st.ceti.Reachability {:
return de.tudresden.inf.st.ceti.Reachability.parseFrom(bytes);
:}
ConvertReachability maps de.tudresden.inf.st.ceti.Reachability r to CanReachObjectOfInterestWrapper {:
var result = new CanReachObjectOfInterestWrapper();
for (var objReach : r.getObjectsList()) {
if (objReach.getReachable()) {
result.addCanReachObjectOfInterest(new CanReachObjectOfInterest().setObjectName(objReach.getIdObject()));
}
}
return result;
:}
// --- sending --- // --- sending ---
send WorldModelB.NextOperation using PrintOperation ; send WorldModelB.NextOperation using PrintOperation ;
......
...@@ -335,6 +335,14 @@ aspect AttributeMappings { ...@@ -335,6 +335,14 @@ aspect AttributeMappings {
} }
aspect Navigation { aspect Navigation {
// --- isCollaborationZone ---
syn boolean DropOffLocation.isCollaborationZone() = false;
eq CollaborationZone.isCollaborationZone() = true;
// --- asCollaborationZone ---
syn CollaborationZone DropOffLocation.asCollaborationZone() = null;
eq CollaborationZone.asCollaborationZone() = this;
//--- worldModelB --- //--- worldModelB ---
inh WorldModelB ASTNode.worldModelB(); inh WorldModelB ASTNode.worldModelB();
eq WorldModelB.getChild().worldModelB() = this; eq WorldModelB.getChild().worldModelB() = this;
......
...@@ -6,6 +6,9 @@ Robot ::= <Name:String> CanReachObjectOfInterestWrapper <OwnedCollaborationZoneN ...@@ -6,6 +6,9 @@ Robot ::= <Name:String> CanReachObjectOfInterestWrapper <OwnedCollaborationZoneN
//rel Robot.OwnedCollaborationZone* <-> CollaborationZone.Owner? ; //rel Robot.OwnedCollaborationZone* <-> CollaborationZone.Owner? ;
//rel Robot.OccupiedCollaborationZone? <-> CollaborationZone.Occupient? ; //rel Robot.OccupiedCollaborationZone? <-> CollaborationZone.Occupient? ;
CanReachObjectOfInterestWrapper ::= CanReachObjectOfInterest* ;
CanReachObjectOfInterest ::= <ObjectName:String> ;
abstract Difference ; abstract Difference ;
rel Difference.Object -> LogicalMovableObject ; rel Difference.Object -> LogicalMovableObject ;
DifferenceObjectAtWrongPlace : Difference ; DifferenceObjectAtWrongPlace : Difference ;
......
...@@ -22,7 +22,6 @@ import static de.tudresden.inf.st.ros3rag.common.Util.mqttUri; ...@@ -22,7 +22,6 @@ import static de.tudresden.inf.st.ros3rag.common.Util.mqttUri;
* @author rschoene - Initial contribution * @author rschoene - Initial contribution
*/ */
public class MainB extends SharedMainParts<MqttHandler, WorldModelB> { public class MainB extends SharedMainParts<MqttHandler, WorldModelB> {
private final String TOPIC_DEMO_MOVE_objectRed1_RED;
private final String TOPIC_MODEL_SVG_PATH; private final String TOPIC_MODEL_SVG_PATH;
private de.tudresden.inf.st.ceti.Scene demo_scene; private de.tudresden.inf.st.ceti.Scene demo_scene;
...@@ -30,7 +29,6 @@ public class MainB extends SharedMainParts<MqttHandler, WorldModelB> { ...@@ -30,7 +29,6 @@ public class MainB extends SharedMainParts<MqttHandler, WorldModelB> {
MainB(String configFile) { MainB(String configFile) {
super("place-b", UtilB.pathToDirectoryOfPlaceB().resolve(configFile)); super("place-b", UtilB.pathToDirectoryOfPlaceB().resolve(configFile));
this.TOPIC_DEMO_MOVE_objectRed1_RED = cellName + "/demo/move/objectRed1/red";
this.TOPIC_MODEL_SVG_PATH = cellName + "/model/svg/path"; this.TOPIC_MODEL_SVG_PATH = cellName + "/model/svg/path";
} }
...@@ -46,26 +44,32 @@ public class MainB extends SharedMainParts<MqttHandler, WorldModelB> { ...@@ -46,26 +44,32 @@ public class MainB extends SharedMainParts<MqttHandler, WorldModelB> {
@Override @Override
protected void createSpecificMainHandlerConnections() { protected void createSpecificMainHandlerConnections() {
mainHandler.newConnection(TOPIC_DEMO_MOVE_objectRed1_RED, bytes -> mainHandler.newConnection("place-b/demo", bytes -> {
UtilB.updatePositionOfObjectToLocation(model.getMyScene(), "objectRed1", "binRed") switch (new String(bytes)) {
); case "objectRed1/red":
mainHandler.newConnection("demo/initial_scene", bytes -> { UtilB.updatePositionOfObjectToLocation(model.getMyScene(), "objectRed1", "binRed");
break;
case "initial_scene":
try { try {
demo_scene = Util.readScene(UtilB.pathToDirectoryOfPlaceB().resolve("src/main/resources/config-scene-b-placeworld-manual.json")); demo_scene = Util.readScene(UtilB.pathToDirectoryOfPlaceB().resolve("src/main/resources/config-scene-b-placeworld-manual.json"));
mainHandler.publish(config.forB.topicsSceneUpdate.get(0), demo_scene.toByteArray()); mainHandler.publish(config.forB.topicsSceneUpdate.get(0), demo_scene.toByteArray());
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
}); break;
mainHandler.newConnection("demo/arm1/active", bytes -> case "arm1/active":
updateAndPublishScene("arm1", robot -> robot.toBuilder().setActive(true).build())); updateAndPublishScene("arm1", robot -> robot.toBuilder().setActive(true).build());
mainHandler.newConnection("demo/arm1/inactive", bytes -> break;
updateAndPublishScene("arm1", robot -> robot.toBuilder().setActive(false).build())); case "arm1/inactive":
mainHandler.newConnection("demo/arm2/active", bytes -> updateAndPublishScene("arm1", robot -> robot.toBuilder().setActive(false).build());
updateAndPublishScene("arm2", robot -> robot.toBuilder().setActive(true).build())); break;
mainHandler.newConnection("demo/arm2/inactive", bytes -> case "arm2/active":
updateAndPublishScene("arm2", robot -> robot.toBuilder().setActive(false).build())); updateAndPublishScene("arm2", robot -> robot.toBuilder().setActive(true).build());
mainHandler.newConnection("demo/big-blue/cz", bytes -> break;
case "arm2/inactive":
updateAndPublishScene("arm2", robot -> robot.toBuilder().setActive(false).build());
break;
case "big-blue/cz":
updateAndPublishScene("bigBlue", bigBlue -> { updateAndPublishScene("bigBlue", bigBlue -> {
Object.Builder builder = bigBlue.toBuilder(); Object.Builder builder = bigBlue.toBuilder();
builder.getPosBuilder() builder.getPosBuilder()
...@@ -73,9 +77,9 @@ public class MainB extends SharedMainParts<MqttHandler, WorldModelB> { ...@@ -73,9 +77,9 @@ public class MainB extends SharedMainParts<MqttHandler, WorldModelB> {
.setY(0.65) .setY(0.65)
.setZ(0.94); .setZ(0.94);
return builder.build(); return builder.build();
}) });
); break;
mainHandler.newConnection("demo/big-blue/g1", bytes -> case "big-blue/g1":
updateAndPublishScene("bigBlue", bigBlue -> { updateAndPublishScene("bigBlue", bigBlue -> {
Object.Builder builder = bigBlue.toBuilder(); Object.Builder builder = bigBlue.toBuilder();
builder.getPosBuilder() builder.getPosBuilder()
...@@ -83,12 +87,16 @@ public class MainB extends SharedMainParts<MqttHandler, WorldModelB> { ...@@ -83,12 +87,16 @@ public class MainB extends SharedMainParts<MqttHandler, WorldModelB> {
.setY(1.0) .setY(1.0)
.setZ(0.93); .setZ(0.93);
return builder.build(); return builder.build();
}) });
); break;
default:
logger.error("Unknown demo command {}", new String(bytes));
}
});
} }
private void updateAndPublishScene(String objectName, Function<Object, Object> change) { private void updateAndPublishScene(String objectName, Function<Object, Object> change) {
UtilB.updateObject(demo_scene, objectName, change); demo_scene = UtilB.updateObject(demo_scene, objectName, change);
mainHandler.publish(config.forB.topicsSceneUpdate.get(0), demo_scene.toByteArray()); mainHandler.publish(config.forB.topicsSceneUpdate.get(0), demo_scene.toByteArray());
} }
......
mqttHost: "192.168.0.122" #mqttHost: "192.168.0.122"
mqttHost: "localhost"
filenameRegions: "src/main/resources/regions-b-placeworld.json" filenameRegions: "src/main/resources/regions-b-placeworld.json"
forB: forB:
topicsSceneUpdate: topicsSceneUpdate:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment