To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.javaOpen lugnet.robotics.rcx.java in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / Java / 232
231  |  233
Subject: 
Transmitting time USB vs serial
Newsgroups: 
lugnet.robotics.rcx.java
Date: 
Sat, 28 Dec 2002 23:48:47 GMT
Viewed: 
4682 times
  
Hello,

I use lejos 2.1.0 and legousbtower 0.52 from the lejos distribution.

I measured the transmitting time of an Int from PC to RCX with the
attached programs and got the following result:

1. single integer (LED at the tower is off before pressing ENTER):
USB serial
6000-9000ms 300-700ms

2. multiple integers (pressing ENTER multiple times, LED keeps on):
USB serial
240ms 240ms

What can I do to decrease the response time in the first case with
the USB tower? Is it a problem of the driver or can I set the USB
tower to be always active? ("port.setListen( true )" doesn't help)

Thanks for any help,
Michael.



==================================================================
TowerTestPC.java:
==================================================================
import java.io.*;
import josx.rcxcomm.*;

public class TowerTestPC {

    DataOutputStream out;

    TowerTestPC() throws IOException {
        RCXPort port = new RCXPort();
        out = new DataOutputStream( port.getOutputStream() );
    }

    public static void main(String [] args) {
        try {
            TowerTestPC tt = new TowerTestPC();
            BufferedReader in = new BufferedReader( new InputStreamReader( System.in ));
            System.out.println("Press return to send Integer to RCX.");
            while( true ) {
                String line = in.readLine();
                long before = System.currentTimeMillis();
                tt.out.writeInt( 999 );
                tt.out.flush();
                long after = System.currentTimeMillis();
                System.out.println("writeInt+flush: " + ( after - before ) + " ms");
            }
        } catch (IOException ioe) {};
    }
}




==================================================================
TowerTestRCX.java:
==================================================================


import java.io.*;
import josx.platform.rcx.*;
import josx.rcxcomm.*;

public class TowerTestRCX {

    DataInputStream in;

    public TowerTestRCX() throws IOException {
        RCXPort port = new RCXPort();
        in = new DataInputStream( port.getInputStream() );
    }

    public static void main( String [] args ) {
        try {
            TowerTestRCX tt = new TowerTestRCX();

            while( true ) {
                int newpos = tt.in.readInt();
                Sound.beep();
            }
        } catch (IOException e) {
            Sound.beep();
            Sound.beep();
            Sound.beep();
        }
    }
}
==================================================================



Message has 1 Reply:
  Re: Transmitting time USB vs serial
 
(...) Michael, I tried your programs on Windows and Linux. On Windows 98 the USB tower takes about one second to reply (990 - 1100ms). On Linux it took about 9 seconds as you indicate. This looks like a problem with the Linux USB driver. I will ask (...) (22 years ago, 5-Jan-03, to lugnet.robotics.rcx.java)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR