[Rxtx] Latency Woes

Chris Bartley bartley at cmu.edu
Mon Mar 7 20:08:05 MST 2011


We use a queue for all our request/response serial communications, and have found it really easy to work with.  Code is here:

	http://code.google.com/p/create-lab-commons/source/browse/trunk/java/code/serial/src/edu/cmu/ri/createlab/serial/SerialPortCommandExecutionQueue.java

It's assuming a command & response scheme that's specific to the protocol we use to talk to our robots, but it should be easy to modify for your needs.

Hope this helps.  Let me know if you have questions.

Chris

On Mar 7, 2011, at 9:50 PM, <jfh at greenhousepc.com> <jfh at greenhousepc.com> wrote:

> Curtis,
> 
> No, I assume he means a real queue, not just "don't read all the bytes at once."  However, if you know you can process some number of requests in some amount of time, allowing data to pile up (receiver FIFO space permitting) can be a valid strategy.  Inserting gobs of Thread.yield() and notify() can help pep things up as well.
> --
> Julie Haugh
> Senior Design Engineer
> greenHouse Computers, LLC // jfh at greenhousepc.com // greenHousePC on Skype
> 
> 
> -------- Original Message --------
> Subject: Re: [Rxtx] Latency Woes
> From: Curtis Hacker <hakcenter at gmail.com>
> Date: Mon, March 07, 2011 8:24 pm
> To: rxtx at qbang.org
> 
> Sample code ?
> 
> I don't necessarily want to read the byte I just wrote, but wait till 
> the que depth is 2.
> 
> Setup a thread without a sleep timer:
> if (in.available() > 1) {
> do_stuff();
> }
> 
> ??
> 
> On 03/07/11 18:08, Adrian Crum wrote:
> > Drop the requests into a queue, and then have a separate thread 
> > service the queue.
> >
> > -Adrian
> >
> > On 3/7/2011 5:55 PM, Curtis Hacker wrote:
> >> I have finally deduced my slow data logging to a latency issue.
> >>
> >> I write software for dsms, and the protocol is request / receive, you 
> >> cannot do more than 1 sensor at a time. So when you log multiple 
> >> sensors, +20ms per item, sampling rate drops like a rock.
> >>
> >> I was wondering if there is any ideas besides going completely native 
> >> with my application to reduce latency. With or without events I don't 
> >> care at this point I need to kill as much of the latency as possible. 
> >> Realistically I need no more than 1ms.
> >> _______________________________________________
> >> Rxtx mailing list
> >> Rxtx at qbang.org
> >> http://mailman.qbang.org/mailman/listinfo/rxtx
> > _______________________________________________
> > Rxtx mailing list
> > Rxtx at qbang.org
> > http://mailman.qbang.org/mailman/listinfo/rxtx
> >
> _______________________________________________
> Rxtx mailing list
> Rxtx at qbang.org
> http://mailman.qbang.org/mailman/listinfo/rxtx
> _______________________________________________
> Rxtx mailing list
> Rxtx at qbang.org
> http://mailman.qbang.org/mailman/listinfo/rxtx




More information about the Rxtx mailing list