def opAnyStrSeq(self):
     tc = CORBA.TypeCode('IDL:matecorba/test/StrSeq:1.0')
     return CORBA.Any(tc, [ 'foo' ] * 16)
 def opStructAny(self):
     tc = CORBA.TypeCode('IDL:omg.org/CORBA/long:1.0')
     return matecorba.test.StructAny(constants.STRING_IN,
                                 CORBA.Any(tc, constants.LONG_IN))
Esempio n. 3
0
)
graph.initialize()

res, q_init, err = graph.applyNodeConstraints("table/pose grasps box/pose2",
                                              half_sitting)
# res, q_goal, err = graph.applyNodeConstraints("talos/right_gripper grasps box/bottom", half_sitting)
# print(ps.directPath(q_init, q_init, True))
ps.setInitialConfig(q_init)
# ps.addGoalConfig(q_goal)
ps.setTargetState(graph.nodes["talos/left_gripper grasps box/handle1"])
ps.setParameter("SimpleTimeParameterization/safety", 0.5)
ps.setParameter("SimpleTimeParameterization/order", 2)
ps.setParameter("SimpleTimeParameterization/maxAcceleration", 2.0)

ps.setParameter("ConfigurationShooter/Gaussian/standardDeviation", 0.05)
ps.client.basic.problem.selectConfigurationShooter("Gaussian")
# ps.setRandomSeed(1)
print(ps.solve())

ps.client.manipulation.problem.selectProblem("estimation")
clients.manipulation.problem.resetProblem()

robotEst, psEst, vfEst = makeRobotProblemAndViewerFactory(clients)

graphEst = makeGraph(robotEst)
graphEst.initialize()

psEst.setParameter("SimpleTimeParameterization/safety",
                   CORBA.Any(CORBA.TC_double, 0.5))
psEst.setParameter("SimpleTimeParameterization/order", 2)
Esempio n. 4
0
 def member_label(self, index):
     if index < 0 or index >= len(self._d[6]): raise CORBA.TypeCode.Bounds()
     if index == self._d[5]: return CORBA.Any(CORBA._tc_octet, 0)
     return CORBA.Any(createTypeCode(self._d[4]), self._d[6][index][0])
Esempio n. 5
0
                    sys.exit(1)
                except CosEventChannelAdmin.AlreadyConnected, ex:
                    sys.stderr.write('Proxy Push Consumer already connected!')
                    sys.exit(1)
                except CORBA.COMM_FAILURE, ex:
                    sys.stderr.write("Caught COMM_FAILURE Exception " +\
                      "connecting Push Supplier! Retrying...")
                    time.sleep(1)
            print "Connected Push Supplier."

            # Push data.
            i = 0
            while ((self.discnum == 0) or (i < self.discnum)):
                try:
                    sys.stdout.write("Push Supplier: push() called. ")
                    proxy_consumer.push(CORBA.Any(CORBA.TC_ulong, l))
                    print "Data :", l
                except CosEventComm.Disconnected, ex:
                    print "Failed. Caught Disconnected Exception!"
                except CORBA.COMM_FAILURE, ex:
                    print "Failed. Caught COMM_FAILURE Exception!"
                i = i + 1
                l = l + 1
                #time.sleep(1)

            # Disconnect - retrying on Comms Failure.
            while (1):
                try:
                    proxy_consumer.disconnect_push_consumer()
                    break
                except CORBA.COMM_FAILURE, ex:
Esempio n. 6
0
        passed(test + ": got exception %s" % ex.__class__.__name__)
    except CORBA.Exception, ex:
        failed(test + ": wrong exception: %s" % ex.__class__.__name__)

    test = "PPshS-3"  # ----------------------------------------------------------
    connect_push_consumer(proxyPushSupplier, consumer_i._this())
    try:
        connect_push_consumer(proxyPushSupplier, consumer_i._this())
        failed(test + ": no exception")
    except CosEventChannelAdmin.AlreadyConnected, ex:
        passed(test + ": got exception %s" % ex.__class__.__name__)
    except CORBA.Exception, ex:
        failed(test + ": wrong exception: %s" % ex.__class__.__name__)

    test = "PPshS-works"  # ----------------------------------------------------------
    push(supplier_i.pushConsumer, CORBA.Any(CORBA.TC_string, test))
    result = consumer_i.receive(time.time() + timeout)
    if (result):
        if (result.value(CORBA.TC_string) == test):
            passed(test)
        else:
            failed(test + ": wrong value (" + result.value(CORBA.TC_string) +
                   ")")
    else:
        failed(test + ": timed out")

    test = "PPshS-1"  # ----------------------------------------------------------
    disconnect_push_supplier(proxyPushSupplier)
    time.sleep(1)
    if (consumer_i.disconnected):
        passed(test + ", PshS-1")
Esempio n. 7
0
    def test26_any_exception(self):
        '''any with exception'''

        tc = CORBA.TypeCode('IDL:orbit/test/TestException:1.0')
        any = CORBA.Any(tc, test.TestException('reason', 42, [], factory))
        del any
Esempio n. 8
0
def main(args):
    orb = CORBA.ORB_init(args)
    poa = orb.resolve_initial_references("RootPOA")
    poa._get_the_POAManager().activate()

    orb.register_value_factory(CORBA.id(ValueTest.Three), Three_i)

    obj = orb.string_to_object(args[1])
    obj = obj._narrow(ValueTest.Test)

    v1 = ValueTest.One("hello", 123)
    v2 = ValueTest.One("test", 42)
    v3 = ValueTest.Two(None, None)
    v4 = ValueTest.Two(v1, None)
    v5 = ValueTest.Two(v1, v2)
    v6 = ValueTest.Two(v1, v1)
    v7 = Derived.Five("abc", 456, "more")

    obj.show("Simple values")
    r1 = obj.op1(v1)
    r2 = obj.op1(v2)
    r3 = obj.op1(None)

    obj.show("Two different values")
    obj.op2(v1, v2)

    obj.show("Nil, value")
    obj.op2(None, v1)

    obj.show("Value, nil")
    obj.op2(v1, None)

    obj.show("Two nils")
    obj.op2(None, None)

    obj.show("Two references to the same value")
    obj.op2(v1, v1)

    obj.show("Value containing two nils")
    r4 = obj.op3(v3)

    obj.show("Value containing value, nil")
    r5 = obj.op3(v4)

    obj.show("Value containing val1, val2")
    r6 = obj.op3(v5)

    obj.show("Value containing two references to same value")
    r7 = obj.op3(v6)

    obj.show("Derived value (should be truncated)")
    r8 = obj.op1(v7)

    obj.show("Same derived value twice")
    obj.op2(v7, v7)

    obj.show("Base value, derived value")
    obj.op2(v1, v7)

    obj.show("Derived value, base value")
    obj.op2(v7, v1)

    obj.show("String in valuebox")
    r9 = obj.op4("Hello")

    obj.show("Empty value box")
    r10 = obj.op4(None)

    obj.show("Nil abstract interface")
    obj.op5(None)

    fi = Four_i()
    fo = fi._this()

    obj.show("Abstract interface set to object reference")
    obj.op5(fo)

    t = Three_i("experiment")
    obj.show("Abstract interface set to value")
    obj.op5(t)

    # Any tests
    a1 = CORBA.Any(ValueTest._tc_One, v1)
    a2 = CORBA.Any(Derived._tc_Five, v7)
    v8 = Derived.Six(1.234, "test")
    a3 = CORBA.Any(Derived._tc_Six, v8)
    a4 = CORBA.Any(ValueTest._tc_One, None)
    a5 = CORBA.Any(ValueTest._tc_One, v2)
    a6 = CORBA.Any(ValueTest._tc_One, v2)

    obj.show("Value in Any")
    obj.op6(a1)

    obj.show("Derived value in Any")
    obj.op6(a2)

    obj.show("Completely unknown value in any")
    obj.op6(a3)

    obj.show("Nil value in any")
    obj.op6(a4)

    obj.show("Two anys")
    obj.op7(a1, a5)

    obj.show("Same any twice")
    obj.op7(a1, a1)

    obj.show("Different anys containing same value")
    obj.op7(a5, a6)

    obj.show("Same derived value twice")
    obj.op7(a2, a2)

    obj.show("Any and value")
    obj.op8(a1, v2)

    obj.show("Any and same value")
    obj.op8(a1, v1)

    obj.show("Any and derived")
    obj.op8(a1, v7)

    obj.show("Same derived value in any and value")
    obj.op8(a2, v7)

    obj.show("Value and any")
    obj.op9(v2, a1)

    obj.show("Value and same value in any")
    obj.op9(v1, a1)

    obj.show("Derived value and any")
    obj.op9(v7, a1)

    obj.show("Same derived value as value and in any")
    obj.op9(v7, a2)

    obj.show("Empty value")
    e1 = ValueTest.Empty()
    e2 = ValueTest.Empty()
    obj.op10(e1)

    obj.show("Different empty values")
    obj.op11(e1, e2)

    obj.show("Same empty values")
    obj.op11(e1, e1)

    obj.show("Empty value, None")
    obj.op11(e1, None)

    obj.show("None, empty value")
    obj.op11(None, e1)

    obj.show("None, None")
    obj.op11(None, None)

    obj.show("Container of empty values")
    c1 = ValueTest.Container(e1, e2)
    obj.op12(c1)

    orb.destroy()
        failed(test + ": timed out")
    disconnect_push_consumer(proxyPushConsumer)  # Tidy!

    test = "PPshC-3"  # ----------------------------------------------------------
    proxyPushConsumer = obtain_push_consumer(supplierAdmin)
    connect_push_supplier(proxyPushConsumer, supplier_i._this())
    try:
        connect_push_supplier(proxyPushConsumer, supplier_i._this())
        failed(test + ": no exception")
    except CosEventChannelAdmin.AlreadyConnected, ex:
        passed(test)
    except:
        failed(test + ": wrong exception: %s" % ex.__class__.__name__)

    test = "PshC-1"  # -----------------------------------------------------------
    push(proxyPushConsumer, CORBA.Any(CORBA.TC_string, test))
    result, hasEvent = try_pull(consumer_i.pullSupplier, time.time() + timeout)
    if (hasEvent):
        if (result.value(CORBA.TC_string) == test):
            passed(test)
        else:
            failed(test + ": wrong value (" + result.value(CORBA.TC_string) +
                   ")")
    else:
        failed(test + ": timed out")

    test = "PshC-2"  # -----------------------------------------------------------
    disconnect_push_consumer(proxyPushConsumer)
    try:
        push(proxyPushConsumer, CORBA.Any(CORBA.TC_string, test))
    except:
Esempio n. 10
0
def to_any(data):
    """to_any(data) -- try to return data as a CORBA.Any"""
    tc, val = _to_tc_value(data)
    return CORBA.Any(tc, val)
Esempio n. 11
0
            id = "omni:%s:%08x" % (_idbase, _idcount)
        finally:
            _idlock.release()

        dl = [tcInternal.tv_struct, None, id, ""]
        ms = []
        svals = []
        items = data.items()
        for (k,v) in items:
            if not isinstance(k, str):
                raise CORBA.BAD_PARAM(omniORB.BAD_PARAM_WrongPythonType,
                                      CORBA.COMPLETED_NO)
            t, v = _to_tc_value(v)

            if t._k._v in INVALID_MEMBER_KINDS:
                v = CORBA.Any(t,v)
                t = CORBA.TC_any
            
            ms.append(k)
            dl.append(k)
            dl.append(t._d)
            svals.append(v)
        cls   = omniORB.createUnknownStruct(id, ms)
        dl[1] = cls
        tc    = tcInternal.createTypeCode(tuple(dl))
        value = cls(*svals)
        return tc, value

    elif isinstance(data, FixedType):
        if data == CORBA.fixed(0):
            tc = tcInternal.createTypeCode((tcInternal.tv_fixed, 1, 0))