ARIA-Users
Date Index
Thread Index
[Aria-users] Send commands to server robot to let it move and turn
- To: aria-users@xxxxxxxxxxxxxxxx
- Subject: [Aria-users] Send commands to server robot to let it move and turn
- From: wjxnet_126 <wjxnet_126@xxxxxxx>
- Date: Fri, 23 May 2008 21:19:34 +0800 (CST)
- Content-Type: multipart/alternative; boundary="----=_Part_143482_30841773.1211548774204"
- Delivered-To: aria-archives@activmedia.com
- Delivered-To: aria-users@server.local.net
- Resent-Date: Fri, 23 May 2008 10:23:27 -0400 (EDT)
- Resent-From: aria-users@xxxxxxxxxxxxxx
- Resent-Message-ID: <24YrV.A.w9D.eNtNIB@server.activmedia.com>
- Resent-Reply-To: aria-users@activmedia.com
- Resent-Sender: aria-users-request@xxxxxxxxxxxxxx
hello, everyone!
I have two robots, one is server, the other is acted as client. The client sends some commands to the server, to let the
server robot move and turn, the following is my codes:
int main(int argc, char **argv)
{
Aria::init();
ArArgumentParser parser(&argc, argv);
parser.loadDefaultArguments();
if (!Aria::parseArgs() || !parser.checkHelpAndWarnUnparsed())
{
Aria::logOptions();
exit(0);
}
ArClientBase client;
ArClientSimpleConnector clientConnector(&parser);
if (!clientConnector.connectClient(&client))
{
if (client.wasRejected())
printf("Server '%s' rejected connection, exiting\n", client.getHost());
else
printf("Could not connect to server '%s', exiting\n", client.getHost());
exit(1);
}
client.runAsync();
double myTurnValue=30,myMoveValue=3000;
///attention please
ArNetPacket packet;
packet.doubleToBuf(myTurnValue);
printf("Telling the server to turn \n");
client.requestOnceByCommand(12, &packet); // heading
packet.doubleToBuf(myMoveValue);
printf("Telling the server to move \n");
client.requestOnceByCommand(8, &packet); // move
Aria::shutdown();
return 0;
}
Could you please take a look at it, since the server just does not do the action. Thanks!
Jianxin Wu
中 国 最 强 网 游 --- 网 易 梦 幻 西 游 ,166 万 玩 家 同 时 在 线