ARIA-Users
Date Index
Thread Index
Re: [Aria-users] Send commands to server robot to let it move andturn
- To: wjxnet_126 <wjxnet_126@xxxxxxx>
- Subject: Re: [Aria-users] Send commands to server robot to let it move andturn
- From: Matt LaFary <lafary@xxxxxxxxxxxxxxxx>
- Date: Fri, 23 May 2008 11:21:09 -0400
- Cc: aria-users@xxxxxxxxxxxxxxxx
- Content-Transfer-Encoding: 7bit
- Content-Type: text/plain; charset=x-gbk; format=flowed
- Delivered-To: aria-archives@activmedia.com
- Delivered-To: aria-users@server.local.net
- In-Reply-To: <8829010.544591211548774204.JavaMail.coremail@bj126app102.126.com>
- References: <8829010.544591211548774204.JavaMail.coremail@bj126app102.126.com>
- Resent-Date: Fri, 23 May 2008 12:36:27 -0400 (EDT)
- Resent-From: aria-users@xxxxxxxxxxxxxx
- Resent-Message-ID: <5NHAeC.A.-_G.KKvNIB@server.activmedia.com>
- Resent-Reply-To: aria-users@activmedia.com
- Resent-Sender: aria-users-request@xxxxxxxxxxxxxx
- User-Agent: Debian Thunderbird 1.0.2 (X11/20060830)
The commands for ArNetworking are NOT the same as the microcontroller
commands you send from ArRobot. What you are trying to do won't work
the way you are trying it. ArNetworking works at a higher level. The
packets go into code that then does something with them.
Also you should never use requestOnceByCommand, it isn't for doing what
you are trying, but is internal and the command numbers change depending
on the run (again, these aren't the same as the microcontroller command
numbers).
You can look at examples/serverDemo.cpp, examples/clientDemo.cpp,
tests/standAloneServer.cpp and tests/standAloneClient.cpp to see some of
the ways that ArNetworking works with commands.
Matt LaFary
MobileRobots Inc
wjxnet_126 wrote:
> 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