From: Yashan S. <ys...@nd...> - 2006-07-13 15:06:39
|
Hi Toby, I have changed my .cfg file to: driver ( name "stage" provides ["6665:position2d:0" "6665:laser:0"] model "robot1" ) driver( name "stage" provides ["6666:position2d:0" "6666:laser:0"] model "robot2" ) driver( name "relay" provides ["6665:opaque:0"] ) driver( name "relay" provides ["6666:opaque:0"] ) But I still met same problem as I post in the last articles. "warning : skipping message from 51:0 with unsupported type 1:2 interface 57 51 type 3 1 subtype 3 2 " and i cannot GetData from opaque device either. the output for "./comm_ys": abc count=0 opGetData[0]= opGetData[1]= opGetData[2]= opGetData[3]=@ I attached my code. Thanks so much! ys Toby Collett wrote: > Can you post all messages to the mailing list, this way they get > archived and other can help as well. > > stage doesnt support the opaque proxy directly so you will need to > instantiate a relay driver for each of the two robots, i.e. > > driver( > name "relay" > provides ["6665:opaque:0"] > ) > > driver( > name "relay" > provides ["6666:opaque:0"] > ) > > and remove the requires lines from the stage entries... > > Toby > > Yashan Sun wrote: > >> Hey Toby, >> >> My .cfg is, >> driver >> ( name "stage" >> provides ["simulation:0" ] >> plugin "libstageplugin" >> worldfile "simple_ys.world" ) >> >> driver >> ( >> name "stage" >> provides ["6665:position2d:0" "6665:laser:0"] >> requires ["6665:opaque:0"] >> model "robot1" >> ) >> >> driver( >> name "stage" >> provides ["6666:position2d:0" "6666:laser:0"] >> requires ["6666:opaque:0" ] >> model "robot2" >> ) >> >> driver( >> name "relay" >> provides ["opaque:0"] >> # provides ["6665:opaque:0" "6666:opaque:0"] >> ) >> >> My. cpp file is, >> #include <libplayerc++/playerc++.h> >> #include <libplayerc/playerc.h> >> #include <iostream> >> #include "args.h" >> >> >> int >> main(int argc, char **argv) >> { >> parse_args(argc,argv); >> >> try >> { >> using namespace PlayerCc; >> >> PlayerClient robot(gHostname, gPort); >> Position2dProxy pp(&robot, gIndex); >> LaserProxy lp(&robot, gIndex); >> OpaqueProxy op(&robot, gIndex); >> >> player_opaque_data_t opData; >> uint8_t opGetData[PLAYER_OPAQUE_MAX_SIZE]; >> PlayerClient robot1(gHostname, 6666); >> Position2dProxy pp1(&robot1, gIndex); >> LaserProxy lp1(&robot1, gIndex); >> // OpaqueProxy op1(&robot1, 0); (*****) >> player_opaque_data_t op1Data; >> uint8_t op1GetData[PLAYER_OPAQUE_MAX_SIZE ]; >> >> for(;;) >> { >> robot.Read(); >> >> opData.data_count = 3; >> opData.data[0]='a'; >> opData.data[1]='b'; >> opData.data[2]='c'; >> op.SendCmd(&opData); >> std::cout << opData.data << std::endl; >> uint count = op.GetCount(); >> std::cout << "count=" << count << std::endl; >> op.GetData(opGetData); >> std::cout << "opGetData[0]=" << opGetData[0] << std::endl; >> std::cout << "opGetData[1]=" <<opGetData[1] << std::endl; >> std::cout << "opGetData[2]=" <<opGetData[2] << std::endl; >> std::cout << "opGetData[3]=" <<opGetData[3] << std::endl; >> } >> } >> catch (PlayerCc::PlayerError e) >> { >> std::cerr << e << std::endl; >> return -1; >> } >> } >> >> *the output for "player mycfg. cfg":* >> Stage driver creating 2 devices >> 6665.4.0 is "robot1" >> 6665.6.0 is "robot1.laser:0" >> Stage driver creating 2 devices >> 6666.4.0 is "robot2" >> 6666.6.0 is "robot2.laser:0" >> simple_ys.cfg:27 warning: field [requires] is defined but not used >> simple_ys.cfg:34 warning: field [requires] is defined but not used >> Listening on ports: 6665 6666 >> accepted client 0 on port 6665, fd 11 >> accepted client 1 on port 6666, fd 12 >> warn: Stage ignores motor power state (1) (p_position.cc ProcessMessage) >> interface 57 51 >> type 3 1 >> subtype 3 2 >> warning : skipping message from 51:0 with unsupported type 1:2 >> interface 57 51 >> type 3 1 >> subtype 3 2 >> warning : skipping message from 51:0 with unsupported type 1:2 >> >> what is the meaning of type or subtype? >> * >> the output for "./mycc": >> *abc >> count=0 >> opGetData[0]= >> opGetData[1]=4 >> opGetData[2]= >> opGetData[3]=@ >> * >> *It seems that i cannot GetData from opaque device. The data_count is >> equal to zero. >> How can I fix the problem? >> >> >> When I uncomment the line "// OpaqueProxy op1(&robot1, >> 0); (*****)", >> I can compile mycc file correctly. But when I run "./mycc" >> I get, >> playerc error : got NACK from request >> playerc error : failed to get response >> OpaqueProxy::OpaqueProxy()(-1) : could not subscribe >> >> Does it mean that i cannot claim to two opaqueproxies in a one file? >> If so, how can i realize the client-2-client communication. >> >> I do appreciate your kindly help ... : ) >> >> Best, >> yashan >> |