Re:Re: [robocup-rescue-s] yab api for 0.49.x

From: David Ojeda <david@gia.usb.ve>
Date: Tue 13 Jun 2006 - 03:53:35 GMT

Here is the 'easy fix' for the receive method. With this change I managed
to run the sample agents with no troubles. I'm sure there is a better or prettier
way to do this, but I was desperate.

    public byte[] receive() {
        try{
            int length = 0;
            int temp = -1;
            while (temp == -1) temp = in.read();
            length = temp;
            temp = -1;
            while (temp == -1) temp = in.read();
            length = length<<8 | temp;
            temp = -1;
            while (temp == -1) temp = in.read();
            length = length<<8 | temp;
            temp = -1;
            while (temp == -1) temp = in.read();
            length = length<<8 | temp;
            byte[] buffer = new byte[length];
            int total = 0;
            while (total < length) {
                total += in.read(buffer,total,length-total);
            }
            return buffer;
        }catch(Exception e){
            e.printStackTrace();
            if(e instanceof java.net.SocketException)
                System.exit(0);
        }
        return null;
    }

I still wonder... am I the only one getting this error?

On Mon, Jun 12, 2006 at 11:13:11AM -0400, David Ojeda wrote:
>
> Dear Hossein,
>
> I've tried with Saboorian's release with no luck (same errors).
> I also tried yours and I'm still having some troubles communicating with the
> kernel. This time a negative array is created because the receive method
> fails:
> int length = in.read();
> length = length<<8 | in.read();
> length = length<<8 | in.read();
> length = length<<8 | in.read();
> byte[] buffer = new byte[length];
> since DatainputStream.read returns -1 when it couldn't read from the socket,
> then there must be a communication problem.
> This could be easy to fix if I just check for negative values on every
> in.read(), but I'm just wondering... am I the only one experiencing these
> problems? Does this version works out-of-the-box for you?
>
> thanks,
> David
>
> ps: I'm using rescue-0.49.8
>
> On Sunday 04 June 2006 18:50, Hossein Azizpour wrote:
> > Dear David,
> >
> > There is no header type like '1174405120', you might be using an old
> > version of yabAPI that is not compatible with the new communication
> > protocol of kernel 0.49.x.
> >
> > Property type '47' is for temperature of a building sent as a property of
> > building object.
> >
> > You may use 0.49 compatible yabAPI available on our website:
> > http://ce.aut.ac.ir/~sos/downloads.htm<http://ce.aut.ac.ir/%7Esos/downloads
> >.htm>(temporarily down!)
> > or the one released by Mr.Saboorian:
> > http://saviour.siahe.com/yab/yabapi-1.49.tar.gz
> > you can also use rescuecore available with the kernel package, if you don't
> > insist on using yabAPI base code.
> >
> > Regards,
> >
> > On 6/5/06, David Ojeda <david@gia.usb.ve> wrote:
> > > Hello all,
> > >
> > > I am having some trouble migrating to the newest versions of the
> > > simulator.
> > > I've tried with several versions of yabAPI with no luck at all. I keep
> > > getting these errors:
> > >
> > >
> > > Exception in thread "Thread-1" java.lang.Error: received illegal
> > > header:1174405120
> > > at yab.io.RCRSSProtocolSocket.getBlock(Unknown Source)
> > > at yab.io.RCRSSProtocolSocket.receive(Unknown Source)
> > > at yab.agent.Agent.run(Unknown Source)
> > >
> > > ...
> > >
> > > Exception in thread "Thread-9" java.lang.Error: received illegal
> > > header:18176
> > > at yab.io.RCRSSProtocolSocket.getBlock(Unknown Source)
> > > at yab.io.RCRSSProtocolSocket.receive(Unknown Source)
> > > at yab.agent.Agent.run(Unknown Source)
> > >
> > > ...
> > >
> > > And a lot of unrecognized properties:
> > > Unrecognised property: 47
> > >
> > >
> > > Can anyone help me?
> > >
> > > Thanks
> > >
> > > --
> > > David Ojeda A.
> > > Grupo de Inteligencia Artificial
> > > Universidad Simón Bolívar
> > > _______________________________________________
> > > robocup-rescue-s mailing list
> > > robocup-rescue-s@mailman.cc.gatech.edu
> > > https://mailman.cc.gatech.edu/mailman/listinfo/robocup-rescue-s
>
> --
> David Ojeda A.
> Grupo de Inteligencia Artificial
> Universidad Simón Bolívar
> _______________________________________________
> robocup-rescue-s mailing list
> robocup-rescue-s@mailman.cc.gatech.edu
> https://mailman.cc.gatech.edu/mailman/listinfo/robocup-rescue-s
> _______________________________________________
> rcrss mailing list
> rcrss@gia.usb.ve
> http://www.gia.usb.ve/mailman/listinfo/rcrss
>

-- 
David Ojeda A
Linux Registered User #355562
_______________________________________________
robocup-rescue-s mailing list
robocup-rescue-s@mailman.cc.gatech.edu
https://mailman.cc.gatech.edu/mailman/listinfo/robocup-rescue-s
Received on Tue Jun 13 06:11:18 2006

This archive was generated by hypermail 2.1.8 : Tue 13 Jun 2006 - 04:11:23 GMT