From: Rebble <hyy...@16...> - 2009-03-23 06:51:23
|
Hi: I have tried the OpaqueProxy for two robot com. But when running , i even can't get the data from the Opaqueproxy. It is really weird.For i just give data to op1, and using op1.SendCmd(&op1Data);to send data to opaque ,then use op1.GetData(op1GetData); >From the Player, there shows: warn: Stage ignores motor power state (1) (p_position.cc ProcessMessage) warn: Stage ignores motor power state (1) (p_position.cc ProcessMessage) Shutting opaque driver down Opaque driver has been shutdown Shutting opaque driver down Opaque driver has been shutdown closing TCP connection to client 1 on port 6666 closing TCP connection to client 0 on port 6665 Here is my com1.cc file: #include <libplayerc++/playerc++.h> #include<stdio.h> #include <libplayerc/playerc.h> #include <iostream> #include "args.h" #define PLAYER_OPAQUE_MAX_SIZE 1024 using namespace PlayerCc; using namespace std; int main(int argc, char **argv) { parse_args(argc,argv); PlayerClient r1("localhost",6665);//the first robot Position2dProxy pp1(&r1); LaserProxy lp1(&r1); OpaqueProxy op1(&r1); player_opaque_data_t op1Data; player_opaque_data_t op2Data; uint8_t op1GetData[PLAYER_OPAQUE_MAX_SIZE]; PlayerClient r2("localhost",6666);//the second Position2dProxy pp2(&r2); LaserProxy lp2(&r2); OpaqueProxy op2(&r2); uint8_t op2GetData[PLAYER_OPAQUE_MAX_SIZE]; op1Data.data = new uint8_t[4]; cout << r1 << endl;//the output is port num pp1.SetMotorEnable (true); r1.Read(); op1Data.data_count = 4; op1Data.data[0]='0'; op1Data.data[1]='1'; op1Data.data[2]='c'; op1Data.data[3]='d'; cout << "Sent Data1"<< " "<<op1Data.data[3] << endl; cout << "Sent Data2"<< " "<<op1Data.data << endl; //send the data structure to opaque proxy op1.SendCmd(&op1Data); r1.Read(); // get back the opaque data uint count = op1.GetCount(); // pp1.SetMotorEnable (true); r1.Read(); pp1.SetMotorEnable (true); op1.GetData(op1GetData); std::cout << "op1GetData=" << op1GetData<< std::endl; std::cout << "Sent Count" << " "<< count << std::endl; return 0; } after running ./com1, i get: localhost: 6665 Sent Data1 d Sent Data2 01cd op1GetData=// �� Sent Count 24 any valueable suggestions will be appreciated. Thanks!! Rebble -- View this message in context: http://www.nabble.com/Shutting-opaque-driver-down-when-running-client-program-using-OpaqueProxy-tp22655054p22655054.html Sent from the playerstage-users mailing list archive at Nabble.com. |
From: Toby C. <tco...@pl...> - 2009-03-23 07:26:30
|
two things to I notice straight away, if you are planning on displaying the data using cout/printf dont forget to send a null byte on the end. The second thing is that read does not guarantee data for every proxy, you should set the fresh flag to false and then loop over read until fresh is true meaning data has arrived for the proxy. Toby 2009/3/23 Rebble <hyy...@16...> > > Hi: > I have tried the OpaqueProxy for two robot com. But when running , i even > can't get the data from the Opaqueproxy. It is really weird.For i just give > data to op1, and using op1.SendCmd(&op1Data);to send data to opaque ,then > use op1.GetData(op1GetData); > From the Player, there shows: > warn: Stage ignores motor power state (1) (p_position.cc ProcessMessage) > warn: Stage ignores motor power state (1) (p_position.cc ProcessMessage) > Shutting opaque driver down > Opaque driver has been shutdown > Shutting opaque driver down > Opaque driver has been shutdown > closing TCP connection to client 1 on port 6666 > closing TCP connection to client 0 on port 6665 > Here is my com1.cc file: > #include <libplayerc++/playerc++.h> > #include<stdio.h> > #include <libplayerc/playerc.h> > #include <iostream> > #include "args.h" > #define PLAYER_OPAQUE_MAX_SIZE 1024 > > using namespace PlayerCc; > using namespace std; > int > main(int argc, char **argv) > { > parse_args(argc,argv); > PlayerClient r1("localhost",6665);//the first robot > Position2dProxy pp1(&r1); > LaserProxy lp1(&r1); > OpaqueProxy op1(&r1); > player_opaque_data_t op1Data; > player_opaque_data_t op2Data; > uint8_t op1GetData[PLAYER_OPAQUE_MAX_SIZE]; > > PlayerClient r2("localhost",6666);//the second > Position2dProxy pp2(&r2); > LaserProxy lp2(&r2); > OpaqueProxy op2(&r2); > uint8_t op2GetData[PLAYER_OPAQUE_MAX_SIZE]; > > op1Data.data = new uint8_t[4]; > cout << r1 << endl;//the output is port num > pp1.SetMotorEnable (true); > > r1.Read(); > > op1Data.data_count = 4; > op1Data.data[0]='0'; > op1Data.data[1]='1'; > op1Data.data[2]='c'; > op1Data.data[3]='d'; > cout << "Sent Data1"<< " "<<op1Data.data[3] << endl; > cout << "Sent Data2"<< " "<<op1Data.data << endl; > //send the data structure to opaque proxy > op1.SendCmd(&op1Data); > r1.Read(); > // get back the opaque data > uint count = op1.GetCount(); > // pp1.SetMotorEnable (true); > r1.Read(); > pp1.SetMotorEnable (true); > op1.GetData(op1GetData); > std::cout << "op1GetData=" << op1GetData<< std::endl; > std::cout << "Sent Count" << " "<< count << std::endl; > > return 0; > } > after running ./com1, i get: > localhost: 6665 > Sent Data1 d > Sent Data2 01cd > > op1GetData=// > > �� > Sent Count 24 > any valueable suggestions will be appreciated. Thanks!! > Rebble > -- > View this message in context: > http://www.nabble.com/Shutting-opaque-driver-down-when-running-client-program-using-OpaqueProxy-tp22655054p22655054.html > Sent from the playerstage-users mailing list archive at Nabble.com. > > > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Playerstage-users mailing list > Pla...@li... > https://lists.sourceforge.net/lists/listinfo/playerstage-users > -- This email is intended for the addressee only and may contain privileged and/or confidential information |
From: Rebble <hyy...@16...> - 2009-03-24 07:59:21
|
Dear Toby; Sorry to reply so late. I don't know how to add the fresh flag, as i searched in the forum, it will be true whenever read() is called, and may be set to false by user. So it is associated with the reas() function and i don't need to define a variable called "fresh", isn't it? But when i use cout <<fresh<<endl; after read(); to see if the read() is successful, it says that the 'fresh' hasn't be declared here. Why?How should i do to use fresh flag? thanks! Rebble two things to I notice straight away, if you are planning on displaying the data using cout/printf dont forget to send a null byte on the end. The second thing is that read does not guarantee data for every proxy, you should set the fresh flag to false and then loop over read until fresh is true meaning data has arrived for the proxy. Toby 2009/3/23 Rebble <hyy...@16...> -- View this message in context: http://www.nabble.com/Shutting-opaque-driver-down-when-running-client-program-using-OpaqueProxy-tp22655054p22675610.html Sent from the playerstage-users mailing list archive at Nabble.com. |
From: Toby C. <tco...@pl...> - 2009-03-24 18:10:40
|
each client proxy has a frash flag which is set true if that proxy gets data in a read call. With the c++ client these can be accessed using IsFresh() and NotFresh() members of the Proxy class. See documentation on this page http://playerstage.sourceforge.net/doc/Player-2.1.0/player/classPlayerCc_1_1ClientProxy.html Toby 2009/3/24 Rebble <hyy...@16...> > > Dear Toby; > Sorry to reply so late. I don't know how to add the fresh flag, as i > searched in the forum, it will be true whenever read() is called, and may > be > set to false by user. So it is associated with the reas() function and i > don't need to define a variable called "fresh", isn't it? But when i use > cout <<fresh<<endl; after read(); to see if the read() is successful, it > says that the 'fresh' hasn't be declared here. Why?How should i do to use > fresh flag? > thanks! > Rebble > > two things to I notice straight away, if you are planning on displaying the > data using cout/printf dont forget to send a null byte on the end. > > The second thing is that read does not guarantee data for every proxy, you > should set the fresh flag to false and then loop over read until fresh is > true meaning data has arrived for the proxy. > > Toby > > 2009/3/23 Rebble <hyy...@16...> > -- > View this message in context: > http://www.nabble.com/Shutting-opaque-driver-down-when-running-client-program-using-OpaqueProxy-tp22655054p22675610.html > Sent from the playerstage-users mailing list archive at Nabble.com. > > > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Playerstage-users mailing list > Pla...@li... > https://lists.sourceforge.net/lists/listinfo/playerstage-users > -- This email is intended for the addressee only and may contain privileged and/or confidential information |
From: Rebble <hyy...@16...> - 2009-03-27 13:13:01
|
Hello Toby: Yes,I have get it worked. Since i have been writing programs in VS2005(under WINDOWS), so is it difficult to transplant the these into Player? Because you know in VS many files can be inclued in a project. Or i have to put all the files in just one .cc file?(I used the c++ client in Player). Looking forward for your help!! Thanks!! Rebble each client proxy has a frash flag which is set true if that proxy gets data in a read call. With the c++ client these can be accessed using IsFresh() and NotFresh() members of the Proxy class. See documentation on this page http://playerstage.sourceforge.net/doc/Player-2.1.0/player/classPlayerCc_1_1ClientProxy.html Toby 2009/3/24 Rebble <hyy...@16...> > > Dear Toby; > Sorry to reply so late. I don't know how to add the fresh flag, as i > searched in the forum, it will be true whenever read() is called, and may > be > set to false by user. So it is associated with the reas() function and i > don't need to define a variable called "fresh", isn't it? But when i use > cout <<fresh<<endl; after read(); to see if the read() is successful, it > says that the 'fresh' hasn't be declared here. Why?How should i do to use > fresh flag? > thanks! > Rebble -- View this message in context: http://www.nabble.com/Shutting-opaque-driver-down-when-running-client-program-using-OpaqueProxy-tp22655054p22741324.html Sent from the playerstage-users mailing list archive at Nabble.com. |
From: Geoffrey B. <gb...@ki...> - 2009-03-27 18:54:09
|
If you're using Windows, you can use the trunk version of Player, which works under Windows. Be aware that this is still under development, though, and there may be bugs or other issues. We would certainly welcome any input you had into making it work. See here for instructions (any ideas on improving these are also welcome): http://playerstage.sourceforge.net/wiki/Windows Geoff Rebble wrote: > Hello Toby: > Yes,I have get it worked. Since i have been writing programs in > VS2005(under WINDOWS), so is it difficult to transplant the these into > Player? Because you know in VS many files can be inclued in a project. Or i > have to put all the files in just one .cc file?(I used the c++ client in > Player). > Looking forward for your help!! Thanks!! > Rebble > > each client proxy has a frash flag which is set true if that proxy gets data > in a read call. With the c++ client these can be accessed using IsFresh() > and NotFresh() members of the Proxy class. > > See documentation on this page > http://playerstage.sourceforge.net/doc/Player-2.1.0/player/classPlayerCc_1_1ClientProxy.html > > Toby > > 2009/3/24 Rebble <hyy...@16...> > >> Dear Toby; >> Sorry to reply so late. I don't know how to add the fresh flag, as i >> searched in the forum, it will be true whenever read() is called, and may >> be >> set to false by user. So it is associated with the reas() function and i >> don't need to define a variable called "fresh", isn't it? But when i use >> cout <<fresh<<endl; after read(); to see if the read() is successful, it >> says that the 'fresh' hasn't be declared here. Why?How should i do to use >> fresh flag? >> thanks! >> Rebble |