Passing data python -> corba -> orocos

On Friday 07 May 2010 09:53:16 Steven Bellens wrote:
> Hi all,
>
> I'm trying to pass a float from python over corba to orocos. I'm able to do
> this in the other direction (orocos - > corba -> python). The code I use
> first connects to the Orocos component, gets the available ports and sets
> up a dataChannel afterwards. I try to set a float variable using the
> command "myVariable.set(3.0)" according to the functions defined in
> Operations.idl (the myVariable dataChannel is an assignable expression).
> The commands executes without any errors but it returns "false" (and
> doesn't set myVariable). The documentation in operations.idl says this
> means that my data (3.0) is of the wrong type. Any ideas on what is going
> on?

It doesn't print any errors on the Orocos side ? If a wrong type is involved,
an error should be printed.

Also, aren't you writing an 'any' into myVariable.set(...) ? Is Python
converting this automatically to an any ? Maybe it converts it to a 'double'
while your port expects a 'float' or the other way around.

Since it returns false, it must print some error (for our debugging sake), so
that in itself is something to improve...

It's probably line 233 in OperationsI.h that fails. you could replace this
line with this:


if ( mset->updateBlob(ORO_CORBA_PROTOCOL_ID, &value ) == false) {
    TypeCode_var tc = value.type();
    RTT::log(Error) << "Failed to update Assignable Expression of type "<< 
mset->getTypeName() << " with Any (Type id:" << tc->id() << " Type name:"<< 
tc->name() <<")"<<endlog();
    return false;
}
return true;


That might give you the information to dig further.

Peter

Passing data python -> corba -> orocos

On Friday 07 May 2010 09:53:16 Steven Bellens wrote:
> Hi all,
>
> I'm trying to pass a float from python over corba to orocos. I'm able to do
> this in the other direction (orocos - > corba -> python). The code I use
> first connects to the Orocos component, gets the available ports and sets
> up a dataChannel afterwards. I try to set a float variable using the
> command "myVariable.set(3.0)" according to the functions defined in
> Operations.idl (the myVariable dataChannel is an assignable expression).
> The commands executes without any errors but it returns "false" (and
> doesn't set myVariable). The documentation in operations.idl says this
> means that my data (3.0) is of the wrong type. Any ideas on what is going
> on?

Correction to my previous post, some scoping was missing, the _var didn't
compile, *and* it only works if you use TAO, not Omniorb


      if ( mset->updateBlob(ORO_CORBA_PROTOCOL_ID, &value ) == false) {
          CORBA::TypeCode_ptr tc = value.type();
          RTT::log(RTT::Error) << "Failed to update Assignable Expression of 
type "<< mset->getTypeName()
                  << " with Any (Type id:" << tc->id() << " Type name:"<< tc-
>name() <<")"<<RTT::endlog();
          return false;
      }
      return true;  


Peter

Passing data python -> corba -> orocos

On Wednesday 12 May 2010 09:33:20 Steven Bellens wrote:
> 2010/5/7 Peter Soetens <peter [..] ...>
>
> > On Friday 07 May 2010 09:53:16 Steven Bellens wrote:
> > > Hi all,
> > >
> > > I'm trying to pass a float from python over corba to orocos. I'm able
> > > to
> >
> > do
> >
> > > this in the other direction (orocos - > corba -> python). The code I
> > > use first connects to the Orocos component, gets the available ports
> > > and sets up a dataChannel afterwards. I try to set a float variable
> > > using the command "myVariable.set(3.0)" according to the functions
> > > defined in Operations.idl (the myVariable dataChannel is an assignable
> > > expression). The commands executes without any errors but it returns
> > > "false" (and doesn't set myVariable). The documentation in
> > > operations.idl says this means that my data (3.0) is of the wrong type.
> > > Any ideas on what is
> >
> > going
> >
> > > on?
> >
> > Correction to my previous post, some scoping was missing, the _var didn't
> > compile, *and* it only works if you use TAO, not Omniorb
> >
> > &#10;&gt; &gt;      if ( mset-&gt;updateBlob(ORO_CORBA_PROTOCOL_ID, &amp;value ) == false) {&#10;&gt; &gt;           CORBA::TypeCode_ptr tc = value.type();&#10;&gt; &gt;          RTT::log(RTT::Error) &lt;&lt; &quot;Failed to update Assignable Expression&#10;&gt; &gt; of type &quot;&lt;&lt; mset-&gt;getTypeName()&#10;&gt; &gt;                  &lt;&lt; &quot; with Any (Type id:&quot; &lt;&lt; tc-&gt;id() &lt;&lt; &quot; Type name:&quot;&lt;&lt;&#10;&gt; &gt; tc-&#10;&gt; &gt;&#10;&gt; &gt; &gt;name() &lt;&lt;&quot;)&quot;&lt;&lt;RTT::endlog();&#10;&gt; &gt;&#10;&gt; &gt;           return false;&#10;&gt; &gt;      }&#10;&gt; &gt;      return true;&#10;&gt; &gt;
>
> There is no extra output after inserting the above code.

Then it *must* return true, in contrary with what you wrote before ?

>
> Correction to my first post: the command I was using is
> 'myVariable.set(any.to_any(3.0))', which returns false, doesn't give any
> error messages at the python side, but at the Orocos side I get this
> (strange?) message:
>
> /deployer-corba-gnulinux::main()] Converting type 'KDL::Frame' to
> sequence<CORBA::Double>.

That is strange... but this is printed when preparing a local C++ structure to
be sent to the CORBA transport, ie your python code. But you are writing a
double, not a KDL::Frame ??

>
> When I try 'myVariable.set(3.0)' the python side tells me:
>
> omniORB: throw BAD_PARAM from pyMarshal.cc:406
> (NO,BAD_PARAM_WrongPythonType)
> Python script error from controller "cont1#CONTR#2":
> Traceback (most recent call last):
> File "connect.py", line 161, in update
> print imageDC.set(3.0)
> File "Operations_idl.py", line 174, in set
> return _omnipy.invoke(self, "set",
> _0_RTT.Corba.AssignableExpression._d_set, args)
> omniORB.CORBA.BAD_PARAM: CORBA.BAD_PARAM(omniORB.BAD_PARAM_WrongPythonType,
> CORBA.COMPLETED_NO)

That's expected behavior, so keep using the to_any() approach.

Peter