Quantcast

Re: adding a device to yarp

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: adding a device to yarp

Joe Saunders
Hi All,

I've just updated our with the latest version of yarp and seem to be
having a few problems with running asynchronous port callbacks - which
were working fine before.

Just to illustrate, I compiled (and added a few printfs) to the test
code in ex0402_port_callback_reply.cpp

   
        ConnectionWriter *returnToSender = connection.getWriter();
 
        if (returnToSender!=NULL) {
            out.write(*returnToSender);
            printf("Sent reply %s\n",out.toString().c_str());
        }
        else {
           printf("Problem getting return object\n");
        }
        return true;

returnToSender always seems to get given a NULL (and thus never returns
anything).


I'm stumped as to why it suddenly isn't working - any help greatly
appreciated.

Cheers

Joe

p.s.


Here's some output:

Terminal 1:  

joe@Joe:~$ yarp write /sender
Port /sender listening at tcp://192.168.1.148:10002
             
Terminal 2:

Joe@Joe:~/test$ ./test
yarp: Port /in active at tcp://192.168.1.148:10012
main thread free to do whatever it wants
main thread free to do whatever it wants
main thread free to do whatever it wants

Terminal 3:

joe@Joe:~/test$ yarp connect /sender /in
Added output connection from "/sender" to "/in"
joe@Joe:~/test$ yarp name list
registration name /in ip 192.168.1.148 port 10012 type tcp
registration name /root ip 192.168.1.148 port 10000 type tcp
registration name /sender ip 192.168.1.148 port 10002 type tcp
registration name fallback ip 224.2.1.1 port 10001 type mcast
*** end of message

Terminal 1: (types)

** this is a message ***

Terminal 2:

main thread free to do whatever it wants
Got "***" this is a message "***"
About to send return message
Problem getting return object
main thread free to do whatever it wants








 
 

 


--
Dr. Joe Saunders
Adaptive Systems Research Group
Science and Technology Research Institute
University of Hertfordshire
College Lane
Hatfield, Herts, AL10 9AB
United Kingdom


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Robotcub-hackers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/robotcub-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: adding a device to yarp

paulfitz
Administrator
Joe Saunders wrote:

> I've just updated our with the latest version of yarp and seem to be
> having a few problems with running asynchronous port callbacks - which
> were working fine before.
>
> Just to illustrate, I compiled (and added a few printfs) to the test
> code in ex0402_port_callback_reply.cpp
>
>    
>         ConnectionWriter *returnToSender = connection.getWriter();
>  
>         if (returnToSender!=NULL) {
>             out.write(*returnToSender);
>             printf("Sent reply %s\n",out.toString().c_str());
>         }
>         else {
>            printf("Problem getting return object\n");
>         }
>         return true;
>
> returnToSender always seems to get given a NULL (and thus never returns
> anything).
> [snip]
> joe@Joe:~$ yarp write /sender
>  

Hi Joe,

At least in your illustration, the problem is the use of "yarp write".  
Yarp write does not expect or want replies, so the call to
connection.getWriter() will fail on the reader side.

If instead of yarp write, you use yarp rpc, it should work fine - like this:
  yarp rpc /in

I assume this illustration was intended as a simple test case for some
more complex program or pair of programs you have.  The principle should
be the same there.  Make sure the sender expects replies, and is letting
YARP know that it expects replies.  Specifically, make sure you use the
Port::write(PortWriter,PortReader) command.

YARP became stricter about not allowing replies to senders who don't
expect replies, so that may be a cause of a change of behavior you saw
after upgrading.

Hope this helps,
Paul




------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Robotcub-hackers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/robotcub-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: adding a device to yarp

Joe Saunders
Thanks Paul, I'll try that on Monday. Presumably my older yarp version was
very out of date and at least now we will be back in line.

Have a good weekend.

Cheers

Joe


----- Original Message -----
From: "Paul Fitzpatrick" <[hidden email]>
To: "Joe Saunders" <[hidden email]>
Cc: "Paul Fitzpatrick" <[hidden email]>; "RobotCub Hackers"
<[hidden email]>
Sent: Friday, February 13, 2009 5:51 PM
Subject: Re: [rc-hackers] adding a device to yarp


> Joe Saunders wrote:
>> I've just updated our with the latest version of yarp and seem to be
>> having a few problems with running asynchronous port callbacks - which
>> were working fine before.
>>
>> Just to illustrate, I compiled (and added a few printfs) to the test
>> code in ex0402_port_callback_reply.cpp
>>
>>
>>         ConnectionWriter *returnToSender = connection.getWriter();
>>
>>         if (returnToSender!=NULL) {
>>             out.write(*returnToSender);
>>             printf("Sent reply %s\n",out.toString().c_str());
>>         }
>>         else {
>>            printf("Problem getting return object\n");
>>         }
>>         return true;
>>
>> returnToSender always seems to get given a NULL (and thus never returns
>> anything).
>> [snip]
>> joe@Joe:~$ yarp write /sender
>>
>
> Hi Joe,
>
> At least in your illustration, the problem is the use of "yarp write".
> Yarp write does not expect or want replies, so the call to
> connection.getWriter() will fail on the reader side.
>
> If instead of yarp write, you use yarp rpc, it should work fine - like
> this:
>  yarp rpc /in
>
> I assume this illustration was intended as a simple test case for some
> more complex program or pair of programs you have.  The principle should
> be the same there.  Make sure the sender expects replies, and is letting
> YARP know that it expects replies.  Specifically, make sure you use the
> Port::write(PortWriter,PortReader) command.
>
> YARP became stricter about not allowing replies to senders who don't
> expect replies, so that may be a cause of a change of behavior you saw
> after upgrading.
>
> Hope this helps,
> Paul
>
>
>
>


--------------------------------------------------------------------------------



No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.0.237 / Virus Database: 270.10.23/1951 - Release Date: 02/13/09
06:51:00


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Robotcub-hackers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/robotcub-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: adding a device to yarp

Joe Saunders
In reply to this post by paulfitz
Hi Paul,

Just to let you know - the rpc, of course, worked fine, but that gap in
my knowledge didn't actually solve the real problem involving two
programs communicating. I already had all the appropriate calls you
suggested.

However using your rpc clue I finally tracked down to this:


          ConnectionWriter *returnToSender = connection.getWriter();
          if (returnToSender!=NULL)
          {
             botSend.write(*returnToSender);
          }
//!!
          return true;
//!!

The "return true;" statement was *not* needed previously, once I added
it everything worked fine (and our robot sparked into life!).

Thanks for the help.

Cheers

Joe


On Fri, 2009-02-13 at 12:51 -0500, Paul Fitzpatrick wrote:

> Joe Saunders wrote:
> > I've just updated our with the latest version of yarp and seem to be
> > having a few problems with running asynchronous port callbacks - which
> > were working fine before.
> >
> > Just to illustrate, I compiled (and added a few printfs) to the test
> > code in ex0402_port_callback_reply.cpp
> >
> >    
> >         ConnectionWriter *returnToSender = connection.getWriter();
> >  
> >         if (returnToSender!=NULL) {
> >             out.write(*returnToSender);
> >             printf("Sent reply %s\n",out.toString().c_str());
> >         }
> >         else {
> >            printf("Problem getting return object\n");
> >         }
> >         return true;
> >
> > returnToSender always seems to get given a NULL (and thus never returns
> > anything).
> > [snip]
> > joe@Joe:~$ yarp write /sender
> >  
>
> Hi Joe,
>
> At least in your illustration, the problem is the use of "yarp write".  
> Yarp write does not expect or want replies, so the call to
> connection.getWriter() will fail on the reader side.
>
> If instead of yarp write, you use yarp rpc, it should work fine - like this:
>   yarp rpc /in
>
> I assume this illustration was intended as a simple test case for some
> more complex program or pair of programs you have.  The principle should
> be the same there.  Make sure the sender expects replies, and is letting
> YARP know that it expects replies.  Specifically, make sure you use the
> Port::write(PortWriter,PortReader) command.
>
> YARP became stricter about not allowing replies to senders who don't
> expect replies, so that may be a cause of a change of behavior you saw
> after upgrading.
>
> Hope this helps,
> Paul
>
>
>
>
--
Dr. Joe Saunders
Adaptive Systems Research Group
Science and Technology Research Institute
University of Hertfordshire
College Lane
Hatfield, Herts, AL10 9AB
United Kingdom


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Robotcub-hackers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/robotcub-hackers
Loading...