the client application that controls the second robot needs two player_clients, one connected the relay and one connected to the robot.

On 28/02/2008, Eshwaran VijayKumar <eshwaran.vijaykumar@gmail.com> wrote:
Hi,
  I am afraid, I don't understand you. Even if the relay driver is bound to one robot i.e it acts as a master, Why exactly isn't the other device in this case robot1 able to subscribe to it even as a slave? As I have said earlier, the client program  is crashing giving the "got NACK from request error" only when there is any reference to OpaqueProxy op1(&robot1,0) i.e when the second robot is trying to subscribe to the opaqueproxy (without which I wouldn't be able to perform communication between master and slave)
    Could you please illustrate how exactly I could achieve this?
Regards
Eshwaran


On Thu, Feb 28, 2008 at 9:06 AM, Toby Collett <tcollett+player@plan9.net.nz> wrote:
not binding to a specific port just means it binds to the default. the relay only exists on one robot and is connected to by both of them (it could also be run seperately from either robot)

Toby

On 28/02/2008, Eshwaran VijayKumar <eshwaran.vijaykumar@gmail.com> wrote:
Hi,
  I modified my code as per your suggestions:
My cfg file is the same as before (except that requires lines have been removed.)

driver(name "stage"
        model "r0"
        provides ["6665:position2d:0" "6665:laser:0" ]     )
driver( name "stage"
        model "r1"
        provides ["6666:position2d:0" "6666:laser:0"]      )
driver(      name "relay"
     provides ["opaque:0"])

My code is
#include <libplayerc++/playerc++.h>
 #include <libplayerc/playerc.h>
 #include <iostream>
 #include "args.h"
 int main(int argc, char **argv)
 {  parse_args(argc,argv);
  using namespace PlayerCc;
  using namespace std;
  PlayerClient robot(gHostname,6665);
  Position2dProxy pp(&robot, 0);
  LaserProxy lp(&robot, 0);
  OpaqueProxy op(&robot, 0);
  player_opaque_data_t opData,op1Data;
  PlayerClient robot1(gHostname,6666);
  Position2dProxy pp1(&robot1, gIndex);
  OpaqueProxy op1(&robot1,0);
 for(;;)
 { robot.Read();
 robot1.Read();
 pp.SetSpeed(0.5,dtor(30));
 pp1.SetSpeed(0.8,dtor(45));
 opData.data_count = 3;
 opData.data[0]='a';
 opData.data[1]='b';
 opData.data[2]='c';
 opData.data[3]='\0';
  op.SendCmd(&opData);
 std::cout << "SENT DATA"<<opData.data << std::endl;
 uint count = op1.GetCount();
 std::cout << "SENT count=" << count << std::endl;
  op1.GetData(op1Data.data);
 std::cout<<"GET DATA"<<op1Data.data<<std::endl;
}
}
The error I am getting :
>>>>>>>Client Error:

playerc error   : got NACK from request
playerc error   : failed to get response
terminate called after throwing an instance of 'PlayerCc::PlayerError'
Aborted

>>>>>>>Player Terminal Window:
 Stage plugin:  6665.simulation.0 is a Stage world
 [Loading ./opq1.world][Include pioneer.inc][Include map.inc][Include sick.inc][Load time 0.115sec]
 Stage plugin:  6665.position2d.0 is attempting to find a model under model "r0" of type [position]
"r0"
 Stage plugin:  6665.laser.0 is attempting to find a model under model "r0" of type [laser]
"r0.laser:0"
 Stage plugin:  6666.position2d.0 is attempting to find a model under model "r1" of type [position]
"r1"
 Stage plugin:  6666.laser.0 is attempting to find a model under model "r1" of type [laser]
"r1.laser:0"
listening on 6665
listening on 6666
Listening on ports: 6665 6666
accepted TCP client 0 on port 6665, fd 14
accepted TCP client 1 on port 6666, fd 15
warning : skipping subscription to unknown device opaque:0
warning : other error on client 0
closing TCP connection to client 0 on port 6665
unsubscribe from r0 0
unsubscribe from r0.laser:0 0
Shutting stage driver down
stage driver has been shutdown
warning : other error on client 0
closing TCP connection to client 0 on port 6666
unsubscribe from r1 0
Shutting stage driver down
stage driver has been shutdown

  I would like to point that even though the opaque driver is not bound to any port specifically (by giving a provides["opaque:0"]), I am unable to send data from it to the other clients that subscribe to it. Only one client is able to subscribe to the driver. Both robots are however able to subscribe to two separate relay drivers when each has a specific opaque proxy diffrentiated by index or port.
          I mention this because once I remove  OpaqueProxy op1(&robot1,0); and change op1.GetData(op1Data.data); to op.GetData(op1Data.data), the code runs perfectly in that I am able to send and receive data to and from the SAME robot while the other robot can be used for other purposes. However this doesn't serve my purpose of communicating between two robots.
Any help again would be much appreciated.

Thanks in advance,

Regards
Eshwaran


           


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Playerstage-developers mailing list
Playerstage-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-developers




--
This email is intended for the addressee only and may contain privileged and/or confidential information
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Playerstage-developers mailing list
Playerstage-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-developers



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Playerstage-developers mailing list
Playerstage-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-developers




--
This email is intended for the addressee only and may contain privileged and/or confidential information