ER1 User Guide 10-21
TestClient.java
Sending command: events
Response: OK
Sending command: events
Response: move done
Sending command: move -90 d
Response: OK
Sending command: events
Response: OK
move done
Sending command: move 50 c
Response: OK
Sending command: events
Response: OK
Sending command: events
Response: OK
Sending command: events
Response: OK
move done
C:\ER1>
TestClient.java
Here is the TestClient.java file:
/**
* @file TestClient.java
* @author www.evolution.com
* @author Copyright (C) 2002, Evolution Robotics, Inc.
*/
import java.io.DataOutputStream;
import java.io.BufferedInputStream;
import java.net.Socket;
class TestClient
{
///////////////////////////////////////////////////////////////////////
// userProgram.
///////////////////////////////////////////////////////////////////////
/**
* @brief
* Users put their own commands here.
*/
public static void userProgram()
{
// Send the first move command, 10 inches forward.
String recvMsg = client.sendCommand("move 10 i
client.waitFor("move");
// Send the turn command, 90 degrees to left.
recvMsg = client.sendCommand("move -90 d
client.waitFor("move");
// Send the next move command, 50 cm forward.
recvMsg = client.sendCommand("move 50 c
client.waitFor("move");
}