def world(self, n): # mounting pts: x y z θ w = World(*[(i * self.dx, 0, 0, 0) for i in range(0, n)]) # cmpts: for i in range(0, n): Arm("Arm" + str(i), w, i) #TODO option for Panda arm return w
def world(self, n, m): # mounting pts: x y z θ w = World(*[(0, i * self.dy, 0, 0) for i in range(0, n)]) # cmpts: for i in range(0, n): Cart("Cart" + str(i), w, i) return w
def world(): # mounting pts: x y z θ comp w = World( (-1, 0, 0, 0), # producer (0, 0, 0, 0)) # sensor # specs producer = CubeProcess("producer", 0, 0, 0, 0, 0.2, 0.2, 0.05, w, 0) sensor = CubeProcess("sensor", 0, 0, 0, 0, 0.2, 0.2, 0.2, w, 1) return w
def world(x, y, z, a, b, c): # mounting pts: x y z θ comp w = World( (0, 0, 0, 0), # arm (0, 0, 0, 0)) # point #arm = Arm("arm", w, 0, -2.2689280275926285, 2.2689280275926285, 0) #folded toward the back arm = Arm("arm", w, 0, a, b, c) point = PointProcess("point", x, y, z, w, 1) return w
def test_folded_above_0(self, debug=False): # mounting pts: x y z θ comp w = World( (0, 0, 1, 0), # arm (0, 0, 0, 0)) # point arm = Arm("arm", w, 0, -2.2689280275926285, -2.2689280275926285, 0) #folded toward the back below = FpProcess( "point", self.below(0.97), w, 1) #The folded arm FP extends 2-3cm below 0 due to maxFP ch = choreo1() self.assertTrue(self.check0(ch, w, debug))
def xp1_world(): w = World( ( 0, 0, 0, mp.pi / 2 ), # cart: it is rotated by 90 degrees, so it x/y are not the same as the global frame (-1.1, 0.09, 0, 0), # carrier: aligned with the right side (0, 0, 0, 0), # pillar (0, 0, 0, 0)) # bridge cart = Cart("Cart", w, 0) arm = Arm("Arm", cart) # on top the cart: it is also rotated by 90 degrees carrier = CartSquare("Carrier", w, 1) pillar = Cube(-0.5, 0.5, 0, mp.pi / 4, 0.1, 0.3, 0.2, w, 2) bridge = Cube(-0.5, 0.5, 0.2, mp.pi / 4, 0.3, 0.03, 0.1, w, 3) return w
def world(): # mounting pts: x y z θ comp w = World( (0, 0.7, 0.18, 0), # arm (-0.6, 0, 0, 0), # carrier (-0.2, -1.1, 0, mp.pi / 2), # franka (-0.95, 0, 0, 0), # producer (0.15, -0.05, 0, 0)) # sensor # specs arm = Arm("arm", w, 0, -2.2689280275926285, 2.2689280275926285, 0) carrier = CartSquare("carrier", w, 1) franka = FrankaEmikaPanda("franka", w, 2) producer = CubeProcess("producer", 0, 0, 0, 0, 0.1, 0.2, 0.05, w, 3) sensor = CubeProcess("sensor", 0, 0, 0, 0, 0.1, 0.1, 0.2, w, 4) return w
def check(self, P1, P2): w = World() p1 = P1(w, 0) p2 = P2(w, 1) env = Env(w, []) ch = choreo() visitor = Projection() visitor.execute(ch, env) chor = visitor.choreography vectorize(chor, w) checker = CompatibilityCheck(chor, w) checker.localChoiceChecks() checker.generateTotalGuardsChecks() checker.computePreds() checker.generateCompatibilityChecks() for i in range(0, len(checker.vcs)): vc = checker.vcs[i] if not vc.discharge(): print(i, "inFP", vc.title) if vc.hasModel(): print(vc.modelStr()) return False return True
import unittest from spec.contract import * from spec.time import timifyFormula from experiments_setups import World, DummyProcess from utils.geometry import cube #TODO contract, vaccuous, refinement, composition, etc. w = World() dp1 = DummyProcess("DP1", w, 0) dp2 = DummyProcess("DP2", w, 1) class TestContract01(AssumeGuaranteeContract): def __init__(self, proc = dp1): super().__init__("TestContract01") self._p = proc def components(self): return {self._p}; class TestContract02(AssumeGuaranteeContract): def __init__(self, proc = dp1): super().__init__("TestContract02") self._p = proc def components(self): return {self._p};
def progTwistAndTurnWorld(): w = World((0, 0, 0, 0), (0.5, 0, 0, mp.pi)) cart = Cart("Cart", w, 0) arm = Arm("Arm", cart) carrier = CartSquare("Carrier", w, 1) return w