Commit 0fa7f92a authored by René Schöne's avatar René Schöne
Browse files

Update safetyzone model.

- also make definitions less verbose again
- resolves #28
parent 06a3ec6c
Pipeline #7114 passed with stages
in 6 minutes and 3 seconds
...@@ -14,13 +14,7 @@ aspect Computation { ...@@ -14,13 +14,7 @@ aspect Computation {
System.out.println("isInSafetyZone(" + pos + ")"); System.out.println("isInSafetyZone(" + pos + ")");
for (Zone sz : getSafetyZoneList()) { for (Zone sz : getSafetyZoneList()) {
for (Coordinate coordinate : sz.getCoordinateList()) { for (Coordinate coordinate : sz.getCoordinateList()) {
IntPosition inside = coordinate.getPosition(); if (coordinate.getPosition().equals(pos)) {
if (inside.getX() <= pos.getX() &&
inside.getY() <= pos.getY() &&
inside.getZ() <= pos.getZ() &&
pos.getX() <= inside.getX() + getSize().getX() &&
pos.getY() <= inside.getY() + getSize().getY() &&
pos.getZ() <= inside.getZ() + getSize().getZ()) {
return true; return true;
} }
} }
......
...@@ -10,23 +10,23 @@ RobotArm.AppropriateSpeed canDependOn Joint.CurrentPosition as dependency1 ; ...@@ -10,23 +10,23 @@ RobotArm.AppropriateSpeed canDependOn Joint.CurrentPosition as dependency1 ;
// --- mapping definitions --- // --- mapping definitions ---
ParseLinkState maps byte[] bytes to panda.Linkstate.PandaLinkState {: ParseLinkState maps byte[] bytes to panda.Linkstate.PandaLinkState {:
System.out.println("ParseLinkState"); // System.out.println("ParseLinkState");
return panda.Linkstate.PandaLinkState.parseFrom(bytes); return panda.Linkstate.PandaLinkState.parseFrom(bytes);
:} :}
SerializeRobotConfig maps config.Robotconfig.RobotConfig rc to byte[] {: SerializeRobotConfig maps config.Robotconfig.RobotConfig rc to byte[] {:
System.out.println("SerializeRobotConfig"); // System.out.println("SerializeRobotConfig");
return rc.toByteArray(); return rc.toByteArray();
:} :}
LinkStateToIntPosition maps panda.Linkstate.PandaLinkState pls to IntPosition {: LinkStateToIntPosition maps panda.Linkstate.PandaLinkState pls to IntPosition {:
System.out.println("LinkStateToIntPosition"); // System.out.println("LinkStateToIntPosition");
panda.Linkstate.PandaLinkState.Position p = pls.getPos(); panda.Linkstate.PandaLinkState.Position p = pls.getPos();
return IntPosition.of((int) (Math.round(p.getPositionX() * 2)), (int) (Math.round(p.getPositionY() * 2)), (int) (Math.round(p.getPositionZ() * 2 + 0.5))); return IntPosition.of((int) (Math.round(p.getPositionX() * 2)), (int) (Math.round(p.getPositionY() * 2)), (int) (Math.round(p.getPositionZ() * 2 + 0.5)));
:} :}
CreateSpeedMessage maps double speed to config.Robotconfig.RobotConfig {: CreateSpeedMessage maps double speed to config.Robotconfig.RobotConfig {:
System.out.println("CreateSpeedMessage"); // System.out.println("CreateSpeedMessage");
return config.Robotconfig.RobotConfig.newBuilder() return config.Robotconfig.RobotConfig.newBuilder()
.setSpeed(speed) .setSpeed(speed)
.setLoopTrajectory(true) .setLoopTrajectory(true)
......
Model ::= RobotArm ZoneModel ; Model ::= RobotArm ZoneModel ;
ZoneModel ::= <Size:IntPosition> SafetyZone:Zone* ; ZoneModel ::= SafetyZone:Zone* ;
Zone ::= Coordinate* ; Zone ::= Coordinate* ;
......
...@@ -42,7 +42,6 @@ public class StarterMain { ...@@ -42,7 +42,6 @@ public class StarterMain {
model.MqttSetHost(config.mqttHost); model.MqttSetHost(config.mqttHost);
ZoneModel zoneModel = new ZoneModel(); ZoneModel zoneModel = new ZoneModel();
zoneModel.setSize(makePosition(1, 1, 1));
Zone safetyZone = new Zone(); Zone safetyZone = new Zone();
for (int[] coordinate : safetyZoneCoordinates) { for (int[] coordinate : safetyZoneCoordinates) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment