Computation.jrag 836 Bytes
Newer Older
1
2
aspect Computation {
  syn boolean RobotArm.isInSafetyZone() {
3
    System.out.println("isInSafetyZone()");
René Schöne's avatar
René Schöne committed
4
5
    for (Link link : getLinkList()) {
      if (model().getZoneModel().isInSafetyZone(link.getCurrentPosition())) {
6
7
8
9
10
11
        return true;
      }
    }
    return model().getZoneModel().isInSafetyZone(getEndEffector().getCurrentPosition());
  }

12
13
  cache ZoneModel.isInSafetyZone(IntPosition pos);
  syn boolean ZoneModel.isInSafetyZone(IntPosition pos) {
14
    System.out.println("isInSafetyZone(" + pos + ")");
15
    for (Zone sz : getSafetyZoneList()) {
16
      for (Coordinate coordinate : sz.getCoordinateList()) {
René Schöne's avatar
René Schöne committed
17
        if (coordinate.getPosition().equals(pos)) {
18
19
20
21
22
23
24
          return true;
        }
      }
    }
    return false;
  }

René Schöne's avatar
René Schöne committed
25
  syn double RobotArm.getAppropriateSpeed() {
26
27
    return isInSafetyZone() ? 0.4d : 1.0d;
  }
28
}