ARIA-Users

Date Index Thread Index

[Aria-users] Send commands to server robot to let it move and turn



 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 万 玩 家 同 时 在 线